diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
commit | d25e11bee6ca5ca523884da132d18e1400e077b9 (patch) | |
tree | 8af39fde19f7ed640a60fb397c7edd647dff1c4c /node_modules/cherow | |
download | kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.gz kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.bz2 kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.zip |
Initial commit
Diffstat (limited to 'node_modules/cherow')
45 files changed, 53968 insertions, 0 deletions
diff --git a/node_modules/cherow/CHANGELOG.MD b/node_modules/cherow/CHANGELOG.MD new file mode 100644 index 0000000..5ddad42 --- /dev/null +++ b/node_modules/cherow/CHANGELOG.MD @@ -0,0 +1 @@ +# Changelog
\ No newline at end of file diff --git a/node_modules/cherow/CODE_OF_CONDUCT.md b/node_modules/cherow/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..ac5ae32 --- /dev/null +++ b/node_modules/cherow/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at kflash123@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/node_modules/cherow/CONTRIBUTING.md b/node_modules/cherow/CONTRIBUTING.md new file mode 100644 index 0000000..df1780c --- /dev/null +++ b/node_modules/cherow/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contribution Guide
+
+This page describes how to contribute changes to Cherow.
+
+Please do **not** create a pull request without reading this guide first. Failure to do so may result in the **rejection** of the pull request.
+And also keep in mind that performance is the main priority. The "fastest" way to solve an issue, isn't the fastest one, but the slowest one!
+
+**1. Create a ticket in the [issue tracker](https://github.com/cherow/cherow/issues)**.
+This serves as a placeholder for important feedback, review, or any future updates.
+
+**2. Run all the tests**. This requires Node.js: `npm install` to set up, `npm test` to run the tests.
+
+**3. Work on a feature branch**. If the change still needs some tweaks, it will not clutter the master branch.
+
+**4. Write a reasonable commit message:**
+
+* Keep the first line < 72 characters. Write additional paragraphs if necessary.
+* Put the link to the ticket. This is important for cross-referencing purposes.
+
diff --git a/node_modules/cherow/README.md b/node_modules/cherow/README.md new file mode 100644 index 0000000..f1df54e --- /dev/null +++ b/node_modules/cherow/README.md @@ -0,0 +1,169 @@ +# Cherow
+
+[![NPM version](https://img.shields.io/npm/v/cherow.svg)](https://www.npmjs.com/package/cherow)
+[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/cherow/cherow)
+[![Build status](https://ci.appveyor.com/api/projects/status/pkydnkv0deckns5l/branch/master?svg=true)](https://ci.appveyor.com/project/Kflash/cherow/branch/master)
+[![CircleCI](https://circleci.com/gh/cherow/cherow.svg?style=svg)](https://circleci.com/gh/cherow/cherow)
+[![Coverage Status](https://coveralls.io/repos/github/cherow/cherow/badge.svg?branch=master)](https://coveralls.io/github/cherow/cherow?branch=master)
+
+A very fast and lightweight, standards-compliant, self-hosted javascript parser with high focus on both performance and stability.
+
+## [Demo](https://cherow.github.io/cherow/) and [Benchmark](https://cherow.github.io/cherow/performance/)
+
+## Features
+
+* Conforms to the standard ECMAScript® 2019 [(ECMA-262 9th Edition)](https://tc39.github.io/ecma262/) language specification (*draft*)
+* Support for all stage 3 proposals via option.
+* JSX support via option.
+* Experimental feature support via option.
+* Optionally track syntactic node locations
+* Modular
+* Emits an [ESTree-compatible](https://github.com/estree/estree) abstract syntax tree.
+* Very well tested (~46 000 [unit tests](https://github.com/cherow/cherow/tree/master/test) with [full code coverage)](https://coveralls.io/github/cherow/cherow))
+* Supports all module loaders
+* Lightweight - ~70 KB minified (*18 kb smaller than Acorn*)
+
+## ESNext features
+
+`Stage 3` features support. These need to be enabled with the `next` option.
+
+* [Import()](https://github.com/tc39/proposal-dynamic-import)
+* [Class field declarations for JavaScript](https://github.com/tc39/proposal-class-fields)
+* [Numeric Separators](https://github.com/tc39/proposal-numeric-separator)
+* [Private methods and getter/setters for JavaScript classes](https://github.com/tc39/proposal-private-methods)
+* [BigInt](https://github.com/tc39/proposal-bigint)
+* [Import.meta](https://github.com/tc39/proposal-import-meta)
+
+## Experimental features
+
+Experimental features support as in `NodeJS`. These need to be enabled with the `experimental` option.
+
+* [Decorators](https://github.com/tc39/proposal-decorators)
+* [Do-expressions](https://github.com/tc39/proposal-do-expressions)
+
+## API
+
+Cherow generates AST according to [ESTree AST format](https://github.com/estree/estree), and can be used to perform [syntactic analysis](https://en.wikipedia.org/wiki/Parsing) (parsing) of a JavaScript program, and with ES2015 and later a JavaScript program can be either [a script or a module](http://www.ecma-international.org/ecma-262/8.0/index.html#sec-ecmascript-language-scripts-and-modules).
+
+The `parse` method exposed by Cherow takes an optional `options` object which allows you to specify whether to parse in [`script`](http://www.ecma-international.org/ecma-262/8.0/#sec-parse-script) mode (the default) or in [`module`](http://www.ecma-international.org/ecma-262/8.0/#sec-parsemodule) mode.
+
+
+Here is a quick example to parse a script:
+
+```js
+
+cherow.parseScript('x = async() => { for await (x of xs); }');
+
+// or
+
+cherow.parse('x = async() => { for await (x of xs); }');
+
+```
+
+This will return when serialized in json:
+
+```js
+{
+ body: [{
+ expression: {
+ left: {
+ name: 'x',
+ type: 'Identifier'
+ },
+ operator: '=',
+ right: {
+ async: true,
+ body: {
+ body: [{
+ await: true,
+ body: {
+ type: 'EmptyStatement',
+ },
+ left: {
+ name: 'x',
+ type: 'Identifier',
+ },
+ right: {
+ name: 'xs',
+ type: 'Identifier',
+ },
+ type: 'ForOfStatement',
+ }],
+ type: 'BlockStatement'
+ },
+ expression: false,
+ generator: false,
+ id: null,
+ params: [],
+ type: 'ArrowFunctionExpression'
+ },
+ type: 'AssignmentExpression'
+ },
+ type: 'ExpressionStatement'
+ }],
+ sourceType: 'script',
+ type: 'Program'
+}
+```
+
+## Options
+
+The second argument allows you to specify various options:
+
+| Option | Description |
+| ----------- | ------------------------------------------------------------ |
+| `module` | Enable module syntax |
+| `loc` | Attach line/column location information to each node |
+| `ranges` | Append start and end offsets to each node |
+| `globalReturn` | Allow return in the global scope |
+| `skipShebang` | Allow to skip shebang - '#' |
+| `impliedStrict` | Enable strict mode initial enforcement |
+| `next` | Enable stage 3 support (*ESNext*) |
+| `jsx` | Enable React JSX parsing |
+| `tolerant` | Create a top-level error array containing all "skipped" errors |
+| `source` | Set to true to record the source file in every node's `loc` object when the `loc option` is set. |
+| `experimental` | Enable experimental features
+| `raw` | Attach raw property to each literal node |
+| `rawIdentifier` | Attach raw property to each identifier node |
+| `node` | Allow to bypass scoping when run in a NodejS environment |
+
+## Builds
+
+Cherow contains 3 different builds:
+
+| Name | Description |
+| ----------- | ------------------------------------------------------------ |
+| `Stable` | Stable release |
+| `Next` | Has the `next` option enabled by default, and support all latest ECMAScript proposals. |
+| `Bleeding` | The active development branch. You can and will expect bugs with this branch because it's not stable |
+
+## Contributing
+
+If you feel something could've been done better, please do feel free to file a pull request with the changes.
+
+Read our guidelines [here](CONTRIBUTING.md)
+
+## Bug reporting
+
+If you caught a bug, don't hesitate to report it in the issue tracker. From the moment I respond to you, it will take maximum 60 minutes before the bug is fixed.
+
+Note that I will try to respond to you within one hour. Sometimes it can take a bit longer. I'm not allways online. And if I find out it
+will take more then 60 minutes to solve your issue, you will be notified.
+
+I know how irritating it can be if you are writing code and encounter bugs in your dependencies. And even more frustrating if you need to wait weeks or days.
+
+
+## Rationale
+
+Existing parsers have many issues with them:
+
+* `Acorn` is the most commonly used tool out there because of its support for recent ES standards, but it's slow and it often is too permissive in what it accepts. It's also not optimized for handheld devices.
+
+* `Esprima` is a little faster than Acorn, but it's almost never updated, and their test suite has too many invalid tests. It also doesn't support recent ES standards.
+
+* `Babylon` is highly coupled to Babel, and is comparatively very slow and buggy, and failing to correctly handle even stable ECMAScript standard features.
+
+None of these parsers would fare any chance against the official Test262 suite, and most fail a substantial number of them.
+
+We figured we could *try* do better. *We* are used in plural form because Cherow is developed by a main developer and two
+others "*behind the scene*" that contributes with their knowledge whenever it's necessary.
diff --git a/node_modules/cherow/dist/amd/cherow.js b/node_modules/cherow/dist/amd/cherow.js new file mode 100644 index 0000000..542cb0b --- /dev/null +++ b/node_modules/cherow/dist/amd/cherow.js @@ -0,0 +1,7319 @@ +define('cherow', ['exports'], function (exports) { 'use strict'; + + // Note: this *must* be kept in sync with the enum's order.
+ //
+ // It exploits the enum value ordering, and it's necessarily a complete and
+ // utter hack.
+ //
+ // All to lower it to a single monomorphic array access.
+ const keywordDescTable = [
+ 'end of source',
+ /* Constants/Bindings */
+ 'identifier', 'number', 'string', 'regular expression',
+ 'false', 'true', 'null',
+ /* Template nodes */
+ 'template continuation', 'template end',
+ /* Punctuators */
+ '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '</', '/>',
+ /* Update operators */
+ '++', '--',
+ /* Assign operators */
+ '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
+ '&=',
+ /* Unary/binary operators */
+ 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
+ '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
+ /* Variable declaration kinds */
+ 'var', 'let', 'const',
+ /* Other reserved words */
+ 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
+ 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
+ 'this', 'throw', 'try', 'while', 'with',
+ /* Strict mode reserved words */
+ 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
+ /* Contextual keywords */
+ 'as', 'async', 'await', 'constructor', 'get', 'set', 'from', 'of',
+ '#',
+ 'eval', 'arguments', 'enum', 'BigInt', '@', 'JSXText',
+ /** TS */
+ 'KeyOf', 'ReadOnly', 'is', 'unique', 'declare', 'type', 'namespace', 'abstract', 'module',
+ 'global', 'require', 'target'
+ ];
+ /**
+ * The conversion function between token and its string description/representation.
+ */
+ function tokenDesc(token) {
+ return keywordDescTable[token & 255 /* Type */];
+ }
+ // Used `Object.create(null)` to avoid potential `Object.prototype`
+ // interference.
+ const descKeywordTable = Object.create(null, {
+ this: { value: 33566815 /* ThisKeyword */ },
+ function: { value: 33566808 /* FunctionKeyword */ },
+ if: { value: 12377 /* IfKeyword */ },
+ return: { value: 12380 /* ReturnKeyword */ },
+ var: { value: 33566791 /* VarKeyword */ },
+ else: { value: 12370 /* ElseKeyword */ },
+ for: { value: 12374 /* ForKeyword */ },
+ new: { value: 33566811 /* NewKeyword */ },
+ in: { value: 167786289 /* InKeyword */ },
+ typeof: { value: 302002218 /* TypeofKeyword */ },
+ while: { value: 12386 /* WhileKeyword */ },
+ case: { value: 12363 /* CaseKeyword */ },
+ break: { value: 12362 /* BreakKeyword */ },
+ try: { value: 12385 /* TryKeyword */ },
+ catch: { value: 12364 /* CatchKeyword */ },
+ delete: { value: 302002219 /* DeleteKeyword */ },
+ throw: { value: 302002272 /* ThrowKeyword */ },
+ switch: { value: 33566814 /* SwitchKeyword */ },
+ continue: { value: 12366 /* ContinueKeyword */ },
+ default: { value: 12368 /* DefaultKeyword */ },
+ instanceof: { value: 167786290 /* InstanceofKeyword */ },
+ do: { value: 12369 /* DoKeyword */ },
+ void: { value: 302002220 /* VoidKeyword */ },
+ finally: { value: 12373 /* FinallyKeyword */ },
+ arguments: { value: 37879925 /* Arguments */ },
+ keyof: { value: 131194 /* KeyOfKeyword */ },
+ readonly: { value: 131195 /* ReadOnlyKeyword */ },
+ unique: { value: 131197 /* UniqueKeyword */ },
+ declare: { value: 131198 /* DeclareKeyword */ },
+ async: { value: 594028 /* AsyncKeyword */ },
+ await: { value: 34017389 /* AwaitKeyword */ },
+ class: { value: 33566797 /* ClassKeyword */ },
+ const: { value: 33566793 /* ConstKeyword */ },
+ constructor: { value: 69742 /* ConstructorKeyword */ },
+ debugger: { value: 12367 /* DebuggerKeyword */ },
+ enum: { value: 12406 /* EnumKeyword */ },
+ eval: { value: 37879924 /* Eval */ },
+ export: { value: 12371 /* ExportKeyword */ },
+ extends: { value: 12372 /* ExtendsKeyword */ },
+ false: { value: 33566725 /* FalseKeyword */ },
+ from: { value: 69745 /* FromKeyword */ },
+ get: { value: 69743 /* GetKeyword */ },
+ implements: { value: 20579 /* ImplementsKeyword */ },
+ import: { value: 33566810 /* ImportKeyword */ },
+ interface: { value: 20580 /* InterfaceKeyword */ },
+ let: { value: 33574984 /* LetKeyword */ },
+ null: { value: 33566727 /* NullKeyword */ },
+ of: { value: 69746 /* OfKeyword */ },
+ package: { value: 20581 /* PackageKeyword */ },
+ private: { value: 20582 /* PrivateKeyword */ },
+ protected: { value: 20583 /* ProtectedKeyword */ },
+ public: { value: 20584 /* PublicKeyword */ },
+ set: { value: 69744 /* SetKeyword */ },
+ static: { value: 20585 /* StaticKeyword */ },
+ super: { value: 33566813 /* SuperKeyword */ },
+ true: { value: 33566726 /* TrueKeyword */ },
+ with: { value: 12387 /* WithKeyword */ },
+ yield: { value: 1107316842 /* YieldKeyword */ },
+ is: { value: 131196 /* IsKeyword */ },
+ type: { value: 131199 /* TypeKeyword */ },
+ namespace: { value: 131200 /* NameSpaceKeyword */ },
+ abstract: { value: 131201 /* AbstractKeyword */ },
+ as: { value: 167843947 /* AsKeyword */ },
+ module: { value: 131202 /* ModuleKeyword */ },
+ global: { value: 131203 /* GlobalKeyword */ },
+ require: { value: 131204 /* RequireKeyword */ },
+ target: { value: 131205 /* TargetKeyword */ },
+ });
+ function descKeyword(value) {
+ return (descKeywordTable[value] | 0);
+ } + + /*@internal*/
+ const characterType = [
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 16 /* Space */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ ]; + + // Unicode v. 11 support
+ // tslint:disable
+ function isValidIdentifierPart(code) {
+ return (convert[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
+ }
+ function isValidIdentifierStart(code) {
+ return (convert[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
+ }
+ function mustEscape(code) {
+ return (convert[(code >>> 5) + 69632] >>> code & 31 & 1) !== 0;
+ }
+ const convert = ((compressed, lookup) => {
+ const result = new Uint32Array(104448);
+ let index = 0;
+ let subIndex = 0;
+ while (index < 3392) {
+ const inst = compressed[index++];
+ if (inst < 0) {
+ subIndex -= inst;
+ }
+ else {
+ let code = compressed[index++];
+ if (inst & 2)
+ code = lookup[code];
+ if (inst & 1) {
+ result.fill(code, subIndex, subIndex += compressed[index++]);
+ }
+ else {
+ result[subIndex++] = code;
+ }
+ }
+ }
+ return result;
+ })([-1, 2, 28, 2, 29, 2, 5, -1, 0, 77595648, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 15, 2, 60, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 61, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 20, 2, 0, 0, 608174079, 2, 0, 2, 127, 2, 6, 2, 62, -1, 2, 64, 2, 26, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2965387679, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 2, 171, 0, 4294828031, 0, 3825204735, 0, 123747807, 0, 65487, 2, 3, 0, 4092591615, 0, 1080049119, 0, 458703, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247020, 2, 68, 0, 4284449919, 0, 851904, 2, 4, 2, 16, 0, 67076095, -1, 2, 69, 0, 1006628014, 0, 4093591391, -1, 0, 50331649, 0, 3265266687, 2, 34, 0, 4294844415, 0, 4278190047, 2, 23, 2, 125, -1, 3, 0, 2, 2, 33, 2, 0, 2, 9, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 10, 0, 261632, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 2088959, 2, 31, 2, 8, 0, 909311, 3, 0, 2, 0, 814743551, 2, 42, 0, 67057664, 3, 0, 2, 2, 45, 2, 0, 2, 32, 2, 0, 2, 18, 2, 7, 0, 268374015, 2, 30, 2, 51, 2, 0, 2, 78, 0, 134153215, -1, 2, 6, 2, 0, 2, 7, 0, 2684354559, 0, 67044351, 0, 1073676416, -2, 3, 0, 2, 2, 43, 0, 1046528, 3, 0, 3, 2, 8, 2, 0, 2, 41, 0, 4294960127, 2, 9, 2, 39, 2, 10, 0, 4294377472, 2, 21, 3, 0, 7, 0, 4227858431, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -1, 2, 122, 0, 1048577, 2, 84, 2, 12, -1, 2, 12, 0, 131042, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 1046559, 2, 0, 2, 13, 2, 0, 0, 2147516671, 2, 24, 3, 88, 2, 2, 0, -16, 2, 89, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 2, 119, 2, 0, 0, 3220242431, 3, 0, 3, 2, 20, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 2, 0, 2, 27, 2, 0, 2, 8, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 25, 2, 8, 2, 23, 3, 0, 2, 0, 67076097, 2, 7, 2, 0, 2, 24, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 3774349439, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, 2, 19, 0, 1638399, 2, 169, 2, 104, 3, 0, 3, 2, 23, 2, 28, 2, 29, 2, 5, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -3, 2, 146, -4, 2, 23, 2, 0, 2, 37, 0, 1, 2, 0, 2, 63, 2, 32, 2, 16, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 33, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277137519, 0, 2269118463, -1, 3, 23, 2, -1, 2, 34, 2, 38, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 48, -14, 2, 23, 2, 44, 2, 37, -5, 3, 0, 2, 2, 38, 0, 2147549120, 2, 0, 2, 16, 2, 17, 2, 130, 2, 0, 2, 52, 0, 4294901872, 0, 5242879, 3, 0, 2, 0, 402595359, -1, 2, 118, 0, 1090519039, -2, 2, 120, 2, 39, 2, 0, 2, 55, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, -4, 3, 0, 2, 0, 1140787199, -1, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 41, 2, 42, -1, 2, 10, 2, 43, -6, 2, 0, 2, 16, -3, 3, 0, 2, 0, 2147484671, -8, 2, 0, 2, 7, 2, 44, 2, 0, 0, 603979727, -1, 2, 0, 2, 45, -8, 2, 54, 2, 46, 0, 67043329, 2, 123, 2, 47, 0, 8388351, -2, 2, 124, 0, 3028287487, 2, 48, 2, 126, 0, 33259519, 2, 42, -9, 2, 24, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, 2, 42, -2, 2, 17, 2, 51, 2, 0, 2, 24, 0, 67043343, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 4294901791, 2, 7, 2, 164, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 0, 1677656575, -166, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 90, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -42, 0, 4194303871, 0, 2011, -62, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 55, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -22583, 3, 0, 7, 2, 19, -6130, 3, 5, 2, -1, 0, 69207040, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 15, 2, 60, 2, 0, 2, 35, -1, 2, 17, 2, 61, -1, 2, 0, 2, 62, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 19, 2, 63, 3, 0, 2, 0, 131135, 2, 94, 0, 70256639, 0, 71303167, 0, 272, 2, 45, 2, 62, -1, 2, 64, -2, 2, 96, 0, 603979775, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 65, 2, 66, 0, 33554435, 2, 121, 2, 65, 2, 147, 0, 131075, 0, 3594373096, 0, 67094296, 2, 66, -1, 2, 67, 0, 603979263, 2, 156, 0, 3, 0, 4294828001, 0, 602930687, 2, 180, 0, 393219, 2, 67, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 68, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 69, 0, 537783470, 0, 4026531935, -1, 0, 1, -1, 2, 34, 2, 70, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 16, -1, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 253951, 3, 20, 2, 0, 122879, 2, 0, 2, 8, 0, 276824064, -2, 3, 0, 2, 2, 45, 2, 0, 0, 4294903295, 2, 0, 2, 18, 2, 7, -1, 2, 17, 2, 51, 2, 0, 2, 78, 2, 42, -1, 2, 24, 2, 0, 2, 31, -2, 0, 128, -2, 2, 79, 2, 8, 0, 4064, -1, 2, 117, 0, 4227907585, 2, 0, 2, 116, 2, 0, 2, 50, 2, 196, 2, 9, 2, 39, 2, 10, -1, 0, 6544896, 3, 0, 6, -2, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -3, 2, 84, 2, 12, -3, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 817183, 2, 0, 2, 13, 2, 0, 0, 33023, 2, 24, 3, 88, 2, -17, 2, 89, 0, 524157950, 2, 4, 2, 0, 2, 90, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 19, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 0, 4294965179, 0, 7, 2, 0, 2, 8, 2, 92, 2, 8, -1, 0, 1761345536, 2, 94, 2, 95, 2, 38, 2, 23, 2, 96, 2, 36, 2, 162, 0, 2080440287, 2, 0, 2, 35, 2, 138, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 7, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 2700607615, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, -3, 2, 104, 3, 0, 3, 2, 23, -1, 3, 5, 2, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -8, 2, 23, 2, 0, 2, 37, -1, 2, 0, 2, 63, 2, 32, 2, 18, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 17, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277075969, 2, 18, -1, 3, 23, 2, -1, 2, 34, 2, 139, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 50, -14, 2, 23, 2, 44, 2, 116, -5, 2, 117, 2, 41, -2, 2, 117, 2, 19, 2, 17, 2, 35, 2, 117, 2, 38, 0, 4294901776, 0, 4718591, 2, 117, 2, 36, 0, 335544350, -1, 2, 118, 2, 119, -2, 2, 120, 2, 39, 2, 7, -1, 2, 121, 2, 65, 0, 3758161920, 0, 3, -4, 2, 0, 2, 31, 2, 174, -1, 2, 0, 2, 19, 0, 176, -5, 2, 0, 2, 49, 2, 182, -1, 2, 0, 2, 19, 2, 194, -1, 2, 0, 2, 62, -2, 2, 16, -7, 2, 0, 2, 119, -3, 3, 0, 2, 2, 122, -8, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871887, -1, 2, 0, 2, 45, -8, 2, 54, 2, 49, 0, 1, 2, 123, 2, 19, -3, 2, 124, 2, 37, 2, 125, 2, 126, 0, 16778239, -10, 2, 36, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, -3, 2, 17, 2, 127, 2, 0, 2, 19, 2, 50, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 65567, -1, 2, 26, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 2, 130, -187, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 2, 138, -129, 3, 0, 6, 2, 139, -1, 3, 0, 2, 2, 50, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -28719, 2, 0, 0, 1, -1, 2, 122, 2, 0, 0, 8193, -21, 0, 50331648, 0, 10255, 0, 4, -11, 2, 66, 2, 168, -1, 0, 71680, -1, 2, 157, 0, 4292900864, 0, 805306431, -5, 2, 146, -1, 2, 176, -1, 0, 6144, -2, 2, 123, -1, 2, 150, -1, 2, 153, 2, 147, 2, 161, 2, 0, 0, 3223322624, 2, 36, 0, 4, -4, 2, 188, 0, 205128192, 0, 1333757536, 0, 2147483696, 0, 423953, 0, 747766272, 0, 2717763192, 0, 4286578751, 0, 278545, 2, 148, 0, 4294886464, 0, 33292336, 0, 417809, 2, 148, 0, 1329579616, 0, 4278190128, 0, 700594195, 0, 1006647527, 0, 4286497336, 0, 4160749631, 2, 149, 0, 469762560, 0, 4171219488, 0, 16711728, 2, 149, 0, 202375680, 0, 3214918176, 0, 4294508592, 0, 139280, -1, 0, 983584, 2, 190, 0, 58720275, 0, 3489923072, 0, 10517376, 0, 4293066815, 0, 1, 0, 2013265920, 2, 175, 2, 0, 0, 17816169, 0, 3288339281, 0, 201375904, 2, 0, -2, 0, 256, 0, 122880, 0, 16777216, 2, 146, 0, 4160757760, 2, 0, -6, 2, 163, -11, 0, 3263218176, -1, 0, 49664, 0, 2160197632, 0, 8388802, -1, 0, 12713984, -1, 2, 150, 2, 155, 2, 158, -2, 2, 159, -20, 0, 3758096385, -2, 2, 151, 0, 4292878336, 2, 22, 2, 166, 0, 4294057984, -2, 2, 160, 2, 152, 2, 172, -2, 2, 151, -1, 2, 179, -1, 2, 167, 2, 122, 0, 4026593280, 0, 14, 0, 4292919296, -1, 2, 154, 0, 939588608, -1, 0, 805306368, -1, 2, 122, 0, 1610612736, 2, 152, 2, 153, 3, 0, 2, -2, 2, 154, 2, 155, -3, 0, 267386880, -1, 2, 156, 0, 7168, -1, 0, 65024, 2, 150, 2, 157, 2, 158, -7, 2, 165, -8, 2, 159, -1, 0, 1426112704, 2, 160, -1, 2, 185, 0, 271581216, 0, 2149777408, 2, 19, 2, 157, 2, 122, 0, 851967, 0, 3758129152, -1, 2, 19, 2, 178, -4, 2, 154, -20, 2, 192, 2, 161, -56, 0, 3145728, 2, 184, -1, 2, 191, 2, 122, -1, 2, 162, 2, 122, -4, 0, 32505856, -1, 2, 163, -1, 0, 2147385088, 2, 22, 1, 2155905152, 2, -3, 2, 164, 2, 0, 2, 165, -2, 2, 166, -6, 2, 167, 0, 4026597375, 0, 1, -1, 0, 1, -1, 2, 168, -3, 2, 139, 2, 66, -2, 2, 162, 2, 177, -1, 2, 173, 2, 122, -6, 2, 122, -213, 2, 167, -657, 2, 17, -36, 2, 169, -1, 2, 186, -10, 0, 4294963200, -5, 2, 170, -5, 2, 158, 2, 0, 2, 24, -1, 0, 4227919872, -1, 2, 170, -2, 0, 4227874752, -3, 0, 2146435072, 2, 155, -2, 0, 1006649344, 2, 122, -1, 2, 22, 0, 201375744, -3, 0, 134217720, 2, 22, 0, 4286677377, 0, 32896, -1, 2, 171, -3, 2, 172, -349, 2, 173, 2, 174, 2, 175, 3, 0, 264, -11, 2, 176, -2, 2, 158, 2, 0, 0, 520617856, 0, 2692743168, 0, 36, -3, 0, 524284, -11, 2, 19, -1, 2, 183, -1, 2, 181, 0, 3221291007, 2, 158, -1, 0, 524288, 0, 2158720, -3, 2, 155, 0, 1, -4, 2, 122, 0, 3808625411, 0, 3489628288, 0, 4096, 0, 1207959680, 0, 3221274624, 2, 0, -3, 2, 177, 0, 120, 0, 7340032, -2, 0, 4026564608, 2, 4, 2, 19, 2, 160, 3, 0, 4, 2, 155, -1, 2, 178, 2, 175, -1, 0, 8176, 2, 179, 2, 177, 2, 180, -1, 0, 4290773232, 2, 0, -4, 2, 160, 2, 187, 0, 15728640, 2, 175, -1, 2, 157, -1, 0, 4294934512, 3, 0, 4, -9, 2, 22, 2, 167, 2, 181, 3, 0, 4, 0, 704, 0, 1849688064, 0, 4194304, -1, 2, 122, 0, 4294901887, 2, 0, 0, 130547712, 0, 1879048192, 0, 2080374784, 3, 0, 2, -1, 2, 182, 2, 183, -1, 0, 17829776, 0, 2025848832, 0, 4261477888, -2, 2, 0, -1, 0, 4286580608, -1, 0, 29360128, 2, 184, 0, 16252928, 0, 3791388672, 2, 39, 3, 0, 2, -2, 2, 193, 2, 0, -1, 2, 26, -1, 0, 66584576, -1, 2, 189, 3, 0, 9, 2, 122, 3, 0, 4, -1, 2, 157, 2, 158, 3, 0, 5, -2, 0, 245760, 0, 2147418112, -1, 2, 146, 2, 199, 0, 4227923456, -1, 2, 185, 2, 186, 2, 22, -2, 2, 176, 0, 4292870145, 0, 262144, 2, 122, 3, 0, 2, 0, 1073758848, 2, 187, -1, 0, 4227921920, 2, 188, 0, 68289024, 0, 528402016, 0, 4292927536, 3, 0, 4, -2, 0, 2483027968, 2, 0, -2, 2, 189, 3, 0, 5, -1, 2, 184, 2, 160, 2, 0, -2, 0, 4227923936, 2, 63, -1, 2, 170, 2, 94, 2, 0, 2, 150, 2, 154, 3, 0, 6, -1, 2, 175, 3, 0, 3, -2, 0, 2146959360, 3, 0, 8, -2, 2, 157, -1, 2, 190, 2, 117, -1, 2, 151, 3, 0, 8, 2, 191, 0, 8388608, 2, 171, 2, 169, 2, 183, 0, 4286578944, 3, 0, 2, 0, 1152, 0, 1266679808, 2, 189, 0, 576, 0, 4261707776, 2, 94, 3, 0, 9, 2, 151, 3, 0, 8, -28, 2, 158, 3, 0, 3, -3, 0, 4292902912, -6, 2, 96, 3, 0, 85, -33, 2, 164, 3, 0, 126, -18, 2, 192, 3, 0, 269, -17, 2, 151, 2, 122, 0, 4294917120, 3, 0, 2, 2, 19, 0, 4290822144, -2, 0, 67174336, 0, 520093700, 2, 17, 3, 0, 21, -2, 2, 177, 3, 0, 3, -2, 0, 65504, 2, 122, 2, 49, 3, 0, 2, 2, 92, -191, 2, 123, -23, 2, 26, 3, 0, 296, -8, 2, 122, 3, 0, 2, 2, 19, -11, 2, 175, 3, 0, 72, -3, 0, 3758159872, 0, 201391616, 3, 0, 155, -7, 2, 167, -1, 0, 384, -1, 0, 133693440, -3, 2, 193, -2, 2, 30, 3, 0, 4, 2, 166, -2, 2, 22, 2, 151, 3, 0, 4, -2, 2, 185, -1, 2, 146, 0, 335552923, 2, 194, -1, 0, 538974272, 0, 2214592512, 0, 132000, -10, 0, 192, -8, 0, 12288, -21, 0, 134213632, 0, 4294901761, 3, 0, 42, 0, 100663424, 0, 4294965284, 3, 0, 62, -6, 0, 4286578784, 2, 0, -2, 0, 1006696448, 3, 0, 24, 2, 37, -1, 2, 195, 3, 0, 10, 2, 194, 0, 4110942569, 0, 1432950139, 0, 2701658217, 0, 4026532864, 0, 4026532881, 2, 0, 2, 47, 3, 0, 8, -1, 2, 154, -2, 2, 166, 0, 98304, 0, 65537, 2, 167, 2, 169, -2, 2, 154, -1, 2, 63, 2, 0, 2, 116, 2, 197, 2, 175, 0, 4294770176, 2, 30, 3, 0, 4, -30, 2, 195, 2, 196, -3, 2, 166, -2, 2, 151, 2, 0, 2, 154, -1, 2, 189, -1, 2, 157, 2, 198, 3, 0, 2, 2, 154, 2, 122, -1, 0, 193331200, -1, 0, 4227923960, 2, 197, -1, 3, 0, 3, 2, 198, 3, 0, 44, -1334, 2, 22, 2, 0, -129, 2, 195, -6, 2, 160, -180, 2, 199, -233, 2, 4, 3, 0, 96, -16, 2, 160, 3, 0, 22583, -7, 2, 17, 3, 0, 6128], [4294967295, 4294967291, 4092460543, 4294828015, 4294967294, 134217726, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 1061158911, 536805376, 4294910143, 4160749567, 4294901759, 134217727, 4294901760, 4194303, 65535, 262143, 67108863, 4286578688, 536870911, 8388607, 4294918143, 4294443008, 255, 67043328, 2281701374, 4294967232, 2097151, 4294903807, 4294902783, 4294967039, 511, 524287, 131071, 127, 4294902271, 4294549487, 16777215, 1023, 67047423, 4294901888, 33554431, 4286578687, 4294770687, 67043583, 32767, 15, 2047999, 4292870143, 4294934527, 4294966783, 67045375, 4294967279, 262083, 20511, 4290772991, 41943039, 493567, 2047, 4294959104, 1071644671, 602799615, 65536, 4294828000, 805044223, 4277151126, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 4294967264, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4294967292, 4294965759, 4294966272, 4294901823, 4294967280, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 268369920, 4292804608, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4294966591, 2445279231, 3670015, 3238002687, 63, 4294967288, 4294705151, 4095, 3221208447, 4294549472, 2147483648, 4294705152, 4294966143, 64, 4294966719, 16383, 3774873592, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4087, 31, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 536870912, 2952790016, 202506752, 139264, 402653184, 4261412864, 4227922944, 2147532800, 61440, 3758096384, 117440512, 65280, 4227858432, 3233808384, 3221225472, 4294965248, 32768, 57152, 4294934528, 67108864, 4293918720, 4290772992, 25165824, 57344, 4278190080, 65472, 4227907584, 65520, 1920, 4026531840, 49152, 4160749568, 4294836224, 63488, 1073741824, 4294967040, 251658240, 196608, 12582912, 2097152, 65408, 64512, 417808, 4227923712, 48, 512, 4294967168, 4294966784, 16, 4292870144, 4227915776, 65528, 4294950912, 65532]); + + /**
+ * Return the next unicodechar in the stream
+ *
+ * @param parser Parser object
+ */
+ function nextUnicodeChar(parser) {
+ const { index } = parser;
+ const hi = parser.source.charCodeAt(index);
+ if (hi < 55296 /* LeadSurrogateMin */ || hi > 56319 /* LeadSurrogateMax */)
+ return hi;
+ const lo = parser.source.charCodeAt(index + 1);
+ if (lo < 56320 /* TrailSurrogateMin */ || lo > 57343 /* TrailSurrogateMax */)
+ return hi;
+ return 65536 /* NonBMPMin */ + ((hi & 0x3FF) << 10) | lo & 0x3FF;
+ }
+ /**
+ * Returns true if this is a valid identifier part
+ *
+ * @param code Codepoint
+ */
+ const isIdentifierPart = (code) => (characterType[code] & 1 /* IdentifierStart */) !== 0 || isValidIdentifierPart(code);
+ function escapeInvalidCharacters(code) {
+ switch (code) {
+ case 0 /* Null */:
+ return '\\0';
+ case 8 /* Backspace */:
+ return '\\b';
+ case 9 /* Tab */:
+ return '\\t';
+ case 10 /* LineFeed */:
+ return '\\n';
+ case 11 /* VerticalTab */:
+ return '\\v';
+ case 12 /* FormFeed */:
+ return '\\f';
+ case 13 /* CarriageReturn */:
+ return '\\r';
+ default:
+ if (!mustEscape(code))
+ return fromCodePoint(code);
+ if (code < 0x10)
+ return `\\x0${code.toString(16)}`;
+ if (code < 0x100)
+ return `\\x${code.toString(16)}`;
+ if (code < 0x1000)
+ return `\\u0${code.toString(16)}`;
+ if (code < 0x10000)
+ return `\\u${code.toString(16)}`;
+ return `\\u{${code.toString(16)}}`;
+ }
+ }
+ /**
+ * Consume an token in the scanner on match. This is an equalent to
+ * 'consume' used in the parser code itself.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function consumeOpt(parser, code) {
+ if (parser.source.charCodeAt(parser.index) !== code)
+ return false;
+ parser.index++;
+ parser.column++;
+ return true;
+ }
+ /**
+ * Consumes line feed
+ *
+ * @param parser Parser object
+ * @param state Scanner state
+ */
+ function consumeLineFeed(parser, state) {
+ parser.flags |= exports.Flags.NewLine;
+ parser.index++;
+ if ((state & exports.ScannerState.LastIsCR) === 0) {
+ parser.column = 0;
+ parser.line++;
+ }
+ }
+ /**
+ * Scans private name. Stage 3 proposal related
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanPrivateName(parser, context) {
+ if (!(context & exports.Context.InClass) || !isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return 115 /* Hash */;
+ }
+ /**
+ * Advance to new line
+ *
+ * @param parser Parser object
+ */
+ function advanceNewline(parser) {
+ parser.flags |= exports.Flags.NewLine;
+ parser.index++;
+ parser.column = 0;
+ parser.line++;
+ }
+ const fromCodePoint = (code) => {
+ return code <= 0xFFFF ?
+ String.fromCharCode(code) :
+ String.fromCharCode(((code - 65536 /* NonBMPMin */) >> 10) + 55296 /* LeadSurrogateMin */, ((code - 65536 /* NonBMPMin */) & (1024 - 1)) + 56320 /* TrailSurrogateMin */);
+ };
+ function readNext(parser) {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.source.length)
+ report(parser, 14 /* UnicodeOutOfRange */);
+ return nextUnicodeChar(parser);
+ }
+ function toHex(code) {
+ if (code < 48 /* Zero */)
+ return -1;
+ if (code <= 57 /* Nine */)
+ return code - 48 /* Zero */;
+ if (code < 65 /* UpperA */)
+ return -1;
+ if (code <= 70 /* UpperF */)
+ return code - 65 /* UpperA */ + 10;
+ if (code < 97 /* LowerA */)
+ return -1;
+ if (code <= 102 /* LowerF */)
+ return code - 97 /* LowerA */ + 10;
+ return -1;
+ }
+ function advanceOnMaybeAstral(parser, ch) {
+ parser.index++;
+ parser.column++;
+ if (ch > 0xFFFF)
+ parser.index++;
+ } + + /**
+ * Scan escape sequence
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanEscapeSequence(parser, context, first) {
+ switch (first) {
+ case 98 /* LowerB */:
+ return 8 /* Backspace */;
+ case 102 /* LowerF */:
+ return 12 /* FormFeed */;
+ case 114 /* LowerR */:
+ return 13 /* CarriageReturn */;
+ case 110 /* LowerN */:
+ return 10 /* LineFeed */;
+ case 116 /* LowerT */:
+ return 9 /* Tab */;
+ case 118 /* LowerV */:
+ return 11 /* VerticalTab */;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ return exports.Escape.Empty;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ {
+ // 1 to 3 octal digits
+ let code = first - 48 /* Zero */;
+ let index = parser.index + 1;
+ let column = parser.column + 1;
+ let next = parser.source.charCodeAt(index);
+ if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ // Strict mode code allows only \0, then a non-digit.
+ if (code !== 0 || next === 56 /* Eight */ || next === 57 /* Nine */) {
+ if (context & exports.Context.Strict)
+ return exports.Escape.StrictOctal;
+ parser.flags |= exports.Flags.HasOctal;
+ }
+ }
+ else if (context & exports.Context.Strict) {
+ return exports.Escape.StrictOctal;
+ }
+ else {
+ parser.flags |= exports.Flags.HasOctal;
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ parser.index = index - 1;
+ parser.column = column - 1;
+ }
+ return code;
+ }
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ // 1 to 2 octal digits
+ if (context & exports.Context.Strict)
+ return exports.Escape.StrictOctal;
+ let code = first - 48 /* Zero */;
+ const index = parser.index + 1;
+ const column = parser.column + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ code = code * 8 + (next - 48 /* Zero */);
+ parser.lastValue = next;
+ parser.index = index;
+ parser.column = column;
+ }
+ return code;
+ }
+ // `8`, `9` (invalid escapes)
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return exports.Escape.EightOrNine;
+ // ASCII escapes
+ case 120 /* LowerX */:
+ {
+ const ch1 = parser.lastValue = readNext(parser);
+ const hi = toHex(ch1);
+ if (hi < 0)
+ return exports.Escape.InvalidHex;
+ const ch2 = parser.lastValue = readNext(parser);
+ const lo = toHex(ch2);
+ if (lo < 0)
+ return exports.Escape.InvalidHex;
+ return hi << 4 | lo;
+ }
+ // UCS-2/Unicode escapes
+ case 117 /* LowerU */:
+ {
+ let ch = parser.lastValue = readNext(parser);
+ if (ch === 123 /* LeftBrace */) {
+ ch = parser.lastValue = readNext(parser);
+ let code = toHex(ch);
+ if (code < 0)
+ return exports.Escape.InvalidHex;
+ ch = parser.lastValue = readNext(parser);
+ while (ch !== 125 /* RightBrace */) {
+ const digit = toHex(ch);
+ if (digit < 0)
+ return exports.Escape.InvalidHex;
+ code = code * 16 + digit;
+ // Code point out of bounds
+ if (code > 1114111 /* NonBMPMax */)
+ return exports.Escape.OutOfRange;
+ ch = parser.lastValue = readNext(parser);
+ }
+ return code;
+ }
+ else {
+ // \uNNNN
+ let codePoint = toHex(ch);
+ if (codePoint < 0)
+ return exports.Escape.InvalidHex;
+ for (let i = 0; i < 3; i++) {
+ ch = parser.lastValue = readNext(parser);
+ const digit = toHex(ch);
+ if (digit < 0)
+ return exports.Escape.InvalidHex;
+ codePoint = codePoint * 16 + digit;
+ }
+ return codePoint;
+ }
+ }
+ default:
+ return parser.source.charCodeAt(parser.index);
+ }
+ }
+ /**
+ * Throws a string error for either string or template literal
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function throwStringError(parser, context, code) {
+ switch (code) {
+ case exports.Escape.Empty:
+ return;
+ case exports.Escape.StrictOctal:
+ report(parser, context & exports.Context.TaggedTemplate ?
+ 76 /* TemplateOctalLiteral */ :
+ 11 /* StrictOctalEscape */);
+ case exports.Escape.EightOrNine:
+ report(parser, 13 /* InvalidEightAndNine */);
+ case exports.Escape.InvalidHex:
+ report(parser, 75 /* MalformedEscape */, 'hexadecimal');
+ case exports.Escape.OutOfRange:
+ report(parser, 14 /* UnicodeOutOfRange */);
+ /* istanbul ignore next */
+ default:
+ // ignore
+ }
+ }
+ /**
+ * Scan a string literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote codepoint
+ */
+ function scanString(parser, context, quote) {
+ const { index: start, lastValue } = parser;
+ let ret = '';
+ parser.index++;
+ parser.column++; // consume quote
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ switch (ch) {
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ report(parser, 6 /* UnterminatedString */);
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch > 128 /* MaxAsciiCharacter */) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ const code = scanEscapeSequence(parser, context, ch);
+ if (code >= 0)
+ ret += fromCodePoint(code);
+ else
+ throwStringError(parser, context, code);
+ ch = parser.lastValue;
+ }
+ break;
+ default:
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++; // consume quote
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ return 33554435 /* StringLiteral */;
+ } + + /**
+ * Consumes template brace
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function consumeTemplateBrace(parser, context) {
+ if (parser.index >= parser.length)
+ report(parser, 9 /* UnterminatedTemplate */);
+ // Upon reaching a '}', consume it and rewind the scanner state
+ parser.index--;
+ parser.column--;
+ return scanTemplate(parser, context);
+ }
+ /**
+ * Scan template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param first Codepoint
+ */
+ function scanTemplate(parser, context) {
+ const { index: start, lastValue } = parser;
+ let tail = true;
+ let ret = '';
+ let ch = readNext(parser);
+ loop: while (ch !== 96 /* Backtick */) {
+ switch (ch) {
+ // Break after a literal `${` (thus the dedicated code path).
+ case 36 /* Dollar */:
+ {
+ const index = parser.index + 1;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 123 /* LeftBrace */) {
+ parser.index = index;
+ parser.column++;
+ tail = false;
+ break loop;
+ }
+ ret += '$';
+ break;
+ }
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch >= 128) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ // Because octals are forbidden in escaped template sequences and the fact that
+ // both string and template scanning uses the same method - 'scanEscapeSequence',
+ // we set the strict context mask.
+ const code = scanEscapeSequence(parser, context | exports.Context.Strict, ch);
+ if (code >= 0) {
+ ret += fromCodePoint(code);
+ }
+ else if (code !== exports.Escape.Empty && context & exports.Context.TaggedTemplate) {
+ ret = undefined;
+ ch = scanLooserTemplateSegment(parser, parser.lastValue);
+ if (ch < 0) {
+ tail = false;
+ }
+ break loop;
+ }
+ else {
+ throwStringError(parser, context | exports.Context.TaggedTemplate, code);
+ }
+ ch = parser.lastValue;
+ }
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ // falls through
+ default:
+ if (ret != null)
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++;
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ if (tail) {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 1);
+ return 33554441 /* TemplateTail */;
+ }
+ else {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 2);
+ return 33554440 /* TemplateCont */;
+ }
+ }
+ /**
+ * Scan looser template segment
+ *
+ * @param parser Parser object
+ * @param ch codepoint
+ */
+ function scanLooserTemplateSegment(parser, ch) {
+ while (ch !== 96 /* Backtick */) {
+ if (ch === 36 /* Dollar */ && parser.source.charCodeAt(parser.index + 1) === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return -ch;
+ }
+ // Skip '\' and continue to scan the template token to search
+ // for the end, without validating any escape sequences
+ ch = readNext(parser);
+ }
+ return ch;
+ } + + // 11.8.3 Numeric Literals
+ /**
+ * Scans hex integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HexIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanHexIntegerLiteral(parser, context) {
+ parser.index++;
+ parser.column++;
+ let state = exports.NumericState.None;
+ let value = toHex(parser.source.charCodeAt(parser.index));
+ if (value < 0)
+ report(parser, 0 /* Unexpected */);
+ parser.index++;
+ parser.column++;
+ while (parser.index < parser.length) {
+ const next = parser.source.charCodeAt(parser.index);
+ if (context & exports.Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~exports.NumericState.SeenSeparator;
+ const digit = toHex(next);
+ if (digit < 0)
+ break;
+ value = value * 16 + digit;
+ parser.index++;
+ parser.column++;
+ }
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+ }
+ /**
+ * Scans binary and octal integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalIntegerLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BinaryIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanOctalOrBinary(parser, context, base) {
+ parser.index++;
+ parser.column++;
+ let digits = 0;
+ let ch;
+ let value = 0;
+ let state = exports.NumericState.None;
+ while (parser.index < parser.length) {
+ ch = parser.source.charCodeAt(parser.index);
+ if (context & exports.Context.OptionsNext && ch === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~exports.NumericState.SeenSeparator;
+ const converted = ch - 48 /* Zero */;
+ if (!(ch >= 48 /* Zero */ && ch <= 57 /* Nine */) || converted >= base)
+ break;
+ value = value * base + converted;
+ parser.index++;
+ parser.column++;
+ digits++;
+ }
+ if (digits === 0)
+ report(parser, 0 /* Unexpected */);
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+ }
+ /**
+ * Scans implicit octal digits
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalDigits)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanImplicitOctalDigits(parser, context) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ if (context & exports.Context.Strict)
+ report(parser, 0 /* Unexpected */);
+ let index = parser.index;
+ let column = parser.column;
+ let code = 0;
+ parser.flags |= exports.Flags.HasOctal;
+ // Implicit octal, unless there is a non-octal digit.
+ // (Annex B.1.1 on Numeric Literals)
+ while (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ else if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ return scanNumericLiteral(parser, context);
+ }
+ else {
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ }
+ parser.index = index;
+ parser.column = column;
+ return assembleNumericLiteral(parser, context, code, consumeOpt(parser, 110 /* LowerN */));
+ }
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ parser.flags |= exports.Flags.HasOctal;
+ default:
+ if (context & exports.Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ return scanNumericLiteral(parser, context);
+ }
+ }
+ /**
+ * Scans signed integer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SignedInteger)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanSignedInteger(parser, end) {
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */ || next === 45 /* Hyphen */) {
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (!(next >= 48 /* Zero */ && next <= 57 /* Nine */)) {
+ report(parser, 0 /* Unexpected */);
+ }
+ const preNumericPart = parser.index;
+ const finalFragment = scanDecimalDigitsOrSeparator(parser);
+ return parser.source.substring(end, preNumericPart) + finalFragment;
+ }
+ /**
+ * Scans numeric literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanNumericLiteral(parser, context, state = exports.NumericState.None) {
+ let value = state & exports.NumericState.Float ?
+ 0 :
+ scanDecimalAsSmi(parser, context);
+ const next = parser.source.charCodeAt(parser.index);
+ // I know I'm causing a bug here. The question is - will anyone figure this out?
+ if (next !== 46 /* Period */ && next !== 95 /* Underscore */ && !isValidIdentifierStart(next)) {
+ return assembleNumericLiteral(parser, context, value);
+ }
+ if (consumeOpt(parser, 46 /* Period */)) {
+ if (context & exports.Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ state |= exports.NumericState.Float;
+ value = `${value}.${scanDecimalDigitsOrSeparator(parser)}`;
+ }
+ const end = parser.index;
+ if (consumeOpt(parser, 110 /* LowerN */)) {
+ if (state & exports.NumericState.Float)
+ report(parser, 0 /* Unexpected */);
+ state |= exports.NumericState.BigInt;
+ }
+ if (consumeOpt(parser, 101 /* LowerE */) || consumeOpt(parser, 69 /* UpperE */)) {
+ state |= exports.NumericState.Float;
+ value += scanSignedInteger(parser, end);
+ }
+ if (isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 0 /* Unexpected */);
+ }
+ return assembleNumericLiteral(parser, context, state & exports.NumericState.Float ? parseFloat(value) : parseInt(value, 10), !!(state & exports.NumericState.BigInt));
+ }
+ /**
+ * Internal helper function for scanning numeric separators.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state NumericState state
+ */
+ function scanNumericSeparator(parser, state) {
+ parser.index++;
+ parser.column++;
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ state |= exports.NumericState.SeenSeparator;
+ return state;
+ }
+ /**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanDecimalDigitsOrSeparator(parser) {
+ let start = parser.index;
+ let state = exports.NumericState.None;
+ let ret = '';
+ loop: while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 95 /* Underscore */:
+ const preUnderscoreIndex = parser.index;
+ state = scanNumericSeparator(parser, state);
+ ret += parser.source.substring(start, preUnderscoreIndex);
+ start = parser.index;
+ continue;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ state = state & ~exports.NumericState.SeenSeparator;
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ break loop;
+ }
+ }
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return ret + parser.source.substring(start, parser.index);
+ }
+ /**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanDecimalAsSmi(parser, context) {
+ let state = exports.NumericState.None;
+ let value = 0;
+ let next = parser.source.charCodeAt(parser.index);
+ while (next >= 48 /* Zero */ && next <= 57 /* Nine */ || next === 95 /* Underscore */) {
+ if (context & exports.Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ next = parser.source.charCodeAt(parser.index);
+ continue;
+ }
+ state &= ~exports.NumericState.SeenSeparator;
+ value = value * 10 + (next - 48 /* Zero */);
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return value;
+ }
+ /**
+ * Internal helper function that assamble the number scanning parts and return
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param value The numeric value
+ */
+ function assembleNumericLiteral(parser, context, value, isBigInt = false) {
+ parser.tokenValue = value;
+ if (context & exports.Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ return isBigInt ? 33554551 /* BigIntLiteral */ : 33554434 /* NumericLiteral */;
+ } + + /**
+ * Scan identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function scanIdentifier(parser, context, first) {
+ let start = parser.index;
+ let ret = '';
+ let isEscaped = false;
+ if (first)
+ advanceOnMaybeAstral(parser, first);
+ loop: while (parser.index < parser.length) {
+ const index = parser.index;
+ let ch = parser.source.charCodeAt(index);
+ switch (ch) {
+ case 92 /* Backslash */:
+ ret += parser.source.slice(start, index);
+ ret += scanUnicodeCodePointEscape(parser);
+ start = parser.index;
+ isEscaped = true;
+ break;
+ default:
+ if (ch >= 0xD800 && ch <= 0xDBFF) {
+ const lo = parser.source.charCodeAt(index + 1);
+ ch = (ch & 0x3FF) << 10 | lo & 0x3FF | 0x10000;
+ }
+ if (!isIdentifierPart(ch))
+ break loop;
+ advanceOnMaybeAstral(parser, ch);
+ }
+ }
+ if (start < parser.index)
+ ret += parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ const len = ret.length;
+ // Keywords are between 2 and 11 characters long and start with a lowercase letter
+ // https://tc39.github.io/ecma262/#sec-keywords
+ if (len >= 2 && len <= 11) {
+ const token = descKeyword(ret);
+ if (token > 0) {
+ if (isEscaped) {
+ if (context & exports.Context.DisallowEscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ // Here we fall back to a mutual parser flag if the escaped keyword isn't disallowed through
+ // context masks. This is similiar to how V8 does it - they are using an
+ // 'escaped_keyword' token.
+ // - J.K. Thomas
+ parser.flags |= exports.Flags.EscapedKeyword;
+ }
+ return token;
+ }
+ }
+ if (context & exports.Context.OptionsRawidentifiers)
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ return 33685505 /* Identifier */;
+ }
+ /**
+ * Scanning chars in the range 0...127, and treat them as an possible
+ * identifier. This allows subsequent checking to be faster.
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param first Code point
+ */
+ function scanMaybeIdentifier(parser, context, first) {
+ first = nextUnicodeChar(parser);
+ if (!isValidIdentifierStart(first)) {
+ report(parser, 10 /* UnexpectedChar */, escapeInvalidCharacters(first));
+ }
+ return scanIdentifier(parser, context, first);
+ }
+ /**
+ * Scan unicode codepoint escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function scanUnicodeCodePointEscape(parser) {
+ const { index } = parser;
+ if (index + 5 < parser.length) {
+ if (parser.source.charCodeAt(index + 1) !== 117 /* LowerU */) {
+ report(parser, 0 /* Unexpected */);
+ }
+ parser.index += 2;
+ parser.column += 2;
+ const code = scanIdentifierUnicodeEscape(parser);
+ if (code >= 55296 /* LeadSurrogateMin */ && code <= 56319 /* LeadSurrogateMax */) {
+ report(parser, 74 /* UnexpectedSurrogate */);
+ }
+ if (!isIdentifierPart(code)) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ return fromCodePoint(code);
+ }
+ report(parser, 0 /* Unexpected */);
+ }
+ /**
+ * Scan identifier unicode escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function scanIdentifierUnicodeEscape(parser) {
+ // Accept both \uxxxx and \u{xxxxxx}. In the latter case, the number of
+ // hex digits between { } is arbitrary. \ and u have already been read.
+ let ch = parser.source.charCodeAt(parser.index);
+ let codePoint = 0;
+ // '\u{DDDDDDDD}'
+ if (ch === 123 /* LeftBrace */) { // {
+ ch = readNext(parser);
+ let digit = toHex(ch);
+ while (digit >= 0) {
+ codePoint = (codePoint << 4) | digit;
+ if (codePoint > 1114111 /* NonBMPMax */) {
+ report(parser, 89 /* UndefinedUnicodeCodePoint */);
+ }
+ parser.index++;
+ parser.column++;
+ digit = toHex(parser.source.charCodeAt(parser.index));
+ }
+ if (parser.source.charCodeAt(parser.index) !== 125 /* RightBrace */) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ consumeOpt(parser, 125 /* RightBrace */);
+ // '\uDDDD'
+ }
+ else {
+ for (let i = 0; i < 4; i++) {
+ ch = parser.source.charCodeAt(parser.index);
+ const digit = toHex(ch);
+ if (digit < 0)
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ codePoint = (codePoint << 4) | digit;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ return codePoint;
+ } + + // 11.4 Comments
+ /**
+ * Skips single HTML comments. Same behavior as in V8.
+ *
+ * @param parser Parser Object
+ * @param context Context masks.
+ * @param state Scanner state
+ * @param type Comment type
+ */
+ function skipSingleHTMLComment(parser, context, state, type) {
+ if (context & exports.Context.Module)
+ report(parser, 90 /* HtmlCommentInModule */);
+ return skipSingleLineComment(parser, context, state, type);
+ }
+ /**
+ * Skips SingleLineComment, SingleLineHTMLCloseComment and SingleLineHTMLOpenComment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SingleLineComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLOpenComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLCloseComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ * @param type Comment type
+ */
+ function skipSingleLineComment(parser, context, state, type) {
+ const start = parser.index;
+ const collectable = !!(context & exports.Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 13 /* CarriageReturn */:
+ advanceNewline(parser);
+ if ((parser.index < parser.length) && parser.source.charCodeAt(parser.index) === 10 /* LineFeed */)
+ parser.index++;
+ return state | exports.ScannerState.NewLine;
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ advanceNewline(parser);
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state | exports.ScannerState.NewLine;
+ default:
+ parser.index++;
+ parser.column++;
+ }
+ }
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state;
+ }
+ /**
+ * Skips multiline comment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-MultiLineComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ */
+ function skipMultiLineComment(parser, context, state) {
+ const start = parser.index;
+ const collectable = !!(context & exports.Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 42 /* Asterisk */:
+ parser.index++;
+ parser.column++;
+ state &= ~exports.ScannerState.LastIsCR;
+ if (consumeOpt(parser, 47 /* Slash */)) {
+ if (collectable)
+ addComment(parser, context, 'MultiLine', start);
+ return state;
+ }
+ break;
+ // Mark multiline comments containing linebreaks as new lines
+ // so we can perfectly handle edge cases like: '1/*\n*/--> a comment'
+ case 13 /* CarriageReturn */:
+ state |= exports.ScannerState.NewLine | exports.ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ break;
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ default:
+ state &= ~exports.ScannerState.LastIsCR;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ // Unterminated multi-line comment.
+ tolerant(parser, context, 8 /* UnterminatedComment */);
+ }
+ /**
+ * Add comments
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param type Comment type
+ * @param commentStart Start position of comment
+ */
+ function addComment(parser, context, type, commentStart) {
+ const { index, startIndex: start, startLine, startColumn, lastLine, lastColumn } = parser;
+ const comment = {
+ type,
+ value: parser.source.slice(commentStart, type === 'MultiLine' ? index - 2 : index),
+ start,
+ end: index,
+ };
+ if (context & exports.Context.OptionsLoc) {
+ comment.loc = {
+ start: { line: startLine, column: startColumn },
+ end: { line: lastLine, column: lastColumn },
+ };
+ }
+ parser.comments.push(comment);
+ } + + /**
+ * Scan
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-punctuatorss)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scan(parser, context) {
+ parser.flags &= ~exports.Flags.NewLine | exports.Flags.EscapedKeyword;
+ const lineStart = parser.index === 0;
+ let state = exports.ScannerState.None;
+ while (parser.index < parser.length) {
+ if (!lineStart) {
+ parser.startIndex = parser.index;
+ parser.startColumn = parser.column;
+ parser.startLine = parser.line;
+ }
+ const first = parser.source.charCodeAt(parser.index);
+ if (first > 128 /* MaxAsciiCharacter */) {
+ switch (first) {
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ case 65519 /* ByteOrderMark */:
+ case 160 /* NonBreakingSpace */:
+ case 5760 /* Ogham */:
+ case 8192 /* EnQuad */:
+ case 8193 /* EmQuad */:
+ case 8194 /* EnSpace */:
+ case 8195 /* EmSpace */:
+ case 8196 /* ThreePerEmSpace */:
+ case 8197 /* FourPerEmSpace */:
+ case 8198 /* SixPerEmSpace */:
+ case 8199 /* FigureSpace */:
+ case 8200 /* PunctuationSpace */:
+ case 8201 /* ThinSpace */:
+ case 8202 /* HairSpace */:
+ case 8239 /* NarrowNoBreakSpace */:
+ case 8287 /* MathematicalSpace */:
+ case 12288 /* IdeographicSpace */:
+ case 65279 /* Zwnbs */:
+ case 8205 /* Zwj */:
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ return scanMaybeIdentifier(parser, context, first);
+ }
+ }
+ else {
+ // Note: Here we first get rid of LT and WS, then we make sure that the lookup time
+ // for the single punctuator char is short as possible. A single punctuator
+ // char is a valid token that cannot also be a prefix of a combination
+ // of long tokens - e.g. '(', ')' and '=' is valid. '==' is not.
+ switch (first) {
+ case 13 /* CarriageReturn */:
+ state |= exports.ScannerState.NewLine | exports.ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ break;
+ case 9 /* Tab */:
+ case 11 /* VerticalTab */:
+ case 12 /* FormFeed */:
+ case 32 /* Space */:
+ parser.index++;
+ parser.column++;
+ break;
+ // `(`
+ case 40 /* LeftParen */:
+ parser.index++;
+ parser.column++;
+ return 50331659 /* LeftParen */;
+ // `)`
+ case 41 /* RightParen */:
+ parser.index++;
+ parser.column++;
+ return 16 /* RightParen */;
+ // `,`
+ case 44 /* Comma */:
+ parser.index++;
+ parser.column++;
+ return 16777234 /* Comma */;
+ // `:`
+ case 58 /* Colon */:
+ parser.index++;
+ parser.column++;
+ return 16777237 /* Colon */;
+ // `;`
+ case 59 /* Semicolon */:
+ parser.index++;
+ parser.column++;
+ return 17825809 /* Semicolon */;
+ // `?`
+ case 63 /* QuestionMark */:
+ parser.index++;
+ parser.column++;
+ return 22 /* QuestionMark */;
+ // `]`
+ case 93 /* RightBracket */:
+ parser.index++;
+ parser.column++;
+ return 20 /* RightBracket */;
+ // `{`
+ case 123 /* LeftBrace */:
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ // `}`
+ case 125 /* RightBrace */:
+ parser.index++;
+ parser.column++;
+ return 17825807 /* RightBrace */;
+ // `~`
+ case 126 /* Tilde */:
+ parser.index++;
+ parser.column++;
+ return 301989934 /* Complement */;
+ // `[`
+ case 91 /* LeftBracket */:
+ parser.index++;
+ parser.column++;
+ return 41943059 /* LeftBracket */;
+ // `@`
+ case 64 /* At */:
+ parser.index++;
+ parser.column++;
+ return 120 /* At */;
+ // `/`, `/=`, `/>`
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774773 /* Divide */;
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipSingleLineComment(parser, context, state, 'SingleLine');
+ continue;
+ }
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipMultiLineComment(parser, context, state);
+ continue;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 100663333 /* DivideAssign */;
+ }
+ default:
+ return 167774773 /* Divide */;
+ }
+ }
+ // `-`, `--`, `-=`
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++; // skip `-`
+ const next = parser.source.charCodeAt(parser.index);
+ switch (next) {
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++;
+ if ((state & exports.ScannerState.NewLine || lineStart) &&
+ consumeOpt(parser, 62 /* GreaterThan */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLClose');
+ continue;
+ }
+ return 570425372 /* Decrement */;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 67108899 /* SubtractAssign */;
+ }
+ default:
+ return 436209968 /* Subtract */;
+ }
+ }
+ // `<`, `<=`, `<<`, `<<=`, `</`, <!--
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++; // skip `<`
+ if (consumeOpt(parser, 33 /* Exclamation */) &&
+ consumeOpt(parser, 45 /* Hyphen */) &&
+ consumeOpt(parser, 45 /* Hyphen */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLOpen');
+ continue;
+ }
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 61 /* EqualSign */) ?
+ 67108894 /* ShiftLeftAssign */ :
+ 167774273 /* ShiftLeft */;
+ case 61 /* EqualSign */:
+ parser.index++;
+ parser.column++;
+ return 167774013 /* LessThanOrEqual */;
+ case 47 /* Slash */:
+ {
+ if (!(context & exports.Context.OptionsJSX))
+ break;
+ const index = parser.index + 1;
+ // Check that it's not a comment start.
+ if (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 42 /* Asterisk */ || next === 47 /* Slash */)
+ break;
+ }
+ parser.index++;
+ parser.column++;
+ return 25 /* JSXClose */;
+ }
+ default: // ignore
+ return 167774015 /* LessThan */;
+ }
+ // `!`, `!=`, `!==`
+ case 33 /* Exclamation */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 301989933 /* Negate */;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773756 /* LooseNotEqual */;
+ return 167773754 /* StrictNotEqual */;
+ // `'string'`, `"string"`
+ case 39 /* SingleQuote */:
+ case 34 /* DoubleQuote */:
+ return scanString(parser, context, first);
+ // `%`, `%=`
+ case 37 /* Percent */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167774772 /* Modulo */;
+ return 67108902 /* ModuloAssign */;
+ // `&`, `&&`, `&=`
+ case 38 /* Ampersand */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 38 /* Ampersand */) {
+ parser.index++;
+ parser.column++;
+ return 169869879 /* LogicalAnd */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108905 /* BitwiseAndAssign */;
+ }
+ return 167773508 /* BitwiseAnd */;
+ }
+ // `*`, `**`, `*=`, `**=`
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774771 /* Multiply */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108900 /* MultiplyAssign */;
+ }
+ if (next !== 42 /* Asterisk */)
+ return 167774771 /* Multiply */;
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167775030 /* Exponentiate */;
+ return 67108897 /* ExponentiateAssign */;
+ }
+ // `+`, `++`, `+=`
+ case 43 /* Plus */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 436209967 /* Add */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */) {
+ parser.index++;
+ parser.column++;
+ return 570425371 /* Increment */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108898 /* AddAssign */;
+ }
+ return 436209967 /* Add */;
+ }
+ // `\\u{N}var`
+ case 92 /* Backslash */:
+ return scanIdentifier(parser, context);
+ // `=`, `==`, `===`, `=>`
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 167773753 /* StrictEqual */;
+ }
+ else {
+ return 167773755 /* LooseEqual */;
+ }
+ }
+ else if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ return 10 /* Arrow */;
+ }
+ return 83886109 /* Assign */;
+ }
+ // `>`, `>=`, `>>`, `>>>`, `>>=`, `>>>=`
+ case 62 /* GreaterThan */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774016 /* GreaterThan */;
+ if (context & exports.Context.InJSXChild)
+ return 167774016 /* GreaterThan */;
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 167774014 /* GreaterThanOrEqual */;
+ }
+ if (next !== 62 /* GreaterThan */)
+ return 167774016 /* GreaterThan */;
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 67108896 /* LogicalShiftRightAssign */;
+ }
+ else {
+ return 167774275 /* LogicalShiftRight */;
+ }
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108895 /* ShiftRightAssign */;
+ }
+ return 167774274 /* ShiftRight */;
+ }
+ // `^`, `^=`
+ case 94 /* Caret */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773254 /* BitwiseXor */;
+ return 67108903 /* BitwiseXorAssign */;
+ // ``string``
+ case 96 /* Backtick */:
+ return scanTemplate(parser, context);
+ // `|`, `||`, `|=`
+ case 124 /* VerticalBar */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 124 /* VerticalBar */) {
+ parser.index++;
+ parser.column++;
+ return 169869624 /* LogicalOr */;
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108904 /* BitwiseOrAssign */;
+ }
+ return 167772997 /* BitwiseOr */;
+ }
+ // `.`, `...`, `.123` (numeric literal)
+ case 46 /* Period */:
+ {
+ let index = parser.index + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 57 /* Nine */) {
+ scanNumericLiteral(parser, context, exports.NumericState.Float);
+ return 33554434 /* NumericLiteral */;
+ }
+ else if (next === 46 /* Period */) {
+ index++;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 46 /* Period */) {
+ parser.index = index + 1;
+ parser.column += 3;
+ return 14 /* Ellipsis */;
+ }
+ }
+ parser.index++;
+ parser.column++;
+ return 16777229 /* Period */;
+ }
+ // `#`
+ case 35 /* Hash */:
+ {
+ parser.index++;
+ parser.column++;
+ const index = parser.index;
+ const next = parser.source.charCodeAt(index);
+ if (context & exports.Context.OptionsShebang &&
+ lineStart &&
+ next === 33 /* Exclamation */) {
+ parser.index = index + 1;
+ skipSingleLineComment(parser, context, exports.ScannerState.None, 'SheBang');
+ continue;
+ }
+ return scanPrivateName(parser, context);
+ }
+ // `0`...`9`
+ case 48 /* Zero */:
+ {
+ parser.index++;
+ parser.column++;
+ switch (parser.source.charCodeAt(parser.index)) {
+ // Hex number - '0x', '0X'
+ case 88 /* UpperX */:
+ case 120 /* LowerX */:
+ return scanHexIntegerLiteral(parser, context);
+ // Binary number - '0b', '0B'
+ case 66 /* UpperB */:
+ case 98 /* LowerB */:
+ return scanOctalOrBinary(parser, context, 2);
+ // Octal number - '0o', '0O'
+ case 79 /* UpperO */:
+ case 111 /* LowerO */:
+ return scanOctalOrBinary(parser, context, 8);
+ default:
+ // Implicit octal digits startign with '0'
+ return scanImplicitOctalDigits(parser, context);
+ }
+ }
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return scanNumericLiteral(parser, context);
+ // `a`...`z`, `A`...`Z`, `_var`, `$var`
+ case 65 /* UpperA */:
+ case 66 /* UpperB */:
+ case 67 /* UpperC */:
+ case 68 /* UpperD */:
+ case 69 /* UpperE */:
+ case 70 /* UpperF */:
+ case 71 /* UpperG */:
+ case 72 /* UpperH */:
+ case 73 /* UpperI */:
+ case 74 /* UpperJ */:
+ case 75 /* UpperK */:
+ case 76 /* UpperL */:
+ case 77 /* UpperM */:
+ case 78 /* UpperN */:
+ case 79 /* UpperO */:
+ case 80 /* UpperP */:
+ case 81 /* UpperQ */:
+ case 82 /* UpperR */:
+ case 83 /* UpperS */:
+ case 84 /* UpperT */:
+ case 85 /* UpperU */:
+ case 86 /* UpperV */:
+ case 87 /* UpperW */:
+ case 88 /* UpperX */:
+ case 89 /* UpperY */:
+ case 90 /* UpperZ */:
+ case 36 /* Dollar */:
+ case 95 /* Underscore */:
+ case 97 /* LowerA */:
+ case 98 /* LowerB */:
+ case 99 /* LowerC */:
+ case 100 /* LowerD */:
+ case 101 /* LowerE */:
+ case 102 /* LowerF */:
+ case 103 /* LowerG */:
+ case 104 /* LowerH */:
+ case 105 /* LowerI */:
+ case 106 /* LowerJ */:
+ case 107 /* LowerK */:
+ case 108 /* LowerL */:
+ case 109 /* LowerM */:
+ case 110 /* LowerN */:
+ case 111 /* LowerO */:
+ case 112 /* LowerP */:
+ case 113 /* LowerQ */:
+ case 114 /* LowerR */:
+ case 115 /* LowerS */:
+ case 116 /* LowerT */:
+ case 117 /* LowerU */:
+ case 118 /* LowerV */:
+ case 119 /* LowerW */:
+ case 120 /* LowerX */:
+ case 121 /* LowerY */:
+ case 122 /* LowerZ */:
+ default:
+ return scanIdentifier(parser, context, first);
+ }
+ }
+ }
+ return 1048576 /* EndOfSource */;
+ } + + /**
+ * Scans regular expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanRegularExpression(parser, context) {
+ const bodyStart = parser.index;
+ let preparseState = exports.RegexState.Empty;
+ loop: while (true) {
+ const ch = parser.source.charCodeAt(parser.index);
+ parser.index++;
+ parser.column++;
+ if (preparseState & exports.RegexState.Escape) {
+ preparseState &= ~exports.RegexState.Escape;
+ }
+ else {
+ switch (ch) {
+ case 47 /* Slash */:
+ if (!preparseState)
+ break loop;
+ else
+ break;
+ case 92 /* Backslash */:
+ preparseState |= exports.RegexState.Escape;
+ break;
+ case 91 /* LeftBracket */:
+ preparseState |= exports.RegexState.Class;
+ break;
+ case 93 /* RightBracket */:
+ preparseState &= exports.RegexState.Escape;
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ report(parser, 7 /* UnterminatedRegExp */);
+ default: // ignore
+ }
+ }
+ if (parser.index >= parser.source.length) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ const bodyEnd = parser.index - 1;
+ let mask = exports.RegexFlags.Empty;
+ const { index: flagStart } = parser;
+ loop: while (parser.index < parser.source.length) {
+ const code = parser.source.charCodeAt(parser.index);
+ switch (code) {
+ case 103 /* LowerG */:
+ if (mask & exports.RegexFlags.Global)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'g');
+ mask |= exports.RegexFlags.Global;
+ break;
+ case 105 /* LowerI */:
+ if (mask & exports.RegexFlags.IgnoreCase)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'i');
+ mask |= exports.RegexFlags.IgnoreCase;
+ break;
+ case 109 /* LowerM */:
+ if (mask & exports.RegexFlags.Multiline)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'm');
+ mask |= exports.RegexFlags.Multiline;
+ break;
+ case 117 /* LowerU */:
+ if (mask & exports.RegexFlags.Unicode)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'u');
+ mask |= exports.RegexFlags.Unicode;
+ break;
+ case 121 /* LowerY */:
+ if (mask & exports.RegexFlags.Sticky)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'y');
+ mask |= exports.RegexFlags.Sticky;
+ break;
+ case 115 /* LowerS */:
+ if (mask & exports.RegexFlags.DotAll)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 's');
+ mask |= exports.RegexFlags.DotAll;
+ break;
+ default:
+ if (!isIdentifierPart(code))
+ break loop;
+ report(parser, 16 /* UnexpectedTokenRegExpFlag */, fromCodePoint(code));
+ }
+ parser.index++;
+ parser.column++;
+ }
+ const flags = parser.source.slice(flagStart, parser.index);
+ const pattern = parser.source.slice(bodyStart, bodyEnd);
+ parser.tokenRegExp = { pattern, flags };
+ if (context & exports.Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ parser.tokenValue = validate(parser, context, pattern, flags);
+ return 33554436 /* RegularExpression */;
+ }
+ /**
+ * Validates regular expressions
+ *
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param pattern Regexp body
+ * @param flags Regexp flags
+ */
+ function validate(parser, context, pattern, flags) {
+ if (!(context & exports.Context.OptionsNode)) {
+ try {
+ }
+ catch (e) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ try {
+ return new RegExp(pattern, flags);
+ }
+ catch (e) {
+ return null;
+ }
+ } + + // 12.15.5 Destructuring Assignment
+ /**
+ * Parses either a binding identifier or binding pattern
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBindingIdentifierOrPattern(parser, context, args = []) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ return token === 41943052 /* LeftBrace */ ?
+ parserObjectAssignmentPattern(parser, context) :
+ parseArrayAssignmentPattern(parser, context, args);
+ }
+ else if (token & (262144 /* IsAwait */ | 1073741824 /* IsYield */)) {
+ if (token & 262144 /* IsAwait */ && (context & (exports.Context.Async | exports.Context.Module))) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ else if (token & 1073741824 /* IsYield */ && (context & (exports.Context.Yield | exports.Context.Strict))) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ }
+ args.push(parser.tokenValue);
+ return parseBindingIdentifier(parser, context);
+ }
+ /**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BindingIdentifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBindingIdentifier(parser, context) {
+ const { token } = parser;
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ else if (context & exports.Context.BlockScope && token === 33574984 /* LetKeyword */) {
+ // let is disallowed as a lexically bound name
+ tolerant(parser, context, 27 /* LetInLexicalBinding */);
+ }
+ else if (hasBit(token, 20480 /* FutureReserved */)) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ parser.flags |= exports.Flags.StrictFunctionName;
+ }
+ else if (!isValidIdentifier(context, token)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ }
+ /**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAssignmentRestElement(parser, context, args) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+ }
+ /**
+ * Parse rest property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ // tslint:disable-next-line:function-name
+ function AssignmentRestProperty(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const { token } = parser;
+ const argument = parseBindingIdentifierOrPattern(parser, context);
+ if (hasBit(token, 8388608 /* IsBindingPattern */))
+ tolerant(parser, context, 94 /* InvalidRestBindingPattern */);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+ }
+ /**
+ * ArrayAssignmentPattern[Yield] :
+ * [ Elisionopt AssignmentRestElement[?Yield]opt ]
+ * [ AssignmentElementList[?Yield] ]
+ * [ AssignmentElementList[?Yield] , Elisionopt AssignmentRestElement[?Yield]opt ]
+ *
+ * AssignmentRestElement[Yield] :
+ * ... DestructuringAssignmentTarget[?Yield]
+ *
+ * AssignmentElementList[Yield] :
+ * AssignmentElisionElement[?Yield]
+ * AssignmentElementList[?Yield] , AssignmentElisionElement[?Yield]
+ *
+ * AssignmentElisionElement[Yield] :
+ * Elisionopt AssignmentElement[?Yield]
+ *
+ * AssignmentElement[Yield] :
+ * DestructuringAssignmentTarget[?Yield] Initializer[In,?Yield]opt
+ *
+ * DestructuringAssignmentTarget[Yield] :
+ * LeftHandSideExpression[?Yield]
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param Parser object
+ * @param Context masks
+ */
+ function parseArrayAssignmentPattern(parser, context, args) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else {
+ if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseAssignmentRestElement(parser, context, args));
+ break;
+ }
+ else {
+ elements.push(parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseBindingInitializer));
+ }
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ // tslint:disable-next-line:no-object-literal-type-assertion
+ return finishNode(context, parser, pos, {
+ type: 'ArrayPattern',
+ elements,
+ });
+ }
+ /**
+ * Parse object assignment pattern
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parserObjectAssignmentPattern(parser, context) {
+ const pos = getLocation(parser);
+ const properties = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ properties.push(AssignmentRestProperty(parser, context));
+ break;
+ }
+ properties.push(parseAssignmentProperty(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ObjectPattern',
+ properties,
+ });
+ }
+ /** Parse assignment pattern
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param left LHS of assignment pattern
+ * @param pos Location
+ */
+ function parseAssignmentPattern(parser, context, left, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression),
+ });
+ }
+ /**
+ * Parse binding initializer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBindingInitializer(parser, context) {
+ const pos = getLocation(parser);
+ const left = parseBindingIdentifierOrPattern(parser, context);
+ return !consume(parser, context, 83886109 /* Assign */) ?
+ left :
+ finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseAssignmentExpression(parser, context | exports.Context.AllowIn),
+ });
+ }
+ /**
+ * Parse assignment property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAssignmentProperty(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ let key;
+ let value;
+ let computed = false;
+ let shorthand = false;
+ // single name binding
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ key = parseIdentifier(parser, context);
+ shorthand = !consume(parser, context, 16777237 /* Colon */);
+ if (shorthand) {
+ const hasInitializer = consume(parser, context, 83886109 /* Assign */);
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (!isValidIdentifier(context, token))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ value = hasInitializer ? parseAssignmentPattern(parser, context, key, pos) : key;
+ }
+ else
+ value = parseBindingInitializer(parser, context);
+ }
+ else {
+ computed = token === 41943059 /* LeftBracket */;
+ key = parsePropertyName(parser, context);
+ expect(parser, context, 16777237 /* Colon */);
+ value = parseExpressionCoverGrammar(parser, context, parseBindingInitializer);
+ }
+ // Note! The specs specifically state that this is "assignment property", but
+ // nothing in ESTree specs explains the difference between this "property" and the "property" for object literals.
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ kind: 'init',
+ key,
+ computed,
+ value,
+ method: false,
+ shorthand,
+ });
+ } + + // JSX Specification
+ // https://facebook.github.io/jsx/
+ /**
+ * Parses JSX element or JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXRootElement(parser, context) {
+ const pos = getLocation(parser);
+ let children = [];
+ let closingElement = null;
+ let selfClosing = false;
+ let openingElement;
+ expect(parser, context, 167774015 /* LessThan */);
+ const isFragment = parser.token === 167774016 /* GreaterThan */;
+ if (isFragment) {
+ openingElement = parseJSXOpeningFragment(parser, context, pos);
+ }
+ else {
+ const name = parseJSXElementName(parser, context);
+ const attributes = parseJSXAttributes(parser, context);
+ selfClosing = consume(parser, context, 167774773 /* Divide */);
+ openingElement = parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos);
+ }
+ if (isFragment)
+ return parseJSXFragment(parser, context, openingElement, pos);
+ if (!selfClosing) {
+ children = parseJSXChildren(parser, context);
+ closingElement = parseJSXClosingElement(parser, context);
+ const open = isEqualTagNames(openingElement.name);
+ const close = isEqualTagNames(closingElement.name);
+ if (open !== close)
+ report(parser, 85 /* ExpectedJSXClosingTag */, close);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'JSXElement',
+ children,
+ openingElement,
+ closingElement,
+ });
+ }
+ /**
+ * Parses JSX opening element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param name Element name
+ * @param attributes Element attributes
+ * @param selfClosing True if this is a selfclosing JSX Element
+ * @param pos Line / Column tracking
+ */
+ function parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos) {
+ if (context & exports.Context.InJSXChild && selfClosing)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningElement',
+ name,
+ attributes,
+ selfClosing,
+ });
+ }
+ /**
+ * Parse JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param openingElement Opening fragment
+ * @param pos Line / Column location
+ */
+ function parseJSXFragment(parser, context, openingElement, pos) {
+ const children = parseJSXChildren(parser, context);
+ const closingFragment = parseJSXClosingFragment(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXFragment',
+ children,
+ openingElement,
+ closingFragment,
+ });
+ }
+ /**
+ * Parse JSX opening fragmentD
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXOpeningFragment(parser, context, pos) {
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningFragment',
+ });
+ }
+ /**
+ * Prime the scanner and advance to the next JSX token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextJSXToken(parser) {
+ return parser.token = scanJSXToken(parser);
+ }
+ /**
+ * Mini scanner
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanJSXToken(parser) {
+ if (parser.index >= parser.source.length)
+ return 1048576 /* EndOfSource */;
+ parser.lastIndex = parser.startIndex = parser.index;
+ const char = parser.source.charCodeAt(parser.index);
+ if (char === 60 /* LessThan */) {
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 47 /* Slash */) ? 25 /* JSXClose */ : 167774015 /* LessThan */;
+ }
+ else if (char === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ }
+ while (parser.index < parser.source.length) {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 123 /* LeftBrace */ || next === 60 /* LessThan */)
+ break;
+ }
+ return 121 /* JSXText */;
+ }
+ /**
+ * Parses JSX children
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXChildren(parser, context) {
+ const children = [];
+ while (parser.token !== 25 /* JSXClose */) {
+ children.push(parseJSXChild(parser, context));
+ }
+ return children;
+ }
+ /**
+ * Parses JSX Text
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXText(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.source.slice(parser.startIndex, parser.index);
+ parser.token = scanJSXToken(parser);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXText',
+ value,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = value;
+ return node;
+ }
+ /**
+ * Parses JSX Child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXChild(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ case 121 /* JSXText */:
+ return parseJSXText(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpression(parser, context & ~exports.Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context & ~exports.Context.InJSXChild);
+ default:
+ report(parser, 0 /* Unexpected */);
+ }
+ return undefined; // note: get rid of this
+ }
+ /**
+ * Parses JSX attributes
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttributes(parser, context) {
+ const attributes = [];
+ while (parser.index < parser.source.length) {
+ if (parser.token === 167774773 /* Divide */ || parser.token === 167774016 /* GreaterThan */)
+ break;
+ attributes.push(parseJSXAttribute(parser, context));
+ }
+ return attributes;
+ }
+ /**
+ * Parses JSX spread attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXSpreadAttribute(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~exports.Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadAttribute',
+ argument: expression,
+ });
+ }
+ /**
+ * Parses JSX namespace name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param namespace Identifier
+ * @param pos Line / Column location
+ */
+ function parseJSXNamespacedName(parser, context, namespace, pos) {
+ expect(parser, context, 16777237 /* Colon */);
+ const name = parseJSXIdentifier(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXNamespacedName',
+ namespace,
+ name,
+ });
+ }
+ /**
+ * Parses JSX attribute name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttributeName(parser, context) {
+ const pos = getLocation(parser);
+ const identifier = parseJSXIdentifier(parser, context);
+ return parser.token === 16777237 /* Colon */ ?
+ parseJSXNamespacedName(parser, context, identifier, pos) :
+ identifier;
+ }
+ /**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttributeValue(parser, context) {
+ switch (scanJSXAttributeValue(parser, context)) {
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpressionContainer(parser, context | exports.Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context | exports.Context.InJSXChild);
+ default:
+ tolerant(parser, context, 87 /* InvalidJSXAttributeValue */);
+ return undefined; // note: get rid of this
+ }
+ }
+ /**
+ * Parses JSX Attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttribute(parser, context) {
+ const pos = getLocation(parser);
+ if (parser.token === 41943052 /* LeftBrace */)
+ return parseJSXSpreadAttribute(parser, context);
+ scanJSXIdentifier(parser);
+ const attrName = parseJSXAttributeName(parser, context);
+ const value = parser.token === 83886109 /* Assign */ ? parseJSXAttributeValue(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'JSXAttribute',
+ value: value,
+ name: attrName,
+ });
+ }
+ /**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanJSXAttributeValue(parser, context) {
+ parser.lastIndex = parser.index;
+ const ch = parser.source.charCodeAt(parser.index);
+ switch (ch) {
+ case 34 /* DoubleQuote */:
+ case 39 /* SingleQuote */:
+ return scanJSXString(parser, context, ch);
+ default:
+ return nextToken(parser, context);
+ }
+ }
+ /**
+ * Parses JSX String
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote Code point
+ */
+ function scanJSXString(parser, context, quote) {
+ const rawStart = parser.index;
+ parser.index++;
+ parser.column++;
+ let ret = '';
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ ret += fromCodePoint(ch);
+ parser.index++;
+ parser.column++;
+ ch = parser.source.charCodeAt(parser.index);
+ if (parser.index >= parser.source.length)
+ report(parser, 6 /* UnterminatedString */);
+ }
+ parser.index++;
+ parser.column++; // skip the quote
+ // raw
+ if (context & exports.Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(rawStart, parser.index);
+ parser.tokenValue = ret;
+ return 33554435 /* StringLiteral */;
+ }
+ /**
+ * Parses JJSX Empty Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXEmptyExpression(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXEmptyExpression',
+ });
+ }
+ /**
+ * Parses JSX Spread child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXSpreadChild(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpression(parser, context);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadChild',
+ expression,
+ });
+ }
+ /**
+ * Parses JSX Expression container
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXExpressionContainer(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ // Note: JSX Expressions can't be empty
+ if (parser.token === 17825807 /* RightBrace */)
+ tolerant(parser, context, 84 /* NonEmptyJSXExpression */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~exports.Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+ }
+ /**
+ * Parses JSX Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ if (parser.token === 14 /* Ellipsis */)
+ return parseJSXSpreadChild(parser, context);
+ const expression = parser.token === 17825807 /* RightBrace */ ?
+ parseJSXEmptyExpression(parser, context) :
+ parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+ }
+ /**
+ * Parses JSX Closing fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXClosingFragment(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ expect(parser, context, 167774016 /* GreaterThan */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingFragment',
+ });
+ }
+ /**
+ * Parses JSX Closing Element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXClosingElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ const name = parseJSXElementName(parser, context);
+ if (context & exports.Context.InJSXChild)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingElement',
+ name,
+ });
+ }
+ /**
+ * Parses JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXIdentifier(parser, context) {
+ const { token, tokenValue: name, tokenRaw: raw } = parser;
+ if (!(token & (131072 /* IsIdentifier */ | 4096 /* Keyword */))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXIdentifier',
+ name,
+ });
+ if (context & exports.Context.OptionsRawidentifiers)
+ node.raw = raw;
+ return node;
+ }
+ /**
+ * Parses JSX Member expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXMemberExpression(parser, context, expr, pos) {
+ // Note: In order to be able to parse cases like ''<A.B.C.D.E.foo-bar />', where the dash is located at the
+ // end, we must rescan for the JSX Identifier now. This because JSX identifiers differ from normal identifiers
+ scanJSXIdentifier(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXMemberExpression',
+ object: expr,
+ property: parseJSXIdentifier(parser, context),
+ });
+ }
+ /**
+ * Parses JSX Element name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXElementName(parser, context) {
+ const pos = getLocation(parser);
+ scanJSXIdentifier(parser);
+ let elementName = parseJSXIdentifier(parser, context);
+ if (parser.token === 16777237 /* Colon */)
+ return parseJSXNamespacedName(parser, context, elementName, pos);
+ while (consume(parser, context, 16777229 /* Period */)) {
+ elementName = parseJSXMemberExpression(parser, context, elementName, pos);
+ }
+ return elementName;
+ }
+ /**
+ * Scans JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanJSXIdentifier(parser) {
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const firstCharPosition = parser.index;
+ let ch = parser.source.charCodeAt(parser.index);
+ while ((parser.index < parser.source.length) && (ch === 45 /* Hyphen */ || (isValidIdentifierPart(ch)))) {
+ ch = readNext(parser);
+ }
+ parser.tokenValue += parser.source.substr(firstCharPosition, parser.index - firstCharPosition);
+ }
+ return parser.token;
+ } + + /**
+ * Expression :
+ * AssignmentExpression
+ * Expression , AssignmentExpression
+ *
+ * ExpressionNoIn :
+ * AssignmentExpressionNoIn
+ * ExpressionNoIn , AssignmentExpressionNoIn
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Expression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExpression(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ return parser.token === 16777234 /* Comma */ ?
+ parseSequenceExpression(parser, context, expr, pos) :
+ expr;
+ }
+ /**
+ * Parse secuence expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSequenceExpression(parser, context, left, pos) {
+ const expressions = [left];
+ while (consume(parser, context, 16777234 /* Comma */)) {
+ expressions.push(parseExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ /**
+ * Parse yield expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-YieldExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseYieldExpression(parser, context, pos) {
+ // YieldExpression[In] :
+ // yield
+ // yield [no LineTerminator here] AssignmentExpression[?In, Yield]
+ // yield [no LineTerminator here] * AssignmentExpression[?In, Yield]
+ // https://tc39.github.io/ecma262/#sec-generator-function-definitions-static-semantics-early-errors
+ if (context & exports.Context.InParameter)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ expect(parser, context, 1107316842 /* YieldKeyword */);
+ let argument = null;
+ let delegate = false;
+ if (!(parser.flags & exports.Flags.NewLine)) {
+ delegate = consume(parser, context, 167774771 /* Multiply */);
+ // 'Token.IsExpressionStart' bitmask contains the complete set of
+ // tokens that can appear after an AssignmentExpression, and none of them
+ // can start an AssignmentExpression.
+ if (delegate || parser.token & 33554432 /* IsExpressionStart */) {
+ argument = parseAssignmentExpression(parser, context);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'YieldExpression',
+ argument,
+ delegate,
+ });
+ }
+ /**
+ * AssignmentExpression :
+ * ConditionalExpression
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpression
+ * LeftHandSideExpression AssignmentOperator AssignmentExpression
+ *
+ * AssignmentExpressionNoIn :
+ * ConditionalExpressionNoIn
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpressionNoIn
+ * LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAssignmentExpression(parser, context) {
+ const pos = getLocation(parser);
+ let { token } = parser;
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ return parseYieldExpression(parser, context, pos);
+ let expr = token & 524288 /* IsAsync */ && lookahead(parser, context, nextTokenisIdentifierOrParen)
+ ? parserCoverCallExpressionAndAsyncArrowHead(parser, context)
+ : parseConditionalExpression(parser, context, pos);
+ if (parser.token === 10 /* Arrow */) {
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & (20480 /* FutureReserved */ | 4194304 /* IsEvalOrArguments */)) {
+ // Invalid: ' yield => { 'use strict'; 0 };'
+ if (token & 20480 /* FutureReserved */) {
+ parser.flags |= exports.Flags.HasStrictReserved;
+ }
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ }
+ expr = [expr];
+ }
+ return parseArrowFunction(parser, context &= ~exports.Context.Async, pos, expr);
+ }
+ if (hasBit(parser.token, 67108864 /* IsAssignOp */)) {
+ token = parser.token;
+ if (context & exports.Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ }
+ else if (consume(parser, context, 83886109 /* Assign */)) {
+ if (!(parser.flags & exports.Flags.AllowDestructuring)) {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ // Only re-interpret if not inside a formal parameter list
+ if (!(context & exports.Context.InParameter))
+ reinterpret(parser, context, expr);
+ if (context & exports.Context.InParen)
+ parser.flags |= exports.Flags.SimpleParameterList;
+ if (parser.token & 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasAwait;
+ }
+ else if (context & exports.Context.InParen &&
+ context & (exports.Context.Strict | exports.Context.Yield) &&
+ parser.token & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasYield;
+ }
+ }
+ else {
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ nextToken(parser, context);
+ }
+ const right = parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ parser.pendingExpressionError = null;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentExpression',
+ left: expr,
+ operator: tokenDesc(token),
+ right,
+ });
+ }
+ return expr;
+ }
+ /**
+ * Parse conditional expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ConditionalExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseConditionalExpression(parser, context, pos) {
+ const test = parseBinaryExpression(parser, context, 0, pos);
+ if (!consume(parser, context, 22 /* QuestionMark */))
+ return test;
+ const consequent = parseExpressionCoverGrammar(parser, context & ~exports.Context.AllowDecorator | exports.Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16777237 /* Colon */);
+ return finishNode(context, parser, pos, {
+ type: 'ConditionalExpression',
+ test,
+ consequent,
+ alternate: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+ }
+ /**
+ * Parse binary expression.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-exp-operator)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-additive-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-bitwise-shift-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-equality-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-relational-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-multiplicative-operators)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param minPrec Minimum precedence value
+ * @param pos Line / Column info
+ * @param Left Left hand side of the binary expression
+ */
+ function parseBinaryExpression(parser, context, minPrec, pos, left = parseUnaryExpression(parser, context)) {
+ // Shift-reduce parser for the binary operator part of the JS expression
+ // syntax.
+ const bit = context & exports.Context.AllowIn ^ exports.Context.AllowIn;
+ while (hasBit(parser.token, 167772160 /* IsBinaryOp */)) {
+ const t = parser.token;
+ const prec = t & 3840 /* Precedence */;
+ const delta = (t === 167775030 /* Exponentiate */) << 8 /* PrecStart */;
+ if (bit && t === 167786289 /* InKeyword */)
+ break;
+ // When the next token is no longer a binary operator, it's potentially the
+ // start of an expression, so we break the loop
+ if (prec + delta <= minPrec)
+ break;
+ nextToken(parser, context);
+ left = finishNode(context, parser, pos, {
+ type: t & 2097152 /* IsLogical */ ? 'LogicalExpression' : 'BinaryExpression',
+ left,
+ right: parseBinaryExpression(parser, context & ~exports.Context.AllowIn, prec, getLocation(parser)),
+ operator: tokenDesc(t),
+ });
+ }
+ return left;
+ }
+ /**
+ * Parse await expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AwaitExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ */
+ function parseAwaitExpression(parser, context, pos) {
+ if (context & exports.Context.InParameter)
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ expect(parser, context, 34017389 /* AwaitKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'AwaitExpression',
+ argument: parseUnaryExpression(parser, context),
+ });
+ }
+ /**
+ * Parses unary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UnaryExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseUnaryExpression(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ if (hasBit(token, 301989888 /* IsUnaryOp */)) {
+ nextToken(parser, context);
+ if (parser.flags & exports.Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ const argument = parseExpressionCoverGrammar(parser, context, parseUnaryExpression);
+ if (parser.token === 167775030 /* Exponentiate */) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & exports.Context.Strict && token === 302002219 /* DeleteKeyword */) {
+ if (argument.type === 'Identifier') {
+ tolerant(parser, context, 43 /* StrictDelete */);
+ }
+ else if (isPropertyWithPrivateFieldKey(argument)) {
+ tolerant(parser, context, 44 /* DeletePrivateField */);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'UnaryExpression',
+ operator: tokenDesc(token),
+ argument,
+ prefix: true,
+ });
+ }
+ return context & exports.Context.Async && token & 262144 /* IsAwait */
+ ? parseAwaitExpression(parser, context, pos)
+ : parseUpdateExpression(parser, context, pos);
+ }
+ /**
+ * Parses update expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UpdateExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseUpdateExpression(parser, context, pos) {
+ const { token } = parser;
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */)) {
+ nextToken(parser, context);
+ const expr = parseLeftHandSideExpression(parser, context, pos);
+ validateUpdateExpression(parser, context, expr, 'Prefix');
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expr,
+ operator: tokenDesc(token),
+ prefix: true,
+ });
+ }
+ else if (context & exports.Context.OptionsJSX && token === 167774015 /* LessThan */) {
+ return parseJSXRootElement(parser, context | exports.Context.InJSXChild);
+ }
+ const expression = parseLeftHandSideExpression(parser, context, pos);
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */) && !(parser.flags & exports.Flags.NewLine)) {
+ validateUpdateExpression(parser, context, expression, 'Postfix');
+ const operator = parser.token;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expression,
+ operator: tokenDesc(operator),
+ prefix: false,
+ });
+ }
+ return expression;
+ }
+ /**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseRestElement(parser, context, args = []) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (context & exports.Context.InParen && parser.token & 262144 /* IsAwait */)
+ parser.flags |= exports.Flags.HasAwait;
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+ }
+ /**
+ * Parse spread element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SpreadElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSpreadElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+ }
+ /**
+ * Parse left hand side expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LeftHandSideExpression)
+ *
+ * @param Parser Parer instance
+ * @param Context Contextmasks
+ * @param pos Location info
+ */
+ function parseLeftHandSideExpression(parser, context, pos) {
+ const expr = context & exports.Context.OptionsNext && parser.token === 33566810 /* ImportKeyword */
+ ? parseCallImportOrMetaProperty(parser, context | exports.Context.AllowIn)
+ : parseMemberExpression(parser, context | exports.Context.AllowIn, pos);
+ return parseCallExpression(parser, context | exports.Context.AllowIn, pos, expr);
+ }
+ /**
+ * Parse member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ * @param expr Expression
+ */
+ function parseMemberExpression(parser, context, pos, expr = parsePrimaryExpression(parser, context)) {
+ while (true) {
+ switch (parser.token) {
+ case 16777229 /* Period */: {
+ consume(parser, context, 16777229 /* Period */);
+ parser.flags = parser.flags & ~exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ const property = parseIdentifierNameOrPrivateName(parser, context);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: false,
+ property,
+ });
+ continue;
+ }
+ case 41943059 /* LeftBracket */: {
+ consume(parser, context, 41943059 /* LeftBracket */);
+ parser.flags = parser.flags & ~exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ const property = parseExpression(parser, context);
+ expect(parser, context, 20 /* RightBracket */);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: true,
+ property,
+ });
+ continue;
+ }
+ case 33554441 /* TemplateTail */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplateLiteral(parser, context),
+ });
+ continue;
+ }
+ case 33554440 /* TemplateCont */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplate(parser, context | exports.Context.TaggedTemplate),
+ });
+ continue;
+ }
+ default:
+ return expr;
+ }
+ }
+ }
+ /**
+ * Parse call expression
+ *
+ * @param parser Parer instance
+ * @param context Context masks
+ * @param pos Line / Colum info
+ * @param expr Expression
+ */
+ function parseCallExpression(parser, context, pos, expr) {
+ while (true) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ if (parser.token !== 50331659 /* LeftParen */)
+ return expr;
+ const args = parseArgumentList(parser, context & ~exports.Context.AllowDecorator);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ }
+ /**
+ * Parse cover call expression and async arrow head
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CoverCallExpressionAndAsyncArrowHead)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parserCoverCallExpressionAndAsyncArrowHead(parser, context) {
+ const pos = getLocation(parser);
+ let expr = parseMemberExpression(parser, context | exports.Context.AllowIn, pos);
+ // Here we jump right into it and parse a simple, faster sub-grammar for
+ // async arrow / async identifier + call expression. This could have been done different
+ // but ESTree sucks!
+ //
+ // - J.K. Thomas
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (parser.token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */);
+ return parseAsyncArrowFunction(parser, context, exports.ModifierState.Await, pos, [parseAndClassifyIdentifier(parser, context)]);
+ }
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ while (parser.token === 50331659 /* LeftParen */) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ const args = parseAsyncArgumentList(parser, context);
+ if (parser.token === 10 /* Arrow */) {
+ expr = parseAsyncArrowFunction(parser, context, exports.ModifierState.Await, pos, args);
+ break;
+ }
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ return expr;
+ }
+ /**
+ * Parse argument list
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parseArgumentList(parser, context) {
+ // ArgumentList :
+ // AssignmentOrSpreadExpression
+ // ArgumentList , AssignmentOrSpreadExpression
+ //
+ // AssignmentOrSpreadExpression :
+ // ... AssignmentExpression
+ // AssignmentExpression
+ expect(parser, context, 50331659 /* LeftParen */);
+ const expressions = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ expressions.push(parseSpreadElement(parser, context));
+ }
+ else {
+ if (context & exports.Context.Yield && hasBit(parser.token, 1073741824 /* IsYield */)) {
+ parser.flags |= exports.Flags.HasYield;
+ setPendingError(parser);
+ }
+ expressions.push(parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression));
+ }
+ if (parser.token !== 16 /* RightParen */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return expressions;
+ }
+ /**
+ * Parse argument list for async arrow / async call expression
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parseAsyncArgumentList(parser, context) {
+ // Here we are parsing an "extended" argument list tweaked to handle async arrows. This is
+ // done here to avoid overhead and possible performance loss if we only
+ // parse out a simple call expression - E.g 'async(foo, bar)' or 'async(foo, bar)()';
+ //
+ // - J.K. Thomas
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = [];
+ let { token } = parser;
+ let state = exports.CoverCallState.Empty;
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ args.push(parseSpreadElement(parser, context));
+ state = exports.CoverCallState.HasSpread;
+ }
+ else {
+ token = parser.token;
+ state = validateAsyncArgumentList(parser, context, state);
+ args.push(restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression));
+ }
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ if (state & exports.CoverCallState.HasSpread)
+ state = exports.CoverCallState.SeenSpread;
+ }
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & exports.CoverCallState.SeenSpread) {
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ }
+ else if (state & exports.CoverCallState.EvalOrArguments) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ else if (state & exports.CoverCallState.Yield) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ parser.flags |= exports.Flags.HasStrictReserved;
+ }
+ else if (parser.flags & exports.Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (state & exports.CoverCallState.Await || parser.flags & exports.Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ }
+ return args;
+ }
+ /**
+ * Parse primary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PrimaryExpression)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parsePrimaryExpression(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ return parseIdentifier(parser, context);
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionOrIdentifier(parser, context);
+ case 50331659 /* LeftParen */:
+ return parseParenthesizedExpression(parser, context | exports.Context.InParen);
+ case 41943059 /* LeftBracket */:
+ return restoreExpressionCoverGrammar(parser, context, parseArrayLiteral);
+ case 41943052 /* LeftBrace */:
+ return restoreExpressionCoverGrammar(parser, context, parseObjectLiteral);
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionExpression(parser, context);
+ case 33566727 /* NullKeyword */:
+ case 33566726 /* TrueKeyword */:
+ case 33566725 /* FalseKeyword */:
+ return parseNullOrTrueOrFalseLiteral(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassExpression(parser, context);
+ case 33566811 /* NewKeyword */:
+ return parseNewExpressionOrMetaProperty(parser, context);
+ case 33566813 /* SuperKeyword */:
+ return parseSuperProperty(parser, context);
+ case 33554551 /* BigIntLiteral */:
+ return parseBigIntLiteral(parser, context);
+ case 33566815 /* ThisKeyword */:
+ return parseThisExpression(parser, context);
+ case 115 /* Hash */:
+ return parseIdentifierNameOrPrivateName(parser, context);
+ case 167774773 /* Divide */:
+ case 100663333 /* DivideAssign */:
+ scanRegularExpression(parser, context);
+ return parseRegularExpressionLiteral(parser, context);
+ case 33554441 /* TemplateTail */:
+ return parseTemplateLiteral(parser, context);
+ case 33554440 /* TemplateCont */:
+ return parseTemplate(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetAsIdentifier(parser, context);
+ case 12369 /* DoKeyword */:
+ if (context & exports.Context.OptionsExperimental)
+ return parseDoExpression(parser, context);
+ default:
+ return parseAndClassifyIdentifier(parser, context);
+ }
+ }
+ /**
+ * Parse do expression (*experimental*)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDoExpression(parser, context) {
+ // AssignmentExpression ::
+ // do '{' StatementList '}'
+ const pos = getLocation(parser);
+ expect(parser, context, 12369 /* DoKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'DoExpression',
+ body: parseBlockStatement(parser, context)
+ });
+ }
+ /**
+ * Parse 'let' as identifier in 'sloppy mode', and throws
+ * in 'strict mode' / 'module code'. We also avoid a lookahead on the
+ * ASI restictions while checking this after parsing out the 'let' keyword
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+ function parseLetAsIdentifier(parser, context) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ if (parser.flags & exports.Flags.NewLine) {
+ if (parser.token === 41943059 /* LeftBracket */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, 'let');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ }
+ /**
+ * Parse either async function expression or identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+ function parseAsyncFunctionOrIdentifier(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) :
+ parseIdentifier(parser, context);
+ }
+ /**
+ * Parses identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIdentifier(parser, context) {
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context | exports.Context.TaggedTemplate);
+ const node = finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ if (context & exports.Context.OptionsRawidentifiers)
+ node.raw = parser.tokenRaw;
+ return node;
+ }
+ /**
+ * Parse regular expression literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseRegularExpressionLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenRegExp, tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ regex: tokenRegExp,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = tokenRaw;
+ return node;
+ }
+ /**
+ * Parses string and number literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StringLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.tokenValue;
+ if (context & exports.Context.Strict && parser.flags & exports.Flags.HasOctal) {
+ tolerant(parser, context, 61 /* StrictOctalLiteral */);
+ }
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+ }
+ /**
+ * Parses BigInt literal (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/proposal-bigint/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBigIntLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ bigint: tokenRaw,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+ }
+ /**
+ * Parses either null or boolean literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BooleanLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNullOrTrueOrFalseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const raw = tokenDesc(token);
+ if (parser.flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: token === 33566727 /* NullKeyword */ ? null : raw === 'true',
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = raw;
+ return node;
+ }
+ /**
+ * Parse this expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseThisExpression(parser, context) {
+ if (parser.flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ const pos = getLocation(parser);
+ nextToken(parser, context | exports.Context.DisallowEscapedKeyword);
+ return finishNode(context, parser, pos, {
+ type: 'ThisExpression',
+ });
+ }
+ /**
+ * Parse identifier name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-IdentifierName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t token
+ */
+ function parseIdentifierName(parser, context, t) {
+ if (!(t & (131072 /* IsIdentifier */ | 4096 /* Keyword */)))
+ tolerant(parser, context, 4 /* UnexpectedKeyword */, tokenDesc(t));
+ return parseIdentifier(parser, context);
+ }
+ /**
+ * Parse identifier name or private name (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIdentifierNameOrPrivateName(parser, context) {
+ if (!consume(parser, context, 115 /* Hash */))
+ return parseIdentifierName(parser, context, parser.token);
+ const { tokenValue } = parser;
+ const pos = getLocation(parser);
+ const name = tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+ }
+ /**
+ * Parse array literal
+ *
+ * ArrayLiteral :
+ * [ Elisionopt ]
+ * [ ElementList ]
+ * [ ElementList , Elisionopt ]
+ *
+ * ElementList :
+ * Elisionopt AssignmentExpression
+ * Elisionopt ... AssignmentExpression
+ * ElementList , Elisionopt AssignmentExpression
+ * ElementList , Elisionopt SpreadElement
+ *
+ * Elision :
+ * ,
+ * Elision ,
+ *
+ * SpreadElement :
+ * ... AssignmentExpression
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseArrayLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseSpreadElement(parser, context));
+ if (parser.token !== 20 /* RightBracket */) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ else {
+ elements.push(restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression));
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ return finishNode(context, parser, pos, {
+ type: 'ArrayExpression',
+ elements,
+ });
+ }
+ /**
+ * Parses cover parenthesized expression and arrow parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-parseCoverParenthesizedExpressionAndArrowParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseParenthesizedExpression(parser, context) {
+ expect(parser, context, 50331659 /* LeftParen */);
+ if (consume(parser, context, 16 /* RightParen */)) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ if (parser.token === 10 /* Arrow */)
+ return [];
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ const restExpr = [parseRestElement(parser, context)];
+ expect(parser, context, 16 /* RightParen */);
+ parser.flags = parser.flags & ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding) | exports.Flags.SimpleParameterList;
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return restExpr;
+ }
+ // Record the sequence position
+ const sequencepos = getLocation(parser);
+ let state = validateCoverParenthesizedExpression(parser, exports.CoverParenthesizedState.None);
+ let expr = restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ // Sequence expression
+ if (parser.token === 16777234 /* Comma */) {
+ state |= exports.CoverParenthesizedState.SequenceExpression;
+ const expressions = [expr];
+ while (consume(parser, context | exports.Context.DisallowEscapedKeyword, 16777234 /* Comma */)) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (!(parser.flags & exports.Flags.AllowBinding))
+ tolerant(parser, context, 77 /* NotBindable */);
+ parser.flags |= exports.Flags.SimpleParameterList;
+ const restElement = parseRestElement(parser, context);
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ expressions.push(restElement);
+ return expressions;
+ }
+ else if (consume(parser, context, 16 /* RightParen */)) {
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return expressions;
+ }
+ else {
+ state = validateCoverParenthesizedExpression(parser, state);
+ expressions.push(restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ }
+ expr = finishNode(context, parser, sequencepos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & exports.CoverParenthesizedState.HasEvalOrArguments) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ else if (state & exports.CoverParenthesizedState.HasReservedWords) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= exports.Flags.HasStrictReserved;
+ }
+ else if (!(parser.flags & exports.Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (parser.flags & exports.Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (context & exports.Context.Async && parser.flags & exports.Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ parser.flags &= ~(exports.Flags.AllowBinding | exports.Flags.HasAwait | exports.Flags.HasYield);
+ return (state & exports.CoverParenthesizedState.SequenceExpression ? expr.expressions : [expr]);
+ }
+ parser.flags &= ~(exports.Flags.HasAwait | exports.Flags.HasYield | exports.Flags.AllowBinding);
+ if (!isValidSimpleAssignmentTarget(expr))
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ return expr;
+ }
+ /**
+ * Parses function expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFunctionExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? exports.ModifierState.Generator : exports.ModifierState.None;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & exports.ModifierState.Generator) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(exports.Context.Method | exports.Context.AllowSuperProperty), isGenerator, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: false,
+ generator: !!(isGenerator & exports.ModifierState.Generator),
+ expression: false,
+ id,
+ });
+ }
+ /**
+ * Parses async function or async generator expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? exports.ModifierState.Generator : exports.ModifierState.None;
+ const isAwait = exports.ModifierState.Await;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict || isAwait & exports.ModifierState.Await)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictFunctionName;
+ }
+ if (token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & exports.ModifierState.Generator)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(exports.Context.Method | exports.Context.AllowSuperProperty), isGenerator | isAwait, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: true,
+ generator: !!(isGenerator & exports.ModifierState.Generator),
+ expression: false,
+ id,
+ });
+ }
+ /**
+ * Parse computed property names
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ComputedPropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseComputedPropertyName(parser, context) {
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const key = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ expect(parser, context, 20 /* RightBracket */);
+ return key;
+ }
+ /**
+ * Parse property name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePropertyName(parser, context) {
+ switch (parser.token) {
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943059 /* LeftBracket */:
+ return parseComputedPropertyName(parser, context);
+ default:
+ return parseIdentifier(parser, context);
+ }
+ }
+ /**
+ * Parse object spread properties
+ *
+ * @see [Link](https://tc39.github.io/proposal-object-rest-spread/#Spread)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSpreadProperties(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (parser.token & 8388608 /* IsBindingPattern */)
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ const argument = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+ }
+ /**
+ * Parses object literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ObjectLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseObjectLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const properties = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ properties.push(parser.token === 14 /* Ellipsis */ ?
+ parseSpreadProperties(parser, context) :
+ parsePropertyDefinition(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ parser.flags &= ~exports.Flags.HasProtoField;
+ return finishNode(context, parser, pos, {
+ type: 'ObjectExpression',
+ properties,
+ });
+ }
+ /**
+ * Parse property definition
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyDefinition)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePropertyDefinition(parser, context) {
+ const pos = getLocation(parser);
+ const flags = parser.flags;
+ let value;
+ let state = consume(parser, context, 167774771 /* Multiply */) ? exports.ObjectState.Generator | exports.ObjectState.Method : exports.ObjectState.Method;
+ const t = parser.token;
+ let key = parsePropertyName(parser, context);
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & exports.Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ else if (!(state & exports.ObjectState.Generator) && t & 524288 /* IsAsync */ && !(parser.flags & exports.Flags.NewLine)) {
+ state |= consume(parser, context, 167774771 /* Multiply */) ? exports.ObjectState.Generator | exports.ObjectState.Async : exports.ObjectState.Async;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69743 /* GetKeyword */) {
+ state = state & ~exports.ObjectState.Method | exports.ObjectState.Getter;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69744 /* SetKeyword */) {
+ state = state & ~exports.ObjectState.Method | exports.ObjectState.Setter;
+ key = parsePropertyName(parser, context);
+ }
+ if (state & (exports.ObjectState.Getter | exports.ObjectState.Setter)) {
+ if (state & exports.ObjectState.Generator)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ state &= ~exports.ObjectState.Method;
+ if (parser.token === 16777237 /* Colon */) {
+ if ((state & (exports.ObjectState.Async | exports.ObjectState.Generator))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ else if (t !== 41943059 /* LeftBracket */ && parser.tokenValue === '__proto__') {
+ if (parser.flags & exports.Flags.HasProtoField) {
+ // Record the error and put it on hold until we've determined
+ // whether or not we're destructuring
+ setPendingExpressionError(parser, 63 /* DuplicateProto */);
+ }
+ else
+ parser.flags |= exports.Flags.HasProtoField;
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ // Invalid: 'async ({a: await}) => 1'
+ if (parser.token & 262144 /* IsAwait */)
+ parser.flags |= exports.Flags.HasAwait;
+ value = restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ }
+ else {
+ if ((state & (exports.ObjectState.Generator | exports.ObjectState.Async)) || !isValidIdentifier(context, t)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(t));
+ }
+ else if (context & (exports.Context.Strict | exports.Context.Yield) && t & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasYield;
+ }
+ state |= exports.ObjectState.Shorthand;
+ if (parser.token === 83886109 /* Assign */) {
+ if (context & exports.Context.Strict && t & 4194304 /* IsEvalOrArguments */) {
+ report(parser, 47 /* StrictEvalArguments */);
+ }
+ else
+ setPendingExpressionError(parser, 91 /* InvalidCoverInitializedName */);
+ expect(parser, context, 83886109 /* Assign */);
+ if (context & (exports.Context.Strict | exports.Context.Yield | exports.Context.Async) && parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */)) {
+ setPendingError(parser);
+ parser.flags |= parser.token & 1073741824 /* IsYield */ ? exports.Flags.HasYield : exports.Flags.HasAwait;
+ }
+ value = parseAssignmentPattern(parser, context, key, pos);
+ }
+ else {
+ if (t & 262144 /* IsAwait */) {
+ if (context & exports.Context.Async)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasAwait;
+ }
+ value = key;
+ }
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ key,
+ value,
+ kind: !(state & exports.ObjectState.Getter | state & exports.ObjectState.Setter) ? 'init' : (state & exports.ObjectState.Setter) ? 'set' : 'get',
+ computed: t === 41943059 /* LeftBracket */,
+ method: !!(state & exports.ObjectState.Method),
+ shorthand: !!(state & exports.ObjectState.Shorthand),
+ });
+ }
+ /**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseMethodDeclaration(parser, context, state) {
+ const pos = getLocation(parser);
+ const isGenerator = state & exports.ObjectState.Generator ? exports.ModifierState.Generator : exports.ModifierState.None;
+ const isAsync = state & exports.ObjectState.Async ? exports.ModifierState.Await : exports.ModifierState.None;
+ const { params, body } = swapContext(parser, context | exports.Context.Method, isGenerator | isAsync, parseFormalListAndBody, state);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: !!(state & exports.ObjectState.Async),
+ generator: !!(state & exports.ObjectState.Generator),
+ expression: false,
+ id: null,
+ });
+ }
+ /**
+ * Parse arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseArrowFunction(parser, context, pos, params) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, '=>');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context & ~exports.Context.Async, params, pos, exports.ModifierState.None);
+ }
+ /**
+ * Parse async arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncArrowFunction(parser, context, state, pos, params) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context | exports.Context.Async, params, pos, state);
+ }
+ /**
+ * Shared helper function for both async arrow and arrows
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ // https://tc39.github.io/ecma262/#prod-AsyncArrowFunction
+ function parseArrowBody(parser, context, params, pos, state) {
+ parser.pendingExpressionError = null;
+ for (const i in params)
+ reinterpret(parser, context | exports.Context.InParameter, params[i]);
+ const expression = parser.token !== 41943052 /* LeftBrace */;
+ const body = expression ? parseExpressionCoverGrammar(parser, context & ~(exports.Context.Yield | exports.Context.InParameter), parseAssignmentExpression) :
+ swapContext(parser, context & ~(exports.Context.Yield | exports.Context.AllowDecorator) | exports.Context.InFunctionBody, state, parseFunctionBody);
+ return finishNode(context, parser, pos, {
+ type: 'ArrowFunctionExpression',
+ body,
+ params,
+ id: null,
+ async: !!(state & exports.ModifierState.Await),
+ generator: false,
+ expression,
+ });
+ }
+ /**
+ * Parses formal parameters and function body.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFormalListAndBody(parser, context, state) {
+ const paramList = parseFormalParameters(parser, context | exports.Context.InParameter, state);
+ const args = paramList.args;
+ const params = paramList.params;
+ const body = parseFunctionBody(parser, context & ~exports.Context.AllowDecorator | exports.Context.InFunctionBody, args);
+ return { params, body };
+ }
+ /**
+ * Parse funciton body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFunctionBody(parser, context, params) {
+ // Note! The 'params' has an 'any' type now because it's really shouldn't be there. This should have been
+ // on the parser object instead. So for now the 'params' arg are only used within the
+ // 'parseFormalListAndBody' method, and not within the arrow function body.
+ const pos = getLocation(parser);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const body = [];
+ while (parser.token === 33554435 /* StringLiteral */) {
+ const { tokenRaw, tokenValue } = parser;
+ body.push(parseDirective(parser, context));
+ if (tokenRaw.length === /* length of prologue*/ 12 && tokenValue === 'use strict') {
+ if (parser.flags & exports.Flags.SimpleParameterList) {
+ tolerant(parser, context, 64 /* IllegalUseStrict */);
+ }
+ else if (parser.flags & (exports.Flags.HasStrictReserved | exports.Flags.StrictFunctionName)) {
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ }
+ else if (parser.flags & exports.Flags.StrictEvalArguments) {
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ }
+ context |= exports.Context.Strict;
+ }
+ }
+ if (context & exports.Context.Strict) {
+ validateParams(parser, context, params);
+ }
+ const { labelSet } = parser;
+ parser.labelSet = {};
+ const savedFlags = parser.flags;
+ parser.flags = parser.flags & ~(exports.Flags.StrictFunctionName | exports.Flags.StrictEvalArguments | exports.Flags.InSwitchStatement | exports.Flags.InIterationStatement) | exports.Flags.AllowDestructuring;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ if (savedFlags & exports.Flags.InIterationStatement)
+ parser.flags |= exports.Flags.InIterationStatement;
+ if (savedFlags & exports.Flags.InSwitchStatement)
+ parser.flags |= exports.Flags.InSwitchStatement;
+ parser.labelSet = labelSet;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body,
+ });
+ }
+ /**
+ * Parse formal parameters
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param Parser object
+ * @param Context masks
+ * @param Optional objectstate. Default to none
+ */
+ function parseFormalParameters(parser, context, state) {
+ // FormalParameterList :
+ // [empty]
+ // FunctionRestParameter
+ // FormalsList
+ // FormalsList , FunctionRestParameter
+ //
+ // FunctionRestParameter :
+ // ... BindingIdentifier
+ //
+ // FormalsList :
+ // FormalParameter
+ // FormalsList , FormalParameter
+ //
+ // FormalParameter :
+ // BindingElement
+ //
+ // BindingElement :
+ // SingleNameBinding
+ // BindingPattern Initializeropt
+ expect(parser, context, 50331659 /* LeftParen */);
+ parser.flags &= ~(exports.Flags.SimpleParameterList | exports.Flags.HasStrictReserved);
+ const args = [];
+ const params = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (state & exports.ObjectState.Setter)
+ tolerant(parser, context, 67 /* BadSetterRestParameter */);
+ parser.flags |= exports.Flags.SimpleParameterList;
+ params.push(parseRestElement(parser, context, args));
+ break;
+ }
+ params.push(parseFormalParameterList(parser, context, args));
+ if (!consume(parser, context, 16777234 /* Comma */))
+ break;
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ if (state & exports.ObjectState.Setter && params.length !== 1) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Setter', 'one', '');
+ }
+ if (state & exports.ObjectState.Getter && params.length > 0) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Getter', 'no', 's');
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return { params, args };
+ }
+ /**
+ * Parse formal parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFormalParameterList(parser, context, args) {
+ const pos = getLocation(parser);
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (hasBit(parser.token, 20480 /* FutureReserved */)) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= exports.Flags.StrictFunctionName;
+ }
+ if (hasBit(parser.token, 4194304 /* IsEvalOrArguments */)) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ }
+ else {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ }
+ const left = parseBindingIdentifierOrPattern(parser, context, args);
+ if (!consume(parser, context, 83886109 /* Assign */))
+ return left;
+ if (parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */) && context & (exports.Context.Yield | exports.Context.Async)) {
+ tolerant(parser, context, parser.token & 262144 /* IsAwait */ ? 52 /* AwaitInParameter */ : 51 /* YieldInParameter */);
+ }
+ parser.flags |= exports.Flags.SimpleParameterList;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+ }
+ /**
+ * Parse class expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassExpression(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & exports.Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const { token } = parser;
+ let state = exports.ObjectState.None;
+ let id = null;
+ let superClass = null;
+ if ((token !== 41943052 /* LeftBrace */ && token !== 12372 /* ExtendsKeyword */)) {
+ if (context & exports.Context.Async && token & 262144 /* IsAwait */) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context | exports.Context.Strict);
+ }
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | exports.Context.Strict, pos);
+ state |= exports.ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context | exports.Context.Strict, state);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ });
+ }
+ /**
+ * Parse class body and element list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElementList)
+ *
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassBodyAndElementList(parser, context, state) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const body = [];
+ let decorators = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (!consume(parser, context, 17825809 /* Semicolon */)) {
+ if (context & exports.Context.OptionsExperimental) {
+ decorators = parseDecorators(parser, context);
+ if (parser.token === 17825807 /* RightBrace */)
+ report(parser, 92 /* TrailingDecorators */);
+ if (decorators.length !== 0 && parser.tokenValue === 'constructor') {
+ report(parser, 93 /* GeneratorConstructor */);
+ }
+ }
+ body.push(context & exports.Context.OptionsNext && parser.token === 115 /* Hash */
+ ? parsePrivateFields(parser, context, decorators)
+ : parseClassElement(parser, context, state, decorators));
+ }
+ }
+ parser.flags &= ~exports.Flags.HasConstructor;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ClassBody',
+ body,
+ });
+ }
+ /**
+ * Parse class element and class public instance fields & private instance fields
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElement)
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassElement(parser, context, state, decorators) {
+ const pos = getLocation(parser);
+ let { tokenValue, token } = parser;
+ const flags = parser.flags;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ state |= exports.ObjectState.Generator;
+ }
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ if (parser.tokenValue === 'constructor') {
+ if (state & exports.ObjectState.Generator)
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'generator');
+ else if (state & exports.ObjectState.Heritage)
+ context |= exports.Context.AllowSuperProperty;
+ state |= exports.ObjectState.Constructor;
+ }
+ let key = parsePropertyName(parser, context);
+ let value;
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ if (token === 20585 /* StaticKeyword */) {
+ token = parser.token;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= exports.ObjectState.Generator;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ if (parser.tokenValue === 'prototype')
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ state |= exports.ObjectState.Static;
+ key = parsePropertyName(parser, context);
+ if (context & exports.Context.OptionsNext && isInstanceField(parser)) {
+ if (tokenValue === 'constructor')
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ }
+ }
+ if (parser.token !== 50331659 /* LeftParen */) {
+ if (token & 524288 /* IsAsync */ && !(state & exports.ObjectState.Generator) && !(parser.flags & exports.Flags.NewLine)) {
+ token = parser.token;
+ tokenValue = parser.tokenValue;
+ state |= exports.ObjectState.Async;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= exports.ObjectState.Generator;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ key = parsePropertyName(parser, context);
+ }
+ else if ((token === 69743 /* GetKeyword */ || token === 69744 /* SetKeyword */)) {
+ state |= token === 69743 /* GetKeyword */ ? exports.ObjectState.Getter : exports.ObjectState.Setter;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ key = parsePropertyName(parser, context & ~exports.Context.Strict);
+ }
+ if (tokenValue === 'prototype') {
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ }
+ else if (!(state & exports.ObjectState.Static) && tokenValue === 'constructor') {
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'accessor');
+ }
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ if (!(state & exports.ObjectState.Computed) && state & exports.ObjectState.Constructor) {
+ if (parser.flags & exports.Flags.HasConstructor)
+ report(parser, 12 /* DuplicateConstructor */);
+ else
+ parser.flags |= exports.Flags.HasConstructor;
+ }
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ if (context & exports.Context.OptionsNext)
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const kind = (state & exports.ObjectState.Constructor) ? 'constructor' : (state & exports.ObjectState.Getter) ? 'get' :
+ (state & exports.ObjectState.Setter) ? 'set' : 'method';
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & exports.ObjectState.Static),
+ computed: !!(state & exports.ObjectState.Computed),
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & exports.ObjectState.Static),
+ computed: !!(state & exports.ObjectState.Computed),
+ key,
+ value,
+ });
+ }
+ /**
+ * Parses field definition.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFieldDefinition(parser, context, key, state, pos, decorators) {
+ if (state & exports.ObjectState.Constructor)
+ tolerant(parser, context, 0 /* Unexpected */);
+ let value = null;
+ if (state & (exports.ObjectState.Async | exports.ObjectState.Generator))
+ tolerant(parser, context, 0 /* Unexpected */);
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & exports.ObjectState.Computed),
+ static: !!(state & exports.ObjectState.Static),
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & exports.ObjectState.Computed),
+ static: !!(state & exports.ObjectState.Static),
+ });
+ }
+ /**
+ * Parse private name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePrivateName(parser, context, pos) {
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+ }
+ /**
+ * Parses private instance fields
+ *
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePrivateFields(parser, context, decorators) {
+ const pos = getLocation(parser);
+ expect(parser, context | exports.Context.InClass, 115 /* Hash */);
+ if (parser.tokenValue === 'constructor')
+ tolerant(parser, context, 41 /* PrivateFieldConstructor */);
+ const key = parsePrivateName(parser, context, pos);
+ if (parser.token === 50331659 /* LeftParen */)
+ return parsePrivateMethod(parser, context, key, pos, decorators);
+ let value = null;
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ });
+ }
+ function parsePrivateMethod(parser, context, key, pos, decorators) {
+ const value = parseMethodDeclaration(parser, context | exports.Context.Strict, exports.ObjectState.None);
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ });
+ }
+ /**
+ * Parse either call expression or import expressions
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseCallImportOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ // Import.meta - Stage 3 proposal
+ if (consume(parser, context, 16777229 /* Period */)) {
+ if (context & exports.Context.Module && parser.tokenValue === 'meta')
+ return parseMetaProperty(parser, context, id, pos);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ let expr = parseImportExpression(parser, context, pos);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16 /* RightParen */);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: [args],
+ });
+ return expr;
+ }
+ /**
+ * Parse Import() expression. (Stage 3 proposal)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+ function parseImportExpression(parser, context, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'Import',
+ });
+ }
+ /**
+ * Parse meta property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Identifier
+ * @param pos Location
+ */
+ function parseMetaProperty(parser, context, meta, pos) {
+ return finishNode(context, parser, pos, {
+ meta,
+ type: 'MetaProperty',
+ property: parseIdentifier(parser, context),
+ });
+ }
+ /**
+ * Parse new expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NewExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNewExpressionOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ if (consume(parser, context | exports.Context.DisallowEscapedKeyword, 16777229 /* Period */)) {
+ if (parser.tokenValue !== 'target' ||
+ !(context & (exports.Context.InParameter | exports.Context.InFunctionBody)))
+ tolerant(parser, context, 53 /* MetaNotInFunctionBody */);
+ return parseMetaProperty(parser, context, id, pos);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'NewExpression',
+ callee: parseImportOrMemberExpression(parser, context, pos),
+ arguments: parser.token === 50331659 /* LeftParen */ ? parseArgumentList(parser, context) : [],
+ });
+ }
+ /**
+ * Parse either import or member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportOrMemberExpression(parser, context, pos) {
+ const { token } = parser;
+ if (context & exports.Context.OptionsNext && token === 33566810 /* ImportKeyword */) {
+ // Invalid: '"new import(x)"'
+ if (lookahead(parser, context, nextTokenIsLeftParen))
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ // Fixes cases like ''new import.meta','
+ return parseCallImportOrMetaProperty(parser, context);
+ }
+ return parseMemberExpression(parser, context, pos);
+ }
+ /**
+ * Parse super property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SuperProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSuperProperty(parser, context) {
+ // SuperProperty[Yield, Await]:
+ // super[Expression[+In, ?Yield, ?Await]]
+ // super.IdentifierName
+ const pos = getLocation(parser);
+ expect(parser, context, 33566813 /* SuperKeyword */);
+ switch (parser.token) {
+ case 50331659 /* LeftParen */:
+ // The super property has to be within a class constructor
+ if (!(context & exports.Context.AllowSuperProperty))
+ tolerant(parser, context, 54 /* BadSuperCall */);
+ break;
+ case 41943059 /* LeftBracket */:
+ case 16777229 /* Period */:
+ if (!(context & exports.Context.Method))
+ tolerant(parser, context, 55 /* UnexpectedSuper */);
+ break;
+ default:
+ tolerant(parser, context, 56 /* LoneSuper */);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Super',
+ });
+ }
+ /**
+ * Parse template literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseTemplateLiteral(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions: [],
+ quasis: [parseTemplateSpans(parser, context)],
+ });
+ }
+ /**
+ * Parse template head
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param cooked Cooked template value
+ * @param raw Raw template value
+ * @param pos Current location
+ */
+ function parseTemplateHead(parser, context, cooked = null, raw, pos) {
+ parser.token = consumeTemplateBrace(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked,
+ raw,
+ },
+ tail: false,
+ });
+ }
+ /**
+ * Parse template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expression Expression AST node
+ * @param quasis Array of Template elements
+ */
+ function parseTemplate(parser, context, expressions = [], quasis = []) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554440 /* TemplateCont */);
+ expressions.push(parseExpression(parser, context));
+ const t = getLocation(parser);
+ quasis.push(parseTemplateHead(parser, context, tokenValue, tokenRaw, pos));
+ if (parser.token === 33554441 /* TemplateTail */) {
+ quasis.push(parseTemplateSpans(parser, context, t));
+ }
+ else {
+ parseTemplate(parser, context, expressions, quasis);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions,
+ quasis,
+ });
+ }
+ /**
+ * Parse template spans
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateSpans)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param loc Current AST node location
+ */
+ function parseTemplateSpans(parser, context, pos = getLocation(parser)) {
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554441 /* TemplateTail */);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked: tokenValue,
+ raw: tokenRaw,
+ },
+ tail: true,
+ });
+ }
+ /**
+ * Parses decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDecoratorList(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'Decorator',
+ expression: parseLeftHandSideExpression(parser, context, pos)
+ });
+ }
+ /**
+ * Parses a list of decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDecorators(parser, context) {
+ const decoratorList = [];
+ while (consume(parser, context, 120 /* At */)) {
+ decoratorList.push(parseDecoratorList(parser, context | exports.Context.AllowDecorator));
+ }
+ return decoratorList;
+ } + + (function (Context) {
+ Context[Context["Empty"] = 0] = "Empty";
+ Context[Context["OptionsNext"] = 1] = "OptionsNext";
+ Context[Context["OptionsRanges"] = 2] = "OptionsRanges";
+ Context[Context["OptionsJSX"] = 4] = "OptionsJSX";
+ Context[Context["OptionsRaw"] = 8] = "OptionsRaw";
+ Context[Context["OptionsLoc"] = 16] = "OptionsLoc";
+ Context[Context["OptionsGlobalReturn"] = 32] = "OptionsGlobalReturn";
+ Context[Context["OptionsComments"] = 64] = "OptionsComments";
+ Context[Context["OptionsShebang"] = 128] = "OptionsShebang";
+ Context[Context["OptionsRawidentifiers"] = 256] = "OptionsRawidentifiers";
+ Context[Context["OptionsTolerant"] = 512] = "OptionsTolerant";
+ Context[Context["OptionsNode"] = 1024] = "OptionsNode";
+ Context[Context["OptionsExperimental"] = 2048] = "OptionsExperimental";
+ Context[Context["Strict"] = 4096] = "Strict";
+ Context[Context["Module"] = 8192] = "Module";
+ Context[Context["TaggedTemplate"] = 16384] = "TaggedTemplate";
+ Context[Context["InClass"] = 32768] = "InClass";
+ Context[Context["AllowIn"] = 65536] = "AllowIn";
+ Context[Context["Async"] = 131072] = "Async";
+ Context[Context["Yield"] = 262144] = "Yield";
+ Context[Context["InParameter"] = 524288] = "InParameter";
+ Context[Context["InFunctionBody"] = 1048576] = "InFunctionBody";
+ Context[Context["AllowSingleStatement"] = 2097152] = "AllowSingleStatement";
+ Context[Context["BlockScope"] = 4194304] = "BlockScope";
+ Context[Context["ForStatement"] = 8388608] = "ForStatement";
+ Context[Context["RequireIdentifier"] = 16777216] = "RequireIdentifier";
+ Context[Context["Method"] = 33554432] = "Method";
+ Context[Context["AllowSuperProperty"] = 67108864] = "AllowSuperProperty";
+ Context[Context["InParen"] = 134217728] = "InParen";
+ Context[Context["InJSXChild"] = 268435456] = "InJSXChild";
+ Context[Context["DisallowEscapedKeyword"] = 536870912] = "DisallowEscapedKeyword";
+ Context[Context["AllowDecorator"] = 1073741824] = "AllowDecorator";
+ Context[Context["LocationTracker"] = 18] = "LocationTracker";
+ })(exports.Context || (exports.Context = {}));
+ (function (Flags) {
+ Flags[Flags["None"] = 0] = "None";
+ Flags[Flags["NewLine"] = 1] = "NewLine";
+ Flags[Flags["AllowBinding"] = 2] = "AllowBinding";
+ Flags[Flags["AllowDestructuring"] = 4] = "AllowDestructuring";
+ Flags[Flags["SimpleParameterList"] = 8] = "SimpleParameterList";
+ Flags[Flags["InSwitchStatement"] = 16] = "InSwitchStatement";
+ Flags[Flags["InIterationStatement"] = 32] = "InIterationStatement";
+ Flags[Flags["HasStrictReserved"] = 64] = "HasStrictReserved";
+ Flags[Flags["HasOctal"] = 128] = "HasOctal";
+ Flags[Flags["SimpleAssignmentTarget"] = 256] = "SimpleAssignmentTarget";
+ Flags[Flags["HasProtoField"] = 512] = "HasProtoField";
+ Flags[Flags["StrictFunctionName"] = 1024] = "StrictFunctionName";
+ Flags[Flags["StrictEvalArguments"] = 2048] = "StrictEvalArguments";
+ Flags[Flags["InFunctionBody"] = 4096] = "InFunctionBody";
+ Flags[Flags["HasAwait"] = 8192] = "HasAwait";
+ Flags[Flags["HasYield"] = 16384] = "HasYield";
+ Flags[Flags["EscapedKeyword"] = 32768] = "EscapedKeyword";
+ Flags[Flags["HasConstructor"] = 65536] = "HasConstructor";
+ })(exports.Flags || (exports.Flags = {}));
+ (function (Labels) {
+ Labels[Labels["None"] = 0] = "None";
+ Labels[Labels["NotNested"] = 1] = "NotNested";
+ Labels[Labels["Nested"] = 2] = "Nested";
+ })(exports.Labels || (exports.Labels = {}));
+ (function (NumericState) {
+ NumericState[NumericState["None"] = 0] = "None";
+ NumericState[NumericState["SeenSeparator"] = 1] = "SeenSeparator";
+ NumericState[NumericState["EigthOrNine"] = 2] = "EigthOrNine";
+ NumericState[NumericState["Float"] = 4] = "Float";
+ NumericState[NumericState["BigInt"] = 8] = "BigInt";
+ })(exports.NumericState || (exports.NumericState = {}));
+ (function (ScannerState) {
+ ScannerState[ScannerState["None"] = 0] = "None";
+ ScannerState[ScannerState["NewLine"] = 1] = "NewLine";
+ ScannerState[ScannerState["LastIsCR"] = 2] = "LastIsCR";
+ })(exports.ScannerState || (exports.ScannerState = {}));
+ (function (ModifierState) {
+ ModifierState[ModifierState["None"] = 0] = "None";
+ ModifierState[ModifierState["Generator"] = 1] = "Generator";
+ ModifierState[ModifierState["Await"] = 2] = "Await";
+ })(exports.ModifierState || (exports.ModifierState = {}));
+ (function (CoverParenthesizedState) {
+ CoverParenthesizedState[CoverParenthesizedState["None"] = 0] = "None";
+ CoverParenthesizedState[CoverParenthesizedState["SequenceExpression"] = 1] = "SequenceExpression";
+ CoverParenthesizedState[CoverParenthesizedState["HasEvalOrArguments"] = 2] = "HasEvalOrArguments";
+ CoverParenthesizedState[CoverParenthesizedState["HasReservedWords"] = 4] = "HasReservedWords";
+ CoverParenthesizedState[CoverParenthesizedState["HasYield"] = 8] = "HasYield";
+ CoverParenthesizedState[CoverParenthesizedState["HasBinding"] = 16] = "HasBinding";
+ })(exports.CoverParenthesizedState || (exports.CoverParenthesizedState = {}));
+ (function (Escape) {
+ Escape[Escape["Empty"] = -1] = "Empty";
+ Escape[Escape["StrictOctal"] = -2] = "StrictOctal";
+ Escape[Escape["EightOrNine"] = -3] = "EightOrNine";
+ Escape[Escape["InvalidHex"] = -4] = "InvalidHex";
+ Escape[Escape["OutOfRange"] = -5] = "OutOfRange";
+ })(exports.Escape || (exports.Escape = {}));
+ (function (RegexFlags) {
+ RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
+ RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
+ RegexFlags[RegexFlags["Global"] = 2] = "Global";
+ RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
+ RegexFlags[RegexFlags["Unicode"] = 8] = "Unicode";
+ RegexFlags[RegexFlags["Sticky"] = 16] = "Sticky";
+ RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
+ })(exports.RegexFlags || (exports.RegexFlags = {}));
+ (function (CoverCallState) {
+ CoverCallState[CoverCallState["Empty"] = 0] = "Empty";
+ CoverCallState[CoverCallState["SeenSpread"] = 1] = "SeenSpread";
+ CoverCallState[CoverCallState["HasSpread"] = 2] = "HasSpread";
+ CoverCallState[CoverCallState["SimpleParameter"] = 4] = "SimpleParameter";
+ CoverCallState[CoverCallState["EvalOrArguments"] = 8] = "EvalOrArguments";
+ CoverCallState[CoverCallState["Yield"] = 16] = "Yield";
+ CoverCallState[CoverCallState["Await"] = 32] = "Await";
+ })(exports.CoverCallState || (exports.CoverCallState = {}));
+ (function (RegexState) {
+ RegexState[RegexState["Empty"] = 0] = "Empty";
+ RegexState[RegexState["Escape"] = 1] = "Escape";
+ RegexState[RegexState["Class"] = 2] = "Class";
+ })(exports.RegexState || (exports.RegexState = {}));
+ (function (ObjectState) {
+ ObjectState[ObjectState["None"] = 0] = "None";
+ ObjectState[ObjectState["Async"] = 1] = "Async";
+ ObjectState[ObjectState["Generator"] = 2] = "Generator";
+ ObjectState[ObjectState["Getter"] = 4] = "Getter";
+ ObjectState[ObjectState["Setter"] = 8] = "Setter";
+ ObjectState[ObjectState["Computed"] = 16] = "Computed";
+ ObjectState[ObjectState["Method"] = 32] = "Method";
+ ObjectState[ObjectState["Shorthand"] = 64] = "Shorthand";
+ ObjectState[ObjectState["Static"] = 128] = "Static";
+ ObjectState[ObjectState["Constructor"] = 256] = "Constructor";
+ ObjectState[ObjectState["Heritage"] = 512] = "Heritage";
+ })(exports.ObjectState || (exports.ObjectState = {}));
+ /**
+ * Validate break and continue statement
+ *
+ * @param parser Parser object
+ * @param label label
+ * @param isContinue true if validation continue statement
+ */
+ function validateBreakOrContinueLabel(parser, context, label, isContinue) {
+ const state = hasLabel(parser, label);
+ if (!state)
+ tolerant(parser, context, 32 /* UnknownLabel */, label);
+ if (isContinue && !(state & exports.Labels.Nested))
+ tolerant(parser, context, 31 /* IllegalContinue */, label);
+ }
+ /**
+ * Add label to the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+ function addLabel(parser, label) {
+ if (parser.labelSet === undefined)
+ parser.labelSet = {};
+ parser.labelSet[`$${label}`] = isIterationStatement(parser.token) ? exports.Labels.Nested : exports.Labels.NotNested;
+ }
+ /**
+ * Remove label from the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+ function popLabel(parser, label) {
+ parser.labelSet[`$${label}`] = exports.Labels.None;
+ }
+ /**
+ * Returns either true or false. Depends if the label exist.
+ *
+ * @param parser Parser object
+ * @param label Label
+ */
+ function hasLabel(parser, label) {
+ return !parser.labelSet ? exports.Labels.None : parser.labelSet[`$${label}`];
+ }
+ /**
+ * Finish each the node for each parse. Set line / and column on the node if the
+ * options are set for it
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Line / column
+ * @param node AST node
+ */
+ function finishNode(context, parser, meta, node) {
+ const { lastIndex, lastLine, lastColumn, sourceFile, index } = parser;
+ if (context & exports.Context.LocationTracker) {
+ if (context & exports.Context.OptionsRanges) {
+ node.start = meta.index;
+ node.end = lastIndex;
+ }
+ if (context & exports.Context.OptionsLoc) {
+ node.loc = {
+ start: { line: meta.line, column: meta.column },
+ end: { line: lastLine, column: lastColumn }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ return node;
+ }
+ /**
+ * Consumes the next token. If the consumed token is not of the expected type
+ * then report an error and return null. Otherwise return true.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ * @param Err Optionally error message to be thrown
+ */
+ function expect(parser, context, token, err = 1 /* UnexpectedToken */) {
+ if (parser.token !== token)
+ report(parser, err, tokenDesc(parser.token));
+ nextToken(parser, context);
+ return true;
+ }
+ /**
+ * If the next token matches the given token, this consumes the token
+ * and returns true. Otherwise return false.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ */
+ function consume(parser, context, token) {
+ if (parser.token !== token)
+ return false;
+ nextToken(parser, context);
+ return true;
+ }
+ /**
+ * Advance and return the next token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextToken(parser, context) {
+ parser.lastIndex = parser.index;
+ parser.lastLine = parser.line;
+ parser.lastColumn = parser.column;
+ return (parser.token = scan(parser, context));
+ }
+ const hasBit = (mask, flags) => (mask & flags) === flags;
+ /**
+ * Automatic Semicolon Insertion
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function consumeSemicolon(parser, context) {
+ return parser.token & 1048576 /* ASI */ || parser.flags & exports.Flags.NewLine
+ ? consume(parser, context, 17825809 /* Semicolon */)
+ : report(parser, !(context & exports.Context.Async) && parser.token & 262144 /* IsAwait */ ? 38 /* AwaitOutsideAsync */ : 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ /**
+ * Bit fiddle current grammar state and keep track of the state during the parse and restore
+ * it back to original state after finish parsing or throw.
+ *
+ * Ideas for this is basicly from V8 and SM, but also the Esprima parser does this in a similar way.
+ *
+ * However this implementation is an major improvement over similiar implementations, and
+ * does not require additonal bitmasks to be set / unset during the parsing outside this function.
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ * @param errMsg Optional error message
+ */
+ function parseExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // If there exist an pending expression error, we throw an error at
+ // the same location it was recorded
+ if (!!parser.pendingExpressionError) {
+ const { error, line, column, index } = parser.pendingExpressionError;
+ constructError(parser, context, index, line, column, error);
+ }
+ // Here we - just in case - disallow both binding and destructuring
+ // and only set the bitmaks if the previous flags (before the callback)
+ // is positive.
+ // Note that this bitmasks may have been turned off during parsing
+ // the callback
+ parser.flags &= ~(exports.Flags.AllowBinding | exports.Flags.AllowDestructuring);
+ if (flags & exports.Flags.AllowBinding)
+ parser.flags |= exports.Flags.AllowBinding;
+ if (flags & exports.Flags.AllowDestructuring)
+ parser.flags |= exports.Flags.AllowDestructuring;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+ }
+ /**
+ * Restor current grammar to previous state, or unset necessary bitmasks
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ */
+ function restoreExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ // Clear pending expression error
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // Both the previous bitmasks and bitmasks set during parsing the callback
+ // has to be positive for us to allow further binding or destructuring.
+ // Note that we allow both before the callback, so this is the only thing
+ // we need to check for.
+ if (!(parser.flags & exports.Flags.AllowBinding) || !(flags & exports.Flags.AllowBinding)) {
+ parser.flags &= ~exports.Flags.AllowBinding;
+ }
+ if (!(parser.flags & exports.Flags.AllowDestructuring) || !(flags & exports.Flags.AllowDestructuring)) {
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ }
+ // Here we either
+ // 1) restore to previous pending expression error
+ // or
+ // 2) if a pending expression error have been set during the parse (*only in object literal*)
+ // we overwrite previous error, and keep the new one
+ parser.pendingExpressionError = pendingExpressionError || parser.pendingExpressionError;
+ return res;
+ }
+ /**
+ * Set / unset yield / await context masks based on the
+ * ModifierState masks before invoking the callback and
+ * returning it's content
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Modifier state
+ * @param callback Callback function to be invoked
+ * @param methodState Optional Objectstate.
+ */
+ function swapContext(parser, context, state, callback, methodState = exports.ObjectState.None) {
+ context &= ~(exports.Context.Async | exports.Context.Yield | exports.Context.InParameter);
+ if (state & exports.ModifierState.Generator)
+ context |= exports.Context.Yield;
+ if (state & exports.ModifierState.Await)
+ context |= exports.Context.Async;
+ return callback(parser, context, methodState);
+ }
+ /**
+ * Validates function params
+ *
+ * Note! In case anyone want to enable full scoping, replace 'paramSet' with an similiar
+ * object on the parser object itself. Then push / set the tokenValue to
+ * it an use an bitmask to mark it as an 'variable' not 'blockscope'. Then when
+ * implementing lexical scoping, you can use that for validation.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param params Array of token values
+ */
+ function validateParams(parser, context, params) {
+ const paramSet = new Map();
+ for (let i = 0; i < params.length; i++) {
+ const key = `@${params[i]}`;
+ if (paramSet.get(key)) {
+ tolerant(parser, context, 81 /* ParamDupe */);
+ }
+ else
+ paramSet.set(key, true);
+ }
+ }
+ /**
+ * Reinterpret various expressions as pattern
+ * This is only used for assignment and arrow parameter list
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param node AST node
+ */
+ const reinterpret = (parser, context, node) => {
+ switch (node.type) {
+ case 'Identifier':
+ if (context & exports.Context.Strict && nameIsArgumentsOrEval(node.name))
+ report(parser, 3 /* InvalidEscapedReservedWord */);
+ case 'ArrayPattern':
+ case 'AssignmentPattern':
+ case 'ObjectPattern':
+ case 'RestElement':
+ case 'MetaProperty':
+ return;
+ case 'ArrayExpression':
+ node.type = 'ArrayPattern';
+ for (let i = 0; i < node.elements.length; ++i) {
+ // skip holes in pattern
+ if (node.elements[i] !== null) {
+ reinterpret(parser, context, node.elements[i]);
+ }
+ }
+ return;
+ case 'ObjectExpression':
+ node.type = 'ObjectPattern';
+ for (let i = 0; i < node.properties.length; i++) {
+ reinterpret(parser, context, node.properties[i]);
+ }
+ return;
+ case 'Property':
+ reinterpret(parser, context, node.value);
+ return;
+ case 'SpreadElement':
+ node.type = 'RestElement';
+ if (node.argument.type !== 'ArrayExpression' &&
+ node.argument.type !== 'ObjectExpression' &&
+ !isValidSimpleAssignmentTarget(node.argument)) {
+ tolerant(parser, context, 71 /* RestDefaultInitializer */);
+ }
+ reinterpret(parser, context, node.argument);
+ break;
+ case 'AssignmentExpression':
+ node.type = 'AssignmentPattern';
+ delete node.operator; // operator is not relevant for assignment pattern
+ reinterpret(parser, context, node.left); // recursive descent
+ return;
+ case 'MemberExpression':
+ if (!(context & exports.Context.InParameter))
+ return;
+ // Fall through
+ default:
+ tolerant(parser, context, context & exports.Context.InParameter ? 77 /* NotBindable */ : 73 /* InvalidDestructuringTarget */, node.type);
+ }
+ };
+ /**
+ * Does a lookahead.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param callback Callback function to be invoked
+ */
+ function lookahead(parser, context, callback) {
+ const { tokenValue, flags, line, column, startColumn, index, lastColumn, startLine, lastLine, lastIndex, startIndex, tokenRaw, token, lastValue, tokenRegExp, labelSet, errors, errorLocation, pendingExpressionError } = parser;
+ const res = callback(parser, context);
+ parser.index = index;
+ parser.token = token;
+ parser.tokenValue = tokenValue;
+ parser.tokenValue = tokenValue;
+ parser.flags = flags;
+ parser.line = line;
+ parser.column = column;
+ parser.tokenRaw = tokenRaw;
+ parser.lastValue = lastValue;
+ parser.startColumn = startColumn;
+ parser.lastColumn = lastColumn;
+ parser.startLine = startLine;
+ parser.lastLine = lastLine;
+ parser.lastIndex = lastIndex;
+ parser.startIndex = startIndex;
+ parser.tokenRegExp = tokenRegExp;
+ parser.labelSet = labelSet;
+ parser.errors = errors;
+ parser.errorLocation = errorLocation;
+ parser.tokenRegExp = tokenRegExp;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+ }
+ /**
+ * Returns true if this an valid simple assignment target
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function isValidSimpleAssignmentTarget(node) {
+ return node.type === 'Identifier' || node.type === 'MemberExpression' ? true : false;
+ }
+ /**
+ * Get current node location
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function getLocation(parser) {
+ return {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+ }
+ /**
+ * Returns true if this is an valid identifier
+ *
+ * @param context Context masks
+ * @param t Token
+ */
+ function isValidIdentifier(context, t) {
+ if (context & exports.Context.Strict) {
+ if (context & exports.Context.Module && t & 262144 /* IsAwait */)
+ return false;
+ if (t & 1073741824 /* IsYield */)
+ return false;
+ return (t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (t & 69632 /* Contextual */) === 69632 /* Contextual */;
+ }
+ return ((t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (t & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (t & 20480 /* FutureReserved */) === 20480 /* FutureReserved */);
+ }
+ /**
+ * Returns true if this an valid lexical binding and not an identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function isLexical(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return !!(token & (131072 /* IsIdentifier */ | 8388608 /* IsBindingPattern */ | 1073741824 /* IsYield */ | 262144 /* IsAwait */) ||
+ token === 33574984 /* LetKeyword */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */);
+ }
+ /**
+ * Returns true if this is end of case or default clauses
+ *
+ * @param parser Parser object
+ */
+ function isEndOfCaseOrDefaultClauses(parser) {
+ return (parser.token === 12368 /* DefaultKeyword */ || parser.token === 17825807 /* RightBrace */ || parser.token === 12363 /* CaseKeyword */);
+ }
+ /**
+ * Validates if the next token in the stream is a left paren or a period
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenIsLeftParenOrPeriod(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */ || parser.token === 16777229 /* Period */;
+ }
+ /**
+ * Validates if the next token in the stream is a identifier or left paren
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenisIdentifierOrParen(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return token & (131072 /* IsIdentifier */ | 1073741824 /* IsYield */) || token === 50331659 /* LeftParen */;
+ }
+ /**
+ * Validates if the next token in the stream is left parenthesis.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenIsLeftParen(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */;
+ }
+ /**
+ * Validates if the next token in the stream is a function keyword on the same line.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenIsFuncKeywordOnSameLine(parser, context) {
+ nextToken(parser, context);
+ return !(parser.flags & exports.Flags.NewLine) && parser.token === 33566808 /* FunctionKeyword */;
+ }
+ /**
+ * Checks if the property has any private field key
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function isPropertyWithPrivateFieldKey(expr) {
+ return !expr.property ? false : expr.property.type === 'PrivateName';
+ }
+ /**
+ * Parse and classify itendifier - similar method as in V8
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAndClassifyIdentifier(parser, context) {
+ const { token, tokenValue: name } = parser;
+ if (context & exports.Context.Strict) {
+ if (context & exports.Context.Module && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (token & 69632 /* Contextual */) === 69632 /* Contextual */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (context & exports.Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ function nameIsArgumentsOrEval(value) {
+ return value === 'eval' || value === 'arguments';
+ }
+ /**
+ * Records an error from current position. If we report an error later, we'll do it from
+ * this position.
+ *
+ * @param parser Parser object
+ */
+ function setPendingError(parser) {
+ parser.errorLocation = {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+ }
+ /**
+ * Returns tagName for JSX element
+ *
+ * @param elementName JSX Element name
+ */
+ function isEqualTagNames(elementName) {
+ // tslint:disable-next-line:switch-default | this switch is exhaustive
+ switch (elementName.type) {
+ case 'JSXIdentifier':
+ return elementName.name;
+ case 'JSXNamespacedName':
+ return `${isEqualTagNames(elementName.namespace)}:${isEqualTagNames(elementName.name)}`;
+ case 'JSXMemberExpression':
+ return `${isEqualTagNames(elementName.object)}.${isEqualTagNames(elementName.property)}`;
+ }
+ }
+ /**
+ * Returns true if this is an instance field ( stage 3 proposal)
+ *
+ * @param parser Parser object
+ */
+ function isInstanceField(parser) {
+ const { token } = parser;
+ return token === 17825807 /* RightBrace */ || token === 17825809 /* Semicolon */ || token === 83886109 /* Assign */;
+ }
+ /**
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expr AST expressions
+ * @param prefix prefix
+ */
+ function validateUpdateExpression(parser, context, expr, prefix) {
+ if (context & exports.Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 68 /* StrictLHSPrefixPostFix */, prefix);
+ }
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ }
+ /**
+ * Record expression error
+ *
+ * @param parser Parser object
+ * @param error Error message
+ */
+ function setPendingExpressionError(parser, type) {
+ parser.pendingExpressionError = {
+ error: errorMessages[type],
+ line: parser.line,
+ column: parser.column,
+ index: parser.index
+ };
+ }
+ /**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+ function validateCoverParenthesizedExpression(parser, state) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= exports.CoverParenthesizedState.HasEvalOrArguments;
+ }
+ else if ((token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ setPendingError(parser);
+ state |= exports.CoverParenthesizedState.HasReservedWords;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasAwait;
+ }
+ }
+ return state;
+ }
+ /**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+ function validateAsyncArgumentList(parser, context, state) {
+ const { token } = parser;
+ if (!(parser.flags & exports.Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= exports.CoverCallState.EvalOrArguments;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ state |= exports.CoverCallState.Await;
+ }
+ else if ((token & 1073741824 /* IsYield */) === 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ state |= exports.CoverCallState.Yield;
+ }
+ }
+ return state;
+ }
+ /**
+ * Returns true if iteration statement. Otherwise return false,
+ *
+ * @param t Token
+ */
+ function isIterationStatement(t) {
+ return t === 12369 /* DoKeyword */ || t === 12386 /* WhileKeyword */ || t === 12374 /* ForKeyword */;
+ }
+ /**
+ * Returns true if in or of token. Otherwise return false,
+ *
+ * @param t Token
+ */
+ function isInOrOf(t) {
+ return t === 69746 /* OfKeyword */ || t === 167786289 /* InKeyword */;
+ } + + /*@internal*/
+ const errorMessages = {
+ [0 /* Unexpected */]: 'Unexpected token',
+ [1 /* UnexpectedToken */]: 'Unexpected token \'%0\'',
+ [2 /* ExpectedToken */]: 'Expected token \'%0\'',
+ [3 /* InvalidEscapedReservedWord */]: 'Keyword must not contain escaped characters',
+ [4 /* UnexpectedKeyword */]: 'Keyword \'%0\' is reserved',
+ [5 /* InvalidLHSInAssignment */]: 'Invalid left-hand side in assignment',
+ [6 /* UnterminatedString */]: 'Unterminated string literal',
+ [7 /* UnterminatedRegExp */]: 'Unterminated regular expression literal',
+ [8 /* UnterminatedComment */]: 'Unterminated MultiLineComment',
+ [9 /* UnterminatedTemplate */]: 'Unterminated template literal',
+ [10 /* UnexpectedChar */]: 'Invalid character \'%0\'',
+ [11 /* StrictOctalEscape */]: 'Octal escapes are not allowed in strict mode',
+ [13 /* InvalidEightAndNine */]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
+ [14 /* UnicodeOutOfRange */]: 'Unicode escape code point out of range',
+ [15 /* DuplicateRegExpFlag */]: 'Duplicate regular expression flag \'%0\'',
+ [16 /* UnexpectedTokenRegExpFlag */]: 'Unexpected regular expression flag \'%0\'',
+ [17 /* StrictLHSAssignment */]: 'Eval or arguments can\'t be assigned to in strict mode code',
+ [18 /* IllegalReturn */]: 'Illegal return statement',
+ [19 /* StrictFunction */]: 'In strict mode code, functions can only be declared at top level or inside a block',
+ [20 /* SloppyFunction */]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
+ [21 /* ForbiddenAsStatement */]: '%0 can\'t appear in single-statement context',
+ [22 /* GeneratorInSingleStatementContext */]: 'Generators can only be declared at the top level or inside a block',
+ [23 /* ForAwaitNotOf */]: '\'for await\' loop should be used with \'of\'',
+ [24 /* DeclarationMissingInitializer */]: 'Missing initializer in %0 declaration',
+ [25 /* ForInOfLoopInitializer */]: '\'for-%0\' loop variable declaration may not have an initializer',
+ [26 /* ForInOfLoopMultiBindings */]: 'Invalid left-hand side in for-%0 loop: Must have a single binding.',
+ [27 /* LetInLexicalBinding */]: 'let is disallowed as a lexically bound name',
+ [28 /* UnexpectedLexicalDeclaration */]: 'Lexical declaration cannot appear in a single-statement context',
+ [29 /* LabelRedeclaration */]: 'Label \'%0\' has already been declared',
+ [30 /* InvalidNestedStatement */]: '%0 statement must be nested within an iteration statement',
+ [31 /* IllegalContinue */]: 'Illegal continue statement: \'%0\' does not denote an iteration statement',
+ [32 /* UnknownLabel */]: 'Undefined label \'%0\'',
+ [33 /* MultipleDefaultsInSwitch */]: 'More than one default clause in switch statement',
+ [34 /* ImportExportDeclAtTopLevel */]: '%0 declarations may only appear at top level of a module',
+ [35 /* AsyncFunctionInSingleStatementContext */]: 'Async functions can only be declared at the top level or inside a block',
+ [36 /* InvalidLineBreak */]: 'No line break is allowed after \'%0\'',
+ [37 /* StrictModeWith */]: 'Strict mode code may not include a with statement',
+ [38 /* AwaitOutsideAsync */]: 'Await is only valid in async functions',
+ [39 /* UnNamedFunctionDecl */]: 'Function declaration must have a name in this context',
+ [12 /* DuplicateConstructor */]: 'Duplicate constructor method in class',
+ [40 /* DisallowedInContext */]: '\'%0\' may not be used as an identifier in this context',
+ [43 /* StrictDelete */]: 'Delete of an unqualified identifier in strict mode',
+ [44 /* DeletePrivateField */]: 'Private fields can not be deleted',
+ [41 /* PrivateFieldConstructor */]: 'Classes may not have a private field named \'#constructor\'',
+ [42 /* PublicFieldConstructor */]: 'Classes may not have a field named \'constructor\'',
+ [45 /* InvalidConstructor */]: 'Class constructor may not be a \'%0\'',
+ [46 /* UnexpectedReserved */]: 'Unexpected reserved word',
+ [47 /* StrictEvalArguments */]: 'Unexpected eval or arguments in strict mode',
+ [48 /* AwaitBindingIdentifier */]: '\'await\' is not a valid identifier inside an async function',
+ [49 /* YieldBindingIdentifier */]: '\'yield\' is not a valid identifier inside an generator function',
+ [50 /* UnexpectedStrictReserved */]: 'Unexpected strict mode reserved word',
+ [52 /* AwaitInParameter */]: 'Await expression not allowed in formal parameter',
+ [51 /* YieldInParameter */]: 'Yield expression not allowed in formal parameter',
+ [53 /* MetaNotInFunctionBody */]: 'new.target only allowed within functions',
+ [54 /* BadSuperCall */]: 'super() is not allowed in this context',
+ [55 /* UnexpectedSuper */]: 'Member access from super not allowed in this context',
+ [56 /* LoneSuper */]: 'Only "(" or "." or "[" are allowed after \'super\'',
+ [57 /* YieldReservedKeyword */]: '\'yield\' is a reserved keyword within generator function bodies',
+ [58 /* ContinuousNumericSeparator */]: 'Only one underscore is allowed as numeric separator',
+ [59 /* TrailingNumericSeparator */]: 'Numeric separators are not allowed at the end of numeric literals',
+ [60 /* ZeroDigitNumericSeparator */]: 'Numeric separator can not be used after leading 0.',
+ [61 /* StrictOctalLiteral */]: 'Legacy octal literals are not allowed in strict mode',
+ [62 /* InvalidLhsInAssignment */]: 'Invalid left-hand side in assignment',
+ [63 /* DuplicateProto */]: 'Property name __proto__ appears more than once in object literal',
+ [64 /* IllegalUseStrict */]: 'Illegal \'use strict\' directive in function with non-simple parameter list',
+ [65 /* StaticPrototype */]: 'Classes may not have a static property named \'prototype\'',
+ [66 /* AccessorWrongArgs */]: '%0 functions must have %1 argument%2',
+ [67 /* BadSetterRestParameter */]: 'Setter function argument must not be a rest parameter',
+ [68 /* StrictLHSPrefixPostFix */]: '%0 increment/decrement may not have eval or arguments operand in strict mode',
+ [69 /* InvalidElisonInObjPropList */]: 'Elision not allowed in object property list',
+ [70 /* ElementAfterRest */]: 'Rest element must be last element',
+ [72 /* ElementAfterSpread */]: 'Spread element must be last element',
+ [71 /* RestDefaultInitializer */]: 'Rest parameter may not have a default initializer',
+ [73 /* InvalidDestructuringTarget */]: 'Invalid destructuring assignment target',
+ [74 /* UnexpectedSurrogate */]: 'Unexpected surrogate pair',
+ [75 /* MalformedEscape */]: 'Malformed %0 character escape sequence',
+ [76 /* TemplateOctalLiteral */]: 'Template literals may not contain octal escape sequences',
+ [77 /* NotBindable */]: 'Invalid binding pattern',
+ [78 /* ParamAfterRest */]: 'Rest parameter must be last formal parameter',
+ [79 /* NoCatchOrFinally */]: 'Missing catch or finally after try',
+ [80 /* NewlineAfterThrow */]: 'Illegal newline after throw',
+ [81 /* ParamDupe */]: 'Duplicate parameter name not allowed in this context',
+ [82 /* AsAfterImportStart */]: 'Missing keyword \'as\' after import *',
+ [83 /* LabelNoColon */]: 'Labels must be followed by a \':\'',
+ [84 /* NonEmptyJSXExpression */]: 'JSX attributes must only be assigned a non-empty \'expression\'',
+ [85 /* ExpectedJSXClosingTag */]: 'Expected corresponding JSX closing tag for %0',
+ [86 /* AdjacentJSXElements */]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
+ [87 /* InvalidJSXAttributeValue */]: 'Invalid JSX attribute value',
+ [88 /* RestWithComma */]: 'Rest element may not have a trailing comma',
+ [89 /* UndefinedUnicodeCodePoint */]: 'Undefined Unicode code-point',
+ [90 /* HtmlCommentInModule */]: 'HTML comments are not allowed in modules',
+ [91 /* InvalidCoverInitializedName */]: 'Invalid shorthand property initializer',
+ [92 /* TrailingDecorators */]: 'Trailing decorator may be followed by method',
+ [93 /* GeneratorConstructor */]: 'Decorators can\'t be used with a constructor',
+ [94 /* InvalidRestBindingPattern */]: '`...` must be followed by an identifier in declaration contexts',
+ };
+ /**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param index The 0-based end index of the error.
+ * @param line The 0-based line position of the error.
+ * @param column The 0-based column position of the error.
+ * @param parser The 0-based end index of the current node.
+ * @param description Error description
+ */
+ /*@internal*/
+ function constructError(parser, context, index, line, column, description) {
+ const error = new SyntaxError(`Line ${line}, column ${column}: ${description}`);
+ error.index = index;
+ error.line = line;
+ error.column = column;
+ error.description = description;
+ if (context & exports.Context.OptionsTolerant) {
+ parser.errors.push(error);
+ }
+ else
+ throw error;
+ }
+ /**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ */
+ function getErrorLocation(parser) {
+ let { index, startLine: line, startColumn: column } = parser;
+ const errorLoc = parser.errorLocation;
+ if (!!errorLoc) {
+ index = errorLoc.index;
+ line = errorLoc.line;
+ column = errorLoc.column;
+ }
+ return { index, line, column };
+ }
+ /**
+ * Throws an error
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+ /*@internal*/
+ function report(parser, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, exports.Context.Empty, index, line, column, errorMessage);
+ }
+ /**
+ * If in tolerant mode, all errors are pushed to a top-level error array containing
+ * otherwise throws
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+ /*@internal*/
+ function tolerant(parser, context, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, context, index, line, column, errorMessage);
+ } + + // Declarations
+ /**
+ * Parses class declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & exports.Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const id = (context & exports.Context.RequireIdentifier && (parser.token !== 33685505 /* Identifier */))
+ ? null :
+ parseBindingIdentifier(parser, context | exports.Context.Strict | exports.Context.DisallowEscapedKeyword);
+ let state = exports.ObjectState.None;
+ let superClass = null;
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | exports.Context.Strict, pos);
+ state |= exports.ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context & ~exports.Context.RequireIdentifier | exports.Context.Strict | exports.Context.InClass, state);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body
+ });
+ }
+ /**
+ * Parses function declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFunctionDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ let isGenerator = exports.ModifierState.None;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ if (context & exports.Context.AllowSingleStatement && !(context & exports.Context.InFunctionBody)) {
+ tolerant(parser, context, 22 /* GeneratorInSingleStatementContext */);
+ }
+ isGenerator = exports.ModifierState.Generator;
+ }
+ return parseFunctionDeclarationBody(parser, context, isGenerator, pos);
+ }
+ /**
+ * Parses out a function declartion body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context mask
+ * @param state Modifier state
+ * @param pos Current location
+ */
+ function parseFunctionDeclarationBody(parser, context, state, pos) {
+ const { token } = parser;
+ let id = null;
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (context & exports.Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (token !== 50331659 /* LeftParen */) {
+ id = parseBindingIdentifier(parser, context);
+ // Unnamed functions are forbidden in statement context.
+ }
+ else if (!(context & exports.Context.RequireIdentifier))
+ tolerant(parser, context, 39 /* UnNamedFunctionDecl */);
+ const { params, body } = swapContext(parser, context & ~(exports.Context.Method | exports.Context.AllowSuperProperty | exports.Context.RequireIdentifier), state, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionDeclaration',
+ params,
+ body,
+ async: !!(state & exports.ModifierState.Await),
+ generator: !!(state & exports.ModifierState.Generator),
+ expression: false,
+ id,
+ });
+ }
+ /**
+ * Parses async function or async generator declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isAwait = exports.ModifierState.Await;
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? exports.ModifierState.Generator : exports.ModifierState.None;
+ return parseFunctionDeclarationBody(parser, context, isGenerator | isAwait, pos);
+ }
+ /**
+ * VariableDeclaration :
+ * BindingIdentifier Initializeropt
+ * BindingPattern Initializer
+ *
+ * VariableDeclarationNoIn :
+ * BindingIdentifier InitializerNoInopt
+ * BindingPattern InitializerNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseVariableDeclaration(parser, context, isConst) {
+ const pos = getLocation(parser);
+ const isBindingPattern = (parser.token & 8388608 /* IsBindingPattern */) !== 0;
+ const id = parseBindingIdentifierOrPattern(parser, context);
+ let init = null;
+ if (consume(parser, context | exports.Context.DisallowEscapedKeyword, 83886109 /* Assign */)) {
+ init = parseExpressionCoverGrammar(parser, context & ~(exports.Context.BlockScope | exports.Context.ForStatement), parseAssignmentExpression);
+ if (isInOrOf(parser.token) && (context & exports.Context.ForStatement || isBindingPattern)) {
+ if (parser.token === 167786289 /* InKeyword */) {
+ // https://github.com/tc39/test262/blob/master/test/annexB/language/statements/for-in/strict-initializer.js
+ if (context & (exports.Context.BlockScope | exports.Context.Strict | exports.Context.Async) || isBindingPattern) {
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ }
+ else
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ // Note: Initializers are required for 'const' and binding patterns
+ }
+ else if (!isInOrOf(parser.token) && (isConst || isBindingPattern)) {
+ tolerant(parser, context, 24 /* DeclarationMissingInitializer */, isConst ? 'const' : 'destructuring');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclarator',
+ init,
+ id,
+ });
+ }
+ /**
+ * Parses variable declaration list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclarationList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseVariableDeclarationList(parser, context, isConst) {
+ const list = [parseVariableDeclaration(parser, context, isConst)];
+ while (consume(parser, context, 16777234 /* Comma */))
+ list.push(parseVariableDeclaration(parser, context, isConst));
+ if (context & exports.Context.ForStatement && isInOrOf(parser.token) && list.length !== 1) {
+ tolerant(parser, context, 26 /* ForInOfLoopMultiBindings */, tokenDesc(parser.token));
+ }
+ return list;
+ } + + // Statements
+ /**
+ * Parses statement list items
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementListItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseStatementListItem(parser, context) {
+ switch (parser.token) {
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionDeclaration(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassDeclaration(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetOrExpressionStatement(parser, context | exports.Context.AllowIn);
+ case 33566793 /* ConstKeyword */:
+ return parseVariableStatement(parser, context | exports.Context.BlockScope | exports.Context.AllowIn);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionDeclarationOrStatement(parser, context);
+ case 33566810 /* ImportKeyword */: {
+ if (context & exports.Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod)) {
+ return parseExpressionStatement(parser, context | exports.Context.AllowIn);
+ }
+ }
+ case 12371 /* ExportKeyword */:
+ if (context & exports.Context.Module) {
+ tolerant(parser, context, 34 /* ImportExportDeclAtTopLevel */, tokenDesc(parser.token));
+ }
+ default:
+ return parseStatement(parser, context | exports.Context.AllowSingleStatement);
+ }
+ }
+ /**
+ * Parses statements
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseStatement(parser, context) {
+ switch (parser.token) {
+ case 33566791 /* VarKeyword */:
+ return parseVariableStatement(parser, context | exports.Context.AllowIn);
+ case 17825809 /* Semicolon */:
+ return parseEmptyStatement(parser, context);
+ case 33566814 /* SwitchKeyword */:
+ return parseSwitchStatement(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseBlockStatement(parser, context);
+ case 12380 /* ReturnKeyword */:
+ return parseReturnStatement(parser, context);
+ case 12377 /* IfKeyword */:
+ return parseIfStatement(parser, context);
+ case 12369 /* DoKeyword */:
+ return parseDoWhileStatement(parser, context);
+ case 12386 /* WhileKeyword */:
+ return parseWhileStatement(parser, context);
+ case 12387 /* WithKeyword */:
+ return parseWithStatement(parser, context);
+ case 12362 /* BreakKeyword */:
+ return parseBreakStatement(parser, context);
+ case 12366 /* ContinueKeyword */:
+ return parseContinueStatement(parser, context);
+ case 12367 /* DebuggerKeyword */:
+ return parseDebuggerStatement(parser, context);
+ case 302002272 /* ThrowKeyword */:
+ return parseThrowStatement(parser, context);
+ case 12385 /* TryKeyword */:
+ return parseTryStatement(parser, context | exports.Context.DisallowEscapedKeyword);
+ case 12374 /* ForKeyword */:
+ return parseForStatement(parser, context | exports.Context.ForStatement);
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ tolerant(parser, context, 35 /* AsyncFunctionInSingleStatementContext */);
+ }
+ return parseExpressionOrLabelledStatement(parser, context | exports.Context.AllowSingleStatement);
+ case 33566808 /* FunctionKeyword */:
+ // V8
+ tolerant(parser, context, context & exports.Context.Strict ? 19 /* StrictFunction */ : 20 /* SloppyFunction */);
+ case 33566797 /* ClassKeyword */:
+ tolerant(parser, context, 21 /* ForbiddenAsStatement */, tokenDesc(parser.token));
+ default:
+ return parseExpressionOrLabelledStatement(parser, context);
+ }
+ }
+ /**
+ * Parses empty statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-EmptyStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseEmptyStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'EmptyStatement'
+ });
+ }
+ /**
+ * Parses the continue statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ContinueStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseContinueStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ // Appearing of continue without an IterationStatement leads to syntax error
+ if (!(parser.flags & (exports.Flags.InSwitchStatement | exports.Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, tokenDesc(parser.token));
+ }
+ let label = null;
+ if (!(parser.flags & exports.Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, true);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ContinueStatement',
+ label
+ });
+ }
+ /**
+ * Parses the break statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BreakStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBreakStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let label = null;
+ if (!(parser.flags & exports.Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, false);
+ }
+ else if (!(parser.flags & (exports.Flags.InSwitchStatement | exports.Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, 'break');
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'BreakStatement',
+ label
+ });
+ }
+ /**
+ * Parses the if statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-if-statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIfStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const consequent = parseConsequentOrAlternate(parser, context | exports.Context.DisallowEscapedKeyword);
+ const alternate = consume(parser, context, 12370 /* ElseKeyword */) ? parseConsequentOrAlternate(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'IfStatement',
+ test,
+ consequent,
+ alternate
+ });
+ }
+ /**
+ * Parse either consequent or alternate. Supports AnnexB.
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseConsequentOrAlternate(parser, context) {
+ return context & exports.Context.Strict || parser.token !== 33566808 /* FunctionKeyword */
+ ? parseStatement(parser, context & ~exports.Context.AllowSingleStatement)
+ : parseFunctionDeclaration(parser, context);
+ }
+ /**
+ * Parses the debugger statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DebuggerStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDebuggerStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'DebuggerStatement'
+ });
+ }
+ /**
+ * Parses try statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TryStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseTryStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const block = parseBlockStatement(parser, context);
+ const handler = parser.token === 12364 /* CatchKeyword */ ? parseCatchBlock(parser, context) : null;
+ const finalizer = consume(parser, context, 12373 /* FinallyKeyword */) ? parseBlockStatement(parser, context) : null;
+ if (!handler && !finalizer)
+ tolerant(parser, context, 79 /* NoCatchOrFinally */);
+ return finishNode(context, parser, pos, {
+ type: 'TryStatement',
+ block,
+ handler,
+ finalizer
+ });
+ }
+ /**
+ * Parses catch block
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Catch)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseCatchBlock(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let param = null;
+ if (consume(parser, context, 50331659 /* LeftParen */)) {
+ const params = [];
+ param = parseBindingIdentifierOrPattern(parser, context, params);
+ validateParams(parser, context, params);
+ expect(parser, context, 16 /* RightParen */);
+ }
+ const body = parseBlockStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'CatchClause',
+ param,
+ body
+ });
+ }
+ /**
+ * Parses throw statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ThrowStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseThrowStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 80 /* NewlineAfterThrow */);
+ const argument = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ThrowStatement',
+ argument
+ });
+ }
+ /**
+ * Parses expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExpressionStatement(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+ }
+ /**
+ * Parse directive node
+ *
+ * * @see [Link](https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDirective(parser, context) {
+ const pos = getLocation(parser);
+ const directive = parser.tokenRaw.slice(1, -1);
+ const expr = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr,
+ directive
+ });
+ }
+ /**
+ * Parses either expression or labelled statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LabelledStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExpressionOrLabelledStatement(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, token } = parser;
+ const expr = parseExpression(parser, (context & ~(exports.Context.AllowSingleStatement | exports.Context.AllowDecorator)) | exports.Context.AllowIn);
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */) && parser.token === 16777237 /* Colon */) {
+ // If within generator function bodies, we do it like this so we can throw an nice error message
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 57 /* YieldReservedKeyword */);
+ expect(parser, context, 16777237 /* Colon */, 83 /* LabelNoColon */);
+ if (hasLabel(parser, tokenValue))
+ tolerant(parser, context, 29 /* LabelRedeclaration */, tokenValue);
+ addLabel(parser, tokenValue);
+ const body = !(context & exports.Context.Strict) &&
+ context & exports.Context.AllowSingleStatement &&
+ parser.token === 33566808 /* FunctionKeyword */
+ ? parseFunctionDeclaration(parser, context)
+ : parseStatement(parser, context);
+ popLabel(parser, tokenValue);
+ return finishNode(context, parser, pos, {
+ type: 'LabeledStatement',
+ label: expr,
+ body
+ });
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+ }
+ /**
+ * Parses do while statement
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDoWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const body = parseIterationStatement(parser, context);
+ expect(parser, context, 12386 /* WhileKeyword */);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ consume(parser, context, 17825809 /* Semicolon */);
+ return finishNode(context, parser, pos, {
+ type: 'DoWhileStatement',
+ body,
+ test
+ });
+ }
+ /**
+ * Parses while statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-WhileStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'WhileStatement',
+ test,
+ body
+ });
+ }
+ /**
+ * Parses block statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BlockStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Block)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBlockStatement(parser, context) {
+ const pos = getLocation(parser);
+ const body = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body
+ });
+ }
+ /**
+ * Parses return statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ReturnStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseReturnStatement(parser, context) {
+ const pos = getLocation(parser);
+ if (!(context & (exports.Context.OptionsGlobalReturn | exports.Context.InFunctionBody))) {
+ tolerant(parser, context, 18 /* IllegalReturn */);
+ }
+ if (parser.flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const argument = !(parser.token & 1048576 /* ASI */) && !(parser.flags & exports.Flags.NewLine)
+ ? parseExpression(parser, (context & ~(exports.Context.InFunctionBody | exports.Context.AllowDecorator)) | exports.Context.AllowIn)
+ : null;
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ReturnStatement',
+ argument
+ });
+ }
+ /**
+ * Sets the necessary mutable parser flags. The parser flags will
+ * be unset after done parsing out the statements.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-IterationStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIterationStatement(parser, context) {
+ // Note: We are deviating from the original grammar here beauce the original grammar says that the
+ // 'iterationStatement' should return either'for', 'do' or 'while' statements. We are doing some
+ // bitfiddling before and after to modify the parser state before we let the 'parseStatement'
+ // return the mentioned statements (to match the original grammar).
+ const savedFlags = parser.flags;
+ parser.flags |= exports.Flags.InIterationStatement | exports.Flags.AllowDestructuring;
+ const body = parseStatement(parser, (context & ~exports.Context.AllowSingleStatement) | exports.Context.DisallowEscapedKeyword);
+ parser.flags = savedFlags;
+ return body;
+ }
+ /**
+ * Parses with statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-WithStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseWithStatement(parser, context) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 37 /* StrictModeWith */);
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const object = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseStatement(parser, context & ~exports.Context.AllowSingleStatement);
+ return finishNode(context, parser, pos, {
+ type: 'WithStatement',
+ object,
+ body
+ });
+ }
+ /**
+ * Parses switch statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SwitchStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSwitchStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const discriminant = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const cases = [];
+ const savedFlags = parser.flags;
+ parser.flags |= exports.Flags.InSwitchStatement;
+ let seenDefault = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ const clause = parseCaseOrDefaultClauses(parser, context);
+ cases.push(clause);
+ if (clause.test === null) {
+ if (seenDefault)
+ tolerant(parser, context, 33 /* MultipleDefaultsInSwitch */);
+ seenDefault = true;
+ }
+ }
+ parser.flags = savedFlags;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'SwitchStatement',
+ discriminant,
+ cases
+ });
+ }
+ /**
+ * Parses either default clause or case clauses
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CaseClauses)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DefaultClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseCaseOrDefaultClauses(parser, context) {
+ const pos = getLocation(parser);
+ let test = null;
+ if (consume(parser, context, 12363 /* CaseKeyword */)) {
+ test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ }
+ else {
+ expect(parser, context, 12368 /* DefaultKeyword */);
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ const consequent = [];
+ while (!isEndOfCaseOrDefaultClauses(parser)) {
+ consequent.push(parseStatementListItem(parser, context | exports.Context.AllowIn));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SwitchCase',
+ test,
+ consequent
+ });
+ }
+ /**
+ * Parses variable statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseVariableStatement(parser, context, shouldConsume = true) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const isConst = token === 33566793 /* ConstKeyword */;
+ nextToken(parser, context);
+ const declarations = parseVariableDeclarationList(parser, context, isConst);
+ // Only consume semicolons if not inside the 'ForStatement' production
+ if (shouldConsume)
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclaration',
+ kind: tokenDesc(token),
+ declarations
+ });
+ }
+ /**
+ * Parses either an lexical declaration (let) or an expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-let-and-const-declarations)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseLetOrExpressionStatement(parser, context, shouldConsume = true) {
+ return lookahead(parser, context, isLexical)
+ ? parseVariableStatement(parser, context | exports.Context.BlockScope, shouldConsume)
+ : parseExpressionOrLabelledStatement(parser, context);
+ }
+ /**
+ * Parses either async function declaration or statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionDeclarationOrStatement(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)
+ ? parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context)
+ : parseStatement(parser, context);
+ }
+ /**
+ * Parses either For, ForIn or ForOf statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-statement)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseForStatement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 12374 /* ForKeyword */);
+ const awaitToken = !!(context & exports.Context.Async && consume(parser, context, 34017389 /* AwaitKeyword */));
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 50331659 /* LeftParen */);
+ const { token } = parser;
+ let init = null;
+ let sequencePos = null;
+ let variableStatement = null;
+ let type = 'ForStatement';
+ let test = null;
+ let update = null;
+ let right;
+ if (token === 33566793 /* ConstKeyword */ || (token === 33574984 /* LetKeyword */ && lookahead(parser, context, isLexical))) {
+ variableStatement = parseVariableStatement(parser, (context & ~exports.Context.AllowIn) | exports.Context.BlockScope, false);
+ }
+ else if (token === 33566791 /* VarKeyword */) {
+ variableStatement = parseVariableStatement(parser, context & ~exports.Context.AllowIn, false);
+ }
+ else if (token !== 17825809 /* Semicolon */) {
+ sequencePos = getLocation(parser);
+ init = restoreExpressionCoverGrammar(parser, (context & ~exports.Context.AllowIn) | exports.Context.DisallowEscapedKeyword, parseAssignmentExpression);
+ }
+ if (consume(parser, context, 69746 /* OfKeyword */)) {
+ type = 'ForOfStatement';
+ if (init) {
+ if (!(parser.flags & exports.Flags.AllowDestructuring) || init.type === 'AssignmentExpression') {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ right = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ }
+ else if (consume(parser, context, 167786289 /* InKeyword */)) {
+ if (init) {
+ if (!(parser.flags & exports.Flags.AllowDestructuring))
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ type = 'ForInStatement';
+ right = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ }
+ else {
+ if (parser.token === 16777234 /* Comma */)
+ init = parseSequenceExpression(parser, context, init, sequencePos);
+ if (variableStatement)
+ init = variableStatement;
+ expect(parser, context, 17825809 /* Semicolon */);
+ test = parser.token !== 17825809 /* Semicolon */
+ ? parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn)
+ : null;
+ expect(parser, context, 17825809 /* Semicolon */);
+ update = parser.token !== 16 /* RightParen */
+ ? parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn)
+ : null;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, type === 'ForOfStatement'
+ ? {
+ type,
+ body,
+ left: init,
+ right,
+ await: awaitToken
+ }
+ : right
+ ? {
+ type: type,
+ body,
+ left: init,
+ right
+ }
+ : {
+ type: type,
+ body,
+ init,
+ test,
+ update
+ });
+ } + + // 15.2 Modules
+ /**
+ * Parse module item list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItemList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseModuleItemList(parser, context) {
+ // Prime the scanner
+ nextToken(parser, context);
+ const statements = [];
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ statements.push(parser.token === 33554435 /* StringLiteral */ ?
+ parseDirective(parser, context) :
+ parseModuleItem(parser, context | exports.Context.AllowIn));
+ }
+ return statements;
+ }
+ /**
+ * Parse module item
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseModuleItem(parser, context) {
+ switch (parser.token) {
+ // @decorator
+ case 120 /* At */:
+ return parseDecorators(parser, context);
+ // ExportDeclaration
+ case 12371 /* ExportKeyword */:
+ return parseExportDeclaration(parser, context);
+ // ImportDeclaration
+ case 33566810 /* ImportKeyword */:
+ // 'Dynamic Import' or meta property disallowed here
+ if (!(context & exports.Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod))) {
+ return parseImportDeclaration(parser, context);
+ }
+ // falls through
+ default:
+ return parseStatementListItem(parser, context);
+ }
+ }
+ /**
+ * Parse export declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ const specifiers = [];
+ let source = null;
+ let declaration = null;
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 12371 /* ExportKeyword */);
+ switch (parser.token) {
+ // export * FromClause ;
+ case 167774771 /* Multiply */:
+ return parseExportAllDeclaration(parser, context, pos);
+ case 12368 /* DefaultKeyword */:
+ return parseExportDefault(parser, context, pos);
+ case 41943052 /* LeftBrace */:
+ {
+ // export ExportClause FromClause ;
+ // export ExportClause ;
+ expect(parser, context, 41943052 /* LeftBrace */);
+ let hasReservedWord = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token !== 69743 /* GetKeyword */ && parser.token & 12288 /* Reserved */) {
+ hasReservedWord = true;
+ setPendingError(parser);
+ }
+ specifiers.push(parseNamedExportDeclaration(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 17825807 /* RightBrace */);
+ if (parser.token === 69745 /* FromKeyword */) {
+ source = parseModuleSpecifier(parser, context);
+ // The left hand side can't be a keyword where there is no
+ // 'from' keyword since it references a local binding.
+ }
+ else if (hasReservedWord)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ consumeSemicolon(parser, context);
+ break;
+ }
+ // export ClassDeclaration
+ case 33566797 /* ClassKeyword */:
+ declaration = (parseClassDeclaration(parser, context));
+ break;
+ // export LexicalDeclaration
+ case 33574984 /* LetKeyword */:
+ case 33566793 /* ConstKeyword */:
+ declaration = parseVariableStatement(parser, context | exports.Context.BlockScope);
+ break;
+ // export VariableDeclaration
+ case 33566791 /* VarKeyword */:
+ declaration = parseVariableStatement(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ declaration = parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context);
+ break;
+ }
+ // Falls through
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportNamedDeclaration',
+ source,
+ specifiers,
+ declaration,
+ });
+ }
+ /**
+ * Parse export all declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExportAllDeclaration(parser, context, pos) {
+ expect(parser, context, 167774771 /* Multiply */);
+ const source = parseModuleSpecifier(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExportAllDeclaration',
+ source,
+ });
+ }
+ /**
+ * Parse named export declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNamedExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ // ExportSpecifier :
+ // IdentifierName
+ // IdentifierName as IdentifierName
+ const local = parseIdentifierName(parser, context | exports.Context.DisallowEscapedKeyword, parser.token);
+ const exported = consume(parser, context, 167843947 /* AsKeyword */)
+ ? parseIdentifierName(parser, context, parser.token)
+ : local;
+ return finishNode(context, parser, pos, {
+ type: 'ExportSpecifier',
+ local,
+ exported,
+ });
+ }
+ /**
+ * Parse export default
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+ function parseExportDefault(parser, context, pos) {
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 12368 /* DefaultKeyword */);
+ let declaration;
+ switch (parser.token) {
+ // export default HoistableDeclaration[Default]
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context | exports.Context.RequireIdentifier);
+ break;
+ // export default ClassDeclaration[Default]
+ // export default @decl ClassDeclaration[Default]
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ declaration = parseClassDeclaration(parser, context & ~exports.Context.AllowIn | exports.Context.RequireIdentifier);
+ break;
+ // export default HoistableDeclaration[Default]
+ case 594028 /* AsyncKeyword */:
+ declaration = parseAsyncFunctionOrAssignmentExpression(parser, context | exports.Context.RequireIdentifier);
+ break;
+ default:
+ // export default [lookahead ∉ {function, class}] AssignmentExpression[In] ;
+ declaration = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportDefaultDeclaration',
+ declaration,
+ });
+ }
+ /**
+ * Parse import declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566810 /* ImportKeyword */);
+ let source;
+ let specifiers = [];
+ // 'import' ModuleSpecifier ';'
+ if (parser.token === 33554435 /* StringLiteral */) {
+ source = parseLiteral(parser, context);
+ }
+ else {
+ specifiers = parseImportClause(parser, context | exports.Context.DisallowEscapedKeyword);
+ source = parseModuleSpecifier(parser, context);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ImportDeclaration',
+ specifiers,
+ source,
+ });
+ }
+ /**
+ * Parse import clause
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportClause(parser, context) {
+ const specifiers = [];
+ switch (parser.token) {
+ // 'import' ModuleSpecifier ';'
+ case 33685505 /* Identifier */:
+ {
+ specifiers.push(parseImportDefaultSpecifier(parser, context));
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ switch (parser.token) {
+ // import a, * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ // import a, {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ default:
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ break;
+ }
+ // import {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ // import * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return specifiers;
+ }
+ /**
+ * Parse named imports
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NamedImports)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNamedImports(parser, context, specifiers) {
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ specifiers.push(parseImportSpecifier(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ }
+ /**
+ * Parse import specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportSpecifier(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const imported = parseIdentifierName(parser, context | exports.Context.DisallowEscapedKeyword, token);
+ let local;
+ if (consume(parser, context, 167843947 /* AsKeyword */)) {
+ local = parseBindingIdentifier(parser, context);
+ }
+ else {
+ // An import name that is a keyword is a syntax error if it is not followed
+ // by the keyword 'as'.
+ if (hasBit(token, 12288 /* Reserved */))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ if (hasBit(token, 4194304 /* IsEvalOrArguments */))
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ local = imported;
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ImportSpecifier',
+ local,
+ imported,
+ });
+ }
+ /**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NameSpaceImport)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNameSpaceImport(parser, context, specifiers) {
+ // NameSpaceImport:
+ // * as ImportedBinding
+ const pos = getLocation(parser);
+ expect(parser, context, 167774771 /* Multiply */);
+ expect(parser, context, 167843947 /* AsKeyword */, 82 /* AsAfterImportStart */);
+ const local = parseBindingIdentifier(parser, context);
+ specifiers.push(finishNode(context, parser, pos, {
+ type: 'ImportNamespaceSpecifier',
+ local,
+ }));
+ }
+ /**
+ * Parse module specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseModuleSpecifier(parser, context) {
+ // ModuleSpecifier :
+ // StringLiteral
+ expect(parser, context, 69745 /* FromKeyword */);
+ if (parser.token !== 33554435 /* StringLiteral */)
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseLiteral(parser, context);
+ }
+ /**
+ * Parse import default specifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportDefaultSpecifier(parser, context) {
+ return finishNode(context, parser, getLocation(parser), {
+ type: 'ImportDefaultSpecifier',
+ local: parseIdentifier(parser, context),
+ });
+ }
+ /**
+ * Parses either async function or assignment expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionOrAssignmentExpression(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context | exports.Context.RequireIdentifier) :
+ parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ } + + /**
+ * Creates the parser object
+ *
+ * @param source The source coode to parser
+ * @param sourceFile Optional source file info to be attached in every node
+ */
+ function createParser(source, sourceFile) {
+ return {
+ // The source code to parse
+ source,
+ // Source length
+ length: source.length,
+ // Current position
+ index: 0,
+ // Current line
+ line: 1,
+ // Current column
+ column: 0,
+ // Start position before current token
+ startIndex: 0,
+ // Start position column before current token
+ startColumn: 0,
+ // Start position line before current token
+ startLine: 1,
+ // End position after parsing after current token
+ lastIndex: 0,
+ // End column position after current token
+ lastColumn: 0,
+ // End line position after current token
+ lastLine: 0,
+ // Pending cover grammar errors
+ pendingExpressionError: undefined,
+ // Mutable parser flags. Allows destructuring by default.
+ flags: exports.Flags.AllowDestructuring,
+ // The tokens
+ token: 1048576 /* EndOfSource */,
+ // Misc
+ tokenRaw: '',
+ lastValue: 0,
+ comments: [],
+ sourceFile,
+ tokenRegExp: undefined,
+ tokenValue: undefined,
+ labelSet: undefined,
+ errorLocation: undefined,
+ errors: [],
+ };
+ }
+ /**
+ * Creating the parser
+ *
+ * @param source The source coode to parser
+ * @param options The parser options
+ * @param context Context masks
+ */
+ function parseSource(source, options, /*@internal*/ context) {
+ let sourceFile = '';
+ if (!!options) {
+ // The flag to enable module syntax support
+ if (options.module)
+ context |= exports.Context.Module;
+ // The flag to enable stage 3 support (ESNext)
+ if (options.next)
+ context |= exports.Context.OptionsNext;
+ // The flag to enable React JSX parsing
+ if (options.jsx)
+ context |= exports.Context.OptionsJSX;
+ // The flag to enable start and end offsets to each node
+ if (options.ranges)
+ context |= exports.Context.OptionsRanges;
+ // The flag to enable line/column location information to each node
+ if (options.loc)
+ context |= exports.Context.OptionsLoc;
+ // The flag to attach raw property to each literal node
+ if (options.raw)
+ context |= exports.Context.OptionsRaw;
+ // Attach raw property to each identifier node
+ if (options.rawIdentifier)
+ context |= exports.Context.OptionsRawidentifiers;
+ // The flag to allow return in the global scope
+ if (options.globalReturn)
+ context |= exports.Context.OptionsGlobalReturn;
+ // The flag to allow to skip shebang - '#'
+ if (options.skipShebang)
+ context |= exports.Context.OptionsShebang;
+ // Enable tolerant mode
+ if (options.tolerant)
+ context |= exports.Context.OptionsTolerant;
+ // Set to true to record the source file in every node's loc object when the loc option is set.
+ if (!!options.source)
+ sourceFile = options.source;
+ // Create a top-level comments array containing all comments
+ if (!!options.comments)
+ context |= exports.Context.OptionsComments;
+ // The flag to enable implied strict mode
+ if (options.impliedStrict)
+ context |= exports.Context.Strict;
+ // The flag to enable experimental features
+ if (options.experimental)
+ context |= exports.Context.OptionsExperimental;
+ // The flag to set to bypass methods in Node
+ if (options.node)
+ context |= exports.Context.OptionsNode;
+ // Accepts a callback function to be invoked for each syntax node (as the node is constructed)
+ }
+ const parser = createParser(source, sourceFile);
+ const body = context & exports.Context.Module ?
+ parseModuleItemList(parser, context) :
+ parseStatementList(parser, context);
+ const node = {
+ type: 'Program',
+ sourceType: context & exports.Context.Module ? 'module' : 'script',
+ body: body,
+ };
+ if (context & exports.Context.LocationTracker) {
+ if (context & exports.Context.OptionsRanges) {
+ node.start = 0;
+ node.end = source.length;
+ }
+ if (context & exports.Context.OptionsLoc) {
+ node.loc = {
+ start: { line: 1, column: 0 },
+ end: { line: parser.line, column: parser.column
+ }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ if (context & exports.Context.OptionsComments)
+ node.comments = parser.comments;
+ if (context & exports.Context.OptionsTolerant)
+ node.errors = parser.errors;
+ return node;
+ }
+ /**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function parseStatementList(parser, context) {
+ const statements = [];
+ let hasProlog = true; // Parsing directive prologue.
+ // prime the scanner
+ nextToken(parser, context | exports.Context.DisallowEscapedKeyword);
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ if (hasProlog && parser.token !== 33554435 /* StringLiteral */)
+ hasProlog = false;
+ if (hasProlog) {
+ if (!(context & exports.Context.Strict) && parser.tokenRaw.length === 12 && parser.tokenValue === 'use strict') {
+ context |= exports.Context.Strict;
+ }
+ statements.push(parseDirective(parser, context));
+ }
+ else {
+ statements.push(parseStatementListItem(parser, context));
+ }
+ }
+ return statements;
+ }
+ /**
+ * Parse either script code or module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+ function parse(source, options) {
+ return options && options.module
+ ? parseModule(source, options)
+ : parseScript(source, options);
+ }
+ /**
+ * Parse script code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+ function parseScript(source, options) {
+ return parseSource(source, options, exports.Context.Empty);
+ }
+ /**
+ * Parse module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+ function parseModule(source, options) {
+ return parseSource(source, options, exports.Context.Strict | exports.Context.Module);
+ } + + + + var estree = /*#__PURE__*/Object.freeze({ + + }); + + + + var index = /*#__PURE__*/Object.freeze({ + scanIdentifier: scanIdentifier, + scanMaybeIdentifier: scanMaybeIdentifier, + scanHexIntegerLiteral: scanHexIntegerLiteral, + scanOctalOrBinary: scanOctalOrBinary, + scanImplicitOctalDigits: scanImplicitOctalDigits, + scanSignedInteger: scanSignedInteger, + scanNumericLiteral: scanNumericLiteral, + scanNumericSeparator: scanNumericSeparator, + scanDecimalDigitsOrSeparator: scanDecimalDigitsOrSeparator, + scanDecimalAsSmi: scanDecimalAsSmi, + scanRegularExpression: scanRegularExpression, + scan: scan, + scanEscapeSequence: scanEscapeSequence, + throwStringError: throwStringError, + scanString: scanString, + consumeTemplateBrace: consumeTemplateBrace, + scanTemplate: scanTemplate, + skipSingleHTMLComment: skipSingleHTMLComment, + skipSingleLineComment: skipSingleLineComment, + skipMultiLineComment: skipMultiLineComment, + addComment: addComment, + nextUnicodeChar: nextUnicodeChar, + isIdentifierPart: isIdentifierPart, + escapeInvalidCharacters: escapeInvalidCharacters, + consumeOpt: consumeOpt, + consumeLineFeed: consumeLineFeed, + scanPrivateName: scanPrivateName, + advanceNewline: advanceNewline, + fromCodePoint: fromCodePoint, + readNext: readNext, + toHex: toHex, + advanceOnMaybeAstral: advanceOnMaybeAstral + }); + + + + var parser = /*#__PURE__*/Object.freeze({ + parseClassDeclaration: parseClassDeclaration, + parseFunctionDeclaration: parseFunctionDeclaration, + parseAsyncFunctionOrAsyncGeneratorDeclaration: parseAsyncFunctionOrAsyncGeneratorDeclaration, + parseVariableDeclarationList: parseVariableDeclarationList, + parseExpression: parseExpression, + parseSequenceExpression: parseSequenceExpression, + parseAssignmentExpression: parseAssignmentExpression, + parseRestElement: parseRestElement, + parseLeftHandSideExpression: parseLeftHandSideExpression, + parsePrimaryExpression: parsePrimaryExpression, + parseIdentifier: parseIdentifier, + parseLiteral: parseLiteral, + parseBigIntLiteral: parseBigIntLiteral, + parseIdentifierName: parseIdentifierName, + parseFunctionExpression: parseFunctionExpression, + parseAsyncFunctionOrAsyncGeneratorExpression: parseAsyncFunctionOrAsyncGeneratorExpression, + parsePropertyName: parsePropertyName, + parseObjectLiteral: parseObjectLiteral, + parseFormalListAndBody: parseFormalListAndBody, + parseFunctionBody: parseFunctionBody, + parseFormalParameters: parseFormalParameters, + parseFormalParameterList: parseFormalParameterList, + parseClassBodyAndElementList: parseClassBodyAndElementList, + parseClassElement: parseClassElement, + parseDecorators: parseDecorators, + parseModuleItemList: parseModuleItemList, + parseModuleItem: parseModuleItem, + parseExportDeclaration: parseExportDeclaration, + parseImportDeclaration: parseImportDeclaration, + createParser: createParser, + parseSource: parseSource, + parseStatementList: parseStatementList, + parse: parse, + parseScript: parseScript, + parseModule: parseModule, + parseBindingIdentifierOrPattern: parseBindingIdentifierOrPattern, + parseBindingIdentifier: parseBindingIdentifier, + parseAssignmentRestElement: parseAssignmentRestElement, + parseAssignmentPattern: parseAssignmentPattern, + parseBindingInitializer: parseBindingInitializer, + parseStatementListItem: parseStatementListItem, + parseStatement: parseStatement, + parseEmptyStatement: parseEmptyStatement, + parseContinueStatement: parseContinueStatement, + parseBreakStatement: parseBreakStatement, + parseIfStatement: parseIfStatement, + parseDebuggerStatement: parseDebuggerStatement, + parseTryStatement: parseTryStatement, + parseCatchBlock: parseCatchBlock, + parseThrowStatement: parseThrowStatement, + parseExpressionStatement: parseExpressionStatement, + parseDirective: parseDirective, + parseExpressionOrLabelledStatement: parseExpressionOrLabelledStatement, + parseDoWhileStatement: parseDoWhileStatement, + parseWhileStatement: parseWhileStatement, + parseBlockStatement: parseBlockStatement, + parseReturnStatement: parseReturnStatement, + parseIterationStatement: parseIterationStatement, + parseWithStatement: parseWithStatement, + parseSwitchStatement: parseSwitchStatement, + parseCaseOrDefaultClauses: parseCaseOrDefaultClauses, + parseVariableStatement: parseVariableStatement, + parseJSXRootElement: parseJSXRootElement, + parseJSXOpeningElement: parseJSXOpeningElement, + nextJSXToken: nextJSXToken, + scanJSXToken: scanJSXToken, + parseJSXText: parseJSXText, + parseJSXAttributes: parseJSXAttributes, + parseJSXSpreadAttribute: parseJSXSpreadAttribute, + parseJSXNamespacedName: parseJSXNamespacedName, + parseJSXAttributeName: parseJSXAttributeName, + parseJSXAttribute: parseJSXAttribute, + parseJSXEmptyExpression: parseJSXEmptyExpression, + parseJSXSpreadChild: parseJSXSpreadChild, + parseJSXExpressionContainer: parseJSXExpressionContainer, + parseJSXExpression: parseJSXExpression, + parseJSXClosingFragment: parseJSXClosingFragment, + parseJSXClosingElement: parseJSXClosingElement, + parseJSXIdentifier: parseJSXIdentifier, + parseJSXMemberExpression: parseJSXMemberExpression, + parseJSXElementName: parseJSXElementName, + scanJSXIdentifier: scanJSXIdentifier + }); + + // tslint:disable-next-line:variable-name
+ const Parser = parser; + + const version = '1.6.9'; + + exports.version = version; + exports.ESTree = estree; + exports.Scanner = index; + exports.parse = parse; + exports.parseSource = parseSource; + exports.parseModule = parseModule; + exports.parseScript = parseScript; + exports.characterType = characterType; + exports.errorMessages = errorMessages; + exports.constructError = constructError; + exports.report = report; + exports.tolerant = tolerant; + exports.tokenDesc = tokenDesc; + exports.descKeyword = descKeyword; + exports.Parser = Parser; + exports.isValidIdentifierPart = isValidIdentifierPart; + exports.isValidIdentifierStart = isValidIdentifierStart; + exports.mustEscape = mustEscape; + exports.validateBreakOrContinueLabel = validateBreakOrContinueLabel; + exports.addLabel = addLabel; + exports.popLabel = popLabel; + exports.hasLabel = hasLabel; + exports.finishNode = finishNode; + exports.expect = expect; + exports.consume = consume; + exports.nextToken = nextToken; + exports.hasBit = hasBit; + exports.consumeSemicolon = consumeSemicolon; + exports.parseExpressionCoverGrammar = parseExpressionCoverGrammar; + exports.restoreExpressionCoverGrammar = restoreExpressionCoverGrammar; + exports.swapContext = swapContext; + exports.validateParams = validateParams; + exports.reinterpret = reinterpret; + exports.lookahead = lookahead; + exports.isValidSimpleAssignmentTarget = isValidSimpleAssignmentTarget; + exports.getLocation = getLocation; + exports.isValidIdentifier = isValidIdentifier; + exports.isLexical = isLexical; + exports.isEndOfCaseOrDefaultClauses = isEndOfCaseOrDefaultClauses; + exports.nextTokenIsLeftParenOrPeriod = nextTokenIsLeftParenOrPeriod; + exports.nextTokenisIdentifierOrParen = nextTokenisIdentifierOrParen; + exports.nextTokenIsLeftParen = nextTokenIsLeftParen; + exports.nextTokenIsFuncKeywordOnSameLine = nextTokenIsFuncKeywordOnSameLine; + exports.isPropertyWithPrivateFieldKey = isPropertyWithPrivateFieldKey; + exports.parseAndClassifyIdentifier = parseAndClassifyIdentifier; + exports.nameIsArgumentsOrEval = nameIsArgumentsOrEval; + exports.setPendingError = setPendingError; + exports.isEqualTagNames = isEqualTagNames; + exports.isInstanceField = isInstanceField; + exports.validateUpdateExpression = validateUpdateExpression; + exports.setPendingExpressionError = setPendingExpressionError; + exports.validateCoverParenthesizedExpression = validateCoverParenthesizedExpression; + exports.validateAsyncArgumentList = validateAsyncArgumentList; + exports.isInOrOf = isInOrOf; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}); diff --git a/node_modules/cherow/dist/amd/cherow.min.js b/node_modules/cherow/dist/amd/cherow.min.js new file mode 100644 index 0000000..219da9f --- /dev/null +++ b/node_modules/cherow/dist/amd/cherow.min.js @@ -0,0 +1 @@ +define("cherow",["exports"],function(e){"use strict";const t=["end of source","identifier","number","string","regular expression","false","true","null","template continuation","template end","=>","(","{",".","...","}",")",";",",","[","]",":","?","'",'"',"</","/>","++","--","=","<<=",">>=",">>>=","**=","+=","-=","*=","/=","%=","^=","|=","&=","typeof","delete","void","!","~","+","-","in","instanceof","*","%","/","**","&&","||","===","!==","==","!=","<=",">=","<",">","<<",">>",">>>","&","|","^","var","let","const","break","case","catch","class","continue","debugger","default","do","else","export","extends","finally","for","function","if","import","new","return","super","switch","this","throw","try","while","with","implements","interface","package","private","protected","public","static","yield","as","async","await","constructor","get","set","from","of","#","eval","arguments","enum","BigInt","@","JSXText","KeyOf","ReadOnly","is","unique","declare","type","namespace","abstract","module","global","require","target"];function n(e){return t[255&e]}const o=Object.create(null,{this:{value:33566815},function:{value:33566808},if:{value:12377},return:{value:12380},var:{value:33566791},else:{value:12370},for:{value:12374},new:{value:33566811},in:{value:167786289},typeof:{value:302002218},while:{value:12386},case:{value:12363},break:{value:12362},try:{value:12385},catch:{value:12364},delete:{value:302002219},throw:{value:302002272},switch:{value:33566814},continue:{value:12366},default:{value:12368},instanceof:{value:167786290},do:{value:12369},void:{value:302002220},finally:{value:12373},arguments:{value:37879925},keyof:{value:131194},readonly:{value:131195},unique:{value:131197},declare:{value:131198},async:{value:594028},await:{value:34017389},class:{value:33566797},const:{value:33566793},constructor:{value:69742},debugger:{value:12367},enum:{value:12406},eval:{value:37879924},export:{value:12371},extends:{value:12372},false:{value:33566725},from:{value:69745},get:{value:69743},implements:{value:20579},import:{value:33566810},interface:{value:20580},let:{value:33574984},null:{value:33566727},of:{value:69746},package:{value:20581},private:{value:20582},protected:{value:20583},public:{value:20584},set:{value:69744},static:{value:20585},super:{value:33566813},true:{value:33566726},with:{value:12387},yield:{value:1107316842},is:{value:131196},type:{value:131199},namespace:{value:131200},abstract:{value:131201},as:{value:167843947},module:{value:131202},global:{value:131203},require:{value:131204},target:{value:131205}});function r(e){return 0|o[e]}const a=[0,0,0,0,0,0,0,0,0,16,48,16,16,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0];function s(e){return 0!=(1&l[0+(e>>>5)]>>>e)}function i(e){return 0!=(1&l[34816+(e>>>5)]>>>e)}function c(e){return 0!=(1&l[69632+(e>>>5)]>>>e)}const l=((e,t)=>{const n=new Uint32Array(104448);let o=0,r=0;for(;o<3392;){const a=e[o++];if(a<0)r-=a;else{let s=e[o++];2&a&&(s=t[s]),1&a?n.fill(s,r,r+=e[o++]):n[r++]=s}}return n})([-1,2,28,2,29,2,5,-1,0,77595648,3,46,2,3,0,14,2,57,2,58,3,0,3,0,3168796671,0,4294956992,2,1,2,0,2,59,3,0,4,0,4294966523,3,0,4,2,15,2,60,2,0,0,4294836735,0,3221225471,0,4294901942,2,61,0,134152192,3,0,2,0,4294951935,3,0,2,0,2683305983,0,2684354047,2,17,2,0,0,4294961151,3,0,2,2,20,2,0,0,608174079,2,0,2,127,2,6,2,62,-1,2,64,2,26,2,1,3,0,3,0,4294901711,2,40,0,4089839103,0,2961209759,0,1342439375,0,4294543342,0,3547201023,0,1577204103,0,4194240,0,4294688750,2,2,0,80831,0,4261478351,0,4294549486,2,2,0,2965387679,0,196559,0,3594373100,0,3288319768,0,8469959,2,171,0,4294828031,0,3825204735,0,123747807,0,65487,2,3,0,4092591615,0,1080049119,0,458703,2,3,2,0,0,2163244511,0,4227923919,0,4236247020,2,68,0,4284449919,0,851904,2,4,2,16,0,67076095,-1,2,69,0,1006628014,0,4093591391,-1,0,50331649,0,3265266687,2,34,0,4294844415,0,4278190047,2,23,2,125,-1,3,0,2,2,33,2,0,2,9,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,10,0,261632,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,2088959,2,31,2,8,0,909311,3,0,2,0,814743551,2,42,0,67057664,3,0,2,2,45,2,0,2,32,2,0,2,18,2,7,0,268374015,2,30,2,51,2,0,2,78,0,134153215,-1,2,6,2,0,2,7,0,2684354559,0,67044351,0,1073676416,-2,3,0,2,2,43,0,1046528,3,0,3,2,8,2,0,2,41,0,4294960127,2,9,2,39,2,10,0,4294377472,2,21,3,0,7,0,4227858431,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-1,2,122,0,1048577,2,84,2,12,-1,2,12,0,131042,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,1046559,2,0,2,13,2,0,0,2147516671,2,24,3,88,2,2,0,-16,2,89,0,524222462,2,4,2,0,0,4269801471,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,2,119,2,0,0,3220242431,3,0,3,2,20,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,2,0,2,27,2,0,2,8,3,0,2,0,67043391,0,3909091327,2,0,2,25,2,8,2,23,3,0,2,0,67076097,2,7,2,0,2,24,0,67059711,0,4236247039,3,0,2,0,939524103,0,8191999,2,97,2,98,2,14,2,95,3,0,3,0,67057663,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,3774349439,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,2,19,0,1638399,2,169,2,104,3,0,3,2,23,2,28,2,29,2,5,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-3,2,146,-4,2,23,2,0,2,37,0,1,2,0,2,63,2,32,2,16,2,9,2,0,2,109,-1,3,0,4,2,9,2,33,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277137519,0,2269118463,-1,3,23,2,-1,2,34,2,38,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,48,-14,2,23,2,44,2,37,-5,3,0,2,2,38,0,2147549120,2,0,2,16,2,17,2,130,2,0,2,52,0,4294901872,0,5242879,3,0,2,0,402595359,-1,2,118,0,1090519039,-2,2,120,2,39,2,0,2,55,2,40,0,4226678271,0,3766565279,0,2039759,-4,3,0,2,0,1140787199,-1,3,0,2,0,67043519,-5,2,0,0,4282384383,0,1056964609,-1,3,0,2,0,67043345,-1,2,0,2,41,2,42,-1,2,10,2,43,-6,2,0,2,16,-3,3,0,2,0,2147484671,-8,2,0,2,7,2,44,2,0,0,603979727,-1,2,0,2,45,-8,2,54,2,46,0,67043329,2,123,2,47,0,8388351,-2,2,124,0,3028287487,2,48,2,126,0,33259519,2,42,-9,2,24,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,2,42,-2,2,17,2,51,2,0,2,24,0,67043343,2,128,2,19,-21,3,0,2,-4,3,0,2,0,4294901791,2,7,2,164,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,0,1677656575,-166,0,4161266656,0,4071,0,15360,-4,0,28,-13,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,0,4294954999,2,0,-16,2,0,2,90,2,0,0,2105343,0,4160749584,0,65534,-42,0,4194303871,0,2011,-62,3,0,6,0,8323103,-1,3,0,2,2,55,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-22583,3,0,7,2,19,-6130,3,5,2,-1,0,69207040,3,46,2,3,0,14,2,57,2,58,-3,0,3168731136,0,4294956864,2,1,2,0,2,59,3,0,4,0,4294966275,3,0,4,2,15,2,60,2,0,2,35,-1,2,17,2,61,-1,2,0,2,62,0,4294885376,3,0,2,0,3145727,0,2617294944,0,4294770688,2,19,2,63,3,0,2,0,131135,2,94,0,70256639,0,71303167,0,272,2,45,2,62,-1,2,64,-2,2,96,0,603979775,0,4278255616,0,4294836227,0,4294549473,0,600178175,0,2952806400,0,268632067,0,4294543328,0,57540095,0,1577058304,0,1835008,0,4294688736,2,65,2,66,0,33554435,2,121,2,65,2,147,0,131075,0,3594373096,0,67094296,2,66,-1,2,67,0,603979263,2,156,0,3,0,4294828001,0,602930687,2,180,0,393219,2,67,0,671088639,0,2154840064,0,4227858435,0,4236247008,2,68,2,38,-1,2,4,0,917503,2,38,-1,2,69,0,537783470,0,4026531935,-1,0,1,-1,2,34,2,70,0,7936,-3,2,0,0,2147485695,0,1010761728,0,4292984930,0,16387,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,16,-1,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,253951,3,20,2,0,122879,2,0,2,8,0,276824064,-2,3,0,2,2,45,2,0,0,4294903295,2,0,2,18,2,7,-1,2,17,2,51,2,0,2,78,2,42,-1,2,24,2,0,2,31,-2,0,128,-2,2,79,2,8,0,4064,-1,2,117,0,4227907585,2,0,2,116,2,0,2,50,2,196,2,9,2,39,2,10,-1,0,6544896,3,0,6,-2,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-3,2,84,2,12,-3,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,817183,2,0,2,13,2,0,0,33023,2,24,3,88,2,-17,2,89,0,524157950,2,4,2,0,2,90,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,0,3072,2,0,0,2147516415,2,9,3,0,2,2,19,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,0,4294965179,0,7,2,0,2,8,2,92,2,8,-1,0,1761345536,2,94,2,95,2,38,2,23,2,96,2,36,2,162,0,2080440287,2,0,2,35,2,138,0,3296722943,2,0,0,1046675455,0,939524101,0,1837055,2,97,2,98,2,14,2,95,3,0,3,0,7,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,2700607615,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,-3,2,104,3,0,3,2,23,-1,3,5,2,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-8,2,23,2,0,2,37,-1,2,0,2,63,2,32,2,18,2,9,2,0,2,109,-1,3,0,4,2,9,2,17,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277075969,2,18,-1,3,23,2,-1,2,34,2,139,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,50,-14,2,23,2,44,2,116,-5,2,117,2,41,-2,2,117,2,19,2,17,2,35,2,117,2,38,0,4294901776,0,4718591,2,117,2,36,0,335544350,-1,2,118,2,119,-2,2,120,2,39,2,7,-1,2,121,2,65,0,3758161920,0,3,-4,2,0,2,31,2,174,-1,2,0,2,19,0,176,-5,2,0,2,49,2,182,-1,2,0,2,19,2,194,-1,2,0,2,62,-2,2,16,-7,2,0,2,119,-3,3,0,2,2,122,-8,0,4294965249,0,67633151,0,4026597376,2,0,0,536871887,-1,2,0,2,45,-8,2,54,2,49,0,1,2,123,2,19,-3,2,124,2,37,2,125,2,126,0,16778239,-10,2,36,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,-3,2,17,2,127,2,0,2,19,2,50,2,128,2,19,-21,3,0,2,-4,3,0,2,0,65567,-1,2,26,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,2,130,-187,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,2,138,-129,3,0,6,2,139,-1,3,0,2,2,50,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-28719,2,0,0,1,-1,2,122,2,0,0,8193,-21,0,50331648,0,10255,0,4,-11,2,66,2,168,-1,0,71680,-1,2,157,0,4292900864,0,805306431,-5,2,146,-1,2,176,-1,0,6144,-2,2,123,-1,2,150,-1,2,153,2,147,2,161,2,0,0,3223322624,2,36,0,4,-4,2,188,0,205128192,0,1333757536,0,2147483696,0,423953,0,747766272,0,2717763192,0,4286578751,0,278545,2,148,0,4294886464,0,33292336,0,417809,2,148,0,1329579616,0,4278190128,0,700594195,0,1006647527,0,4286497336,0,4160749631,2,149,0,469762560,0,4171219488,0,16711728,2,149,0,202375680,0,3214918176,0,4294508592,0,139280,-1,0,983584,2,190,0,58720275,0,3489923072,0,10517376,0,4293066815,0,1,0,2013265920,2,175,2,0,0,17816169,0,3288339281,0,201375904,2,0,-2,0,256,0,122880,0,16777216,2,146,0,4160757760,2,0,-6,2,163,-11,0,3263218176,-1,0,49664,0,2160197632,0,8388802,-1,0,12713984,-1,2,150,2,155,2,158,-2,2,159,-20,0,3758096385,-2,2,151,0,4292878336,2,22,2,166,0,4294057984,-2,2,160,2,152,2,172,-2,2,151,-1,2,179,-1,2,167,2,122,0,4026593280,0,14,0,4292919296,-1,2,154,0,939588608,-1,0,805306368,-1,2,122,0,1610612736,2,152,2,153,3,0,2,-2,2,154,2,155,-3,0,267386880,-1,2,156,0,7168,-1,0,65024,2,150,2,157,2,158,-7,2,165,-8,2,159,-1,0,1426112704,2,160,-1,2,185,0,271581216,0,2149777408,2,19,2,157,2,122,0,851967,0,3758129152,-1,2,19,2,178,-4,2,154,-20,2,192,2,161,-56,0,3145728,2,184,-1,2,191,2,122,-1,2,162,2,122,-4,0,32505856,-1,2,163,-1,0,2147385088,2,22,1,2155905152,2,-3,2,164,2,0,2,165,-2,2,166,-6,2,167,0,4026597375,0,1,-1,0,1,-1,2,168,-3,2,139,2,66,-2,2,162,2,177,-1,2,173,2,122,-6,2,122,-213,2,167,-657,2,17,-36,2,169,-1,2,186,-10,0,4294963200,-5,2,170,-5,2,158,2,0,2,24,-1,0,4227919872,-1,2,170,-2,0,4227874752,-3,0,2146435072,2,155,-2,0,1006649344,2,122,-1,2,22,0,201375744,-3,0,134217720,2,22,0,4286677377,0,32896,-1,2,171,-3,2,172,-349,2,173,2,174,2,175,3,0,264,-11,2,176,-2,2,158,2,0,0,520617856,0,2692743168,0,36,-3,0,524284,-11,2,19,-1,2,183,-1,2,181,0,3221291007,2,158,-1,0,524288,0,2158720,-3,2,155,0,1,-4,2,122,0,3808625411,0,3489628288,0,4096,0,1207959680,0,3221274624,2,0,-3,2,177,0,120,0,7340032,-2,0,4026564608,2,4,2,19,2,160,3,0,4,2,155,-1,2,178,2,175,-1,0,8176,2,179,2,177,2,180,-1,0,4290773232,2,0,-4,2,160,2,187,0,15728640,2,175,-1,2,157,-1,0,4294934512,3,0,4,-9,2,22,2,167,2,181,3,0,4,0,704,0,1849688064,0,4194304,-1,2,122,0,4294901887,2,0,0,130547712,0,1879048192,0,2080374784,3,0,2,-1,2,182,2,183,-1,0,17829776,0,2025848832,0,4261477888,-2,2,0,-1,0,4286580608,-1,0,29360128,2,184,0,16252928,0,3791388672,2,39,3,0,2,-2,2,193,2,0,-1,2,26,-1,0,66584576,-1,2,189,3,0,9,2,122,3,0,4,-1,2,157,2,158,3,0,5,-2,0,245760,0,2147418112,-1,2,146,2,199,0,4227923456,-1,2,185,2,186,2,22,-2,2,176,0,4292870145,0,262144,2,122,3,0,2,0,1073758848,2,187,-1,0,4227921920,2,188,0,68289024,0,528402016,0,4292927536,3,0,4,-2,0,2483027968,2,0,-2,2,189,3,0,5,-1,2,184,2,160,2,0,-2,0,4227923936,2,63,-1,2,170,2,94,2,0,2,150,2,154,3,0,6,-1,2,175,3,0,3,-2,0,2146959360,3,0,8,-2,2,157,-1,2,190,2,117,-1,2,151,3,0,8,2,191,0,8388608,2,171,2,169,2,183,0,4286578944,3,0,2,0,1152,0,1266679808,2,189,0,576,0,4261707776,2,94,3,0,9,2,151,3,0,8,-28,2,158,3,0,3,-3,0,4292902912,-6,2,96,3,0,85,-33,2,164,3,0,126,-18,2,192,3,0,269,-17,2,151,2,122,0,4294917120,3,0,2,2,19,0,4290822144,-2,0,67174336,0,520093700,2,17,3,0,21,-2,2,177,3,0,3,-2,0,65504,2,122,2,49,3,0,2,2,92,-191,2,123,-23,2,26,3,0,296,-8,2,122,3,0,2,2,19,-11,2,175,3,0,72,-3,0,3758159872,0,201391616,3,0,155,-7,2,167,-1,0,384,-1,0,133693440,-3,2,193,-2,2,30,3,0,4,2,166,-2,2,22,2,151,3,0,4,-2,2,185,-1,2,146,0,335552923,2,194,-1,0,538974272,0,2214592512,0,132e3,-10,0,192,-8,0,12288,-21,0,134213632,0,4294901761,3,0,42,0,100663424,0,4294965284,3,0,62,-6,0,4286578784,2,0,-2,0,1006696448,3,0,24,2,37,-1,2,195,3,0,10,2,194,0,4110942569,0,1432950139,0,2701658217,0,4026532864,0,4026532881,2,0,2,47,3,0,8,-1,2,154,-2,2,166,0,98304,0,65537,2,167,2,169,-2,2,154,-1,2,63,2,0,2,116,2,197,2,175,0,4294770176,2,30,3,0,4,-30,2,195,2,196,-3,2,166,-2,2,151,2,0,2,154,-1,2,189,-1,2,157,2,198,3,0,2,2,154,2,122,-1,0,193331200,-1,0,4227923960,2,197,-1,3,0,3,2,198,3,0,44,-1334,2,22,2,0,-129,2,195,-6,2,160,-180,2,199,-233,2,4,3,0,96,-16,2,160,3,0,22583,-7,2,17,3,0,6128],[4294967295,4294967291,4092460543,4294828015,4294967294,134217726,268435455,2147483647,1048575,1073741823,3892314111,1061158911,536805376,4294910143,4160749567,4294901759,134217727,4294901760,4194303,65535,262143,67108863,4286578688,536870911,8388607,4294918143,4294443008,255,67043328,2281701374,4294967232,2097151,4294903807,4294902783,4294967039,511,524287,131071,127,4294902271,4294549487,16777215,1023,67047423,4294901888,33554431,4286578687,4294770687,67043583,32767,15,2047999,4292870143,4294934527,4294966783,67045375,4294967279,262083,20511,4290772991,41943039,493567,2047,4294959104,1071644671,602799615,65536,4294828e3,805044223,4277151126,8191,1031749119,4294917631,2134769663,4286578493,4282253311,4294942719,33540095,4294905855,4294967264,2868854591,1608515583,265232348,534519807,2147614720,1060109444,4093640016,17376,2139062143,224,4169138175,4294909951,4294967292,4294965759,4294966272,4294901823,4294967280,8289918,4294934399,4294901775,4294965375,1602223615,4294967259,268369920,4292804608,486341884,4294963199,3087007615,1073692671,4128527,4279238655,4294902015,4294966591,2445279231,3670015,3238002687,63,4294967288,4294705151,4095,3221208447,4294549472,2147483648,4294705152,4294966143,64,4294966719,16383,3774873592,536807423,67043839,3758096383,3959414372,3755993023,2080374783,4294835295,4294967103,4160749565,4087,31,184024726,2862017156,1593309078,268434431,268434414,4294901763,536870912,2952790016,202506752,139264,402653184,4261412864,4227922944,2147532800,61440,3758096384,117440512,65280,4227858432,3233808384,3221225472,4294965248,32768,57152,4294934528,67108864,4293918720,4290772992,25165824,57344,4278190080,65472,4227907584,65520,1920,4026531840,49152,4160749568,4294836224,63488,1073741824,4294967040,251658240,196608,12582912,2097152,65408,64512,417808,4227923712,48,512,4294967168,4294966784,16,4292870144,4227915776,65528,4294950912,65532]);function u(e){const{index:t}=e,n=e.source.charCodeAt(t);if(n<55296||n>56319)return n;const o=e.source.charCodeAt(t+1);return o<56320||o>57343?n:65536+((1023&n)<<10)|1023&o}const d=e=>0!=(1&a[e])||s(e);function p(e){switch(e){case 0:return"\\0";case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:return c(e)?e<16?`\\x0${e.toString(16)}`:e<256?`\\x${e.toString(16)}`:e<4096?`\\u0${e.toString(16)}`:e<65536?`\\u${e.toString(16)}`:`\\u{${e.toString(16)}}`:S(e)}}function x(e,t){return e.source.charCodeAt(e.index)===t&&(e.index++,e.column++,!0)}function f(t,n){t.flags|=e.Flags.NewLine,t.index++,0==(n&e.ScannerState.LastIsCR)&&(t.column=0,t.line++)}function m(t,o){return o&e.Context.InClass&&i(t.source.charCodeAt(t.index))||an(t,1,n(t.token)),115}function g(t){t.flags|=e.Flags.NewLine,t.index++,t.column=0,t.line++}const S=e=>e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023));function C(e){return e.index++,e.column++,e.index>=e.source.length&&an(e,14),u(e)}function k(e){return e<48?-1:e<=57?e-48:e<65?-1:e<=70?e-65+10:e<97?-1:e<=102?e-97+10:-1}function w(e,t){e.index++,e.column++,t>65535&&e.index++}function y(t,n,o){switch(o){case 98:return 8;case 102:return 12;case 114:return 13;case 110:return 10;case 116:return 9;case 118:return 11;case 13:case 10:case 8232:case 8233:return t.column=-1,t.line++,e.Escape.Empty;case 48:case 49:case 50:case 51:{let r=o-48,a=t.index+1,s=t.column+1,i=t.source.charCodeAt(a);if(i<48||i>55){if(0!==r||56===i||57===i){if(n&e.Context.Strict)return e.Escape.StrictOctal;t.flags|=e.Flags.HasOctal}}else{if(n&e.Context.Strict)return e.Escape.StrictOctal;t.flags|=e.Flags.HasOctal,t.lastValue=i,r=8*r+(i-48),a++,s++,(i=t.source.charCodeAt(a))>=48&&i<=55&&(t.lastValue=i,r=8*r+(i-48),a++,s++),t.index=a-1,t.column=s-1}return r}case 52:case 53:case 54:case 55:{if(n&e.Context.Strict)return e.Escape.StrictOctal;let r=o-48;const a=t.index+1,s=t.column+1,i=t.source.charCodeAt(a);return i>=48&&i<=55&&(r=8*r+(i-48),t.lastValue=i,t.index=a,t.column=s),r}case 56:case 57:return e.Escape.EightOrNine;case 120:{const n=k(t.lastValue=C(t));if(n<0)return e.Escape.InvalidHex;const o=k(t.lastValue=C(t));return o<0?e.Escape.InvalidHex:n<<4|o}case 117:{let n=t.lastValue=C(t);if(123===n){let o=k(n=t.lastValue=C(t));if(o<0)return e.Escape.InvalidHex;for(n=t.lastValue=C(t);125!==n;){const r=k(n);if(r<0)return e.Escape.InvalidHex;if((o=16*o+r)>1114111)return e.Escape.OutOfRange;n=t.lastValue=C(t)}return o}{let o=k(n);if(o<0)return e.Escape.InvalidHex;for(let r=0;r<3;r++){const r=k(n=t.lastValue=C(t));if(r<0)return e.Escape.InvalidHex;o=16*o+r}return o}}default:return t.source.charCodeAt(t.index)}}function h(t,n,o){switch(o){case e.Escape.Empty:return;case e.Escape.StrictOctal:an(t,n&e.Context.TaggedTemplate?76:11);case e.Escape.EightOrNine:an(t,13);case e.Escape.InvalidHex:an(t,75,"hexadecimal");case e.Escape.OutOfRange:an(t,14)}}function A(e,t,n){const{index:o,lastValue:r}=e;let a="";e.index++,e.column++;let s=e.source.charCodeAt(e.index);for(;s!==n;){switch(s){case 13:case 10:an(e,6);case 92:if((s=C(e))>128)a+=S(s);else{e.lastValue=s;const n=y(e,t,s);n>=0?a+=S(n):h(e,t,n),s=e.lastValue}break;default:a+=S(s)}s=C(e)}return e.index++,e.column++,e.tokenRaw=e.source.slice(o,e.index),e.tokenValue=a,e.lastValue=r,33554435}function b(e,t){return e.index>=e.length&&an(e,9),e.index--,e.column--,E(e,t)}function E(t,n){const{index:o,lastValue:r}=t;let a=!0,s="",i=C(t);e:for(;96!==i;){switch(i){case 36:{const e=t.index+1;if(e<t.length&&123===t.source.charCodeAt(e)){t.index=e,t.column++,a=!1;break e}s+="$";break}case 92:if((i=C(t))>=128)s+=S(i);else{t.lastValue=i;const o=y(t,n|e.Context.Strict,i);if(o>=0)s+=S(o);else{if(o!==e.Escape.Empty&&n&e.Context.TaggedTemplate){s=void 0,(i=I(t,t.lastValue))<0&&(a=!1);break e}h(t,n|e.Context.TaggedTemplate,o)}i=t.lastValue}break;case 13:case 10:case 8232:case 8233:t.column=-1,t.line++;default:null!=s&&(s+=S(i))}i=C(t)}return t.index++,t.column++,t.tokenValue=s,t.lastValue=r,a?(t.tokenRaw=t.source.slice(o+1,t.index-1),33554441):(t.tokenRaw=t.source.slice(o+1,t.index-2),33554440)}function I(e,t){for(;96!==t;){if(36===t&&123===e.source.charCodeAt(e.index+1))return e.index++,e.column++,-t;t=C(e)}return t}function O(t,n){t.index++,t.column++;let o=e.NumericState.None,r=k(t.source.charCodeAt(t.index));for(r<0&&an(t,0),t.index++,t.column++;t.index<t.length;){const a=t.source.charCodeAt(t.index);if(n&e.Context.OptionsNext&&95===a){o=R(t,o);continue}o&=~e.NumericState.SeenSeparator;const s=k(a);if(s<0)break;r=16*r+s,t.index++,t.column++}return o&e.NumericState.SeenSeparator&&an(t,59),M(t,n,r,x(t,110))}function v(t,n,o){t.index++,t.column++;let r,a=0,s=0,i=e.NumericState.None;for(;t.index<t.length;){if(r=t.source.charCodeAt(t.index),n&e.Context.OptionsNext&&95===r){i=R(t,i);continue}i&=~e.NumericState.SeenSeparator;const c=r-48;if(!(r>=48&&r<=57)||c>=o)break;s=s*o+c,t.index++,t.column++,a++}return 0===a&&an(t,0),i&e.NumericState.SeenSeparator&&an(t,59),M(t,n,s,x(t,110))}function F(t,n){switch(t.source.charCodeAt(t.index)){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:{n&e.Context.Strict&&an(t,0);let o=t.index,r=t.column,a=0;for(t.flags|=e.Flags.HasOctal;o<t.length;){const e=t.source.charCodeAt(o);if(95===e)an(t,60);else{if(e<48||e>55)return L(t,n);a=8*a+(e-48),o++,r++}}return t.index=o,t.column=r,M(t,n,a,x(t,110))}case 56:case 57:t.flags|=e.Flags.HasOctal;default:return n&e.Context.OptionsNext&&95===t.source.charCodeAt(t.index)&&an(t,60),L(t,n)}}function N(e,t){let n=e.source.charCodeAt(e.index);43!==n&&45!==n||(e.index++,e.column++,n=e.source.charCodeAt(e.index)),n>=48&&n<=57||an(e,0);const o=e.index,r=D(e);return e.source.substring(t,o)+r}function L(t,n,o=e.NumericState.None){let r=o&e.NumericState.Float?0:P(t,n);const a=t.source.charCodeAt(t.index);if(46!==a&&95!==a&&!i(a))return M(t,n,r);x(t,46)&&(n&e.Context.OptionsNext&&95===t.source.charCodeAt(t.index)&&an(t,60),o|=e.NumericState.Float,r=`${r}.${D(t)}`);const s=t.index;return x(t,110)&&(o&e.NumericState.Float&&an(t,0),o|=e.NumericState.BigInt),(x(t,101)||x(t,69))&&(o|=e.NumericState.Float,r+=N(t,s)),i(t.source.charCodeAt(t.index))&&an(t,0),M(t,n,o&e.NumericState.Float?parseFloat(r):parseInt(r,10),!!(o&e.NumericState.BigInt))}function R(t,n){return t.index++,t.column++,n&e.NumericState.SeenSeparator&&an(t,59),n|=e.NumericState.SeenSeparator}function D(t){let n=t.index,o=e.NumericState.None,r="";e:for(;t.index<t.length;)switch(t.source.charCodeAt(t.index)){case 95:const a=t.index;o=R(t,o),r+=t.source.substring(n,a),n=t.index;continue;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:o&=~e.NumericState.SeenSeparator,t.index++,t.column++;break;default:break e}return o&e.NumericState.SeenSeparator&&an(t,59),r+t.source.substring(n,t.index)}function P(t,n){let o=e.NumericState.None,r=0,a=t.source.charCodeAt(t.index);for(;a>=48&&a<=57||95===a;)n&e.Context.OptionsNext&&95===a?(o=R(t,o),a=t.source.charCodeAt(t.index)):(o&=~e.NumericState.SeenSeparator,r=10*r+(a-48),t.index++,t.column++,a=t.source.charCodeAt(t.index));return o&e.NumericState.SeenSeparator&&an(t,59),r}function M(t,n,o,r=!1){return t.tokenValue=o,n&e.Context.OptionsRaw&&(t.tokenRaw=t.source.slice(t.startIndex,t.index)),r?33554551:33554434}function j(t,n,o){let a=t.index,s="",i=!1;o&&w(t,o);e:for(;t.index<t.length;){const e=t.index;let n=t.source.charCodeAt(e);switch(n){case 92:s+=t.source.slice(a,e),s+=B(t),a=t.index,i=!0;break;default:if(n>=55296&&n<=56319){n=(1023&n)<<10|1023&t.source.charCodeAt(e+1)|65536}if(!d(n))break e;w(t,n)}}a<t.index&&(s+=t.source.slice(a,t.index)),t.tokenValue=s;const c=s.length;if(c>=2&&c<=11){const o=r(s);if(o>0)return i&&(n&e.Context.DisallowEscapedKeyword&&sn(t,n,3),t.flags|=e.Flags.EscapedKeyword),o}return n&e.Context.OptionsRawidentifiers&&(t.tokenRaw=t.source.slice(a,t.index)),33685505}function H(e,t,n){return i(n=u(e))||an(e,10,p(n)),j(e,t,n)}function B(e){const{index:t}=e;if(t+5<e.length){117!==e.source.charCodeAt(t+1)&&an(e,0),e.index+=2,e.column+=2;const n=function(e){let t=e.source.charCodeAt(e.index),n=0;if(123===t){let o=k(t=C(e));for(;o>=0;)(n=n<<4|o)>1114111&&an(e,89),e.index++,e.column++,o=k(e.source.charCodeAt(e.index));125!==e.source.charCodeAt(e.index)&&an(e,75,"unicode"),x(e,125)}else for(let o=0;o<4;o++){const o=k(t=e.source.charCodeAt(e.index));o<0&&an(e,75,"unicode"),n=n<<4|o,e.index++,e.column++}return n}(e);return n>=55296&&n<=56319&&an(e,74),d(n)||an(e,75,"unicode"),S(n)}an(e,0)}function V(t,n,o,r){return n&e.Context.Module&&an(t,90),J(t,n,o,r)}function J(t,n,o,r){const a=t.index,s=!!(n&e.Context.OptionsComments);for(;t.index<t.length;)switch(t.source.charCodeAt(t.index)){case 13:return g(t),t.index<t.length&&10===t.source.charCodeAt(t.index)&&t.index++,o|e.ScannerState.NewLine;case 10:case 8232:case 8233:return g(t),s&&X(t,n,r,a),o|e.ScannerState.NewLine;default:t.index++,t.column++}return s&&X(t,n,r,a),o}function T(t,n,o){const r=t.index,a=!!(n&e.Context.OptionsComments);for(;t.index<t.length;)switch(t.source.charCodeAt(t.index)){case 42:if(t.index++,t.column++,o&=~e.ScannerState.LastIsCR,x(t,47))return a&&X(t,n,"MultiLine",r),o;break;case 13:o|=e.ScannerState.NewLine|e.ScannerState.LastIsCR,g(t);break;case 10:f(t,o),o=o&~e.ScannerState.LastIsCR|e.ScannerState.NewLine;break;case 8232:case 8233:o=o&~e.ScannerState.LastIsCR|e.ScannerState.NewLine,g(t);break;default:o&=~e.ScannerState.LastIsCR,t.index++,t.column++}sn(t,n,8)}function X(t,n,o,r){const{index:a,startIndex:s,startLine:i,startColumn:c,lastLine:l,lastColumn:u}=t,d={type:o,value:t.source.slice(r,"MultiLine"===o?a-2:a),start:s,end:a};n&e.Context.OptionsLoc&&(d.loc={start:{line:i,column:c},end:{line:l,column:u}}),t.comments.push(d)}function G(t,n){t.flags&=~e.Flags.NewLine|e.Flags.EscapedKeyword;const o=0===t.index;let r=e.ScannerState.None;for(;t.index<t.length;){o||(t.startIndex=t.index,t.startColumn=t.column,t.startLine=t.line);const a=t.source.charCodeAt(t.index);if(a>128)switch(a){case 8232:case 8233:r=r&~e.ScannerState.LastIsCR|e.ScannerState.NewLine,g(t);break;case 65519:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:case 8205:t.index++,t.column++;break;default:return H(t,n,a)}else switch(a){case 13:r|=e.ScannerState.NewLine|e.ScannerState.LastIsCR,g(t);break;case 10:f(t,r),r=r&~e.ScannerState.LastIsCR|e.ScannerState.NewLine;break;case 9:case 11:case 12:case 32:t.index++,t.column++;break;case 40:return t.index++,t.column++,50331659;case 41:return t.index++,t.column++,16;case 44:return t.index++,t.column++,16777234;case 58:return t.index++,t.column++,16777237;case 59:return t.index++,t.column++,17825809;case 63:return t.index++,t.column++,22;case 93:return t.index++,t.column++,20;case 123:return t.index++,t.column++,41943052;case 125:return t.index++,t.column++,17825807;case 126:return t.index++,t.column++,301989934;case 91:return t.index++,t.column++,41943059;case 64:return t.index++,t.column++,120;case 47:if(t.index++,t.column++,t.index>=t.length)return 167774773;switch(t.source.charCodeAt(t.index)){case 47:t.index++,t.column++,r=J(t,n,r,"SingleLine");continue;case 42:t.index++,t.column++,r=T(t,n,r);continue;case 61:return t.index++,t.column++,100663333;default:return 167774773}case 45:switch(t.index++,t.column++,t.source.charCodeAt(t.index)){case 45:if(t.index++,t.column++,(r&e.ScannerState.NewLine||o)&&x(t,62)){r=V(t,n,r,"HTMLClose");continue}return 570425372;case 61:return t.index++,t.column++,67108899;default:return 436209968}case 60:if(t.index++,t.column++,x(t,33)&&x(t,45)&&x(t,45)){r=V(t,n,r,"HTMLOpen");continue}switch(t.source.charCodeAt(t.index)){case 60:return t.index++,t.column++,x(t,61)?67108894:167774273;case 61:return t.index++,t.column++,167774013;case 47:{if(!(n&e.Context.OptionsJSX))break;const o=t.index+1;if(o<t.length){const e=t.source.charCodeAt(o);if(42===e||47===e)break}return t.index++,t.column++,25}default:return 167774015}case 33:return t.index++,t.column++,x(t,61)?x(t,61)?167773754:167773756:301989933;case 39:case 34:return A(t,n,a);case 37:return t.index++,t.column++,x(t,61)?67108902:167774772;case 38:{t.index++,t.column++;const e=t.source.charCodeAt(t.index);return 38===e?(t.index++,t.column++,169869879):61===e?(t.index++,t.column++,67108905):167773508}case 42:{if(t.index++,t.column++,t.index>=t.length)return 167774771;const e=t.source.charCodeAt(t.index);return 61===e?(t.index++,t.column++,67108900):42!==e?167774771:(t.index++,t.column++,x(t,61)?67108897:167775030)}case 43:{if(t.index++,t.column++,t.index>=t.length)return 436209967;const e=t.source.charCodeAt(t.index);return 43===e?(t.index++,t.column++,570425371):61===e?(t.index++,t.column++,67108898):436209967}case 92:return j(t,n);case 61:{t.index++,t.column++;const e=t.source.charCodeAt(t.index);return 61===e?(t.index++,t.column++,x(t,61)?167773753:167773755):62===e?(t.index++,t.column++,10):83886109}case 62:{if(t.index++,t.column++,t.index>=t.length)return 167774016;if(n&e.Context.InJSXChild)return 167774016;let o=t.source.charCodeAt(t.index);return 61===o?(t.index++,t.column++,167774014):62!==o?167774016:(t.index++,t.column++,62===(o=t.source.charCodeAt(t.index))?(t.index++,t.column++,x(t,61)?67108896:167774275):61===o?(t.index++,t.column++,67108895):167774274)}case 94:return t.index++,t.column++,x(t,61)?67108903:167773254;case 96:return E(t,n);case 124:{t.index++,t.column++;const e=t.source.charCodeAt(t.index);return 124===e?(t.index++,t.column++,169869624):61===e?(t.index++,t.column++,67108904):167772997}case 46:{let o=t.index+1;const r=t.source.charCodeAt(o);return r>=48&&r<=57?(L(t,n,e.NumericState.Float),33554434):46===r&&++o<t.length&&46===t.source.charCodeAt(o)?(t.index=o+1,t.column+=3,14):(t.index++,t.column++,16777229)}case 35:{t.index++,t.column++;const r=t.index,a=t.source.charCodeAt(r);if(n&e.Context.OptionsShebang&&o&&33===a){t.index=r+1,J(t,n,e.ScannerState.None,"SheBang");continue}return m(t,n)}case 48:switch(t.index++,t.column++,t.source.charCodeAt(t.index)){case 88:case 120:return O(t,n);case 66:case 98:return v(t,n,2);case 79:case 111:return v(t,n,8);default:return F(t,n)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return L(t,n);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 36:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:default:return j(t,n,a)}}return 1048576}function K(t,n){const o=t.index;let r=e.RegexState.Empty;e:for(;;){const n=t.source.charCodeAt(t.index);if(t.index++,t.column++,r&e.RegexState.Escape)r&=~e.RegexState.Escape;else switch(n){case 47:if(r)break;break e;case 92:r|=e.RegexState.Escape;break;case 91:r|=e.RegexState.Class;break;case 93:r&=e.RegexState.Escape;break;case 13:case 10:case 8232:case 8233:an(t,7)}t.index>=t.source.length&&an(t,7)}const a=t.index-1;let s=e.RegexFlags.Empty;const{index:i}=t;e:for(;t.index<t.source.length;){const o=t.source.charCodeAt(t.index);switch(o){case 103:s&e.RegexFlags.Global&&sn(t,n,15,"g"),s|=e.RegexFlags.Global;break;case 105:s&e.RegexFlags.IgnoreCase&&sn(t,n,15,"i"),s|=e.RegexFlags.IgnoreCase;break;case 109:s&e.RegexFlags.Multiline&&sn(t,n,15,"m"),s|=e.RegexFlags.Multiline;break;case 117:s&e.RegexFlags.Unicode&&sn(t,n,15,"u"),s|=e.RegexFlags.Unicode;break;case 121:s&e.RegexFlags.Sticky&&sn(t,n,15,"y"),s|=e.RegexFlags.Sticky;break;case 115:s&e.RegexFlags.DotAll&&sn(t,n,15,"s"),s|=e.RegexFlags.DotAll;break;default:if(!d(o))break e;an(t,16,S(o))}t.index++,t.column++}const c=t.source.slice(i,t.index),l=t.source.slice(o,a);return t.tokenRegExp={pattern:l,flags:c},n&e.Context.OptionsRaw&&(t.tokenRaw=t.source.slice(t.startIndex,t.index)),t.tokenValue=function(t,n,o,r){e.Context.OptionsNode;try{return new RegExp(o,r)}catch(e){return null}}(0,0,l,c),33554436}function Y(t,n,o=[]){const{token:r}=t;return 8388608&r?41943052===r?function(e,t){const n=Ht(e),o=[];Et(e,t,41943052);for(;17825807!==e.token;){if(14===e.token){o.push($(e,t));break}o.push(_(e,t)),17825807!==e.token&&Et(e,t,16777234)}return Et(e,t,17825807),bt(t,e,n,{type:"ObjectPattern",properties:o})}(t,n):function(t,n,o){const r=Ht(t);Ot(t,n);const a=[];for(;20!==t.token;)if(It(t,n,16777234))a.push(null);else{if(14===t.token){a.push(U(t,n,o));break}a.push(Nt(t,n|e.Context.AllowIn,W)),20!==t.token&&Et(t,n,16777234)}return Et(t,n,20),bt(n,t,r,{type:"ArrayPattern",elements:a})}(t,n,o):(1074003968&r&&(262144&r&&n&(e.Context.Async|e.Context.Module)?sn(t,n,48):1073741824&r&&n&(e.Context.Yield|e.Context.Strict)&&sn(t,n,49)),o.push(t.tokenValue),q(t,n))}function q(t,o){const{token:r}=t;4194304&r?(o&e.Context.Strict&&sn(t,o,17),t.flags|=e.Flags.StrictEvalArguments):o&e.Context.BlockScope&&33574984===r?sn(t,o,27):vt(r,20480)?(o&e.Context.Strict&&sn(t,o,1,n(r)),t.flags|=e.Flags.StrictFunctionName):Bt(o,r)||sn(t,o,1,n(r));const a=Ht(t),s=t.tokenValue;return Ot(t,o),bt(o,t,a,{type:"Identifier",name:s})}function U(e,t,n){const o=Ht(e);Et(e,t,14);const r=Y(e,t,n);return 16777234===e.token&&sn(e,t,88),bt(t,e,o,{type:"RestElement",argument:r})}function $(e,t){const n=Ht(e);Et(e,t,14);const{token:o}=e,r=Y(e,t);return vt(o,8388608)&&sn(e,t,94),16777234===e.token&&sn(e,t,88),bt(t,e,n,{type:"RestElement",argument:r})}function z(t,n,o,r){return bt(n,t,r,{type:"AssignmentPattern",left:o,right:Nt(t,n|e.Context.AllowIn,Ae)})}function W(t,n){const o=Ht(t),r=Y(t,n);return It(t,n,83886109)?bt(n,t,o,{type:"AssignmentPattern",left:r,right:Ae(t,n|e.Context.AllowIn)}):r}function _(t,n){const o=Ht(t),{token:r}=t;let a,s,i=!1,c=!1;if(135168&r)if(a=Re(t,n),c=!It(t,n,16777237)){const i=It(t,n,83886109);n&e.Context.Yield&&1073741824&r&&sn(t,n,49),Bt(n,r)||sn(t,n,46),s=i?z(t,n,a,o):a}else s=W(t,n);else i=41943059===r,a=Je(t,n),Et(t,n,16777237),s=Nt(t,n,W);return bt(n,t,o,{type:"Property",kind:"init",key:a,computed:i,value:s,method:!1,shorthand:c})}function Q(e,t){const n=Ht(e);let o,r=[],a=null,s=!1;Et(e,t,167774015);const i=167774016===e.token;if(i)o=function(e,t,n){return ee(e),bt(t,e,n,{type:"JSXOpeningFragment"})}(e,t,n);else{o=Z(e,t,ke(e,t),ae(e,t),s=It(e,t,167774773),n)}if(i)return function(e,t,n,o){const r=ne(e,t),a=me(e,t);return bt(t,e,o,{type:"JSXFragment",children:r,openingElement:n,closingFragment:a})}(e,t,o,n);if(!s){r=ne(e,t),a=ge(e,t);const n=zt(o.name),s=zt(a.name);n!==s&&an(e,85,s)}return bt(t,e,n,{type:"JSXElement",children:r,openingElement:o,closingElement:a})}function Z(t,n,o,r,a,s){return n&e.Context.InJSXChild&&a?Et(t,n,167774016):ee(t),bt(n,t,s,{type:"JSXOpeningElement",name:o,attributes:r,selfClosing:a})}function ee(e){return e.token=te(e)}function te(e){if(e.index>=e.source.length)return 1048576;e.lastIndex=e.startIndex=e.index;const t=e.source.charCodeAt(e.index);if(60===t)return e.index++,e.column++,x(e,47)?25:167774015;if(123===t)return e.index++,e.column++,41943052;for(;e.index<e.source.length;){e.index++,e.column++;const t=e.source.charCodeAt(e.index);if(123===t||60===t)break}return 121}function ne(e,t){const n=[];for(;25!==e.token;)n.push(re(e,t));return n}function oe(t,n){const o=Ht(t),r=t.source.slice(t.startIndex,t.index);t.token=te(t);const a=bt(n,t,o,{type:"JSXText",value:r});return n&e.Context.OptionsRaw&&(a.raw=r),a}function re(t,n){switch(t.token){case 33685505:case 121:return oe(t,n);case 41943052:return fe(t,n&~e.Context.InJSXChild);case 167774015:return Q(t,n&~e.Context.InJSXChild);default:an(t,0)}}function ae(e,t){const n=[];for(;e.index<e.source.length&&167774773!==e.token&&167774016!==e.token;)n.push(ue(e,t));return n}function se(t,n){const o=Ht(t);Et(t,n,41943052),Et(t,n,14);const r=Nt(t,n&~e.Context.InJSXChild,Ae);return Et(t,n,17825807),bt(n,t,o,{type:"JSXSpreadAttribute",argument:r})}function ie(e,t,n,o){return Et(e,t,16777237),bt(t,e,o,{type:"JSXNamespacedName",namespace:n,name:Se(e,t)})}function ce(e,t){const n=Ht(e),o=Se(e,t);return 16777237===e.token?ie(e,t,o,n):o}function le(t,n){switch(function(t,n){t.lastIndex=t.index;const o=t.source.charCodeAt(t.index);switch(o){case 34:case 39:return function(t,n,o){const r=t.index;t.index++,t.column++;let a="",s=t.source.charCodeAt(t.index);for(;s!==o;)a+=S(s),t.index++,t.column++,s=t.source.charCodeAt(t.index),t.index>=t.source.length&&an(t,6);t.index++,t.column++,n&e.Context.OptionsRaw&&(t.tokenRaw=t.source.slice(r,t.index));return t.tokenValue=a,33554435}(t,n,o);default:return Ot(t,n)}}(t,n)){case 33554435:return De(t,n);case 41943052:return xe(t,n|e.Context.InJSXChild);case 167774015:return Q(t,n|e.Context.InJSXChild);default:return void sn(t,n,87)}}function ue(e,t){const n=Ht(e);if(41943052===e.token)return se(e,t);we(e);const o=ce(e,t);return bt(t,e,n,{type:"JSXAttribute",value:83886109===e.token?le(e,t):null,name:o})}function de(e,t){return bt(t,e,Ht(e),{type:"JSXEmptyExpression"})}function pe(e,t){const n=Ht(e);Et(e,t,14);const o=ye(e,t);return Et(e,t,17825807),bt(t,e,n,{type:"JSXSpreadChild",expression:o})}function xe(t,n){const o=Ht(t);Et(t,n,41943052),17825807===t.token&&sn(t,n,84);const r=Nt(t,n&~e.Context.InJSXChild,Ae);return Et(t,n,17825807),bt(n,t,o,{type:"JSXExpressionContainer",expression:r})}function fe(e,t){const n=Ht(e);if(Et(e,t,41943052),14===e.token)return pe(e,t);const o=17825807===e.token?de(e,t):Nt(e,t,Ae);return ee(e),bt(t,e,n,{type:"JSXExpressionContainer",expression:o})}function me(e,t){const n=Ht(e);return Et(e,t,25),Et(e,t,167774016),bt(t,e,n,{type:"JSXClosingFragment"})}function ge(t,n){const o=Ht(t);Et(t,n,25);const r=ke(t,n);return n&e.Context.InJSXChild?Et(t,n,167774016):ee(t),bt(n,t,o,{type:"JSXClosingElement",name:r})}function Se(t,o){const{token:r,tokenValue:a,tokenRaw:s}=t;135168&r||sn(t,o,1,n(t.token));const i=Ht(t);Ot(t,o);const c=bt(o,t,i,{type:"JSXIdentifier",name:a});return o&e.Context.OptionsRawidentifiers&&(c.raw=s),c}function Ce(e,t,n,o){return we(e),bt(t,e,o,{type:"JSXMemberExpression",object:n,property:Se(e,t)})}function ke(e,t){const n=Ht(e);we(e);let o=Se(e,t);if(16777237===e.token)return ie(e,t,o,n);for(;It(e,t,16777229);)o=Ce(e,t,o,n);return o}function we(e){const{token:t}=e;if(135168&t){const t=e.index;let n=e.source.charCodeAt(e.index);for(;e.index<e.source.length&&(45===n||s(n));)n=C(e);e.tokenValue+=e.source.substr(t,e.index-t)}return e.token}function ye(e,t){const n=Ht(e),o=Nt(e,t,Ae);return 16777234===e.token?he(e,t,o,n):o}function he(e,t,n,o){const r=[n];for(;It(e,t,16777234);)r.push(Nt(e,t,Ae));return bt(t,e,o,{type:"SequenceExpression",expressions:r})}function Ae(t,o){const r=Ht(t);let{token:a}=t;if(o&e.Context.Yield&&1073741824&a)return function(t,n,o){n&e.Context.InParameter&&sn(t,n,51),Et(t,n,1107316842);let r=null,a=!1;return t.flags&e.Flags.NewLine||((a=It(t,n,167774771))||33554432&t.token)&&(r=Ae(t,n)),bt(n,t,o,{type:"YieldExpression",argument:r,delegate:a})}(t,o,r);let s=524288&a&&Mt(t,o,Xt)?function(t,n){const o=Ht(t);let r=ve(t,n|e.Context.AllowIn,o);if(135168&t.token)return 262144&t.token&&sn(t,n,40),Ye(t,n,e.ModifierState.Await,o,[qt(t,n)]);t.flags&e.Flags.NewLine&&sn(t,n,36,"async");for(;50331659===t.token;){r=ve(t,n,o,r);const a=Ne(t,n);if(10===t.token){r=Ye(t,n,e.ModifierState.Await,o,a);break}r=bt(n,t,o,{type:"CallExpression",callee:r,arguments:a})}return r}(t,o):function(t,o,r){const a=function t(o,r,a,s,i=be(o,r)){const c=r&e.Context.AllowIn^e.Context.AllowIn;for(;vt(o.token,167772160);){const l=o.token,u=3840&l,d=(167775030===l)<<8;if(c&&167786289===l)break;if(u+d<=a)break;Ot(o,r),i=bt(r,o,s,{type:2097152&l?"LogicalExpression":"BinaryExpression",left:i,right:t(o,r&~e.Context.AllowIn,u,Ht(o)),operator:n(l)})}return i}(t,o,0,r);if(!It(t,o,22))return a;const s=Nt(t,o&~e.Context.AllowDecorator|e.Context.AllowIn,Ae);return Et(t,o,16777237),bt(o,t,r,{type:"ConditionalExpression",test:a,consequent:s,alternate:Nt(t,o,Ae)})}(t,o,r);if(10===t.token)return 135168&a&&(4214784&a&&(20480&a&&(t.flags|=e.Flags.HasStrictReserved),4194304&a&&(o&e.Context.Strict&&sn(t,o,47),t.flags|=e.Flags.StrictEvalArguments)),s=[s]),function(t,n,o,r){t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),t.flags&e.Flags.NewLine&&sn(t,n,36,"=>");return Et(t,n,10),qe(t,n&~e.Context.Async,r,o,e.ModifierState.None)}(t,o&=~e.Context.Async,r,s);if(vt(t.token,67108864)){a=t.token,o&e.Context.Strict&&Ut(s.name)?sn(t,o,17):It(t,o,83886109)?(t.flags&e.Flags.AllowDestructuring||sn(t,o,73),o&e.Context.InParameter||Pt(t,o,s),o&e.Context.InParen&&(t.flags|=e.Flags.SimpleParameterList),262144&t.token?($t(t),t.flags|=e.Flags.HasAwait):o&e.Context.InParen&&o&(e.Context.Strict|e.Context.Yield)&&1073741824&t.token&&($t(t),t.flags|=e.Flags.HasYield)):(jt(s)||sn(t,o,5),t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),Ot(t,o));const i=Nt(t,o|e.Context.AllowIn,Ae);return t.pendingExpressionError=null,bt(o,t,r,{type:"AssignmentExpression",left:s,operator:n(a),right:i})}return s}function be(t,o){const r=Ht(t),{token:a}=t;if(vt(a,301989888)){Ot(t,o),t.flags&e.Flags.EscapedKeyword&&sn(t,o,3);const s=Nt(t,o,be);return 167775030===t.token&&sn(t,o,1,n(t.token)),o&e.Context.Strict&&302002219===a&&("Identifier"===s.type?sn(t,o,43):Yt(s)&&sn(t,o,44)),bt(o,t,r,{type:"UnaryExpression",operator:n(a),argument:s,prefix:!0})}return o&e.Context.Async&&262144&a?function(t,n,o){return n&e.Context.InParameter&&sn(t,n,52),Et(t,n,34017389),bt(n,t,o,{type:"AwaitExpression",argument:be(t,n)})}(t,o,r):function(t,o,r){const{token:a}=t;if(vt(t.token,570425344)){Ot(t,o);const e=Oe(t,o,r);return _t(t,o,e,"Prefix"),bt(o,t,r,{type:"UpdateExpression",argument:e,operator:n(a),prefix:!0})}if(o&e.Context.OptionsJSX&&167774015===a)return Q(t,o|e.Context.InJSXChild);const s=Oe(t,o,r);if(vt(t.token,570425344)&&!(t.flags&e.Flags.NewLine)){_t(t,o,s,"Postfix");const e=t.token;return Ot(t,o),bt(o,t,r,{type:"UpdateExpression",argument:s,operator:n(e),prefix:!1})}return s}(t,o,r)}function Ee(t,n,o=[]){const r=Ht(t);return Et(t,n,14),n&e.Context.InParen&&262144&t.token&&(t.flags|=e.Flags.HasAwait),bt(n,t,r,{type:"RestElement",argument:Y(t,n,o)})}function Ie(t,n){const o=Ht(t);return Et(t,n,14),bt(n,t,o,{type:"SpreadElement",argument:Lt(t,n|e.Context.AllowIn,Ae)})}function Oe(t,n,o){const r=n&e.Context.OptionsNext&&33566810===t.token?tt(t,n|e.Context.AllowIn):ve(t,n|e.Context.AllowIn,o);return function(t,n,o,r){for(;;){if(r=ve(t,n,o,r),50331659!==t.token)return r;const a=Fe(t,n&~e.Context.AllowDecorator);r=bt(n,t,o,{type:"CallExpression",callee:r,arguments:a})}}(t,n|e.Context.AllowIn,o,r)}function ve(t,n,o,r=Le(t,n)){for(;;)switch(t.token){case 16777229:It(t,n,16777229),t.flags=t.flags&~e.Flags.AllowBinding|e.Flags.AllowDestructuring,r=bt(n,t,o,{type:"MemberExpression",object:r,computed:!1,property:je(t,n)});continue;case 41943059:{It(t,n,41943059),t.flags=t.flags&~e.Flags.AllowBinding|e.Flags.AllowDestructuring;const a=ye(t,n);Et(t,n,20),r=bt(n,t,o,{type:"MemberExpression",object:r,computed:!0,property:a});continue}case 33554441:r=bt(n,t,o,{type:"TaggedTemplateExpression",tag:r,quasi:ot(t,n)});continue;case 33554440:r=bt(n,t,o,{type:"TaggedTemplateExpression",tag:r,quasi:rt(t,n|e.Context.TaggedTemplate)});continue;default:return r}}function Fe(t,n){Et(t,n,50331659);const o=[];for(;16!==t.token;)14===t.token?o.push(Ie(t,n)):(n&e.Context.Yield&&vt(t.token,1073741824)&&(t.flags|=e.Flags.HasYield,$t(t)),o.push(Nt(t,n|e.Context.AllowIn,Ae))),16!==t.token&&Et(t,n,16777234);return Et(t,n,16),o}function Ne(t,n){Et(t,n,50331659);const o=[];let{token:r}=t,a=e.CoverCallState.Empty;for(;16!==t.token&&(14===t.token?(t.flags|=e.Flags.SimpleParameterList,o.push(Ie(t,n)),a=e.CoverCallState.HasSpread):(r=t.token,a=en(t,n,a),o.push(Lt(t,n|e.Context.AllowIn,Ae))),It(t,n,16777234)&&(t.flags&=~e.Flags.AllowDestructuring,a&e.CoverCallState.HasSpread&&(a=e.CoverCallState.SeenSpread)),16!==t.token););return Et(t,n,16),10===t.token&&(a&e.CoverCallState.SeenSpread?sn(t,n,78):a&e.CoverCallState.EvalOrArguments?(n&e.Context.Strict&&sn(t,n,47),t.flags|=e.Flags.StrictEvalArguments):a&e.CoverCallState.Yield?(n&e.Context.Strict&&sn(t,n,51),t.flags|=e.Flags.HasStrictReserved):t.flags&e.Flags.HasYield?sn(t,n,51):(a&e.CoverCallState.Await||t.flags&e.Flags.HasAwait)&&sn(t,n,52)),o}function Le(t,o){switch(t.token){case 33685505:return Re(t,o);case 33554434:case 33554435:return De(t,o);case 594028:return function(e,t){return Mt(e,t,Kt)?Ve(e,t):Re(e,t)}(t,o);case 50331659:return function(t,o){if(Et(t,o,50331659),It(t,o,16)){if(t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),10===t.token)return[]}else if(14===t.token){const r=[Ee(t,o)];return Et(t,o,16),t.flags=t.flags&~(e.Flags.AllowDestructuring|e.Flags.AllowBinding)|e.Flags.SimpleParameterList,10!==t.token&&sn(t,o,1,n(t.token)),r}const r=Ht(t);let a=Zt(t,e.CoverParenthesizedState.None),s=Lt(t,o|e.Context.AllowIn,Ae);if(16777234===t.token){a|=e.CoverParenthesizedState.SequenceExpression;const i=[s];for(;It(t,o|e.Context.DisallowEscapedKeyword,16777234);){if(14===t.token){t.flags&e.Flags.AllowBinding||sn(t,o,77),t.flags|=e.Flags.SimpleParameterList;const n=Ee(t,o);return Et(t,o,16),10!==t.token&&sn(t,o,78),i.push(n),i}if(It(t,o,16))return 10!==t.token&&sn(t,o,1,n(t.token)),i;a=Zt(t,a),i.push(Lt(t,o,Ae))}s=bt(o,t,r,{type:"SequenceExpression",expressions:i})}if(Et(t,o,16),10===t.token)return a&e.CoverParenthesizedState.HasEvalOrArguments?(o&e.Context.Strict&&sn(t,o,47),t.flags|=e.Flags.StrictEvalArguments):a&e.CoverParenthesizedState.HasReservedWords?(o&e.Context.Strict&&sn(t,o,50),t.flags|=e.Flags.HasStrictReserved):t.flags&e.Flags.AllowBinding?t.flags&e.Flags.HasYield?sn(t,o,51):o&e.Context.Async&&t.flags&e.Flags.HasAwait&&sn(t,o,52):sn(t,o,77),t.flags&=~(e.Flags.AllowBinding|e.Flags.HasAwait|e.Flags.HasYield),a&e.CoverParenthesizedState.SequenceExpression?s.expressions:[s];t.flags&=~(e.Flags.HasAwait|e.Flags.HasYield|e.Flags.AllowBinding),jt(s)||(t.flags&=~e.Flags.AllowDestructuring);return s}(t,o|e.Context.InParen);case 41943059:return Lt(t,o,He);case 41943052:return Lt(t,o,Xe);case 33566808:return Be(t,o);case 33566727:case 33566726:case 33566725:return function(t,o){const r=Ht(t),{token:a}=t,s=n(a);t.flags&e.Flags.EscapedKeyword&&sn(t,o,3);Ot(t,o);const i=bt(o,t,r,{type:"Literal",value:33566727===a?null:"true"===s});o&e.Context.OptionsRaw&&(i.raw=s);return i}(t,o);case 120:case 33566797:return function(t,n){const o=Ht(t);let r=[];n&e.Context.OptionsExperimental&&(r=it(t,n));Et(t,n|e.Context.DisallowEscapedKeyword,33566797);const{token:a}=t;let s=e.ObjectState.None,i=null,c=null;41943052!==a&&12372!==a&&(n&e.Context.Async&&262144&a&&sn(t,n,48),i=q(t,n|e.Context.Strict));It(t,n,12372)&&(c=Oe(t,n|e.Context.Strict,o),s|=e.ObjectState.Heritage);const l=_e(t,n|e.Context.Strict,s);return bt(n,t,o,n&e.Context.OptionsExperimental?{type:"ClassExpression",id:i,superClass:c,body:l,decorators:r}:{type:"ClassExpression",id:i,superClass:c,body:l})}(t,o);case 33566811:return function(t,o){const r=Ht(t),a=Re(t,o);if(It(t,o|e.Context.DisallowEscapedKeyword,16777229))return"target"===t.tokenValue&&o&(e.Context.InParameter|e.Context.InFunctionBody)||sn(t,o,53),nt(t,o,a,r);return bt(o,t,r,{type:"NewExpression",callee:function(t,o,r){const{token:a}=t;if(o&e.Context.OptionsNext&&33566810===a)return Mt(t,o,Gt)&&sn(t,o,1,n(a)),tt(t,o);return ve(t,o,r)}(t,o,r),arguments:50331659===t.token?Fe(t,o):[]})}(t,o);case 33566813:return function(t,n){const o=Ht(t);switch(Et(t,n,33566813),t.token){case 50331659:n&e.Context.AllowSuperProperty||sn(t,n,54);break;case 41943059:case 16777229:n&e.Context.Method||sn(t,n,55);break;default:sn(t,n,56)}return bt(n,t,o,{type:"Super"})}(t,o);case 33554551:return Pe(t,o);case 33566815:return function(t,n){t.flags&e.Flags.EscapedKeyword&&sn(t,n,3);const o=Ht(t);return Ot(t,n|e.Context.DisallowEscapedKeyword),bt(n,t,o,{type:"ThisExpression"})}(t,o);case 115:return je(t,o);case 167774773:case 100663333:return K(t,o),function(t,n){const o=Ht(t),{tokenRegExp:r,tokenValue:a,tokenRaw:s}=t;Ot(t,n);const i=bt(n,t,o,{type:"Literal",value:a,regex:r});n&e.Context.OptionsRaw&&(i.raw=s);return i}(t,o);case 33554441:return ot(t,o);case 33554440:return rt(t,o);case 33574984:return function(t,n){n&e.Context.Strict&&sn(t,n,50);const o=Ht(t),r=t.tokenValue;Ot(t,n),t.flags&e.Flags.NewLine&&41943059===t.token&&sn(t,n,1,"let");return bt(n,t,o,{type:"Identifier",name:r})}(t,o);case 12369:if(o&e.Context.OptionsExperimental)return function(e,t){const n=Ht(e);return Et(e,t,12369),bt(t,e,n,{type:"DoExpression",body:Nn(e,t)})}(t,o);default:return qt(t,o)}}function Re(t,n){const o=Ht(t),r=t.tokenValue;Ot(t,n|e.Context.TaggedTemplate);const a=bt(n,t,o,{type:"Identifier",name:r});return n&e.Context.OptionsRawidentifiers&&(a.raw=t.tokenRaw),a}function De(t,n){const o=Ht(t),r=t.tokenValue;n&e.Context.Strict&&t.flags&e.Flags.HasOctal&&sn(t,n,61),Ot(t,n);const a=bt(n,t,o,{type:"Literal",value:r});return n&e.Context.OptionsRaw&&(a.raw=t.tokenRaw),a}function Pe(t,n){const o=Ht(t),{tokenValue:r,tokenRaw:a}=t;Ot(t,n);const s=bt(n,t,o,{type:"Literal",value:r,bigint:a});return n&e.Context.OptionsRaw&&(s.raw=t.tokenRaw),s}function Me(e,t,o){return 135168&o||sn(e,t,4,n(o)),Re(e,t)}function je(e,t){if(!It(e,t,115))return Me(e,t,e.token);const{tokenValue:n}=e,o=Ht(e),r=n;return Ot(e,t),bt(t,e,o,{type:"PrivateName",name:r})}function He(t,n){const o=Ht(t);Et(t,n,41943059);const r=[];for(;20!==t.token;)It(t,n,16777234)?r.push(null):14===t.token?(r.push(Ie(t,n)),20!==t.token&&(t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),Et(t,n,16777234))):(r.push(Lt(t,n|e.Context.AllowIn,Ae)),20!==t.token&&Et(t,n,16777234));return Et(t,n,20),bt(n,t,o,{type:"ArrayExpression",elements:r})}function Be(t,n){const o=Ht(t);Et(t,n,33566808);const r=It(t,n,167774771)?e.ModifierState.Generator:e.ModifierState.None;let a=null;const{token:s}=t;135168&s&&(4194304&s&&(n&e.Context.Strict&&sn(t,n,47),t.flags|=e.Flags.StrictEvalArguments),1073741824&t.token&&r&e.ModifierState.Generator&&sn(t,n,49),a=q(t,n));const{params:i,body:c}=Rt(t,n&~(e.Context.Method|e.Context.AllowSuperProperty),r,Ue);return bt(n,t,o,{type:"FunctionExpression",params:i,body:c,async:!1,generator:!!(r&e.ModifierState.Generator),expression:!1,id:a})}function Ve(t,n){const o=Ht(t);Et(t,n,594028),Et(t,n,33566808);const r=It(t,n,167774771)?e.ModifierState.Generator:e.ModifierState.None,a=e.ModifierState.Await;let s=null;const{token:i}=t;135168&i&&(4194304&i&&((n&e.Context.Strict||a&e.ModifierState.Await)&&sn(t,n,47),t.flags|=e.Flags.StrictFunctionName),262144&i&&sn(t,n,48),1073741824&t.token&&r&e.ModifierState.Generator&&sn(t,n,49),s=q(t,n));const{params:c,body:l}=Rt(t,n&~(e.Context.Method|e.Context.AllowSuperProperty),r|a,Ue);return bt(n,t,o,{type:"FunctionExpression",params:c,body:l,async:!0,generator:!!(r&e.ModifierState.Generator),expression:!1,id:s})}function Je(t,n){switch(t.token){case 33554434:case 33554435:return De(t,n);case 41943059:return function(t,n){Et(t,n,41943059);const o=Ae(t,n|e.Context.AllowIn);return Et(t,n,20),o}(t,n);default:return Re(t,n)}}function Te(t,n){const o=Ht(t);return Et(t,n,14),8388608&t.token&&(t.flags&=~e.Flags.AllowDestructuring),bt(n,t,o,{type:"SpreadElement",argument:Ae(t,n|e.Context.AllowIn)})}function Xe(t,n){const o=Ht(t);Et(t,n,41943052);const r=[];for(;17825807!==t.token;)r.push(14===t.token?Te(t,n):Ge(t,n)),17825807!==t.token&&Et(t,n,16777234);return Et(t,n,17825807),t.flags&=~e.Flags.HasProtoField,bt(n,t,o,{type:"ObjectExpression",properties:r})}function Ge(t,o){const r=Ht(t),a=t.flags;let s,i=It(t,o,167774771)?e.ObjectState.Generator|e.ObjectState.Method:e.ObjectState.Method;const c=t.token;let l=Je(t,o);return 16777216&t.token||(a&e.Flags.EscapedKeyword?sn(t,o,3):i&e.ObjectState.Generator||!(524288&c)||t.flags&e.Flags.NewLine?69743===c?(i=i&~e.ObjectState.Method|e.ObjectState.Getter,l=Je(t,o)):69744===c&&(i=i&~e.ObjectState.Method|e.ObjectState.Setter,l=Je(t,o)):(i|=It(t,o,167774771)?e.ObjectState.Generator|e.ObjectState.Async:e.ObjectState.Async,l=Je(t,o)),i&(e.ObjectState.Getter|e.ObjectState.Setter)&&i&e.ObjectState.Generator&&sn(t,o,1,n(t.token))),50331659===t.token?s=Ke(t,o,i):(i&=~e.ObjectState.Method,16777237===t.token?(i&(e.ObjectState.Async|e.ObjectState.Generator)?sn(t,o,1,n(t.token)):41943059!==c&&"__proto__"===t.tokenValue&&(t.flags&e.Flags.HasProtoField?Qt(t,63):t.flags|=e.Flags.HasProtoField),Et(t,o,16777237),262144&t.token&&(t.flags|=e.Flags.HasAwait),s=Lt(t,o,Ae)):(i&(e.ObjectState.Generator|e.ObjectState.Async)||!Bt(o,c)?sn(t,o,1,n(c)):o&(e.Context.Strict|e.Context.Yield)&&1073741824&c&&($t(t),t.flags|=e.Flags.HasYield),i|=e.ObjectState.Shorthand,83886109===t.token?(o&e.Context.Strict&&4194304&c?an(t,47):Qt(t,91),Et(t,o,83886109),o&(e.Context.Strict|e.Context.Yield|e.Context.Async)&&1074003968&t.token&&($t(t),t.flags|=1073741824&t.token?e.Flags.HasYield:e.Flags.HasAwait),s=z(t,o,l,r)):(262144&c&&(o&e.Context.Async&&sn(t,o,46),$t(t),t.flags|=e.Flags.HasAwait),s=l))),bt(o,t,r,{type:"Property",key:l,value:s,kind:i&e.ObjectState.Getter|i&e.ObjectState.Setter?i&e.ObjectState.Setter?"set":"get":"init",computed:41943059===c,method:!!(i&e.ObjectState.Method),shorthand:!!(i&e.ObjectState.Shorthand)})}function Ke(t,n,o){const r=Ht(t),a=o&e.ObjectState.Generator?e.ModifierState.Generator:e.ModifierState.None,s=o&e.ObjectState.Async?e.ModifierState.Await:e.ModifierState.None,{params:i,body:c}=Rt(t,n|e.Context.Method,a|s,Ue,o);return bt(n,t,r,{type:"FunctionExpression",params:i,body:c,async:!!(o&e.ObjectState.Async),generator:!!(o&e.ObjectState.Generator),expression:!1,id:null})}function Ye(t,n,o,r,a){return t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),t.flags&e.Flags.NewLine&&sn(t,n,36,"async"),Et(t,n,10),qe(t,n|e.Context.Async,a,r,o)}function qe(t,n,o,r,a){t.pendingExpressionError=null;for(const r in o)Pt(t,n|e.Context.InParameter,o[r]);const s=41943052!==t.token;return bt(n,t,r,{type:"ArrowFunctionExpression",body:s?Nt(t,n&~(e.Context.Yield|e.Context.InParameter),Ae):Rt(t,n&~(e.Context.Yield|e.Context.AllowDecorator)|e.Context.InFunctionBody,a,$e),params:o,id:null,async:!!(a&e.ModifierState.Await),generator:!1,expression:s})}function Ue(t,n,o){const r=ze(t,n|e.Context.InParameter,o),a=r.args;return{params:r.params,body:$e(t,n&~e.Context.AllowDecorator|e.Context.InFunctionBody,a)}}function $e(t,n,o){const r=Ht(t);Et(t,n|e.Context.DisallowEscapedKeyword,41943052);const a=[];for(;33554435===t.token;){const{tokenRaw:o,tokenValue:r}=t;a.push(In(t,n)),12===o.length&&"use strict"===r&&(t.flags&e.Flags.SimpleParameterList?sn(t,n,64):t.flags&(e.Flags.HasStrictReserved|e.Flags.StrictFunctionName)?sn(t,n,50):t.flags&e.Flags.StrictEvalArguments&&sn(t,n,47),n|=e.Context.Strict)}n&e.Context.Strict&&Dt(t,n,o);const{labelSet:s}=t;t.labelSet={};const i=t.flags;for(t.flags=t.flags&~(e.Flags.StrictFunctionName|e.Flags.StrictEvalArguments|e.Flags.InSwitchStatement|e.Flags.InIterationStatement)|e.Flags.AllowDestructuring;17825807!==t.token;)a.push(fn(t,n));return i&e.Flags.InIterationStatement&&(t.flags|=e.Flags.InIterationStatement),i&e.Flags.InSwitchStatement&&(t.flags|=e.Flags.InSwitchStatement),t.labelSet=s,Et(t,n,17825807),bt(n,t,r,{type:"BlockStatement",body:a})}function ze(t,n,o){Et(t,n,50331659),t.flags&=~(e.Flags.SimpleParameterList|e.Flags.HasStrictReserved);const r=[],a=[];for(;16!==t.token;){if(14===t.token){o&e.ObjectState.Setter&&sn(t,n,67),t.flags|=e.Flags.SimpleParameterList,a.push(Ee(t,n,r));break}if(a.push(We(t,n,r)),!It(t,n,16777234))break;if(16===t.token)break}return o&e.ObjectState.Setter&&1!==a.length&&sn(t,n,66,"Setter","one",""),o&e.ObjectState.Getter&&a.length>0&&sn(t,n,66,"Getter","no","s"),Et(t,n,16),{params:a,args:r}}function We(t,n,o){const r=Ht(t);135168&t.token?(vt(t.token,20480)&&(n&e.Context.Strict&&sn(t,n,50),t.flags|=e.Flags.StrictFunctionName),vt(t.token,4194304)&&(n&e.Context.Strict&&sn(t,n,47),t.flags|=e.Flags.StrictEvalArguments)):t.flags|=e.Flags.SimpleParameterList;const a=Y(t,n,o);return It(t,n,83886109)?(1074003968&t.token&&n&(e.Context.Yield|e.Context.Async)&&sn(t,n,262144&t.token?52:51),t.flags|=e.Flags.SimpleParameterList,bt(n,t,r,{type:"AssignmentPattern",left:a,right:Nt(t,n,Ae)})):a}function _e(t,n,o){const r=Ht(t);Et(t,n,41943052);const a=[];let s=[];for(;17825807!==t.token;)It(t,n,17825809)||(n&e.Context.OptionsExperimental&&(s=it(t,n),17825807===t.token&&an(t,92),0!==s.length&&"constructor"===t.tokenValue&&an(t,93)),a.push(n&e.Context.OptionsNext&&115===t.token?et(t,n,s):Qe(t,n,o,s)));return t.flags&=~e.Flags.HasConstructor,Et(t,n,17825807),bt(n,t,r,{type:"ClassBody",body:a})}function Qe(t,o,r,a){const s=Ht(t);let{tokenValue:i,token:c}=t;const l=t.flags;It(t,o,167774771)&&(r|=e.ObjectState.Generator),41943059===t.token&&(r|=e.ObjectState.Computed),"constructor"===t.tokenValue&&(r&e.ObjectState.Generator?sn(t,o,45,"generator"):r&e.ObjectState.Heritage&&(o|=e.Context.AllowSuperProperty),r|=e.ObjectState.Constructor);let u,d=Je(t,o);if(!(16777216&t.token)){if(l&e.Flags.EscapedKeyword&&sn(t,o,3),20585===c&&(c=t.token,It(t,o,167774771)&&(r|=e.ObjectState.Generator),i=t.tokenValue,41943059===t.token&&(r|=e.ObjectState.Computed),"prototype"===t.tokenValue&&sn(t,o,65),r|=e.ObjectState.Static,d=Je(t,o),o&e.Context.OptionsNext&&Wt(t)))return"constructor"===i&&sn(t,o,1,n(t.token)),Ze(t,o,d,r,s,a);50331659!==t.token&&(!(524288&c)||r&e.ObjectState.Generator||t.flags&e.Flags.NewLine?69743!==c&&69744!==c||(r|=69743===c?e.ObjectState.Getter:e.ObjectState.Setter,i=t.tokenValue,41943059===t.token&&(r|=e.ObjectState.Computed),d=Je(t,o&~e.Context.Strict)):(c=t.token,i=t.tokenValue,r|=e.ObjectState.Async,It(t,o,167774771)&&(r|=e.ObjectState.Generator),41943059===t.token&&(r|=e.ObjectState.Computed),d=Je(t,o)),"prototype"===i?sn(t,o,65):r&e.ObjectState.Static||"constructor"!==i||sn(t,o,45,"accessor"))}if(50331659===t.token)!(r&e.ObjectState.Computed)&&r&e.ObjectState.Constructor&&(t.flags&e.Flags.HasConstructor?an(t,12):t.flags|=e.Flags.HasConstructor),u=Ke(t,o,r);else{if(o&e.Context.OptionsNext)return Ze(t,o,d,r,s,a);sn(t,o,1,n(c))}const p=r&e.ObjectState.Constructor?"constructor":r&e.ObjectState.Getter?"get":r&e.ObjectState.Setter?"set":"method";return bt(o,t,s,o&e.Context.OptionsExperimental?{type:"MethodDefinition",kind:p,static:!!(r&e.ObjectState.Static),computed:!!(r&e.ObjectState.Computed),key:d,value:u,decorators:a}:{type:"MethodDefinition",kind:p,static:!!(r&e.ObjectState.Static),computed:!!(r&e.ObjectState.Computed),key:d,value:u})}function Ze(t,n,o,r,a,s){r&e.ObjectState.Constructor&&sn(t,n,0);let i=null;return r&(e.ObjectState.Async|e.ObjectState.Generator)&&sn(t,n,0),It(t,n,83886109)&&(4194304&t.token&&sn(t,n,47),i=Ae(t,n)),It(t,n,16777234),bt(n,t,a,n&e.Context.OptionsExperimental?{type:"FieldDefinition",key:o,value:i,computed:!!(r&e.ObjectState.Computed),static:!!(r&e.ObjectState.Static),decorators:s}:{type:"FieldDefinition",key:o,value:i,computed:!!(r&e.ObjectState.Computed),static:!!(r&e.ObjectState.Static)})}function et(t,n,o){const r=Ht(t);Et(t,n|e.Context.InClass,115),"constructor"===t.tokenValue&&sn(t,n,41);const a=function(e,t,n){const o=e.tokenValue;return Ot(e,t),bt(t,e,n,{type:"PrivateName",name:o})}(t,n,r);if(50331659===t.token)return function(t,n,o,r,a){const s=Ke(t,n|e.Context.Strict,e.ObjectState.None);return t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),bt(n,t,r,n&e.Context.OptionsExperimental?{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:o,value:s,decorators:a}:{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:o,value:s})}(t,n,a,r,o);let s=null;return It(t,n,83886109)&&(4194304&t.token&&sn(t,n,47),s=Ae(t,n)),It(t,n,16777234),bt(n,t,r,n&e.Context.OptionsExperimental?{type:"FieldDefinition",key:a,value:s,computed:!1,static:!1,decorators:o}:{type:"FieldDefinition",key:a,value:s,computed:!1,static:!1})}function tt(t,o){const r=Ht(t),a=Re(t,o);if(It(t,o,16777229)){if(o&e.Context.Module&&"meta"===t.tokenValue)return nt(t,o,a,r);sn(t,o,1,n(t.token))}let s=function(e,t,n){return bt(t,e,n,{type:"Import"})}(t,o,r);Et(t,o,50331659);const i=Nt(t,o|e.Context.AllowIn,Ae);return Et(t,o,16),s=bt(o,t,r,{type:"CallExpression",callee:s,arguments:[i]})}function nt(e,t,n,o){return bt(t,e,o,{meta:n,type:"MetaProperty",property:Re(e,t)})}function ot(e,t){return bt(t,e,Ht(e),{type:"TemplateLiteral",expressions:[],quasis:[at(e,t)]})}function rt(e,t,n=[],o=[]){const r=Ht(e),{tokenValue:a,tokenRaw:s}=e;Et(e,t,33554440),n.push(ye(e,t));const i=Ht(e);return o.push(function(e,t,n=null,o,r){return e.token=b(e,t),bt(t,e,r,{type:"TemplateElement",value:{cooked:n,raw:o},tail:!1})}(e,t,a,s,r)),33554441===e.token?o.push(at(e,t,i)):rt(e,t,n,o),bt(t,e,r,{type:"TemplateLiteral",expressions:n,quasis:o})}function at(e,t,n=Ht(e)){const{tokenValue:o,tokenRaw:r}=e;return Et(e,t,33554441),bt(t,e,n,{type:"TemplateElement",value:{cooked:o,raw:r},tail:!0})}function st(e,t){const n=Ht(e);return bt(t,e,n,{type:"Decorator",expression:Oe(e,t,n)})}function it(t,n){const o=[];for(;It(t,n,120);)o.push(st(t,n|e.Context.AllowDecorator));return o}var ct,lt,ut,dt,pt,xt,ft,mt,gt,St,Ct,kt;function wt(t,n,o,r){const a=At(t,o);a||sn(t,n,32,o),!r||a&e.Labels.Nested||sn(t,n,31,o)}function yt(t,n){var o;void 0===t.labelSet&&(t.labelSet={}),t.labelSet[`$${n}`]=12369===(o=t.token)||12386===o||12374===o?e.Labels.Nested:e.Labels.NotNested}function ht(t,n){t.labelSet[`$${n}`]=e.Labels.None}function At(t,n){return t.labelSet?t.labelSet[`$${n}`]:e.Labels.None}function bt(t,n,o,r){const{lastIndex:a,lastLine:s,lastColumn:i,sourceFile:c,index:l}=n;return t&e.Context.LocationTracker&&(t&e.Context.OptionsRanges&&(r.start=o.index,r.end=a),t&e.Context.OptionsLoc&&(r.loc={start:{line:o.line,column:o.column},end:{line:s,column:i}},c&&(r.loc.source=c))),r}function Et(e,t,o,r=1){return e.token!==o&&an(e,r,n(e.token)),Ot(e,t),!0}function It(e,t,n){return e.token===n&&(Ot(e,t),!0)}function Ot(e,t){return e.lastIndex=e.index,e.lastLine=e.line,e.lastColumn=e.column,e.token=G(e,t)}(ct=e.Context||(e.Context={}))[ct.Empty=0]="Empty",ct[ct.OptionsNext=1]="OptionsNext",ct[ct.OptionsRanges=2]="OptionsRanges",ct[ct.OptionsJSX=4]="OptionsJSX",ct[ct.OptionsRaw=8]="OptionsRaw",ct[ct.OptionsLoc=16]="OptionsLoc",ct[ct.OptionsGlobalReturn=32]="OptionsGlobalReturn",ct[ct.OptionsComments=64]="OptionsComments",ct[ct.OptionsShebang=128]="OptionsShebang",ct[ct.OptionsRawidentifiers=256]="OptionsRawidentifiers",ct[ct.OptionsTolerant=512]="OptionsTolerant",ct[ct.OptionsNode=1024]="OptionsNode",ct[ct.OptionsExperimental=2048]="OptionsExperimental",ct[ct.Strict=4096]="Strict",ct[ct.Module=8192]="Module",ct[ct.TaggedTemplate=16384]="TaggedTemplate",ct[ct.InClass=32768]="InClass",ct[ct.AllowIn=65536]="AllowIn",ct[ct.Async=131072]="Async",ct[ct.Yield=262144]="Yield",ct[ct.InParameter=524288]="InParameter",ct[ct.InFunctionBody=1048576]="InFunctionBody",ct[ct.AllowSingleStatement=2097152]="AllowSingleStatement",ct[ct.BlockScope=4194304]="BlockScope",ct[ct.ForStatement=8388608]="ForStatement",ct[ct.RequireIdentifier=16777216]="RequireIdentifier",ct[ct.Method=33554432]="Method",ct[ct.AllowSuperProperty=67108864]="AllowSuperProperty",ct[ct.InParen=134217728]="InParen",ct[ct.InJSXChild=268435456]="InJSXChild",ct[ct.DisallowEscapedKeyword=536870912]="DisallowEscapedKeyword",ct[ct.AllowDecorator=1073741824]="AllowDecorator",ct[ct.LocationTracker=18]="LocationTracker",(lt=e.Flags||(e.Flags={}))[lt.None=0]="None",lt[lt.NewLine=1]="NewLine",lt[lt.AllowBinding=2]="AllowBinding",lt[lt.AllowDestructuring=4]="AllowDestructuring",lt[lt.SimpleParameterList=8]="SimpleParameterList",lt[lt.InSwitchStatement=16]="InSwitchStatement",lt[lt.InIterationStatement=32]="InIterationStatement",lt[lt.HasStrictReserved=64]="HasStrictReserved",lt[lt.HasOctal=128]="HasOctal",lt[lt.SimpleAssignmentTarget=256]="SimpleAssignmentTarget",lt[lt.HasProtoField=512]="HasProtoField",lt[lt.StrictFunctionName=1024]="StrictFunctionName",lt[lt.StrictEvalArguments=2048]="StrictEvalArguments",lt[lt.InFunctionBody=4096]="InFunctionBody",lt[lt.HasAwait=8192]="HasAwait",lt[lt.HasYield=16384]="HasYield",lt[lt.EscapedKeyword=32768]="EscapedKeyword",lt[lt.HasConstructor=65536]="HasConstructor",(ut=e.Labels||(e.Labels={}))[ut.None=0]="None",ut[ut.NotNested=1]="NotNested",ut[ut.Nested=2]="Nested",(dt=e.NumericState||(e.NumericState={}))[dt.None=0]="None",dt[dt.SeenSeparator=1]="SeenSeparator",dt[dt.EigthOrNine=2]="EigthOrNine",dt[dt.Float=4]="Float",dt[dt.BigInt=8]="BigInt",(pt=e.ScannerState||(e.ScannerState={}))[pt.None=0]="None",pt[pt.NewLine=1]="NewLine",pt[pt.LastIsCR=2]="LastIsCR",(xt=e.ModifierState||(e.ModifierState={}))[xt.None=0]="None",xt[xt.Generator=1]="Generator",xt[xt.Await=2]="Await",(ft=e.CoverParenthesizedState||(e.CoverParenthesizedState={}))[ft.None=0]="None",ft[ft.SequenceExpression=1]="SequenceExpression",ft[ft.HasEvalOrArguments=2]="HasEvalOrArguments",ft[ft.HasReservedWords=4]="HasReservedWords",ft[ft.HasYield=8]="HasYield",ft[ft.HasBinding=16]="HasBinding",(mt=e.Escape||(e.Escape={}))[mt.Empty=-1]="Empty",mt[mt.StrictOctal=-2]="StrictOctal",mt[mt.EightOrNine=-3]="EightOrNine",mt[mt.InvalidHex=-4]="InvalidHex",mt[mt.OutOfRange=-5]="OutOfRange",(gt=e.RegexFlags||(e.RegexFlags={}))[gt.Empty=0]="Empty",gt[gt.IgnoreCase=1]="IgnoreCase",gt[gt.Global=2]="Global",gt[gt.Multiline=4]="Multiline",gt[gt.Unicode=8]="Unicode",gt[gt.Sticky=16]="Sticky",gt[gt.DotAll=32]="DotAll",(St=e.CoverCallState||(e.CoverCallState={}))[St.Empty=0]="Empty",St[St.SeenSpread=1]="SeenSpread",St[St.HasSpread=2]="HasSpread",St[St.SimpleParameter=4]="SimpleParameter",St[St.EvalOrArguments=8]="EvalOrArguments",St[St.Yield=16]="Yield",St[St.Await=32]="Await",(Ct=e.RegexState||(e.RegexState={}))[Ct.Empty=0]="Empty",Ct[Ct.Escape=1]="Escape",Ct[Ct.Class=2]="Class",(kt=e.ObjectState||(e.ObjectState={}))[kt.None=0]="None",kt[kt.Async=1]="Async",kt[kt.Generator=2]="Generator",kt[kt.Getter=4]="Getter",kt[kt.Setter=8]="Setter",kt[kt.Computed=16]="Computed",kt[kt.Method=32]="Method",kt[kt.Shorthand=64]="Shorthand",kt[kt.Static=128]="Static",kt[kt.Constructor=256]="Constructor",kt[kt.Heritage=512]="Heritage";const vt=(e,t)=>(e&t)===t;function Ft(t,o){return 1048576&t.token||t.flags&e.Flags.NewLine?It(t,o,17825809):an(t,!(o&e.Context.Async)&&262144&t.token?38:1,n(t.token))}function Nt(t,n,o){const{flags:r,pendingExpressionError:a}=t;t.flags|=e.Flags.AllowBinding|e.Flags.AllowDestructuring,t.pendingExpressionError=void 0;const s=o(t,n);if(t.pendingExpressionError){const{error:e,line:o,column:r,index:a}=t.pendingExpressionError;on(t,n,a,o,r,e)}return t.flags&=~(e.Flags.AllowBinding|e.Flags.AllowDestructuring),r&e.Flags.AllowBinding&&(t.flags|=e.Flags.AllowBinding),r&e.Flags.AllowDestructuring&&(t.flags|=e.Flags.AllowDestructuring),t.pendingExpressionError=a,s}function Lt(t,n,o){const{flags:r,pendingExpressionError:a}=t;t.flags|=e.Flags.AllowBinding|e.Flags.AllowDestructuring,t.pendingExpressionError=void 0;const s=o(t,n);return t.flags&e.Flags.AllowBinding&&r&e.Flags.AllowBinding||(t.flags&=~e.Flags.AllowBinding),t.flags&e.Flags.AllowDestructuring&&r&e.Flags.AllowDestructuring||(t.flags&=~e.Flags.AllowDestructuring),t.pendingExpressionError=a||t.pendingExpressionError,s}function Rt(t,n,o,r,a=e.ObjectState.None){return n&=~(e.Context.Async|e.Context.Yield|e.Context.InParameter),o&e.ModifierState.Generator&&(n|=e.Context.Yield),o&e.ModifierState.Await&&(n|=e.Context.Async),r(t,n,a)}function Dt(e,t,n){const o=new Map;for(let r=0;r<n.length;r++){const a=`@${n[r]}`;o.get(a)?sn(e,t,81):o.set(a,!0)}}const Pt=(t,n,o)=>{switch(o.type){case"Identifier":n&e.Context.Strict&&Ut(o.name)&&an(t,3);case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":case"RestElement":case"MetaProperty":return;case"ArrayExpression":o.type="ArrayPattern";for(let e=0;e<o.elements.length;++e)null!==o.elements[e]&&Pt(t,n,o.elements[e]);return;case"ObjectExpression":o.type="ObjectPattern";for(let e=0;e<o.properties.length;e++)Pt(t,n,o.properties[e]);return;case"Property":return void Pt(t,n,o.value);case"SpreadElement":o.type="RestElement","ArrayExpression"===o.argument.type||"ObjectExpression"===o.argument.type||jt(o.argument)||sn(t,n,71),Pt(t,n,o.argument);break;case"AssignmentExpression":return o.type="AssignmentPattern",delete o.operator,void Pt(t,n,o.left);case"MemberExpression":if(!(n&e.Context.InParameter))return;default:sn(t,n,n&e.Context.InParameter?77:73,o.type)}};function Mt(e,t,n){const{tokenValue:o,flags:r,line:a,column:s,startColumn:i,index:c,lastColumn:l,startLine:u,lastLine:d,lastIndex:p,startIndex:x,tokenRaw:f,token:m,lastValue:g,tokenRegExp:S,labelSet:C,errors:k,errorLocation:w,pendingExpressionError:y}=e,h=n(e,t);return e.index=c,e.token=m,e.tokenValue=o,e.tokenValue=o,e.flags=r,e.line=a,e.column=s,e.tokenRaw=f,e.lastValue=g,e.startColumn=i,e.lastColumn=l,e.startLine=u,e.lastLine=d,e.lastIndex=p,e.startIndex=x,e.tokenRegExp=S,e.labelSet=C,e.errors=k,e.errorLocation=w,e.tokenRegExp=S,e.pendingExpressionError=y,h}function jt(e){return"Identifier"===e.type||"MemberExpression"===e.type}function Ht(e){return{line:e.startLine,column:e.startColumn,index:e.startIndex}}function Bt(t,n){return t&e.Context.Strict?!(t&e.Context.Module&&262144&n)&&(!(1073741824&n)&&(131072==(131072&n)||69632==(69632&n))):131072==(131072&n)||69632==(69632&n)||20480==(20480&n)}function Vt(e,t){Ot(e,t);const{token:n}=e;return!!(1082523648&n||33574984===n||69632==(69632&n))}function Jt(e){return 12368===e.token||17825807===e.token||12363===e.token}function Tt(e,t){return Ot(e,t),50331659===e.token||16777229===e.token}function Xt(e,t){Ot(e,t);const{token:n}=e;return 1073872896&n||50331659===n}function Gt(e,t){return Ot(e,t),50331659===e.token}function Kt(t,n){return Ot(t,n),!(t.flags&e.Flags.NewLine)&&33566808===t.token}function Yt(e){return!!e.property&&"PrivateName"===e.property.type}function qt(t,o){const{token:r,tokenValue:a}=t;if(o&e.Context.Strict){if(o&e.Context.Module&&262144&r&&sn(t,o,40,n(t.token)),1073741824&r&&sn(t,o,40,n(t.token)),131072==(131072&r)||69632==(69632&r))return Re(t,o);an(t,1,n(t.token))}if(o&e.Context.Yield&&1073741824&r&&sn(t,o,40,n(t.token)),o&e.Context.Async&&262144&r&&sn(t,o,40,n(t.token)),131072==(131072&r)||69632==(69632&r)||20480==(20480&r))return Re(t,o);an(t,1,n(t.token))}function Ut(e){return"eval"===e||"arguments"===e}function $t(e){e.errorLocation={line:e.startLine,column:e.startColumn,index:e.startIndex}}function zt(e){switch(e.type){case"JSXIdentifier":return e.name;case"JSXNamespacedName":return`${zt(e.namespace)}:${zt(e.name)}`;case"JSXMemberExpression":return`${zt(e.object)}.${zt(e.property)}`}}function Wt(e){const{token:t}=e;return 17825807===t||17825809===t||83886109===t}function _t(t,n,o,r){n&e.Context.Strict&&Ut(o.name)&&sn(t,n,68,r),jt(o)||sn(t,n,5)}function Qt(e,t){e.pendingExpressionError={error:nn[t],line:e.line,column:e.column,index:e.index}}function Zt(t,n){const{token:o}=t;return 8388608&o?t.flags|=e.Flags.SimpleParameterList:4194304==(4194304&o)?($t(t),n|=e.CoverParenthesizedState.HasEvalOrArguments):20480==(20480&o)?($t(t),n|=e.CoverParenthesizedState.HasReservedWords):262144==(262144&o)&&($t(t),t.flags|=e.Flags.HasAwait),n}function en(t,n,o){const{token:r}=t;return t.flags&e.Flags.AllowBinding?8388608&r?t.flags|=e.Flags.SimpleParameterList:4194304==(4194304&r)?($t(t),o|=e.CoverCallState.EvalOrArguments):262144==(262144&r)?($t(t),o|=e.CoverCallState.Await):1073741824==(1073741824&r)&&($t(t),o|=e.CoverCallState.Yield):sn(t,n,77),o}function tn(e){return 69746===e||167786289===e}const nn={0:"Unexpected token",1:"Unexpected token '%0'",2:"Expected token '%0'",3:"Keyword must not contain escaped characters",4:"Keyword '%0' is reserved",5:"Invalid left-hand side in assignment",6:"Unterminated string literal",7:"Unterminated regular expression literal",8:"Unterminated MultiLineComment",9:"Unterminated template literal",10:"Invalid character '%0'",11:"Octal escapes are not allowed in strict mode",13:"Escapes \\8 or \\9 are not syntactically valid escapes",14:"Unicode escape code point out of range",15:"Duplicate regular expression flag '%0'",16:"Unexpected regular expression flag '%0'",17:"Eval or arguments can't be assigned to in strict mode code",18:"Illegal return statement",19:"In strict mode code, functions can only be declared at top level or inside a block",20:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",21:"%0 can't appear in single-statement context",22:"Generators can only be declared at the top level or inside a block",23:"'for await' loop should be used with 'of'",24:"Missing initializer in %0 declaration",25:"'for-%0' loop variable declaration may not have an initializer",26:"Invalid left-hand side in for-%0 loop: Must have a single binding.",27:"let is disallowed as a lexically bound name",28:"Lexical declaration cannot appear in a single-statement context",29:"Label '%0' has already been declared",30:"%0 statement must be nested within an iteration statement",31:"Illegal continue statement: '%0' does not denote an iteration statement",32:"Undefined label '%0'",33:"More than one default clause in switch statement",34:"%0 declarations may only appear at top level of a module",35:"Async functions can only be declared at the top level or inside a block",36:"No line break is allowed after '%0'",37:"Strict mode code may not include a with statement",38:"Await is only valid in async functions",39:"Function declaration must have a name in this context",12:"Duplicate constructor method in class",40:"'%0' may not be used as an identifier in this context",43:"Delete of an unqualified identifier in strict mode",44:"Private fields can not be deleted",41:"Classes may not have a private field named '#constructor'",42:"Classes may not have a field named 'constructor'",45:"Class constructor may not be a '%0'",46:"Unexpected reserved word",47:"Unexpected eval or arguments in strict mode",48:"'await' is not a valid identifier inside an async function",49:"'yield' is not a valid identifier inside an generator function",50:"Unexpected strict mode reserved word",52:"Await expression not allowed in formal parameter",51:"Yield expression not allowed in formal parameter",53:"new.target only allowed within functions",54:"super() is not allowed in this context",55:"Member access from super not allowed in this context",56:'Only "(" or "." or "[" are allowed after \'super\'',57:"'yield' is a reserved keyword within generator function bodies",58:"Only one underscore is allowed as numeric separator",59:"Numeric separators are not allowed at the end of numeric literals",60:"Numeric separator can not be used after leading 0.",61:"Legacy octal literals are not allowed in strict mode",62:"Invalid left-hand side in assignment",63:"Property name __proto__ appears more than once in object literal",64:"Illegal 'use strict' directive in function with non-simple parameter list",65:"Classes may not have a static property named 'prototype'",66:"%0 functions must have %1 argument%2",67:"Setter function argument must not be a rest parameter",68:"%0 increment/decrement may not have eval or arguments operand in strict mode",69:"Elision not allowed in object property list",70:"Rest element must be last element",72:"Spread element must be last element",71:"Rest parameter may not have a default initializer",73:"Invalid destructuring assignment target",74:"Unexpected surrogate pair",75:"Malformed %0 character escape sequence",76:"Template literals may not contain octal escape sequences",77:"Invalid binding pattern",78:"Rest parameter must be last formal parameter",79:"Missing catch or finally after try",80:"Illegal newline after throw",81:"Duplicate parameter name not allowed in this context",82:"Missing keyword 'as' after import *",83:"Labels must be followed by a ':'",84:"JSX attributes must only be assigned a non-empty 'expression'",85:"Expected corresponding JSX closing tag for %0",86:"Adjacent JSX elements must be wrapped in an enclosing tag",87:"Invalid JSX attribute value",88:"Rest element may not have a trailing comma",89:"Undefined Unicode code-point",90:"HTML comments are not allowed in modules",91:"Invalid shorthand property initializer",92:"Trailing decorator may be followed by method",93:"Decorators can't be used with a constructor",94:"`...` must be followed by an identifier in declaration contexts"};function on(t,n,o,r,a,s){const i=new SyntaxError(`Line ${r}, column ${a}: ${s}`);if(i.index=o,i.line=r,i.column=a,i.description=s,!(n&e.Context.OptionsTolerant))throw i;t.errors.push(i)}function rn(e){let{index:t,startLine:n,startColumn:o}=e;const r=e.errorLocation;return r&&(t=r.index,n=r.line,o=r.column),{index:t,line:n,column:o}}function an(t,n,...o){const{index:r,line:a,column:s}=rn(t),i=nn[n].replace(/%(\d+)/g,(e,t)=>o[t]);on(t,e.Context.Empty,r,a,s,i)}function sn(e,t,n,...o){const{index:r,line:a,column:s}=rn(e);on(e,t,r,a,s,nn[n].replace(/%(\d+)/g,(e,t)=>o[t]))}function cn(t,n){const o=Ht(t);let r=[];n&e.Context.OptionsExperimental&&(r=it(t,n)),Et(t,n|e.Context.DisallowEscapedKeyword,33566797);const a=n&e.Context.RequireIdentifier&&33685505!==t.token?null:q(t,n|e.Context.Strict|e.Context.DisallowEscapedKeyword);let s=e.ObjectState.None,i=null;It(t,n,12372)&&(i=Oe(t,n|e.Context.Strict,o),s|=e.ObjectState.Heritage);const c=_e(t,n&~e.Context.RequireIdentifier|e.Context.Strict|e.Context.InClass,s);return bt(n,t,o,n&e.Context.OptionsExperimental?{type:"ClassDeclaration",id:a,superClass:i,body:c,decorators:r}:{type:"ClassDeclaration",id:a,superClass:i,body:c})}function ln(t,n){const o=Ht(t);Et(t,n,33566808);let r=e.ModifierState.None;return It(t,n,167774771)&&(n&e.Context.AllowSingleStatement&&!(n&e.Context.InFunctionBody)&&sn(t,n,22),r=e.ModifierState.Generator),un(t,n,r,o)}function un(t,n,o,r){const{token:a}=t;let s=null;n&e.Context.Yield&&1073741824&a&&sn(t,n,49),n&e.Context.Async&&262144&a&&sn(t,n,48),50331659!==a?s=q(t,n):n&e.Context.RequireIdentifier||sn(t,n,39);const{params:i,body:c}=Rt(t,n&~(e.Context.Method|e.Context.AllowSuperProperty|e.Context.RequireIdentifier),o,Ue);return bt(n,t,r,{type:"FunctionDeclaration",params:i,body:c,async:!!(o&e.ModifierState.Await),generator:!!(o&e.ModifierState.Generator),expression:!1,id:s})}function dn(t,n){const o=Ht(t);Et(t,n,594028),Et(t,n,33566808);const r=e.ModifierState.Await;return un(t,n,(It(t,n,167774771)?e.ModifierState.Generator:e.ModifierState.None)|r,o)}function pn(t,o,r){const a=Ht(t),s=0!=(8388608&t.token),i=Y(t,o);let c=null;return It(t,o|e.Context.DisallowEscapedKeyword,83886109)?(c=Nt(t,o&~(e.Context.BlockScope|e.Context.ForStatement),Ae),tn(t.token)&&(o&e.Context.ForStatement||s)&&(167786289===t.token?(o&(e.Context.BlockScope|e.Context.Strict|e.Context.Async)||s)&&sn(t,o,25,n(t.token)):sn(t,o,25,n(t.token)))):tn(t.token)||!r&&!s||sn(t,o,24,r?"const":"destructuring"),bt(o,t,a,{type:"VariableDeclarator",init:c,id:i})}function xn(t,o,r){const a=[pn(t,o,r)];for(;It(t,o,16777234);)a.push(pn(t,o,r));return o&e.Context.ForStatement&&tn(t.token)&&1!==a.length&&sn(t,o,26,n(t.token)),a}function fn(t,o){switch(t.token){case 33566808:return ln(t,o);case 120:case 33566797:return cn(t,o);case 33574984:return function(t,n,o=!0){return Mt(t,n,Vt)?jn(t,n|e.Context.BlockScope,o):On(t,n)}(t,o|e.Context.AllowIn);case 33566793:return jn(t,o|e.Context.BlockScope|e.Context.AllowIn);case 594028:return function(e,t){return Mt(e,t,Kt)?dn(e,t):mn(e,t)}(t,o);case 33566810:if(o&e.Context.OptionsNext&&Mt(t,o,Tt))return En(t,o|e.Context.AllowIn);case 12371:o&e.Context.Module&&sn(t,o,34,n(t.token));default:return mn(t,o|e.Context.AllowSingleStatement)}}function mn(t,o){switch(t.token){case 33566791:return jn(t,o|e.Context.AllowIn);case 17825809:return gn(t,o);case 33566814:return Pn(t,o);case 41943052:return Nn(t,o);case 12380:return Ln(t,o);case 12377:return kn(t,o);case 12369:return vn(t,o);case 12386:return Fn(t,o);case 12387:return Dn(t,o);case 12362:return Cn(t,o);case 12366:return Sn(t,o);case 12367:return yn(t,o);case 302002272:return bn(t,o);case 12385:return hn(t,o|e.Context.DisallowEscapedKeyword);case 12374:return function(t,n){const o=Ht(t);Et(t,n,12374);const r=!!(n&e.Context.Async&&It(t,n,34017389));Et(t,n|e.Context.DisallowEscapedKeyword,50331659);const{token:a}=t;let s,i=null,c=null,l=null,u="ForStatement",d=null,p=null;33566793===a||33574984===a&&Mt(t,n,Vt)?l=jn(t,n&~e.Context.AllowIn|e.Context.BlockScope,!1):33566791===a?l=jn(t,n&~e.Context.AllowIn,!1):17825809!==a&&(c=Ht(t),i=Lt(t,n&~e.Context.AllowIn|e.Context.DisallowEscapedKeyword,Ae));It(t,n,69746)?(u="ForOfStatement",i?(t.flags&e.Flags.AllowDestructuring&&"AssignmentExpression"!==i.type||sn(t,n,73),Pt(t,n,i)):i=l,s=Ae(t,n|e.Context.AllowIn)):It(t,n,167786289)?(i?(t.flags&e.Flags.AllowDestructuring||sn(t,n,73),Pt(t,n,i)):i=l,u="ForInStatement",s=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn)):(16777234===t.token&&(i=he(t,n,i,c)),l&&(i=l),Et(t,n,17825809),d=17825809!==t.token?ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn):null,Et(t,n,17825809),p=16!==t.token?ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn):null);Et(t,n,16);const x=Rn(t,n);return bt(n,t,o,"ForOfStatement"===u?{type:u,body:x,left:i,right:s,await:r}:s?{type:u,body:x,left:i,right:s}:{type:u,body:x,init:i,test:d,update:p})}(t,o|e.Context.ForStatement);case 594028:return Mt(t,o,Kt)&&sn(t,o,35),On(t,o|e.Context.AllowSingleStatement);case 33566808:sn(t,o,o&e.Context.Strict?19:20);case 33566797:sn(t,o,21,n(t.token));default:return On(t,o)}}function gn(e,t){const n=Ht(e);return Ot(e,t),bt(t,e,n,{type:"EmptyStatement"})}function Sn(t,o){const r=Ht(t);Ot(t,o),t.flags&(e.Flags.InSwitchStatement|e.Flags.InIterationStatement)||sn(t,o,30,n(t.token));let a=null;if(!(t.flags&e.Flags.NewLine)&&135168&t.token){const{tokenValue:e}=t;a=Re(t,o),wt(t,o,e,!0)}return Ft(t,o),bt(o,t,r,{type:"ContinueStatement",label:a})}function Cn(t,n){const o=Ht(t);Ot(t,n);let r=null;if(!(t.flags&e.Flags.NewLine)&&135168&t.token){const{tokenValue:e}=t;r=Re(t,n),wt(t,n,e,!1)}else t.flags&(e.Flags.InSwitchStatement|e.Flags.InIterationStatement)||sn(t,n,30,"break");return Ft(t,n),bt(n,t,o,{type:"BreakStatement",label:r})}function kn(t,n){const o=Ht(t);Ot(t,n),Et(t,n,50331659);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Et(t,n,16),bt(n,t,o,{type:"IfStatement",test:r,consequent:wn(t,n|e.Context.DisallowEscapedKeyword),alternate:It(t,n,12370)?wn(t,n):null})}function wn(t,n){return n&e.Context.Strict||33566808!==t.token?mn(t,n&~e.Context.AllowSingleStatement):ln(t,n)}function yn(e,t){const n=Ht(e);return Ot(e,t),Ft(e,t),bt(t,e,n,{type:"DebuggerStatement"})}function hn(e,t){const n=Ht(e);Ot(e,t);const o=Nn(e,t),r=12364===e.token?An(e,t):null,a=It(e,t,12373)?Nn(e,t):null;return r||a||sn(e,t,79),bt(t,e,n,{type:"TryStatement",block:o,handler:r,finalizer:a})}function An(e,t){const n=Ht(e);Ot(e,t);let o=null;if(It(e,t,50331659)){const n=[];o=Y(e,t,n),Dt(e,t,n),Et(e,t,16)}return bt(t,e,n,{type:"CatchClause",param:o,body:Nn(e,t)})}function bn(t,n){const o=Ht(t);Ot(t,n),t.flags&e.Flags.NewLine&&sn(t,n,80);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Ft(t,n),bt(n,t,o,{type:"ThrowStatement",argument:r})}function En(t,n){const o=Ht(t),r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Ft(t,n),bt(n,t,o,{type:"ExpressionStatement",expression:r})}function In(t,n){const o=Ht(t),r=t.tokenRaw.slice(1,-1),a=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Ft(t,n),bt(n,t,o,{type:"ExpressionStatement",expression:a,directive:r})}function On(t,n){const o=Ht(t),{tokenValue:r,token:a}=t,s=ye(t,n&~(e.Context.AllowSingleStatement|e.Context.AllowDecorator)|e.Context.AllowIn);if(135168&a&&16777237===t.token){n&e.Context.Yield&&1073741824&a&&sn(t,n,57),Et(t,n,16777237,83),At(t,r)&&sn(t,n,29,r),yt(t,r);const i=!(n&e.Context.Strict)&&n&e.Context.AllowSingleStatement&&33566808===t.token?ln(t,n):mn(t,n);return ht(t,r),bt(n,t,o,{type:"LabeledStatement",label:s,body:i})}return Ft(t,n),bt(n,t,o,{type:"ExpressionStatement",expression:s})}function vn(t,n){const o=Ht(t);Ot(t,n);const r=Rn(t,n);Et(t,n,12386),Et(t,n,50331659);const a=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Et(t,n,16),It(t,n,17825809),bt(n,t,o,{type:"DoWhileStatement",body:r,test:a})}function Fn(t,n){const o=Ht(t);Ot(t,n),Et(t,n,50331659);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Et(t,n,16),bt(n,t,o,{type:"WhileStatement",test:r,body:Rn(t,n)})}function Nn(e,t){const n=Ht(e),o=[];for(Et(e,t,41943052);17825807!==e.token;)o.push(fn(e,t));return Et(e,t,17825807),bt(t,e,n,{type:"BlockStatement",body:o})}function Ln(t,n){const o=Ht(t);n&(e.Context.OptionsGlobalReturn|e.Context.InFunctionBody)||sn(t,n,18),t.flags&e.Flags.EscapedKeyword&&sn(t,n,3),Ot(t,n);const r=1048576&t.token||t.flags&e.Flags.NewLine?null:ye(t,n&~(e.Context.InFunctionBody|e.Context.AllowDecorator)|e.Context.AllowIn);return Ft(t,n),bt(n,t,o,{type:"ReturnStatement",argument:r})}function Rn(t,n){const o=t.flags;t.flags|=e.Flags.InIterationStatement|e.Flags.AllowDestructuring;const r=mn(t,n&~e.Context.AllowSingleStatement|e.Context.DisallowEscapedKeyword);return t.flags=o,r}function Dn(t,n){n&e.Context.Strict&&sn(t,n,37);const o=Ht(t);Ot(t,n),Et(t,n,50331659);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Et(t,n,16),bt(n,t,o,{type:"WithStatement",object:r,body:mn(t,n&~e.Context.AllowSingleStatement)})}function Pn(t,n){const o=Ht(t);Ot(t,n),Et(t,n,50331659);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);Et(t,n,16),Et(t,n|e.Context.DisallowEscapedKeyword,41943052);const a=[],s=t.flags;t.flags|=e.Flags.InSwitchStatement;let i=!1;for(;17825807!==t.token;){const e=Mn(t,n);a.push(e),null===e.test&&(i&&sn(t,n,33),i=!0)}return t.flags=s,Et(t,n,17825807),bt(n,t,o,{type:"SwitchStatement",discriminant:r,cases:a})}function Mn(t,n){const o=Ht(t);let r=null;It(t,n,12363)?r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn):Et(t,n,12368),Et(t,n,16777237);const a=[];for(;!Jt(t);)a.push(fn(t,n|e.Context.AllowIn));return bt(n,t,o,{type:"SwitchCase",test:r,consequent:a})}function jn(e,t,o=!0){const r=Ht(e),{token:a}=e,s=33566793===a;Ot(e,t);const i=xn(e,t,s);return o&&Ft(e,t),bt(t,e,r,{type:"VariableDeclaration",kind:n(a),declarations:i})}function Hn(t,n){Ot(t,n);const o=[];for(;1048576!==t.token;)o.push(33554435===t.token?In(t,n):Bn(t,n|e.Context.AllowIn));return o}function Bn(t,n){switch(t.token){case 120:return it(t,n);case 12371:return Vn(t,n);case 33566810:if(!(n&e.Context.OptionsNext&&Mt(t,n,Tt)))return Tn(t,n);default:return fn(t,n)}}function Vn(t,o){const r=Ht(t),a=[];let s=null,i=null;switch(Et(t,o|e.Context.DisallowEscapedKeyword,12371),t.token){case 167774771:return function(e,t,n){Et(e,t,167774771);const o=Yn(e,t);return Ft(e,t),bt(t,e,n,{type:"ExportAllDeclaration",source:o})}(t,o,r);case 12368:return function(t,n,o){let r;switch(Et(t,n|e.Context.DisallowEscapedKeyword,12368),t.token){case 33566808:r=ln(t,n|e.Context.RequireIdentifier);break;case 120:case 33566797:r=cn(t,n&~e.Context.AllowIn|e.Context.RequireIdentifier);break;case 594028:r=function(t,n){return Mt(t,n,Kt)?dn(t,n|e.Context.RequireIdentifier):Ae(t,n|e.Context.AllowIn)}(t,n|e.Context.RequireIdentifier);break;default:r=Ae(t,n|e.Context.AllowIn),Ft(t,n)}return bt(n,t,o,{type:"ExportDefaultDeclaration",declaration:r})}(t,o,r);case 41943052:{Et(t,o,41943052);let n=!1;for(;17825807!==t.token;)69743!==t.token&&12288&t.token&&(n=!0,$t(t)),a.push(Jn(t,o)),17825807!==t.token&&Et(t,o,16777234);Et(t,o|e.Context.DisallowEscapedKeyword,17825807),69745===t.token?s=Yn(t,o):n&&sn(t,o,46),Ft(t,o);break}case 33566797:i=cn(t,o);break;case 33574984:case 33566793:i=jn(t,o|e.Context.BlockScope);break;case 33566791:i=jn(t,o);break;case 33566808:i=ln(t,o);break;case 594028:if(Mt(t,o,Kt)){i=dn(t,o);break}default:an(t,1,n(t.token))}return bt(o,t,r,{type:"ExportNamedDeclaration",source:s,specifiers:a,declaration:i})}function Jn(t,n){const o=Ht(t),r=Me(t,n|e.Context.DisallowEscapedKeyword,t.token);return bt(n,t,o,{type:"ExportSpecifier",local:r,exported:It(t,n,167843947)?Me(t,n,t.token):r})}function Tn(t,o){const r=Ht(t);let a;Et(t,o,33566810);let s=[];return 33554435===t.token?a=De(t,o):(s=function(e,t){const o=[];switch(e.token){case 33685505:if(o.push(function(e,t){return bt(t,e,Ht(e),{type:"ImportDefaultSpecifier",local:Re(e,t)})}(e,t)),It(e,t,16777234))switch(e.token){case 167774771:Kn(e,t,o);break;case 41943052:Xn(e,t,o);break;default:sn(e,t,1,n(e.token))}break;case 41943052:Xn(e,t,o);break;case 167774771:Kn(e,t,o);break;default:an(e,1,n(e.token))}return o}(t,o|e.Context.DisallowEscapedKeyword),a=Yn(t,o)),Ft(t,o),bt(o,t,r,{type:"ImportDeclaration",specifiers:s,source:a})}function Xn(e,t,n){for(Et(e,t,41943052);17825807!==e.token;)n.push(Gn(e,t)),17825807!==e.token&&Et(e,t,16777234);Et(e,t,17825807)}function Gn(t,n){const o=Ht(t),{token:r}=t,a=Me(t,n|e.Context.DisallowEscapedKeyword,r);let s;return It(t,n,167843947)?s=q(t,n):(vt(r,12288)&&sn(t,n,46),vt(r,4194304)&&sn(t,n,47),s=a),bt(n,t,o,{type:"ImportSpecifier",local:s,imported:a})}function Kn(e,t,n){const o=Ht(e);Et(e,t,167774771),Et(e,t,167843947,82);const r=q(e,t);n.push(bt(t,e,o,{type:"ImportNamespaceSpecifier",local:r}))}function Yn(e,t){return Et(e,t,69745),33554435!==e.token&&an(e,1,n(e.token)),De(e,t)}function qn(t,n){return{source:t,length:t.length,index:0,line:1,column:0,startIndex:0,startColumn:0,startLine:1,lastIndex:0,lastColumn:0,lastLine:0,pendingExpressionError:void 0,flags:e.Flags.AllowDestructuring,token:1048576,tokenRaw:"",lastValue:0,comments:[],sourceFile:n,tokenRegExp:void 0,tokenValue:void 0,labelSet:void 0,errorLocation:void 0,errors:[]}}function Un(t,n,o){let r="";n&&(n.module&&(o|=e.Context.Module),n.next&&(o|=e.Context.OptionsNext),n.jsx&&(o|=e.Context.OptionsJSX),n.ranges&&(o|=e.Context.OptionsRanges),n.loc&&(o|=e.Context.OptionsLoc),n.raw&&(o|=e.Context.OptionsRaw),n.rawIdentifier&&(o|=e.Context.OptionsRawidentifiers),n.globalReturn&&(o|=e.Context.OptionsGlobalReturn),n.skipShebang&&(o|=e.Context.OptionsShebang),n.tolerant&&(o|=e.Context.OptionsTolerant),n.source&&(r=n.source),n.comments&&(o|=e.Context.OptionsComments),n.impliedStrict&&(o|=e.Context.Strict),n.experimental&&(o|=e.Context.OptionsExperimental),n.node&&(o|=e.Context.OptionsNode));const a=qn(t,r),s=o&e.Context.Module?Hn(a,o):$n(a,o),i={type:"Program",sourceType:o&e.Context.Module?"module":"script",body:s};return o&e.Context.LocationTracker&&(o&e.Context.OptionsRanges&&(i.start=0,i.end=t.length),o&e.Context.OptionsLoc&&(i.loc={start:{line:1,column:0},end:{line:a.line,column:a.column}},r&&(i.loc.source=r))),o&e.Context.OptionsComments&&(i.comments=a.comments),o&e.Context.OptionsTolerant&&(i.errors=a.errors),i}function $n(t,n){const o=[];let r=!0;for(Ot(t,n|e.Context.DisallowEscapedKeyword);1048576!==t.token;)r&&33554435!==t.token&&(r=!1),r?(n&e.Context.Strict||12!==t.tokenRaw.length||"use strict"!==t.tokenValue||(n|=e.Context.Strict),o.push(In(t,n))):o.push(fn(t,n));return o}function zn(e,t){return t&&t.module?_n(e,t):Wn(e,t)}function Wn(t,n){return Un(t,n,e.Context.Empty)}function _n(t,n){return Un(t,n,e.Context.Strict|e.Context.Module)}var Qn=Object.freeze({}),Zn=Object.freeze({scanIdentifier:j,scanMaybeIdentifier:H,scanHexIntegerLiteral:O,scanOctalOrBinary:v,scanImplicitOctalDigits:F,scanSignedInteger:N,scanNumericLiteral:L,scanNumericSeparator:R,scanDecimalDigitsOrSeparator:D,scanDecimalAsSmi:P,scanRegularExpression:K,scan:G,scanEscapeSequence:y,throwStringError:h,scanString:A,consumeTemplateBrace:b,scanTemplate:E,skipSingleHTMLComment:V,skipSingleLineComment:J,skipMultiLineComment:T,addComment:X,nextUnicodeChar:u,isIdentifierPart:d,escapeInvalidCharacters:p,consumeOpt:x,consumeLineFeed:f,scanPrivateName:m,advanceNewline:g,fromCodePoint:S,readNext:C,toHex:k,advanceOnMaybeAstral:w});const eo=Object.freeze({parseClassDeclaration:cn,parseFunctionDeclaration:ln,parseAsyncFunctionOrAsyncGeneratorDeclaration:dn,parseVariableDeclarationList:xn,parseExpression:ye,parseSequenceExpression:he,parseAssignmentExpression:Ae,parseRestElement:Ee,parseLeftHandSideExpression:Oe,parsePrimaryExpression:Le,parseIdentifier:Re,parseLiteral:De,parseBigIntLiteral:Pe,parseIdentifierName:Me,parseFunctionExpression:Be,parseAsyncFunctionOrAsyncGeneratorExpression:Ve,parsePropertyName:Je,parseObjectLiteral:Xe,parseFormalListAndBody:Ue,parseFunctionBody:$e,parseFormalParameters:ze,parseFormalParameterList:We,parseClassBodyAndElementList:_e,parseClassElement:Qe,parseDecorators:it,parseModuleItemList:Hn,parseModuleItem:Bn,parseExportDeclaration:Vn,parseImportDeclaration:Tn,createParser:qn,parseSource:Un,parseStatementList:$n,parse:zn,parseScript:Wn,parseModule:_n,parseBindingIdentifierOrPattern:Y,parseBindingIdentifier:q,parseAssignmentRestElement:U,parseAssignmentPattern:z,parseBindingInitializer:W,parseStatementListItem:fn,parseStatement:mn,parseEmptyStatement:gn,parseContinueStatement:Sn,parseBreakStatement:Cn,parseIfStatement:kn,parseDebuggerStatement:yn,parseTryStatement:hn,parseCatchBlock:An,parseThrowStatement:bn,parseExpressionStatement:En,parseDirective:In,parseExpressionOrLabelledStatement:On,parseDoWhileStatement:vn,parseWhileStatement:Fn,parseBlockStatement:Nn,parseReturnStatement:Ln,parseIterationStatement:Rn,parseWithStatement:Dn,parseSwitchStatement:Pn,parseCaseOrDefaultClauses:Mn,parseVariableStatement:jn,parseJSXRootElement:Q,parseJSXOpeningElement:Z,nextJSXToken:ee,scanJSXToken:te,parseJSXText:oe,parseJSXAttributes:ae,parseJSXSpreadAttribute:se,parseJSXNamespacedName:ie,parseJSXAttributeName:ce,parseJSXAttribute:ue,parseJSXEmptyExpression:de,parseJSXSpreadChild:pe,parseJSXExpressionContainer:xe,parseJSXExpression:fe,parseJSXClosingFragment:me,parseJSXClosingElement:ge,parseJSXIdentifier:Se,parseJSXMemberExpression:Ce,parseJSXElementName:ke,scanJSXIdentifier:we});e.version="1.6.9",e.ESTree=Qn,e.Scanner=Zn,e.parse=zn,e.parseSource=Un,e.parseModule=_n,e.parseScript=Wn,e.characterType=a,e.errorMessages=nn,e.constructError=on,e.report=an,e.tolerant=sn,e.tokenDesc=n,e.descKeyword=r,e.Parser=eo,e.isValidIdentifierPart=s,e.isValidIdentifierStart=i,e.mustEscape=c,e.validateBreakOrContinueLabel=wt,e.addLabel=yt,e.popLabel=ht,e.hasLabel=At,e.finishNode=bt,e.expect=Et,e.consume=It,e.nextToken=Ot,e.hasBit=vt,e.consumeSemicolon=Ft,e.parseExpressionCoverGrammar=Nt,e.restoreExpressionCoverGrammar=Lt,e.swapContext=Rt,e.validateParams=Dt,e.reinterpret=Pt,e.lookahead=Mt,e.isValidSimpleAssignmentTarget=jt,e.getLocation=Ht,e.isValidIdentifier=Bt,e.isLexical=Vt,e.isEndOfCaseOrDefaultClauses=Jt,e.nextTokenIsLeftParenOrPeriod=Tt,e.nextTokenisIdentifierOrParen=Xt,e.nextTokenIsLeftParen=Gt,e.nextTokenIsFuncKeywordOnSameLine=Kt,e.isPropertyWithPrivateFieldKey=Yt,e.parseAndClassifyIdentifier=qt,e.nameIsArgumentsOrEval=Ut,e.setPendingError=$t,e.isEqualTagNames=zt,e.isInstanceField=Wt,e.validateUpdateExpression=_t,e.setPendingExpressionError=Qt,e.validateCoverParenthesizedExpression=Zt,e.validateAsyncArgumentList=en,e.isInOrOf=tn,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/node_modules/cherow/dist/commonjs/cherow.js b/node_modules/cherow/dist/commonjs/cherow.js new file mode 100644 index 0000000..6de1842 --- /dev/null +++ b/node_modules/cherow/dist/commonjs/cherow.js @@ -0,0 +1,7317 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +// Note: this *must* be kept in sync with the enum's order.
+//
+// It exploits the enum value ordering, and it's necessarily a complete and
+// utter hack.
+//
+// All to lower it to a single monomorphic array access.
+const keywordDescTable = [
+ 'end of source',
+ /* Constants/Bindings */
+ 'identifier', 'number', 'string', 'regular expression',
+ 'false', 'true', 'null',
+ /* Template nodes */
+ 'template continuation', 'template end',
+ /* Punctuators */
+ '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '</', '/>',
+ /* Update operators */
+ '++', '--',
+ /* Assign operators */
+ '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
+ '&=',
+ /* Unary/binary operators */
+ 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
+ '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
+ /* Variable declaration kinds */
+ 'var', 'let', 'const',
+ /* Other reserved words */
+ 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
+ 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
+ 'this', 'throw', 'try', 'while', 'with',
+ /* Strict mode reserved words */
+ 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
+ /* Contextual keywords */
+ 'as', 'async', 'await', 'constructor', 'get', 'set', 'from', 'of',
+ '#',
+ 'eval', 'arguments', 'enum', 'BigInt', '@', 'JSXText',
+ /** TS */
+ 'KeyOf', 'ReadOnly', 'is', 'unique', 'declare', 'type', 'namespace', 'abstract', 'module',
+ 'global', 'require', 'target'
+];
+/**
+ * The conversion function between token and its string description/representation.
+ */
+function tokenDesc(token) {
+ return keywordDescTable[token & 255 /* Type */];
+}
+// Used `Object.create(null)` to avoid potential `Object.prototype`
+// interference.
+const descKeywordTable = Object.create(null, {
+ this: { value: 33566815 /* ThisKeyword */ },
+ function: { value: 33566808 /* FunctionKeyword */ },
+ if: { value: 12377 /* IfKeyword */ },
+ return: { value: 12380 /* ReturnKeyword */ },
+ var: { value: 33566791 /* VarKeyword */ },
+ else: { value: 12370 /* ElseKeyword */ },
+ for: { value: 12374 /* ForKeyword */ },
+ new: { value: 33566811 /* NewKeyword */ },
+ in: { value: 167786289 /* InKeyword */ },
+ typeof: { value: 302002218 /* TypeofKeyword */ },
+ while: { value: 12386 /* WhileKeyword */ },
+ case: { value: 12363 /* CaseKeyword */ },
+ break: { value: 12362 /* BreakKeyword */ },
+ try: { value: 12385 /* TryKeyword */ },
+ catch: { value: 12364 /* CatchKeyword */ },
+ delete: { value: 302002219 /* DeleteKeyword */ },
+ throw: { value: 302002272 /* ThrowKeyword */ },
+ switch: { value: 33566814 /* SwitchKeyword */ },
+ continue: { value: 12366 /* ContinueKeyword */ },
+ default: { value: 12368 /* DefaultKeyword */ },
+ instanceof: { value: 167786290 /* InstanceofKeyword */ },
+ do: { value: 12369 /* DoKeyword */ },
+ void: { value: 302002220 /* VoidKeyword */ },
+ finally: { value: 12373 /* FinallyKeyword */ },
+ arguments: { value: 37879925 /* Arguments */ },
+ keyof: { value: 131194 /* KeyOfKeyword */ },
+ readonly: { value: 131195 /* ReadOnlyKeyword */ },
+ unique: { value: 131197 /* UniqueKeyword */ },
+ declare: { value: 131198 /* DeclareKeyword */ },
+ async: { value: 594028 /* AsyncKeyword */ },
+ await: { value: 34017389 /* AwaitKeyword */ },
+ class: { value: 33566797 /* ClassKeyword */ },
+ const: { value: 33566793 /* ConstKeyword */ },
+ constructor: { value: 69742 /* ConstructorKeyword */ },
+ debugger: { value: 12367 /* DebuggerKeyword */ },
+ enum: { value: 12406 /* EnumKeyword */ },
+ eval: { value: 37879924 /* Eval */ },
+ export: { value: 12371 /* ExportKeyword */ },
+ extends: { value: 12372 /* ExtendsKeyword */ },
+ false: { value: 33566725 /* FalseKeyword */ },
+ from: { value: 69745 /* FromKeyword */ },
+ get: { value: 69743 /* GetKeyword */ },
+ implements: { value: 20579 /* ImplementsKeyword */ },
+ import: { value: 33566810 /* ImportKeyword */ },
+ interface: { value: 20580 /* InterfaceKeyword */ },
+ let: { value: 33574984 /* LetKeyword */ },
+ null: { value: 33566727 /* NullKeyword */ },
+ of: { value: 69746 /* OfKeyword */ },
+ package: { value: 20581 /* PackageKeyword */ },
+ private: { value: 20582 /* PrivateKeyword */ },
+ protected: { value: 20583 /* ProtectedKeyword */ },
+ public: { value: 20584 /* PublicKeyword */ },
+ set: { value: 69744 /* SetKeyword */ },
+ static: { value: 20585 /* StaticKeyword */ },
+ super: { value: 33566813 /* SuperKeyword */ },
+ true: { value: 33566726 /* TrueKeyword */ },
+ with: { value: 12387 /* WithKeyword */ },
+ yield: { value: 1107316842 /* YieldKeyword */ },
+ is: { value: 131196 /* IsKeyword */ },
+ type: { value: 131199 /* TypeKeyword */ },
+ namespace: { value: 131200 /* NameSpaceKeyword */ },
+ abstract: { value: 131201 /* AbstractKeyword */ },
+ as: { value: 167843947 /* AsKeyword */ },
+ module: { value: 131202 /* ModuleKeyword */ },
+ global: { value: 131203 /* GlobalKeyword */ },
+ require: { value: 131204 /* RequireKeyword */ },
+ target: { value: 131205 /* TargetKeyword */ },
+});
+function descKeyword(value) {
+ return (descKeywordTable[value] | 0);
+} + +/*@internal*/
+const characterType = [
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 16 /* Space */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+]; + +// Unicode v. 11 support
+// tslint:disable
+function isValidIdentifierPart(code) {
+ return (convert[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
+}
+function isValidIdentifierStart(code) {
+ return (convert[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
+}
+function mustEscape(code) {
+ return (convert[(code >>> 5) + 69632] >>> code & 31 & 1) !== 0;
+}
+const convert = ((compressed, lookup) => {
+ const result = new Uint32Array(104448);
+ let index = 0;
+ let subIndex = 0;
+ while (index < 3392) {
+ const inst = compressed[index++];
+ if (inst < 0) {
+ subIndex -= inst;
+ }
+ else {
+ let code = compressed[index++];
+ if (inst & 2)
+ code = lookup[code];
+ if (inst & 1) {
+ result.fill(code, subIndex, subIndex += compressed[index++]);
+ }
+ else {
+ result[subIndex++] = code;
+ }
+ }
+ }
+ return result;
+})([-1, 2, 28, 2, 29, 2, 5, -1, 0, 77595648, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 15, 2, 60, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 61, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 20, 2, 0, 0, 608174079, 2, 0, 2, 127, 2, 6, 2, 62, -1, 2, 64, 2, 26, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2965387679, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 2, 171, 0, 4294828031, 0, 3825204735, 0, 123747807, 0, 65487, 2, 3, 0, 4092591615, 0, 1080049119, 0, 458703, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247020, 2, 68, 0, 4284449919, 0, 851904, 2, 4, 2, 16, 0, 67076095, -1, 2, 69, 0, 1006628014, 0, 4093591391, -1, 0, 50331649, 0, 3265266687, 2, 34, 0, 4294844415, 0, 4278190047, 2, 23, 2, 125, -1, 3, 0, 2, 2, 33, 2, 0, 2, 9, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 10, 0, 261632, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 2088959, 2, 31, 2, 8, 0, 909311, 3, 0, 2, 0, 814743551, 2, 42, 0, 67057664, 3, 0, 2, 2, 45, 2, 0, 2, 32, 2, 0, 2, 18, 2, 7, 0, 268374015, 2, 30, 2, 51, 2, 0, 2, 78, 0, 134153215, -1, 2, 6, 2, 0, 2, 7, 0, 2684354559, 0, 67044351, 0, 1073676416, -2, 3, 0, 2, 2, 43, 0, 1046528, 3, 0, 3, 2, 8, 2, 0, 2, 41, 0, 4294960127, 2, 9, 2, 39, 2, 10, 0, 4294377472, 2, 21, 3, 0, 7, 0, 4227858431, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -1, 2, 122, 0, 1048577, 2, 84, 2, 12, -1, 2, 12, 0, 131042, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 1046559, 2, 0, 2, 13, 2, 0, 0, 2147516671, 2, 24, 3, 88, 2, 2, 0, -16, 2, 89, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 2, 119, 2, 0, 0, 3220242431, 3, 0, 3, 2, 20, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 2, 0, 2, 27, 2, 0, 2, 8, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 25, 2, 8, 2, 23, 3, 0, 2, 0, 67076097, 2, 7, 2, 0, 2, 24, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 3774349439, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, 2, 19, 0, 1638399, 2, 169, 2, 104, 3, 0, 3, 2, 23, 2, 28, 2, 29, 2, 5, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -3, 2, 146, -4, 2, 23, 2, 0, 2, 37, 0, 1, 2, 0, 2, 63, 2, 32, 2, 16, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 33, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277137519, 0, 2269118463, -1, 3, 23, 2, -1, 2, 34, 2, 38, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 48, -14, 2, 23, 2, 44, 2, 37, -5, 3, 0, 2, 2, 38, 0, 2147549120, 2, 0, 2, 16, 2, 17, 2, 130, 2, 0, 2, 52, 0, 4294901872, 0, 5242879, 3, 0, 2, 0, 402595359, -1, 2, 118, 0, 1090519039, -2, 2, 120, 2, 39, 2, 0, 2, 55, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, -4, 3, 0, 2, 0, 1140787199, -1, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 41, 2, 42, -1, 2, 10, 2, 43, -6, 2, 0, 2, 16, -3, 3, 0, 2, 0, 2147484671, -8, 2, 0, 2, 7, 2, 44, 2, 0, 0, 603979727, -1, 2, 0, 2, 45, -8, 2, 54, 2, 46, 0, 67043329, 2, 123, 2, 47, 0, 8388351, -2, 2, 124, 0, 3028287487, 2, 48, 2, 126, 0, 33259519, 2, 42, -9, 2, 24, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, 2, 42, -2, 2, 17, 2, 51, 2, 0, 2, 24, 0, 67043343, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 4294901791, 2, 7, 2, 164, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 0, 1677656575, -166, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 90, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -42, 0, 4194303871, 0, 2011, -62, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 55, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -22583, 3, 0, 7, 2, 19, -6130, 3, 5, 2, -1, 0, 69207040, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 15, 2, 60, 2, 0, 2, 35, -1, 2, 17, 2, 61, -1, 2, 0, 2, 62, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 19, 2, 63, 3, 0, 2, 0, 131135, 2, 94, 0, 70256639, 0, 71303167, 0, 272, 2, 45, 2, 62, -1, 2, 64, -2, 2, 96, 0, 603979775, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 65, 2, 66, 0, 33554435, 2, 121, 2, 65, 2, 147, 0, 131075, 0, 3594373096, 0, 67094296, 2, 66, -1, 2, 67, 0, 603979263, 2, 156, 0, 3, 0, 4294828001, 0, 602930687, 2, 180, 0, 393219, 2, 67, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 68, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 69, 0, 537783470, 0, 4026531935, -1, 0, 1, -1, 2, 34, 2, 70, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 16, -1, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 253951, 3, 20, 2, 0, 122879, 2, 0, 2, 8, 0, 276824064, -2, 3, 0, 2, 2, 45, 2, 0, 0, 4294903295, 2, 0, 2, 18, 2, 7, -1, 2, 17, 2, 51, 2, 0, 2, 78, 2, 42, -1, 2, 24, 2, 0, 2, 31, -2, 0, 128, -2, 2, 79, 2, 8, 0, 4064, -1, 2, 117, 0, 4227907585, 2, 0, 2, 116, 2, 0, 2, 50, 2, 196, 2, 9, 2, 39, 2, 10, -1, 0, 6544896, 3, 0, 6, -2, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -3, 2, 84, 2, 12, -3, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 817183, 2, 0, 2, 13, 2, 0, 0, 33023, 2, 24, 3, 88, 2, -17, 2, 89, 0, 524157950, 2, 4, 2, 0, 2, 90, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 19, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 0, 4294965179, 0, 7, 2, 0, 2, 8, 2, 92, 2, 8, -1, 0, 1761345536, 2, 94, 2, 95, 2, 38, 2, 23, 2, 96, 2, 36, 2, 162, 0, 2080440287, 2, 0, 2, 35, 2, 138, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 7, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 2700607615, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, -3, 2, 104, 3, 0, 3, 2, 23, -1, 3, 5, 2, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -8, 2, 23, 2, 0, 2, 37, -1, 2, 0, 2, 63, 2, 32, 2, 18, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 17, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277075969, 2, 18, -1, 3, 23, 2, -1, 2, 34, 2, 139, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 50, -14, 2, 23, 2, 44, 2, 116, -5, 2, 117, 2, 41, -2, 2, 117, 2, 19, 2, 17, 2, 35, 2, 117, 2, 38, 0, 4294901776, 0, 4718591, 2, 117, 2, 36, 0, 335544350, -1, 2, 118, 2, 119, -2, 2, 120, 2, 39, 2, 7, -1, 2, 121, 2, 65, 0, 3758161920, 0, 3, -4, 2, 0, 2, 31, 2, 174, -1, 2, 0, 2, 19, 0, 176, -5, 2, 0, 2, 49, 2, 182, -1, 2, 0, 2, 19, 2, 194, -1, 2, 0, 2, 62, -2, 2, 16, -7, 2, 0, 2, 119, -3, 3, 0, 2, 2, 122, -8, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871887, -1, 2, 0, 2, 45, -8, 2, 54, 2, 49, 0, 1, 2, 123, 2, 19, -3, 2, 124, 2, 37, 2, 125, 2, 126, 0, 16778239, -10, 2, 36, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, -3, 2, 17, 2, 127, 2, 0, 2, 19, 2, 50, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 65567, -1, 2, 26, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 2, 130, -187, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 2, 138, -129, 3, 0, 6, 2, 139, -1, 3, 0, 2, 2, 50, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -28719, 2, 0, 0, 1, -1, 2, 122, 2, 0, 0, 8193, -21, 0, 50331648, 0, 10255, 0, 4, -11, 2, 66, 2, 168, -1, 0, 71680, -1, 2, 157, 0, 4292900864, 0, 805306431, -5, 2, 146, -1, 2, 176, -1, 0, 6144, -2, 2, 123, -1, 2, 150, -1, 2, 153, 2, 147, 2, 161, 2, 0, 0, 3223322624, 2, 36, 0, 4, -4, 2, 188, 0, 205128192, 0, 1333757536, 0, 2147483696, 0, 423953, 0, 747766272, 0, 2717763192, 0, 4286578751, 0, 278545, 2, 148, 0, 4294886464, 0, 33292336, 0, 417809, 2, 148, 0, 1329579616, 0, 4278190128, 0, 700594195, 0, 1006647527, 0, 4286497336, 0, 4160749631, 2, 149, 0, 469762560, 0, 4171219488, 0, 16711728, 2, 149, 0, 202375680, 0, 3214918176, 0, 4294508592, 0, 139280, -1, 0, 983584, 2, 190, 0, 58720275, 0, 3489923072, 0, 10517376, 0, 4293066815, 0, 1, 0, 2013265920, 2, 175, 2, 0, 0, 17816169, 0, 3288339281, 0, 201375904, 2, 0, -2, 0, 256, 0, 122880, 0, 16777216, 2, 146, 0, 4160757760, 2, 0, -6, 2, 163, -11, 0, 3263218176, -1, 0, 49664, 0, 2160197632, 0, 8388802, -1, 0, 12713984, -1, 2, 150, 2, 155, 2, 158, -2, 2, 159, -20, 0, 3758096385, -2, 2, 151, 0, 4292878336, 2, 22, 2, 166, 0, 4294057984, -2, 2, 160, 2, 152, 2, 172, -2, 2, 151, -1, 2, 179, -1, 2, 167, 2, 122, 0, 4026593280, 0, 14, 0, 4292919296, -1, 2, 154, 0, 939588608, -1, 0, 805306368, -1, 2, 122, 0, 1610612736, 2, 152, 2, 153, 3, 0, 2, -2, 2, 154, 2, 155, -3, 0, 267386880, -1, 2, 156, 0, 7168, -1, 0, 65024, 2, 150, 2, 157, 2, 158, -7, 2, 165, -8, 2, 159, -1, 0, 1426112704, 2, 160, -1, 2, 185, 0, 271581216, 0, 2149777408, 2, 19, 2, 157, 2, 122, 0, 851967, 0, 3758129152, -1, 2, 19, 2, 178, -4, 2, 154, -20, 2, 192, 2, 161, -56, 0, 3145728, 2, 184, -1, 2, 191, 2, 122, -1, 2, 162, 2, 122, -4, 0, 32505856, -1, 2, 163, -1, 0, 2147385088, 2, 22, 1, 2155905152, 2, -3, 2, 164, 2, 0, 2, 165, -2, 2, 166, -6, 2, 167, 0, 4026597375, 0, 1, -1, 0, 1, -1, 2, 168, -3, 2, 139, 2, 66, -2, 2, 162, 2, 177, -1, 2, 173, 2, 122, -6, 2, 122, -213, 2, 167, -657, 2, 17, -36, 2, 169, -1, 2, 186, -10, 0, 4294963200, -5, 2, 170, -5, 2, 158, 2, 0, 2, 24, -1, 0, 4227919872, -1, 2, 170, -2, 0, 4227874752, -3, 0, 2146435072, 2, 155, -2, 0, 1006649344, 2, 122, -1, 2, 22, 0, 201375744, -3, 0, 134217720, 2, 22, 0, 4286677377, 0, 32896, -1, 2, 171, -3, 2, 172, -349, 2, 173, 2, 174, 2, 175, 3, 0, 264, -11, 2, 176, -2, 2, 158, 2, 0, 0, 520617856, 0, 2692743168, 0, 36, -3, 0, 524284, -11, 2, 19, -1, 2, 183, -1, 2, 181, 0, 3221291007, 2, 158, -1, 0, 524288, 0, 2158720, -3, 2, 155, 0, 1, -4, 2, 122, 0, 3808625411, 0, 3489628288, 0, 4096, 0, 1207959680, 0, 3221274624, 2, 0, -3, 2, 177, 0, 120, 0, 7340032, -2, 0, 4026564608, 2, 4, 2, 19, 2, 160, 3, 0, 4, 2, 155, -1, 2, 178, 2, 175, -1, 0, 8176, 2, 179, 2, 177, 2, 180, -1, 0, 4290773232, 2, 0, -4, 2, 160, 2, 187, 0, 15728640, 2, 175, -1, 2, 157, -1, 0, 4294934512, 3, 0, 4, -9, 2, 22, 2, 167, 2, 181, 3, 0, 4, 0, 704, 0, 1849688064, 0, 4194304, -1, 2, 122, 0, 4294901887, 2, 0, 0, 130547712, 0, 1879048192, 0, 2080374784, 3, 0, 2, -1, 2, 182, 2, 183, -1, 0, 17829776, 0, 2025848832, 0, 4261477888, -2, 2, 0, -1, 0, 4286580608, -1, 0, 29360128, 2, 184, 0, 16252928, 0, 3791388672, 2, 39, 3, 0, 2, -2, 2, 193, 2, 0, -1, 2, 26, -1, 0, 66584576, -1, 2, 189, 3, 0, 9, 2, 122, 3, 0, 4, -1, 2, 157, 2, 158, 3, 0, 5, -2, 0, 245760, 0, 2147418112, -1, 2, 146, 2, 199, 0, 4227923456, -1, 2, 185, 2, 186, 2, 22, -2, 2, 176, 0, 4292870145, 0, 262144, 2, 122, 3, 0, 2, 0, 1073758848, 2, 187, -1, 0, 4227921920, 2, 188, 0, 68289024, 0, 528402016, 0, 4292927536, 3, 0, 4, -2, 0, 2483027968, 2, 0, -2, 2, 189, 3, 0, 5, -1, 2, 184, 2, 160, 2, 0, -2, 0, 4227923936, 2, 63, -1, 2, 170, 2, 94, 2, 0, 2, 150, 2, 154, 3, 0, 6, -1, 2, 175, 3, 0, 3, -2, 0, 2146959360, 3, 0, 8, -2, 2, 157, -1, 2, 190, 2, 117, -1, 2, 151, 3, 0, 8, 2, 191, 0, 8388608, 2, 171, 2, 169, 2, 183, 0, 4286578944, 3, 0, 2, 0, 1152, 0, 1266679808, 2, 189, 0, 576, 0, 4261707776, 2, 94, 3, 0, 9, 2, 151, 3, 0, 8, -28, 2, 158, 3, 0, 3, -3, 0, 4292902912, -6, 2, 96, 3, 0, 85, -33, 2, 164, 3, 0, 126, -18, 2, 192, 3, 0, 269, -17, 2, 151, 2, 122, 0, 4294917120, 3, 0, 2, 2, 19, 0, 4290822144, -2, 0, 67174336, 0, 520093700, 2, 17, 3, 0, 21, -2, 2, 177, 3, 0, 3, -2, 0, 65504, 2, 122, 2, 49, 3, 0, 2, 2, 92, -191, 2, 123, -23, 2, 26, 3, 0, 296, -8, 2, 122, 3, 0, 2, 2, 19, -11, 2, 175, 3, 0, 72, -3, 0, 3758159872, 0, 201391616, 3, 0, 155, -7, 2, 167, -1, 0, 384, -1, 0, 133693440, -3, 2, 193, -2, 2, 30, 3, 0, 4, 2, 166, -2, 2, 22, 2, 151, 3, 0, 4, -2, 2, 185, -1, 2, 146, 0, 335552923, 2, 194, -1, 0, 538974272, 0, 2214592512, 0, 132000, -10, 0, 192, -8, 0, 12288, -21, 0, 134213632, 0, 4294901761, 3, 0, 42, 0, 100663424, 0, 4294965284, 3, 0, 62, -6, 0, 4286578784, 2, 0, -2, 0, 1006696448, 3, 0, 24, 2, 37, -1, 2, 195, 3, 0, 10, 2, 194, 0, 4110942569, 0, 1432950139, 0, 2701658217, 0, 4026532864, 0, 4026532881, 2, 0, 2, 47, 3, 0, 8, -1, 2, 154, -2, 2, 166, 0, 98304, 0, 65537, 2, 167, 2, 169, -2, 2, 154, -1, 2, 63, 2, 0, 2, 116, 2, 197, 2, 175, 0, 4294770176, 2, 30, 3, 0, 4, -30, 2, 195, 2, 196, -3, 2, 166, -2, 2, 151, 2, 0, 2, 154, -1, 2, 189, -1, 2, 157, 2, 198, 3, 0, 2, 2, 154, 2, 122, -1, 0, 193331200, -1, 0, 4227923960, 2, 197, -1, 3, 0, 3, 2, 198, 3, 0, 44, -1334, 2, 22, 2, 0, -129, 2, 195, -6, 2, 160, -180, 2, 199, -233, 2, 4, 3, 0, 96, -16, 2, 160, 3, 0, 22583, -7, 2, 17, 3, 0, 6128], [4294967295, 4294967291, 4092460543, 4294828015, 4294967294, 134217726, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 1061158911, 536805376, 4294910143, 4160749567, 4294901759, 134217727, 4294901760, 4194303, 65535, 262143, 67108863, 4286578688, 536870911, 8388607, 4294918143, 4294443008, 255, 67043328, 2281701374, 4294967232, 2097151, 4294903807, 4294902783, 4294967039, 511, 524287, 131071, 127, 4294902271, 4294549487, 16777215, 1023, 67047423, 4294901888, 33554431, 4286578687, 4294770687, 67043583, 32767, 15, 2047999, 4292870143, 4294934527, 4294966783, 67045375, 4294967279, 262083, 20511, 4290772991, 41943039, 493567, 2047, 4294959104, 1071644671, 602799615, 65536, 4294828000, 805044223, 4277151126, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 4294967264, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4294967292, 4294965759, 4294966272, 4294901823, 4294967280, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 268369920, 4292804608, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4294966591, 2445279231, 3670015, 3238002687, 63, 4294967288, 4294705151, 4095, 3221208447, 4294549472, 2147483648, 4294705152, 4294966143, 64, 4294966719, 16383, 3774873592, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4087, 31, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 536870912, 2952790016, 202506752, 139264, 402653184, 4261412864, 4227922944, 2147532800, 61440, 3758096384, 117440512, 65280, 4227858432, 3233808384, 3221225472, 4294965248, 32768, 57152, 4294934528, 67108864, 4293918720, 4290772992, 25165824, 57344, 4278190080, 65472, 4227907584, 65520, 1920, 4026531840, 49152, 4160749568, 4294836224, 63488, 1073741824, 4294967040, 251658240, 196608, 12582912, 2097152, 65408, 64512, 417808, 4227923712, 48, 512, 4294967168, 4294966784, 16, 4292870144, 4227915776, 65528, 4294950912, 65532]); + +/**
+ * Return the next unicodechar in the stream
+ *
+ * @param parser Parser object
+ */
+function nextUnicodeChar(parser) {
+ const { index } = parser;
+ const hi = parser.source.charCodeAt(index);
+ if (hi < 55296 /* LeadSurrogateMin */ || hi > 56319 /* LeadSurrogateMax */)
+ return hi;
+ const lo = parser.source.charCodeAt(index + 1);
+ if (lo < 56320 /* TrailSurrogateMin */ || lo > 57343 /* TrailSurrogateMax */)
+ return hi;
+ return 65536 /* NonBMPMin */ + ((hi & 0x3FF) << 10) | lo & 0x3FF;
+}
+/**
+ * Returns true if this is a valid identifier part
+ *
+ * @param code Codepoint
+ */
+const isIdentifierPart = (code) => (characterType[code] & 1 /* IdentifierStart */) !== 0 || isValidIdentifierPart(code);
+function escapeInvalidCharacters(code) {
+ switch (code) {
+ case 0 /* Null */:
+ return '\\0';
+ case 8 /* Backspace */:
+ return '\\b';
+ case 9 /* Tab */:
+ return '\\t';
+ case 10 /* LineFeed */:
+ return '\\n';
+ case 11 /* VerticalTab */:
+ return '\\v';
+ case 12 /* FormFeed */:
+ return '\\f';
+ case 13 /* CarriageReturn */:
+ return '\\r';
+ default:
+ if (!mustEscape(code))
+ return fromCodePoint(code);
+ if (code < 0x10)
+ return `\\x0${code.toString(16)}`;
+ if (code < 0x100)
+ return `\\x${code.toString(16)}`;
+ if (code < 0x1000)
+ return `\\u0${code.toString(16)}`;
+ if (code < 0x10000)
+ return `\\u${code.toString(16)}`;
+ return `\\u{${code.toString(16)}}`;
+ }
+}
+/**
+ * Consume an token in the scanner on match. This is an equalent to
+ * 'consume' used in the parser code itself.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeOpt(parser, code) {
+ if (parser.source.charCodeAt(parser.index) !== code)
+ return false;
+ parser.index++;
+ parser.column++;
+ return true;
+}
+/**
+ * Consumes line feed
+ *
+ * @param parser Parser object
+ * @param state Scanner state
+ */
+function consumeLineFeed(parser, state) {
+ parser.flags |= exports.Flags.NewLine;
+ parser.index++;
+ if ((state & exports.ScannerState.LastIsCR) === 0) {
+ parser.column = 0;
+ parser.line++;
+ }
+}
+/**
+ * Scans private name. Stage 3 proposal related
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanPrivateName(parser, context) {
+ if (!(context & exports.Context.InClass) || !isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return 115 /* Hash */;
+}
+/**
+ * Advance to new line
+ *
+ * @param parser Parser object
+ */
+function advanceNewline(parser) {
+ parser.flags |= exports.Flags.NewLine;
+ parser.index++;
+ parser.column = 0;
+ parser.line++;
+}
+const fromCodePoint = (code) => {
+ return code <= 0xFFFF ?
+ String.fromCharCode(code) :
+ String.fromCharCode(((code - 65536 /* NonBMPMin */) >> 10) + 55296 /* LeadSurrogateMin */, ((code - 65536 /* NonBMPMin */) & (1024 - 1)) + 56320 /* TrailSurrogateMin */);
+};
+function readNext(parser) {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.source.length)
+ report(parser, 14 /* UnicodeOutOfRange */);
+ return nextUnicodeChar(parser);
+}
+function toHex(code) {
+ if (code < 48 /* Zero */)
+ return -1;
+ if (code <= 57 /* Nine */)
+ return code - 48 /* Zero */;
+ if (code < 65 /* UpperA */)
+ return -1;
+ if (code <= 70 /* UpperF */)
+ return code - 65 /* UpperA */ + 10;
+ if (code < 97 /* LowerA */)
+ return -1;
+ if (code <= 102 /* LowerF */)
+ return code - 97 /* LowerA */ + 10;
+ return -1;
+}
+function advanceOnMaybeAstral(parser, ch) {
+ parser.index++;
+ parser.column++;
+ if (ch > 0xFFFF)
+ parser.index++;
+} + +/**
+ * Scan escape sequence
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanEscapeSequence(parser, context, first) {
+ switch (first) {
+ case 98 /* LowerB */:
+ return 8 /* Backspace */;
+ case 102 /* LowerF */:
+ return 12 /* FormFeed */;
+ case 114 /* LowerR */:
+ return 13 /* CarriageReturn */;
+ case 110 /* LowerN */:
+ return 10 /* LineFeed */;
+ case 116 /* LowerT */:
+ return 9 /* Tab */;
+ case 118 /* LowerV */:
+ return 11 /* VerticalTab */;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ return exports.Escape.Empty;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ {
+ // 1 to 3 octal digits
+ let code = first - 48 /* Zero */;
+ let index = parser.index + 1;
+ let column = parser.column + 1;
+ let next = parser.source.charCodeAt(index);
+ if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ // Strict mode code allows only \0, then a non-digit.
+ if (code !== 0 || next === 56 /* Eight */ || next === 57 /* Nine */) {
+ if (context & exports.Context.Strict)
+ return exports.Escape.StrictOctal;
+ parser.flags |= exports.Flags.HasOctal;
+ }
+ }
+ else if (context & exports.Context.Strict) {
+ return exports.Escape.StrictOctal;
+ }
+ else {
+ parser.flags |= exports.Flags.HasOctal;
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ parser.index = index - 1;
+ parser.column = column - 1;
+ }
+ return code;
+ }
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ // 1 to 2 octal digits
+ if (context & exports.Context.Strict)
+ return exports.Escape.StrictOctal;
+ let code = first - 48 /* Zero */;
+ const index = parser.index + 1;
+ const column = parser.column + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ code = code * 8 + (next - 48 /* Zero */);
+ parser.lastValue = next;
+ parser.index = index;
+ parser.column = column;
+ }
+ return code;
+ }
+ // `8`, `9` (invalid escapes)
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return exports.Escape.EightOrNine;
+ // ASCII escapes
+ case 120 /* LowerX */:
+ {
+ const ch1 = parser.lastValue = readNext(parser);
+ const hi = toHex(ch1);
+ if (hi < 0)
+ return exports.Escape.InvalidHex;
+ const ch2 = parser.lastValue = readNext(parser);
+ const lo = toHex(ch2);
+ if (lo < 0)
+ return exports.Escape.InvalidHex;
+ return hi << 4 | lo;
+ }
+ // UCS-2/Unicode escapes
+ case 117 /* LowerU */:
+ {
+ let ch = parser.lastValue = readNext(parser);
+ if (ch === 123 /* LeftBrace */) {
+ ch = parser.lastValue = readNext(parser);
+ let code = toHex(ch);
+ if (code < 0)
+ return exports.Escape.InvalidHex;
+ ch = parser.lastValue = readNext(parser);
+ while (ch !== 125 /* RightBrace */) {
+ const digit = toHex(ch);
+ if (digit < 0)
+ return exports.Escape.InvalidHex;
+ code = code * 16 + digit;
+ // Code point out of bounds
+ if (code > 1114111 /* NonBMPMax */)
+ return exports.Escape.OutOfRange;
+ ch = parser.lastValue = readNext(parser);
+ }
+ return code;
+ }
+ else {
+ // \uNNNN
+ let codePoint = toHex(ch);
+ if (codePoint < 0)
+ return exports.Escape.InvalidHex;
+ for (let i = 0; i < 3; i++) {
+ ch = parser.lastValue = readNext(parser);
+ const digit = toHex(ch);
+ if (digit < 0)
+ return exports.Escape.InvalidHex;
+ codePoint = codePoint * 16 + digit;
+ }
+ return codePoint;
+ }
+ }
+ default:
+ return parser.source.charCodeAt(parser.index);
+ }
+}
+/**
+ * Throws a string error for either string or template literal
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function throwStringError(parser, context, code) {
+ switch (code) {
+ case exports.Escape.Empty:
+ return;
+ case exports.Escape.StrictOctal:
+ report(parser, context & exports.Context.TaggedTemplate ?
+ 76 /* TemplateOctalLiteral */ :
+ 11 /* StrictOctalEscape */);
+ case exports.Escape.EightOrNine:
+ report(parser, 13 /* InvalidEightAndNine */);
+ case exports.Escape.InvalidHex:
+ report(parser, 75 /* MalformedEscape */, 'hexadecimal');
+ case exports.Escape.OutOfRange:
+ report(parser, 14 /* UnicodeOutOfRange */);
+ /* istanbul ignore next */
+ default:
+ // ignore
+ }
+}
+/**
+ * Scan a string literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote codepoint
+ */
+function scanString(parser, context, quote) {
+ const { index: start, lastValue } = parser;
+ let ret = '';
+ parser.index++;
+ parser.column++; // consume quote
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ switch (ch) {
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ report(parser, 6 /* UnterminatedString */);
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch > 128 /* MaxAsciiCharacter */) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ const code = scanEscapeSequence(parser, context, ch);
+ if (code >= 0)
+ ret += fromCodePoint(code);
+ else
+ throwStringError(parser, context, code);
+ ch = parser.lastValue;
+ }
+ break;
+ default:
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++; // consume quote
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ return 33554435 /* StringLiteral */;
+} + +/**
+ * Consumes template brace
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeTemplateBrace(parser, context) {
+ if (parser.index >= parser.length)
+ report(parser, 9 /* UnterminatedTemplate */);
+ // Upon reaching a '}', consume it and rewind the scanner state
+ parser.index--;
+ parser.column--;
+ return scanTemplate(parser, context);
+}
+/**
+ * Scan template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param first Codepoint
+ */
+function scanTemplate(parser, context) {
+ const { index: start, lastValue } = parser;
+ let tail = true;
+ let ret = '';
+ let ch = readNext(parser);
+ loop: while (ch !== 96 /* Backtick */) {
+ switch (ch) {
+ // Break after a literal `${` (thus the dedicated code path).
+ case 36 /* Dollar */:
+ {
+ const index = parser.index + 1;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 123 /* LeftBrace */) {
+ parser.index = index;
+ parser.column++;
+ tail = false;
+ break loop;
+ }
+ ret += '$';
+ break;
+ }
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch >= 128) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ // Because octals are forbidden in escaped template sequences and the fact that
+ // both string and template scanning uses the same method - 'scanEscapeSequence',
+ // we set the strict context mask.
+ const code = scanEscapeSequence(parser, context | exports.Context.Strict, ch);
+ if (code >= 0) {
+ ret += fromCodePoint(code);
+ }
+ else if (code !== exports.Escape.Empty && context & exports.Context.TaggedTemplate) {
+ ret = undefined;
+ ch = scanLooserTemplateSegment(parser, parser.lastValue);
+ if (ch < 0) {
+ tail = false;
+ }
+ break loop;
+ }
+ else {
+ throwStringError(parser, context | exports.Context.TaggedTemplate, code);
+ }
+ ch = parser.lastValue;
+ }
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ // falls through
+ default:
+ if (ret != null)
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++;
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ if (tail) {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 1);
+ return 33554441 /* TemplateTail */;
+ }
+ else {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 2);
+ return 33554440 /* TemplateCont */;
+ }
+}
+/**
+ * Scan looser template segment
+ *
+ * @param parser Parser object
+ * @param ch codepoint
+ */
+function scanLooserTemplateSegment(parser, ch) {
+ while (ch !== 96 /* Backtick */) {
+ if (ch === 36 /* Dollar */ && parser.source.charCodeAt(parser.index + 1) === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return -ch;
+ }
+ // Skip '\' and continue to scan the template token to search
+ // for the end, without validating any escape sequences
+ ch = readNext(parser);
+ }
+ return ch;
+} + +// 11.8.3 Numeric Literals
+/**
+ * Scans hex integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HexIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanHexIntegerLiteral(parser, context) {
+ parser.index++;
+ parser.column++;
+ let state = exports.NumericState.None;
+ let value = toHex(parser.source.charCodeAt(parser.index));
+ if (value < 0)
+ report(parser, 0 /* Unexpected */);
+ parser.index++;
+ parser.column++;
+ while (parser.index < parser.length) {
+ const next = parser.source.charCodeAt(parser.index);
+ if (context & exports.Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~exports.NumericState.SeenSeparator;
+ const digit = toHex(next);
+ if (digit < 0)
+ break;
+ value = value * 16 + digit;
+ parser.index++;
+ parser.column++;
+ }
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+}
+/**
+ * Scans binary and octal integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalIntegerLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BinaryIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanOctalOrBinary(parser, context, base) {
+ parser.index++;
+ parser.column++;
+ let digits = 0;
+ let ch;
+ let value = 0;
+ let state = exports.NumericState.None;
+ while (parser.index < parser.length) {
+ ch = parser.source.charCodeAt(parser.index);
+ if (context & exports.Context.OptionsNext && ch === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~exports.NumericState.SeenSeparator;
+ const converted = ch - 48 /* Zero */;
+ if (!(ch >= 48 /* Zero */ && ch <= 57 /* Nine */) || converted >= base)
+ break;
+ value = value * base + converted;
+ parser.index++;
+ parser.column++;
+ digits++;
+ }
+ if (digits === 0)
+ report(parser, 0 /* Unexpected */);
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+}
+/**
+ * Scans implicit octal digits
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalDigits)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanImplicitOctalDigits(parser, context) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ if (context & exports.Context.Strict)
+ report(parser, 0 /* Unexpected */);
+ let index = parser.index;
+ let column = parser.column;
+ let code = 0;
+ parser.flags |= exports.Flags.HasOctal;
+ // Implicit octal, unless there is a non-octal digit.
+ // (Annex B.1.1 on Numeric Literals)
+ while (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ else if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ return scanNumericLiteral(parser, context);
+ }
+ else {
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ }
+ parser.index = index;
+ parser.column = column;
+ return assembleNumericLiteral(parser, context, code, consumeOpt(parser, 110 /* LowerN */));
+ }
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ parser.flags |= exports.Flags.HasOctal;
+ default:
+ if (context & exports.Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ return scanNumericLiteral(parser, context);
+ }
+}
+/**
+ * Scans signed integer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SignedInteger)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanSignedInteger(parser, end) {
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */ || next === 45 /* Hyphen */) {
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (!(next >= 48 /* Zero */ && next <= 57 /* Nine */)) {
+ report(parser, 0 /* Unexpected */);
+ }
+ const preNumericPart = parser.index;
+ const finalFragment = scanDecimalDigitsOrSeparator(parser);
+ return parser.source.substring(end, preNumericPart) + finalFragment;
+}
+/**
+ * Scans numeric literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanNumericLiteral(parser, context, state = exports.NumericState.None) {
+ let value = state & exports.NumericState.Float ?
+ 0 :
+ scanDecimalAsSmi(parser, context);
+ const next = parser.source.charCodeAt(parser.index);
+ // I know I'm causing a bug here. The question is - will anyone figure this out?
+ if (next !== 46 /* Period */ && next !== 95 /* Underscore */ && !isValidIdentifierStart(next)) {
+ return assembleNumericLiteral(parser, context, value);
+ }
+ if (consumeOpt(parser, 46 /* Period */)) {
+ if (context & exports.Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ state |= exports.NumericState.Float;
+ value = `${value}.${scanDecimalDigitsOrSeparator(parser)}`;
+ }
+ const end = parser.index;
+ if (consumeOpt(parser, 110 /* LowerN */)) {
+ if (state & exports.NumericState.Float)
+ report(parser, 0 /* Unexpected */);
+ state |= exports.NumericState.BigInt;
+ }
+ if (consumeOpt(parser, 101 /* LowerE */) || consumeOpt(parser, 69 /* UpperE */)) {
+ state |= exports.NumericState.Float;
+ value += scanSignedInteger(parser, end);
+ }
+ if (isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 0 /* Unexpected */);
+ }
+ return assembleNumericLiteral(parser, context, state & exports.NumericState.Float ? parseFloat(value) : parseInt(value, 10), !!(state & exports.NumericState.BigInt));
+}
+/**
+ * Internal helper function for scanning numeric separators.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state NumericState state
+ */
+function scanNumericSeparator(parser, state) {
+ parser.index++;
+ parser.column++;
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ state |= exports.NumericState.SeenSeparator;
+ return state;
+}
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanDecimalDigitsOrSeparator(parser) {
+ let start = parser.index;
+ let state = exports.NumericState.None;
+ let ret = '';
+ loop: while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 95 /* Underscore */:
+ const preUnderscoreIndex = parser.index;
+ state = scanNumericSeparator(parser, state);
+ ret += parser.source.substring(start, preUnderscoreIndex);
+ start = parser.index;
+ continue;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ state = state & ~exports.NumericState.SeenSeparator;
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ break loop;
+ }
+ }
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return ret + parser.source.substring(start, parser.index);
+}
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanDecimalAsSmi(parser, context) {
+ let state = exports.NumericState.None;
+ let value = 0;
+ let next = parser.source.charCodeAt(parser.index);
+ while (next >= 48 /* Zero */ && next <= 57 /* Nine */ || next === 95 /* Underscore */) {
+ if (context & exports.Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ next = parser.source.charCodeAt(parser.index);
+ continue;
+ }
+ state &= ~exports.NumericState.SeenSeparator;
+ value = value * 10 + (next - 48 /* Zero */);
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return value;
+}
+/**
+ * Internal helper function that assamble the number scanning parts and return
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param value The numeric value
+ */
+function assembleNumericLiteral(parser, context, value, isBigInt = false) {
+ parser.tokenValue = value;
+ if (context & exports.Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ return isBigInt ? 33554551 /* BigIntLiteral */ : 33554434 /* NumericLiteral */;
+} + +/**
+ * Scan identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanIdentifier(parser, context, first) {
+ let start = parser.index;
+ let ret = '';
+ let isEscaped = false;
+ if (first)
+ advanceOnMaybeAstral(parser, first);
+ loop: while (parser.index < parser.length) {
+ const index = parser.index;
+ let ch = parser.source.charCodeAt(index);
+ switch (ch) {
+ case 92 /* Backslash */:
+ ret += parser.source.slice(start, index);
+ ret += scanUnicodeCodePointEscape(parser);
+ start = parser.index;
+ isEscaped = true;
+ break;
+ default:
+ if (ch >= 0xD800 && ch <= 0xDBFF) {
+ const lo = parser.source.charCodeAt(index + 1);
+ ch = (ch & 0x3FF) << 10 | lo & 0x3FF | 0x10000;
+ }
+ if (!isIdentifierPart(ch))
+ break loop;
+ advanceOnMaybeAstral(parser, ch);
+ }
+ }
+ if (start < parser.index)
+ ret += parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ const len = ret.length;
+ // Keywords are between 2 and 11 characters long and start with a lowercase letter
+ // https://tc39.github.io/ecma262/#sec-keywords
+ if (len >= 2 && len <= 11) {
+ const token = descKeyword(ret);
+ if (token > 0) {
+ if (isEscaped) {
+ if (context & exports.Context.DisallowEscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ // Here we fall back to a mutual parser flag if the escaped keyword isn't disallowed through
+ // context masks. This is similiar to how V8 does it - they are using an
+ // 'escaped_keyword' token.
+ // - J.K. Thomas
+ parser.flags |= exports.Flags.EscapedKeyword;
+ }
+ return token;
+ }
+ }
+ if (context & exports.Context.OptionsRawidentifiers)
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ return 33685505 /* Identifier */;
+}
+/**
+ * Scanning chars in the range 0...127, and treat them as an possible
+ * identifier. This allows subsequent checking to be faster.
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param first Code point
+ */
+function scanMaybeIdentifier(parser, context, first) {
+ first = nextUnicodeChar(parser);
+ if (!isValidIdentifierStart(first)) {
+ report(parser, 10 /* UnexpectedChar */, escapeInvalidCharacters(first));
+ }
+ return scanIdentifier(parser, context, first);
+}
+/**
+ * Scan unicode codepoint escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanUnicodeCodePointEscape(parser) {
+ const { index } = parser;
+ if (index + 5 < parser.length) {
+ if (parser.source.charCodeAt(index + 1) !== 117 /* LowerU */) {
+ report(parser, 0 /* Unexpected */);
+ }
+ parser.index += 2;
+ parser.column += 2;
+ const code = scanIdentifierUnicodeEscape(parser);
+ if (code >= 55296 /* LeadSurrogateMin */ && code <= 56319 /* LeadSurrogateMax */) {
+ report(parser, 74 /* UnexpectedSurrogate */);
+ }
+ if (!isIdentifierPart(code)) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ return fromCodePoint(code);
+ }
+ report(parser, 0 /* Unexpected */);
+}
+/**
+ * Scan identifier unicode escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanIdentifierUnicodeEscape(parser) {
+ // Accept both \uxxxx and \u{xxxxxx}. In the latter case, the number of
+ // hex digits between { } is arbitrary. \ and u have already been read.
+ let ch = parser.source.charCodeAt(parser.index);
+ let codePoint = 0;
+ // '\u{DDDDDDDD}'
+ if (ch === 123 /* LeftBrace */) { // {
+ ch = readNext(parser);
+ let digit = toHex(ch);
+ while (digit >= 0) {
+ codePoint = (codePoint << 4) | digit;
+ if (codePoint > 1114111 /* NonBMPMax */) {
+ report(parser, 89 /* UndefinedUnicodeCodePoint */);
+ }
+ parser.index++;
+ parser.column++;
+ digit = toHex(parser.source.charCodeAt(parser.index));
+ }
+ if (parser.source.charCodeAt(parser.index) !== 125 /* RightBrace */) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ consumeOpt(parser, 125 /* RightBrace */);
+ // '\uDDDD'
+ }
+ else {
+ for (let i = 0; i < 4; i++) {
+ ch = parser.source.charCodeAt(parser.index);
+ const digit = toHex(ch);
+ if (digit < 0)
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ codePoint = (codePoint << 4) | digit;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ return codePoint;
+} + +// 11.4 Comments
+/**
+ * Skips single HTML comments. Same behavior as in V8.
+ *
+ * @param parser Parser Object
+ * @param context Context masks.
+ * @param state Scanner state
+ * @param type Comment type
+ */
+function skipSingleHTMLComment(parser, context, state, type) {
+ if (context & exports.Context.Module)
+ report(parser, 90 /* HtmlCommentInModule */);
+ return skipSingleLineComment(parser, context, state, type);
+}
+/**
+ * Skips SingleLineComment, SingleLineHTMLCloseComment and SingleLineHTMLOpenComment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SingleLineComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLOpenComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLCloseComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ * @param type Comment type
+ */
+function skipSingleLineComment(parser, context, state, type) {
+ const start = parser.index;
+ const collectable = !!(context & exports.Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 13 /* CarriageReturn */:
+ advanceNewline(parser);
+ if ((parser.index < parser.length) && parser.source.charCodeAt(parser.index) === 10 /* LineFeed */)
+ parser.index++;
+ return state | exports.ScannerState.NewLine;
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ advanceNewline(parser);
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state | exports.ScannerState.NewLine;
+ default:
+ parser.index++;
+ parser.column++;
+ }
+ }
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state;
+}
+/**
+ * Skips multiline comment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-MultiLineComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ */
+function skipMultiLineComment(parser, context, state) {
+ const start = parser.index;
+ const collectable = !!(context & exports.Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 42 /* Asterisk */:
+ parser.index++;
+ parser.column++;
+ state &= ~exports.ScannerState.LastIsCR;
+ if (consumeOpt(parser, 47 /* Slash */)) {
+ if (collectable)
+ addComment(parser, context, 'MultiLine', start);
+ return state;
+ }
+ break;
+ // Mark multiline comments containing linebreaks as new lines
+ // so we can perfectly handle edge cases like: '1/*\n*/--> a comment'
+ case 13 /* CarriageReturn */:
+ state |= exports.ScannerState.NewLine | exports.ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ break;
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ default:
+ state &= ~exports.ScannerState.LastIsCR;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ // Unterminated multi-line comment.
+ tolerant(parser, context, 8 /* UnterminatedComment */);
+}
+/**
+ * Add comments
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param type Comment type
+ * @param commentStart Start position of comment
+ */
+function addComment(parser, context, type, commentStart) {
+ const { index, startIndex: start, startLine, startColumn, lastLine, lastColumn } = parser;
+ const comment = {
+ type,
+ value: parser.source.slice(commentStart, type === 'MultiLine' ? index - 2 : index),
+ start,
+ end: index,
+ };
+ if (context & exports.Context.OptionsLoc) {
+ comment.loc = {
+ start: { line: startLine, column: startColumn },
+ end: { line: lastLine, column: lastColumn },
+ };
+ }
+ parser.comments.push(comment);
+} + +/**
+ * Scan
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-punctuatorss)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scan(parser, context) {
+ parser.flags &= ~exports.Flags.NewLine | exports.Flags.EscapedKeyword;
+ const lineStart = parser.index === 0;
+ let state = exports.ScannerState.None;
+ while (parser.index < parser.length) {
+ if (!lineStart) {
+ parser.startIndex = parser.index;
+ parser.startColumn = parser.column;
+ parser.startLine = parser.line;
+ }
+ const first = parser.source.charCodeAt(parser.index);
+ if (first > 128 /* MaxAsciiCharacter */) {
+ switch (first) {
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ case 65519 /* ByteOrderMark */:
+ case 160 /* NonBreakingSpace */:
+ case 5760 /* Ogham */:
+ case 8192 /* EnQuad */:
+ case 8193 /* EmQuad */:
+ case 8194 /* EnSpace */:
+ case 8195 /* EmSpace */:
+ case 8196 /* ThreePerEmSpace */:
+ case 8197 /* FourPerEmSpace */:
+ case 8198 /* SixPerEmSpace */:
+ case 8199 /* FigureSpace */:
+ case 8200 /* PunctuationSpace */:
+ case 8201 /* ThinSpace */:
+ case 8202 /* HairSpace */:
+ case 8239 /* NarrowNoBreakSpace */:
+ case 8287 /* MathematicalSpace */:
+ case 12288 /* IdeographicSpace */:
+ case 65279 /* Zwnbs */:
+ case 8205 /* Zwj */:
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ return scanMaybeIdentifier(parser, context, first);
+ }
+ }
+ else {
+ // Note: Here we first get rid of LT and WS, then we make sure that the lookup time
+ // for the single punctuator char is short as possible. A single punctuator
+ // char is a valid token that cannot also be a prefix of a combination
+ // of long tokens - e.g. '(', ')' and '=' is valid. '==' is not.
+ switch (first) {
+ case 13 /* CarriageReturn */:
+ state |= exports.ScannerState.NewLine | exports.ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ break;
+ case 9 /* Tab */:
+ case 11 /* VerticalTab */:
+ case 12 /* FormFeed */:
+ case 32 /* Space */:
+ parser.index++;
+ parser.column++;
+ break;
+ // `(`
+ case 40 /* LeftParen */:
+ parser.index++;
+ parser.column++;
+ return 50331659 /* LeftParen */;
+ // `)`
+ case 41 /* RightParen */:
+ parser.index++;
+ parser.column++;
+ return 16 /* RightParen */;
+ // `,`
+ case 44 /* Comma */:
+ parser.index++;
+ parser.column++;
+ return 16777234 /* Comma */;
+ // `:`
+ case 58 /* Colon */:
+ parser.index++;
+ parser.column++;
+ return 16777237 /* Colon */;
+ // `;`
+ case 59 /* Semicolon */:
+ parser.index++;
+ parser.column++;
+ return 17825809 /* Semicolon */;
+ // `?`
+ case 63 /* QuestionMark */:
+ parser.index++;
+ parser.column++;
+ return 22 /* QuestionMark */;
+ // `]`
+ case 93 /* RightBracket */:
+ parser.index++;
+ parser.column++;
+ return 20 /* RightBracket */;
+ // `{`
+ case 123 /* LeftBrace */:
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ // `}`
+ case 125 /* RightBrace */:
+ parser.index++;
+ parser.column++;
+ return 17825807 /* RightBrace */;
+ // `~`
+ case 126 /* Tilde */:
+ parser.index++;
+ parser.column++;
+ return 301989934 /* Complement */;
+ // `[`
+ case 91 /* LeftBracket */:
+ parser.index++;
+ parser.column++;
+ return 41943059 /* LeftBracket */;
+ // `@`
+ case 64 /* At */:
+ parser.index++;
+ parser.column++;
+ return 120 /* At */;
+ // `/`, `/=`, `/>`
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774773 /* Divide */;
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipSingleLineComment(parser, context, state, 'SingleLine');
+ continue;
+ }
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipMultiLineComment(parser, context, state);
+ continue;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 100663333 /* DivideAssign */;
+ }
+ default:
+ return 167774773 /* Divide */;
+ }
+ }
+ // `-`, `--`, `-=`
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++; // skip `-`
+ const next = parser.source.charCodeAt(parser.index);
+ switch (next) {
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++;
+ if ((state & exports.ScannerState.NewLine || lineStart) &&
+ consumeOpt(parser, 62 /* GreaterThan */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLClose');
+ continue;
+ }
+ return 570425372 /* Decrement */;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 67108899 /* SubtractAssign */;
+ }
+ default:
+ return 436209968 /* Subtract */;
+ }
+ }
+ // `<`, `<=`, `<<`, `<<=`, `</`, <!--
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++; // skip `<`
+ if (consumeOpt(parser, 33 /* Exclamation */) &&
+ consumeOpt(parser, 45 /* Hyphen */) &&
+ consumeOpt(parser, 45 /* Hyphen */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLOpen');
+ continue;
+ }
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 61 /* EqualSign */) ?
+ 67108894 /* ShiftLeftAssign */ :
+ 167774273 /* ShiftLeft */;
+ case 61 /* EqualSign */:
+ parser.index++;
+ parser.column++;
+ return 167774013 /* LessThanOrEqual */;
+ case 47 /* Slash */:
+ {
+ if (!(context & exports.Context.OptionsJSX))
+ break;
+ const index = parser.index + 1;
+ // Check that it's not a comment start.
+ if (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 42 /* Asterisk */ || next === 47 /* Slash */)
+ break;
+ }
+ parser.index++;
+ parser.column++;
+ return 25 /* JSXClose */;
+ }
+ default: // ignore
+ return 167774015 /* LessThan */;
+ }
+ // `!`, `!=`, `!==`
+ case 33 /* Exclamation */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 301989933 /* Negate */;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773756 /* LooseNotEqual */;
+ return 167773754 /* StrictNotEqual */;
+ // `'string'`, `"string"`
+ case 39 /* SingleQuote */:
+ case 34 /* DoubleQuote */:
+ return scanString(parser, context, first);
+ // `%`, `%=`
+ case 37 /* Percent */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167774772 /* Modulo */;
+ return 67108902 /* ModuloAssign */;
+ // `&`, `&&`, `&=`
+ case 38 /* Ampersand */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 38 /* Ampersand */) {
+ parser.index++;
+ parser.column++;
+ return 169869879 /* LogicalAnd */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108905 /* BitwiseAndAssign */;
+ }
+ return 167773508 /* BitwiseAnd */;
+ }
+ // `*`, `**`, `*=`, `**=`
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774771 /* Multiply */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108900 /* MultiplyAssign */;
+ }
+ if (next !== 42 /* Asterisk */)
+ return 167774771 /* Multiply */;
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167775030 /* Exponentiate */;
+ return 67108897 /* ExponentiateAssign */;
+ }
+ // `+`, `++`, `+=`
+ case 43 /* Plus */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 436209967 /* Add */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */) {
+ parser.index++;
+ parser.column++;
+ return 570425371 /* Increment */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108898 /* AddAssign */;
+ }
+ return 436209967 /* Add */;
+ }
+ // `\\u{N}var`
+ case 92 /* Backslash */:
+ return scanIdentifier(parser, context);
+ // `=`, `==`, `===`, `=>`
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 167773753 /* StrictEqual */;
+ }
+ else {
+ return 167773755 /* LooseEqual */;
+ }
+ }
+ else if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ return 10 /* Arrow */;
+ }
+ return 83886109 /* Assign */;
+ }
+ // `>`, `>=`, `>>`, `>>>`, `>>=`, `>>>=`
+ case 62 /* GreaterThan */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774016 /* GreaterThan */;
+ if (context & exports.Context.InJSXChild)
+ return 167774016 /* GreaterThan */;
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 167774014 /* GreaterThanOrEqual */;
+ }
+ if (next !== 62 /* GreaterThan */)
+ return 167774016 /* GreaterThan */;
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 67108896 /* LogicalShiftRightAssign */;
+ }
+ else {
+ return 167774275 /* LogicalShiftRight */;
+ }
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108895 /* ShiftRightAssign */;
+ }
+ return 167774274 /* ShiftRight */;
+ }
+ // `^`, `^=`
+ case 94 /* Caret */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773254 /* BitwiseXor */;
+ return 67108903 /* BitwiseXorAssign */;
+ // ``string``
+ case 96 /* Backtick */:
+ return scanTemplate(parser, context);
+ // `|`, `||`, `|=`
+ case 124 /* VerticalBar */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 124 /* VerticalBar */) {
+ parser.index++;
+ parser.column++;
+ return 169869624 /* LogicalOr */;
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108904 /* BitwiseOrAssign */;
+ }
+ return 167772997 /* BitwiseOr */;
+ }
+ // `.`, `...`, `.123` (numeric literal)
+ case 46 /* Period */:
+ {
+ let index = parser.index + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 57 /* Nine */) {
+ scanNumericLiteral(parser, context, exports.NumericState.Float);
+ return 33554434 /* NumericLiteral */;
+ }
+ else if (next === 46 /* Period */) {
+ index++;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 46 /* Period */) {
+ parser.index = index + 1;
+ parser.column += 3;
+ return 14 /* Ellipsis */;
+ }
+ }
+ parser.index++;
+ parser.column++;
+ return 16777229 /* Period */;
+ }
+ // `#`
+ case 35 /* Hash */:
+ {
+ parser.index++;
+ parser.column++;
+ const index = parser.index;
+ const next = parser.source.charCodeAt(index);
+ if (context & exports.Context.OptionsShebang &&
+ lineStart &&
+ next === 33 /* Exclamation */) {
+ parser.index = index + 1;
+ skipSingleLineComment(parser, context, exports.ScannerState.None, 'SheBang');
+ continue;
+ }
+ return scanPrivateName(parser, context);
+ }
+ // `0`...`9`
+ case 48 /* Zero */:
+ {
+ parser.index++;
+ parser.column++;
+ switch (parser.source.charCodeAt(parser.index)) {
+ // Hex number - '0x', '0X'
+ case 88 /* UpperX */:
+ case 120 /* LowerX */:
+ return scanHexIntegerLiteral(parser, context);
+ // Binary number - '0b', '0B'
+ case 66 /* UpperB */:
+ case 98 /* LowerB */:
+ return scanOctalOrBinary(parser, context, 2);
+ // Octal number - '0o', '0O'
+ case 79 /* UpperO */:
+ case 111 /* LowerO */:
+ return scanOctalOrBinary(parser, context, 8);
+ default:
+ // Implicit octal digits startign with '0'
+ return scanImplicitOctalDigits(parser, context);
+ }
+ }
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return scanNumericLiteral(parser, context);
+ // `a`...`z`, `A`...`Z`, `_var`, `$var`
+ case 65 /* UpperA */:
+ case 66 /* UpperB */:
+ case 67 /* UpperC */:
+ case 68 /* UpperD */:
+ case 69 /* UpperE */:
+ case 70 /* UpperF */:
+ case 71 /* UpperG */:
+ case 72 /* UpperH */:
+ case 73 /* UpperI */:
+ case 74 /* UpperJ */:
+ case 75 /* UpperK */:
+ case 76 /* UpperL */:
+ case 77 /* UpperM */:
+ case 78 /* UpperN */:
+ case 79 /* UpperO */:
+ case 80 /* UpperP */:
+ case 81 /* UpperQ */:
+ case 82 /* UpperR */:
+ case 83 /* UpperS */:
+ case 84 /* UpperT */:
+ case 85 /* UpperU */:
+ case 86 /* UpperV */:
+ case 87 /* UpperW */:
+ case 88 /* UpperX */:
+ case 89 /* UpperY */:
+ case 90 /* UpperZ */:
+ case 36 /* Dollar */:
+ case 95 /* Underscore */:
+ case 97 /* LowerA */:
+ case 98 /* LowerB */:
+ case 99 /* LowerC */:
+ case 100 /* LowerD */:
+ case 101 /* LowerE */:
+ case 102 /* LowerF */:
+ case 103 /* LowerG */:
+ case 104 /* LowerH */:
+ case 105 /* LowerI */:
+ case 106 /* LowerJ */:
+ case 107 /* LowerK */:
+ case 108 /* LowerL */:
+ case 109 /* LowerM */:
+ case 110 /* LowerN */:
+ case 111 /* LowerO */:
+ case 112 /* LowerP */:
+ case 113 /* LowerQ */:
+ case 114 /* LowerR */:
+ case 115 /* LowerS */:
+ case 116 /* LowerT */:
+ case 117 /* LowerU */:
+ case 118 /* LowerV */:
+ case 119 /* LowerW */:
+ case 120 /* LowerX */:
+ case 121 /* LowerY */:
+ case 122 /* LowerZ */:
+ default:
+ return scanIdentifier(parser, context, first);
+ }
+ }
+ }
+ return 1048576 /* EndOfSource */;
+} + +/**
+ * Scans regular expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanRegularExpression(parser, context) {
+ const bodyStart = parser.index;
+ let preparseState = exports.RegexState.Empty;
+ loop: while (true) {
+ const ch = parser.source.charCodeAt(parser.index);
+ parser.index++;
+ parser.column++;
+ if (preparseState & exports.RegexState.Escape) {
+ preparseState &= ~exports.RegexState.Escape;
+ }
+ else {
+ switch (ch) {
+ case 47 /* Slash */:
+ if (!preparseState)
+ break loop;
+ else
+ break;
+ case 92 /* Backslash */:
+ preparseState |= exports.RegexState.Escape;
+ break;
+ case 91 /* LeftBracket */:
+ preparseState |= exports.RegexState.Class;
+ break;
+ case 93 /* RightBracket */:
+ preparseState &= exports.RegexState.Escape;
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ report(parser, 7 /* UnterminatedRegExp */);
+ default: // ignore
+ }
+ }
+ if (parser.index >= parser.source.length) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ const bodyEnd = parser.index - 1;
+ let mask = exports.RegexFlags.Empty;
+ const { index: flagStart } = parser;
+ loop: while (parser.index < parser.source.length) {
+ const code = parser.source.charCodeAt(parser.index);
+ switch (code) {
+ case 103 /* LowerG */:
+ if (mask & exports.RegexFlags.Global)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'g');
+ mask |= exports.RegexFlags.Global;
+ break;
+ case 105 /* LowerI */:
+ if (mask & exports.RegexFlags.IgnoreCase)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'i');
+ mask |= exports.RegexFlags.IgnoreCase;
+ break;
+ case 109 /* LowerM */:
+ if (mask & exports.RegexFlags.Multiline)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'm');
+ mask |= exports.RegexFlags.Multiline;
+ break;
+ case 117 /* LowerU */:
+ if (mask & exports.RegexFlags.Unicode)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'u');
+ mask |= exports.RegexFlags.Unicode;
+ break;
+ case 121 /* LowerY */:
+ if (mask & exports.RegexFlags.Sticky)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'y');
+ mask |= exports.RegexFlags.Sticky;
+ break;
+ case 115 /* LowerS */:
+ if (mask & exports.RegexFlags.DotAll)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 's');
+ mask |= exports.RegexFlags.DotAll;
+ break;
+ default:
+ if (!isIdentifierPart(code))
+ break loop;
+ report(parser, 16 /* UnexpectedTokenRegExpFlag */, fromCodePoint(code));
+ }
+ parser.index++;
+ parser.column++;
+ }
+ const flags = parser.source.slice(flagStart, parser.index);
+ const pattern = parser.source.slice(bodyStart, bodyEnd);
+ parser.tokenRegExp = { pattern, flags };
+ if (context & exports.Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ parser.tokenValue = validate(parser, context, pattern, flags);
+ return 33554436 /* RegularExpression */;
+}
+/**
+ * Validates regular expressions
+ *
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param pattern Regexp body
+ * @param flags Regexp flags
+ */
+function validate(parser, context, pattern, flags) {
+ if (!(context & exports.Context.OptionsNode)) {
+ try {
+ }
+ catch (e) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ try {
+ return new RegExp(pattern, flags);
+ }
+ catch (e) {
+ return null;
+ }
+} + +// 12.15.5 Destructuring Assignment
+/**
+ * Parses either a binding identifier or binding pattern
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingIdentifierOrPattern(parser, context, args = []) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ return token === 41943052 /* LeftBrace */ ?
+ parserObjectAssignmentPattern(parser, context) :
+ parseArrayAssignmentPattern(parser, context, args);
+ }
+ else if (token & (262144 /* IsAwait */ | 1073741824 /* IsYield */)) {
+ if (token & 262144 /* IsAwait */ && (context & (exports.Context.Async | exports.Context.Module))) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ else if (token & 1073741824 /* IsYield */ && (context & (exports.Context.Yield | exports.Context.Strict))) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ }
+ args.push(parser.tokenValue);
+ return parseBindingIdentifier(parser, context);
+}
+/**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BindingIdentifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingIdentifier(parser, context) {
+ const { token } = parser;
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ else if (context & exports.Context.BlockScope && token === 33574984 /* LetKeyword */) {
+ // let is disallowed as a lexically bound name
+ tolerant(parser, context, 27 /* LetInLexicalBinding */);
+ }
+ else if (hasBit(token, 20480 /* FutureReserved */)) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ parser.flags |= exports.Flags.StrictFunctionName;
+ }
+ else if (!isValidIdentifier(context, token)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+}
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentRestElement(parser, context, args) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * Parse rest property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+// tslint:disable-next-line:function-name
+function AssignmentRestProperty(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const { token } = parser;
+ const argument = parseBindingIdentifierOrPattern(parser, context);
+ if (hasBit(token, 8388608 /* IsBindingPattern */))
+ tolerant(parser, context, 94 /* InvalidRestBindingPattern */);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * ArrayAssignmentPattern[Yield] :
+ * [ Elisionopt AssignmentRestElement[?Yield]opt ]
+ * [ AssignmentElementList[?Yield] ]
+ * [ AssignmentElementList[?Yield] , Elisionopt AssignmentRestElement[?Yield]opt ]
+ *
+ * AssignmentRestElement[Yield] :
+ * ... DestructuringAssignmentTarget[?Yield]
+ *
+ * AssignmentElementList[Yield] :
+ * AssignmentElisionElement[?Yield]
+ * AssignmentElementList[?Yield] , AssignmentElisionElement[?Yield]
+ *
+ * AssignmentElisionElement[Yield] :
+ * Elisionopt AssignmentElement[?Yield]
+ *
+ * AssignmentElement[Yield] :
+ * DestructuringAssignmentTarget[?Yield] Initializer[In,?Yield]opt
+ *
+ * DestructuringAssignmentTarget[Yield] :
+ * LeftHandSideExpression[?Yield]
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param Parser object
+ * @param Context masks
+ */
+function parseArrayAssignmentPattern(parser, context, args) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else {
+ if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseAssignmentRestElement(parser, context, args));
+ break;
+ }
+ else {
+ elements.push(parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseBindingInitializer));
+ }
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ // tslint:disable-next-line:no-object-literal-type-assertion
+ return finishNode(context, parser, pos, {
+ type: 'ArrayPattern',
+ elements,
+ });
+}
+/**
+ * Parse object assignment pattern
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parserObjectAssignmentPattern(parser, context) {
+ const pos = getLocation(parser);
+ const properties = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ properties.push(AssignmentRestProperty(parser, context));
+ break;
+ }
+ properties.push(parseAssignmentProperty(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ObjectPattern',
+ properties,
+ });
+}
+/** Parse assignment pattern
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param left LHS of assignment pattern
+ * @param pos Location
+ */
+function parseAssignmentPattern(parser, context, left, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse binding initializer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingInitializer(parser, context) {
+ const pos = getLocation(parser);
+ const left = parseBindingIdentifierOrPattern(parser, context);
+ return !consume(parser, context, 83886109 /* Assign */) ?
+ left :
+ finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseAssignmentExpression(parser, context | exports.Context.AllowIn),
+ });
+}
+/**
+ * Parse assignment property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentProperty(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ let key;
+ let value;
+ let computed = false;
+ let shorthand = false;
+ // single name binding
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ key = parseIdentifier(parser, context);
+ shorthand = !consume(parser, context, 16777237 /* Colon */);
+ if (shorthand) {
+ const hasInitializer = consume(parser, context, 83886109 /* Assign */);
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (!isValidIdentifier(context, token))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ value = hasInitializer ? parseAssignmentPattern(parser, context, key, pos) : key;
+ }
+ else
+ value = parseBindingInitializer(parser, context);
+ }
+ else {
+ computed = token === 41943059 /* LeftBracket */;
+ key = parsePropertyName(parser, context);
+ expect(parser, context, 16777237 /* Colon */);
+ value = parseExpressionCoverGrammar(parser, context, parseBindingInitializer);
+ }
+ // Note! The specs specifically state that this is "assignment property", but
+ // nothing in ESTree specs explains the difference between this "property" and the "property" for object literals.
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ kind: 'init',
+ key,
+ computed,
+ value,
+ method: false,
+ shorthand,
+ });
+} + +// JSX Specification
+// https://facebook.github.io/jsx/
+/**
+ * Parses JSX element or JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXRootElement(parser, context) {
+ const pos = getLocation(parser);
+ let children = [];
+ let closingElement = null;
+ let selfClosing = false;
+ let openingElement;
+ expect(parser, context, 167774015 /* LessThan */);
+ const isFragment = parser.token === 167774016 /* GreaterThan */;
+ if (isFragment) {
+ openingElement = parseJSXOpeningFragment(parser, context, pos);
+ }
+ else {
+ const name = parseJSXElementName(parser, context);
+ const attributes = parseJSXAttributes(parser, context);
+ selfClosing = consume(parser, context, 167774773 /* Divide */);
+ openingElement = parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos);
+ }
+ if (isFragment)
+ return parseJSXFragment(parser, context, openingElement, pos);
+ if (!selfClosing) {
+ children = parseJSXChildren(parser, context);
+ closingElement = parseJSXClosingElement(parser, context);
+ const open = isEqualTagNames(openingElement.name);
+ const close = isEqualTagNames(closingElement.name);
+ if (open !== close)
+ report(parser, 85 /* ExpectedJSXClosingTag */, close);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'JSXElement',
+ children,
+ openingElement,
+ closingElement,
+ });
+}
+/**
+ * Parses JSX opening element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param name Element name
+ * @param attributes Element attributes
+ * @param selfClosing True if this is a selfclosing JSX Element
+ * @param pos Line / Column tracking
+ */
+function parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos) {
+ if (context & exports.Context.InJSXChild && selfClosing)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningElement',
+ name,
+ attributes,
+ selfClosing,
+ });
+}
+/**
+ * Parse JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param openingElement Opening fragment
+ * @param pos Line / Column location
+ */
+function parseJSXFragment(parser, context, openingElement, pos) {
+ const children = parseJSXChildren(parser, context);
+ const closingFragment = parseJSXClosingFragment(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXFragment',
+ children,
+ openingElement,
+ closingFragment,
+ });
+}
+/**
+ * Parse JSX opening fragmentD
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXOpeningFragment(parser, context, pos) {
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningFragment',
+ });
+}
+/**
+ * Prime the scanner and advance to the next JSX token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextJSXToken(parser) {
+ return parser.token = scanJSXToken(parser);
+}
+/**
+ * Mini scanner
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXToken(parser) {
+ if (parser.index >= parser.source.length)
+ return 1048576 /* EndOfSource */;
+ parser.lastIndex = parser.startIndex = parser.index;
+ const char = parser.source.charCodeAt(parser.index);
+ if (char === 60 /* LessThan */) {
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 47 /* Slash */) ? 25 /* JSXClose */ : 167774015 /* LessThan */;
+ }
+ else if (char === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ }
+ while (parser.index < parser.source.length) {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 123 /* LeftBrace */ || next === 60 /* LessThan */)
+ break;
+ }
+ return 121 /* JSXText */;
+}
+/**
+ * Parses JSX children
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXChildren(parser, context) {
+ const children = [];
+ while (parser.token !== 25 /* JSXClose */) {
+ children.push(parseJSXChild(parser, context));
+ }
+ return children;
+}
+/**
+ * Parses JSX Text
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXText(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.source.slice(parser.startIndex, parser.index);
+ parser.token = scanJSXToken(parser);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXText',
+ value,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = value;
+ return node;
+}
+/**
+ * Parses JSX Child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXChild(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ case 121 /* JSXText */:
+ return parseJSXText(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpression(parser, context & ~exports.Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context & ~exports.Context.InJSXChild);
+ default:
+ report(parser, 0 /* Unexpected */);
+ }
+ return undefined; // note: get rid of this
+}
+/**
+ * Parses JSX attributes
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributes(parser, context) {
+ const attributes = [];
+ while (parser.index < parser.source.length) {
+ if (parser.token === 167774773 /* Divide */ || parser.token === 167774016 /* GreaterThan */)
+ break;
+ attributes.push(parseJSXAttribute(parser, context));
+ }
+ return attributes;
+}
+/**
+ * Parses JSX spread attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXSpreadAttribute(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~exports.Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadAttribute',
+ argument: expression,
+ });
+}
+/**
+ * Parses JSX namespace name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param namespace Identifier
+ * @param pos Line / Column location
+ */
+function parseJSXNamespacedName(parser, context, namespace, pos) {
+ expect(parser, context, 16777237 /* Colon */);
+ const name = parseJSXIdentifier(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXNamespacedName',
+ namespace,
+ name,
+ });
+}
+/**
+ * Parses JSX attribute name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributeName(parser, context) {
+ const pos = getLocation(parser);
+ const identifier = parseJSXIdentifier(parser, context);
+ return parser.token === 16777237 /* Colon */ ?
+ parseJSXNamespacedName(parser, context, identifier, pos) :
+ identifier;
+}
+/**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributeValue(parser, context) {
+ switch (scanJSXAttributeValue(parser, context)) {
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpressionContainer(parser, context | exports.Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context | exports.Context.InJSXChild);
+ default:
+ tolerant(parser, context, 87 /* InvalidJSXAttributeValue */);
+ return undefined; // note: get rid of this
+ }
+}
+/**
+ * Parses JSX Attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttribute(parser, context) {
+ const pos = getLocation(parser);
+ if (parser.token === 41943052 /* LeftBrace */)
+ return parseJSXSpreadAttribute(parser, context);
+ scanJSXIdentifier(parser);
+ const attrName = parseJSXAttributeName(parser, context);
+ const value = parser.token === 83886109 /* Assign */ ? parseJSXAttributeValue(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'JSXAttribute',
+ value: value,
+ name: attrName,
+ });
+}
+/**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXAttributeValue(parser, context) {
+ parser.lastIndex = parser.index;
+ const ch = parser.source.charCodeAt(parser.index);
+ switch (ch) {
+ case 34 /* DoubleQuote */:
+ case 39 /* SingleQuote */:
+ return scanJSXString(parser, context, ch);
+ default:
+ return nextToken(parser, context);
+ }
+}
+/**
+ * Parses JSX String
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote Code point
+ */
+function scanJSXString(parser, context, quote) {
+ const rawStart = parser.index;
+ parser.index++;
+ parser.column++;
+ let ret = '';
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ ret += fromCodePoint(ch);
+ parser.index++;
+ parser.column++;
+ ch = parser.source.charCodeAt(parser.index);
+ if (parser.index >= parser.source.length)
+ report(parser, 6 /* UnterminatedString */);
+ }
+ parser.index++;
+ parser.column++; // skip the quote
+ // raw
+ if (context & exports.Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(rawStart, parser.index);
+ parser.tokenValue = ret;
+ return 33554435 /* StringLiteral */;
+}
+/**
+ * Parses JJSX Empty Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXEmptyExpression(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXEmptyExpression',
+ });
+}
+/**
+ * Parses JSX Spread child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXSpreadChild(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpression(parser, context);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadChild',
+ expression,
+ });
+}
+/**
+ * Parses JSX Expression container
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXExpressionContainer(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ // Note: JSX Expressions can't be empty
+ if (parser.token === 17825807 /* RightBrace */)
+ tolerant(parser, context, 84 /* NonEmptyJSXExpression */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~exports.Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+}
+/**
+ * Parses JSX Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ if (parser.token === 14 /* Ellipsis */)
+ return parseJSXSpreadChild(parser, context);
+ const expression = parser.token === 17825807 /* RightBrace */ ?
+ parseJSXEmptyExpression(parser, context) :
+ parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+}
+/**
+ * Parses JSX Closing fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXClosingFragment(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ expect(parser, context, 167774016 /* GreaterThan */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingFragment',
+ });
+}
+/**
+ * Parses JSX Closing Element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXClosingElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ const name = parseJSXElementName(parser, context);
+ if (context & exports.Context.InJSXChild)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingElement',
+ name,
+ });
+}
+/**
+ * Parses JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXIdentifier(parser, context) {
+ const { token, tokenValue: name, tokenRaw: raw } = parser;
+ if (!(token & (131072 /* IsIdentifier */ | 4096 /* Keyword */))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXIdentifier',
+ name,
+ });
+ if (context & exports.Context.OptionsRawidentifiers)
+ node.raw = raw;
+ return node;
+}
+/**
+ * Parses JSX Member expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXMemberExpression(parser, context, expr, pos) {
+ // Note: In order to be able to parse cases like ''<A.B.C.D.E.foo-bar />', where the dash is located at the
+ // end, we must rescan for the JSX Identifier now. This because JSX identifiers differ from normal identifiers
+ scanJSXIdentifier(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXMemberExpression',
+ object: expr,
+ property: parseJSXIdentifier(parser, context),
+ });
+}
+/**
+ * Parses JSX Element name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXElementName(parser, context) {
+ const pos = getLocation(parser);
+ scanJSXIdentifier(parser);
+ let elementName = parseJSXIdentifier(parser, context);
+ if (parser.token === 16777237 /* Colon */)
+ return parseJSXNamespacedName(parser, context, elementName, pos);
+ while (consume(parser, context, 16777229 /* Period */)) {
+ elementName = parseJSXMemberExpression(parser, context, elementName, pos);
+ }
+ return elementName;
+}
+/**
+ * Scans JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXIdentifier(parser) {
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const firstCharPosition = parser.index;
+ let ch = parser.source.charCodeAt(parser.index);
+ while ((parser.index < parser.source.length) && (ch === 45 /* Hyphen */ || (isValidIdentifierPart(ch)))) {
+ ch = readNext(parser);
+ }
+ parser.tokenValue += parser.source.substr(firstCharPosition, parser.index - firstCharPosition);
+ }
+ return parser.token;
+} + +/**
+ * Expression :
+ * AssignmentExpression
+ * Expression , AssignmentExpression
+ *
+ * ExpressionNoIn :
+ * AssignmentExpressionNoIn
+ * ExpressionNoIn , AssignmentExpressionNoIn
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Expression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpression(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ return parser.token === 16777234 /* Comma */ ?
+ parseSequenceExpression(parser, context, expr, pos) :
+ expr;
+}
+/**
+ * Parse secuence expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSequenceExpression(parser, context, left, pos) {
+ const expressions = [left];
+ while (consume(parser, context, 16777234 /* Comma */)) {
+ expressions.push(parseExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+}
+/**
+ * Parse yield expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-YieldExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseYieldExpression(parser, context, pos) {
+ // YieldExpression[In] :
+ // yield
+ // yield [no LineTerminator here] AssignmentExpression[?In, Yield]
+ // yield [no LineTerminator here] * AssignmentExpression[?In, Yield]
+ // https://tc39.github.io/ecma262/#sec-generator-function-definitions-static-semantics-early-errors
+ if (context & exports.Context.InParameter)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ expect(parser, context, 1107316842 /* YieldKeyword */);
+ let argument = null;
+ let delegate = false;
+ if (!(parser.flags & exports.Flags.NewLine)) {
+ delegate = consume(parser, context, 167774771 /* Multiply */);
+ // 'Token.IsExpressionStart' bitmask contains the complete set of
+ // tokens that can appear after an AssignmentExpression, and none of them
+ // can start an AssignmentExpression.
+ if (delegate || parser.token & 33554432 /* IsExpressionStart */) {
+ argument = parseAssignmentExpression(parser, context);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'YieldExpression',
+ argument,
+ delegate,
+ });
+}
+/**
+ * AssignmentExpression :
+ * ConditionalExpression
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpression
+ * LeftHandSideExpression AssignmentOperator AssignmentExpression
+ *
+ * AssignmentExpressionNoIn :
+ * ConditionalExpressionNoIn
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpressionNoIn
+ * LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentExpression(parser, context) {
+ const pos = getLocation(parser);
+ let { token } = parser;
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ return parseYieldExpression(parser, context, pos);
+ let expr = token & 524288 /* IsAsync */ && lookahead(parser, context, nextTokenisIdentifierOrParen)
+ ? parserCoverCallExpressionAndAsyncArrowHead(parser, context)
+ : parseConditionalExpression(parser, context, pos);
+ if (parser.token === 10 /* Arrow */) {
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & (20480 /* FutureReserved */ | 4194304 /* IsEvalOrArguments */)) {
+ // Invalid: ' yield => { 'use strict'; 0 };'
+ if (token & 20480 /* FutureReserved */) {
+ parser.flags |= exports.Flags.HasStrictReserved;
+ }
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ }
+ expr = [expr];
+ }
+ return parseArrowFunction(parser, context &= ~exports.Context.Async, pos, expr);
+ }
+ if (hasBit(parser.token, 67108864 /* IsAssignOp */)) {
+ token = parser.token;
+ if (context & exports.Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ }
+ else if (consume(parser, context, 83886109 /* Assign */)) {
+ if (!(parser.flags & exports.Flags.AllowDestructuring)) {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ // Only re-interpret if not inside a formal parameter list
+ if (!(context & exports.Context.InParameter))
+ reinterpret(parser, context, expr);
+ if (context & exports.Context.InParen)
+ parser.flags |= exports.Flags.SimpleParameterList;
+ if (parser.token & 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasAwait;
+ }
+ else if (context & exports.Context.InParen &&
+ context & (exports.Context.Strict | exports.Context.Yield) &&
+ parser.token & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasYield;
+ }
+ }
+ else {
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ nextToken(parser, context);
+ }
+ const right = parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ parser.pendingExpressionError = null;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentExpression',
+ left: expr,
+ operator: tokenDesc(token),
+ right,
+ });
+ }
+ return expr;
+}
+/**
+ * Parse conditional expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ConditionalExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseConditionalExpression(parser, context, pos) {
+ const test = parseBinaryExpression(parser, context, 0, pos);
+ if (!consume(parser, context, 22 /* QuestionMark */))
+ return test;
+ const consequent = parseExpressionCoverGrammar(parser, context & ~exports.Context.AllowDecorator | exports.Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16777237 /* Colon */);
+ return finishNode(context, parser, pos, {
+ type: 'ConditionalExpression',
+ test,
+ consequent,
+ alternate: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse binary expression.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-exp-operator)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-additive-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-bitwise-shift-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-equality-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-relational-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-multiplicative-operators)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param minPrec Minimum precedence value
+ * @param pos Line / Column info
+ * @param Left Left hand side of the binary expression
+ */
+function parseBinaryExpression(parser, context, minPrec, pos, left = parseUnaryExpression(parser, context)) {
+ // Shift-reduce parser for the binary operator part of the JS expression
+ // syntax.
+ const bit = context & exports.Context.AllowIn ^ exports.Context.AllowIn;
+ while (hasBit(parser.token, 167772160 /* IsBinaryOp */)) {
+ const t = parser.token;
+ const prec = t & 3840 /* Precedence */;
+ const delta = (t === 167775030 /* Exponentiate */) << 8 /* PrecStart */;
+ if (bit && t === 167786289 /* InKeyword */)
+ break;
+ // When the next token is no longer a binary operator, it's potentially the
+ // start of an expression, so we break the loop
+ if (prec + delta <= minPrec)
+ break;
+ nextToken(parser, context);
+ left = finishNode(context, parser, pos, {
+ type: t & 2097152 /* IsLogical */ ? 'LogicalExpression' : 'BinaryExpression',
+ left,
+ right: parseBinaryExpression(parser, context & ~exports.Context.AllowIn, prec, getLocation(parser)),
+ operator: tokenDesc(t),
+ });
+ }
+ return left;
+}
+/**
+ * Parse await expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AwaitExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ */
+function parseAwaitExpression(parser, context, pos) {
+ if (context & exports.Context.InParameter)
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ expect(parser, context, 34017389 /* AwaitKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'AwaitExpression',
+ argument: parseUnaryExpression(parser, context),
+ });
+}
+/**
+ * Parses unary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UnaryExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseUnaryExpression(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ if (hasBit(token, 301989888 /* IsUnaryOp */)) {
+ nextToken(parser, context);
+ if (parser.flags & exports.Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ const argument = parseExpressionCoverGrammar(parser, context, parseUnaryExpression);
+ if (parser.token === 167775030 /* Exponentiate */) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & exports.Context.Strict && token === 302002219 /* DeleteKeyword */) {
+ if (argument.type === 'Identifier') {
+ tolerant(parser, context, 43 /* StrictDelete */);
+ }
+ else if (isPropertyWithPrivateFieldKey(argument)) {
+ tolerant(parser, context, 44 /* DeletePrivateField */);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'UnaryExpression',
+ operator: tokenDesc(token),
+ argument,
+ prefix: true,
+ });
+ }
+ return context & exports.Context.Async && token & 262144 /* IsAwait */
+ ? parseAwaitExpression(parser, context, pos)
+ : parseUpdateExpression(parser, context, pos);
+}
+/**
+ * Parses update expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UpdateExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseUpdateExpression(parser, context, pos) {
+ const { token } = parser;
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */)) {
+ nextToken(parser, context);
+ const expr = parseLeftHandSideExpression(parser, context, pos);
+ validateUpdateExpression(parser, context, expr, 'Prefix');
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expr,
+ operator: tokenDesc(token),
+ prefix: true,
+ });
+ }
+ else if (context & exports.Context.OptionsJSX && token === 167774015 /* LessThan */) {
+ return parseJSXRootElement(parser, context | exports.Context.InJSXChild);
+ }
+ const expression = parseLeftHandSideExpression(parser, context, pos);
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */) && !(parser.flags & exports.Flags.NewLine)) {
+ validateUpdateExpression(parser, context, expression, 'Postfix');
+ const operator = parser.token;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expression,
+ operator: tokenDesc(operator),
+ prefix: false,
+ });
+ }
+ return expression;
+}
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseRestElement(parser, context, args = []) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (context & exports.Context.InParen && parser.token & 262144 /* IsAwait */)
+ parser.flags |= exports.Flags.HasAwait;
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * Parse spread element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SpreadElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSpreadElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+}
+/**
+ * Parse left hand side expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LeftHandSideExpression)
+ *
+ * @param Parser Parer instance
+ * @param Context Contextmasks
+ * @param pos Location info
+ */
+function parseLeftHandSideExpression(parser, context, pos) {
+ const expr = context & exports.Context.OptionsNext && parser.token === 33566810 /* ImportKeyword */
+ ? parseCallImportOrMetaProperty(parser, context | exports.Context.AllowIn)
+ : parseMemberExpression(parser, context | exports.Context.AllowIn, pos);
+ return parseCallExpression(parser, context | exports.Context.AllowIn, pos, expr);
+}
+/**
+ * Parse member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ * @param expr Expression
+ */
+function parseMemberExpression(parser, context, pos, expr = parsePrimaryExpression(parser, context)) {
+ while (true) {
+ switch (parser.token) {
+ case 16777229 /* Period */: {
+ consume(parser, context, 16777229 /* Period */);
+ parser.flags = parser.flags & ~exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ const property = parseIdentifierNameOrPrivateName(parser, context);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: false,
+ property,
+ });
+ continue;
+ }
+ case 41943059 /* LeftBracket */: {
+ consume(parser, context, 41943059 /* LeftBracket */);
+ parser.flags = parser.flags & ~exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ const property = parseExpression(parser, context);
+ expect(parser, context, 20 /* RightBracket */);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: true,
+ property,
+ });
+ continue;
+ }
+ case 33554441 /* TemplateTail */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplateLiteral(parser, context),
+ });
+ continue;
+ }
+ case 33554440 /* TemplateCont */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplate(parser, context | exports.Context.TaggedTemplate),
+ });
+ continue;
+ }
+ default:
+ return expr;
+ }
+ }
+}
+/**
+ * Parse call expression
+ *
+ * @param parser Parer instance
+ * @param context Context masks
+ * @param pos Line / Colum info
+ * @param expr Expression
+ */
+function parseCallExpression(parser, context, pos, expr) {
+ while (true) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ if (parser.token !== 50331659 /* LeftParen */)
+ return expr;
+ const args = parseArgumentList(parser, context & ~exports.Context.AllowDecorator);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+}
+/**
+ * Parse cover call expression and async arrow head
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CoverCallExpressionAndAsyncArrowHead)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parserCoverCallExpressionAndAsyncArrowHead(parser, context) {
+ const pos = getLocation(parser);
+ let expr = parseMemberExpression(parser, context | exports.Context.AllowIn, pos);
+ // Here we jump right into it and parse a simple, faster sub-grammar for
+ // async arrow / async identifier + call expression. This could have been done different
+ // but ESTree sucks!
+ //
+ // - J.K. Thomas
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (parser.token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */);
+ return parseAsyncArrowFunction(parser, context, exports.ModifierState.Await, pos, [parseAndClassifyIdentifier(parser, context)]);
+ }
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ while (parser.token === 50331659 /* LeftParen */) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ const args = parseAsyncArgumentList(parser, context);
+ if (parser.token === 10 /* Arrow */) {
+ expr = parseAsyncArrowFunction(parser, context, exports.ModifierState.Await, pos, args);
+ break;
+ }
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ return expr;
+}
+/**
+ * Parse argument list
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parseArgumentList(parser, context) {
+ // ArgumentList :
+ // AssignmentOrSpreadExpression
+ // ArgumentList , AssignmentOrSpreadExpression
+ //
+ // AssignmentOrSpreadExpression :
+ // ... AssignmentExpression
+ // AssignmentExpression
+ expect(parser, context, 50331659 /* LeftParen */);
+ const expressions = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ expressions.push(parseSpreadElement(parser, context));
+ }
+ else {
+ if (context & exports.Context.Yield && hasBit(parser.token, 1073741824 /* IsYield */)) {
+ parser.flags |= exports.Flags.HasYield;
+ setPendingError(parser);
+ }
+ expressions.push(parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression));
+ }
+ if (parser.token !== 16 /* RightParen */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return expressions;
+}
+/**
+ * Parse argument list for async arrow / async call expression
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parseAsyncArgumentList(parser, context) {
+ // Here we are parsing an "extended" argument list tweaked to handle async arrows. This is
+ // done here to avoid overhead and possible performance loss if we only
+ // parse out a simple call expression - E.g 'async(foo, bar)' or 'async(foo, bar)()';
+ //
+ // - J.K. Thomas
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = [];
+ let { token } = parser;
+ let state = exports.CoverCallState.Empty;
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ args.push(parseSpreadElement(parser, context));
+ state = exports.CoverCallState.HasSpread;
+ }
+ else {
+ token = parser.token;
+ state = validateAsyncArgumentList(parser, context, state);
+ args.push(restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression));
+ }
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ if (state & exports.CoverCallState.HasSpread)
+ state = exports.CoverCallState.SeenSpread;
+ }
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & exports.CoverCallState.SeenSpread) {
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ }
+ else if (state & exports.CoverCallState.EvalOrArguments) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ else if (state & exports.CoverCallState.Yield) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ parser.flags |= exports.Flags.HasStrictReserved;
+ }
+ else if (parser.flags & exports.Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (state & exports.CoverCallState.Await || parser.flags & exports.Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ }
+ return args;
+}
+/**
+ * Parse primary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PrimaryExpression)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parsePrimaryExpression(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ return parseIdentifier(parser, context);
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionOrIdentifier(parser, context);
+ case 50331659 /* LeftParen */:
+ return parseParenthesizedExpression(parser, context | exports.Context.InParen);
+ case 41943059 /* LeftBracket */:
+ return restoreExpressionCoverGrammar(parser, context, parseArrayLiteral);
+ case 41943052 /* LeftBrace */:
+ return restoreExpressionCoverGrammar(parser, context, parseObjectLiteral);
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionExpression(parser, context);
+ case 33566727 /* NullKeyword */:
+ case 33566726 /* TrueKeyword */:
+ case 33566725 /* FalseKeyword */:
+ return parseNullOrTrueOrFalseLiteral(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassExpression(parser, context);
+ case 33566811 /* NewKeyword */:
+ return parseNewExpressionOrMetaProperty(parser, context);
+ case 33566813 /* SuperKeyword */:
+ return parseSuperProperty(parser, context);
+ case 33554551 /* BigIntLiteral */:
+ return parseBigIntLiteral(parser, context);
+ case 33566815 /* ThisKeyword */:
+ return parseThisExpression(parser, context);
+ case 115 /* Hash */:
+ return parseIdentifierNameOrPrivateName(parser, context);
+ case 167774773 /* Divide */:
+ case 100663333 /* DivideAssign */:
+ scanRegularExpression(parser, context);
+ return parseRegularExpressionLiteral(parser, context);
+ case 33554441 /* TemplateTail */:
+ return parseTemplateLiteral(parser, context);
+ case 33554440 /* TemplateCont */:
+ return parseTemplate(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetAsIdentifier(parser, context);
+ case 12369 /* DoKeyword */:
+ if (context & exports.Context.OptionsExperimental)
+ return parseDoExpression(parser, context);
+ default:
+ return parseAndClassifyIdentifier(parser, context);
+ }
+}
+/**
+ * Parse do expression (*experimental*)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDoExpression(parser, context) {
+ // AssignmentExpression ::
+ // do '{' StatementList '}'
+ const pos = getLocation(parser);
+ expect(parser, context, 12369 /* DoKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'DoExpression',
+ body: parseBlockStatement(parser, context)
+ });
+}
+/**
+ * Parse 'let' as identifier in 'sloppy mode', and throws
+ * in 'strict mode' / 'module code'. We also avoid a lookahead on the
+ * ASI restictions while checking this after parsing out the 'let' keyword
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+function parseLetAsIdentifier(parser, context) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ if (parser.flags & exports.Flags.NewLine) {
+ if (parser.token === 41943059 /* LeftBracket */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, 'let');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+}
+/**
+ * Parse either async function expression or identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+function parseAsyncFunctionOrIdentifier(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) :
+ parseIdentifier(parser, context);
+}
+/**
+ * Parses identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIdentifier(parser, context) {
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context | exports.Context.TaggedTemplate);
+ const node = finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ if (context & exports.Context.OptionsRawidentifiers)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parse regular expression literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseRegularExpressionLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenRegExp, tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ regex: tokenRegExp,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = tokenRaw;
+ return node;
+}
+/**
+ * Parses string and number literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StringLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.tokenValue;
+ if (context & exports.Context.Strict && parser.flags & exports.Flags.HasOctal) {
+ tolerant(parser, context, 61 /* StrictOctalLiteral */);
+ }
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parses BigInt literal (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/proposal-bigint/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBigIntLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ bigint: tokenRaw,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parses either null or boolean literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BooleanLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNullOrTrueOrFalseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const raw = tokenDesc(token);
+ if (parser.flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: token === 33566727 /* NullKeyword */ ? null : raw === 'true',
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = raw;
+ return node;
+}
+/**
+ * Parse this expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseThisExpression(parser, context) {
+ if (parser.flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ const pos = getLocation(parser);
+ nextToken(parser, context | exports.Context.DisallowEscapedKeyword);
+ return finishNode(context, parser, pos, {
+ type: 'ThisExpression',
+ });
+}
+/**
+ * Parse identifier name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-IdentifierName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t token
+ */
+function parseIdentifierName(parser, context, t) {
+ if (!(t & (131072 /* IsIdentifier */ | 4096 /* Keyword */)))
+ tolerant(parser, context, 4 /* UnexpectedKeyword */, tokenDesc(t));
+ return parseIdentifier(parser, context);
+}
+/**
+ * Parse identifier name or private name (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIdentifierNameOrPrivateName(parser, context) {
+ if (!consume(parser, context, 115 /* Hash */))
+ return parseIdentifierName(parser, context, parser.token);
+ const { tokenValue } = parser;
+ const pos = getLocation(parser);
+ const name = tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+}
+/**
+ * Parse array literal
+ *
+ * ArrayLiteral :
+ * [ Elisionopt ]
+ * [ ElementList ]
+ * [ ElementList , Elisionopt ]
+ *
+ * ElementList :
+ * Elisionopt AssignmentExpression
+ * Elisionopt ... AssignmentExpression
+ * ElementList , Elisionopt AssignmentExpression
+ * ElementList , Elisionopt SpreadElement
+ *
+ * Elision :
+ * ,
+ * Elision ,
+ *
+ * SpreadElement :
+ * ... AssignmentExpression
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseArrayLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseSpreadElement(parser, context));
+ if (parser.token !== 20 /* RightBracket */) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ else {
+ elements.push(restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression));
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ return finishNode(context, parser, pos, {
+ type: 'ArrayExpression',
+ elements,
+ });
+}
+/**
+ * Parses cover parenthesized expression and arrow parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-parseCoverParenthesizedExpressionAndArrowParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseParenthesizedExpression(parser, context) {
+ expect(parser, context, 50331659 /* LeftParen */);
+ if (consume(parser, context, 16 /* RightParen */)) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ if (parser.token === 10 /* Arrow */)
+ return [];
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ const restExpr = [parseRestElement(parser, context)];
+ expect(parser, context, 16 /* RightParen */);
+ parser.flags = parser.flags & ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding) | exports.Flags.SimpleParameterList;
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return restExpr;
+ }
+ // Record the sequence position
+ const sequencepos = getLocation(parser);
+ let state = validateCoverParenthesizedExpression(parser, exports.CoverParenthesizedState.None);
+ let expr = restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ // Sequence expression
+ if (parser.token === 16777234 /* Comma */) {
+ state |= exports.CoverParenthesizedState.SequenceExpression;
+ const expressions = [expr];
+ while (consume(parser, context | exports.Context.DisallowEscapedKeyword, 16777234 /* Comma */)) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (!(parser.flags & exports.Flags.AllowBinding))
+ tolerant(parser, context, 77 /* NotBindable */);
+ parser.flags |= exports.Flags.SimpleParameterList;
+ const restElement = parseRestElement(parser, context);
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ expressions.push(restElement);
+ return expressions;
+ }
+ else if (consume(parser, context, 16 /* RightParen */)) {
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return expressions;
+ }
+ else {
+ state = validateCoverParenthesizedExpression(parser, state);
+ expressions.push(restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ }
+ expr = finishNode(context, parser, sequencepos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & exports.CoverParenthesizedState.HasEvalOrArguments) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ else if (state & exports.CoverParenthesizedState.HasReservedWords) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= exports.Flags.HasStrictReserved;
+ }
+ else if (!(parser.flags & exports.Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (parser.flags & exports.Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (context & exports.Context.Async && parser.flags & exports.Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ parser.flags &= ~(exports.Flags.AllowBinding | exports.Flags.HasAwait | exports.Flags.HasYield);
+ return (state & exports.CoverParenthesizedState.SequenceExpression ? expr.expressions : [expr]);
+ }
+ parser.flags &= ~(exports.Flags.HasAwait | exports.Flags.HasYield | exports.Flags.AllowBinding);
+ if (!isValidSimpleAssignmentTarget(expr))
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ return expr;
+}
+/**
+ * Parses function expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? exports.ModifierState.Generator : exports.ModifierState.None;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & exports.ModifierState.Generator) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(exports.Context.Method | exports.Context.AllowSuperProperty), isGenerator, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: false,
+ generator: !!(isGenerator & exports.ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parses async function or async generator expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? exports.ModifierState.Generator : exports.ModifierState.None;
+ const isAwait = exports.ModifierState.Await;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict || isAwait & exports.ModifierState.Await)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictFunctionName;
+ }
+ if (token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & exports.ModifierState.Generator)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(exports.Context.Method | exports.Context.AllowSuperProperty), isGenerator | isAwait, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: true,
+ generator: !!(isGenerator & exports.ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parse computed property names
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ComputedPropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseComputedPropertyName(parser, context) {
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const key = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ expect(parser, context, 20 /* RightBracket */);
+ return key;
+}
+/**
+ * Parse property name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePropertyName(parser, context) {
+ switch (parser.token) {
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943059 /* LeftBracket */:
+ return parseComputedPropertyName(parser, context);
+ default:
+ return parseIdentifier(parser, context);
+ }
+}
+/**
+ * Parse object spread properties
+ *
+ * @see [Link](https://tc39.github.io/proposal-object-rest-spread/#Spread)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSpreadProperties(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (parser.token & 8388608 /* IsBindingPattern */)
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ const argument = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+}
+/**
+ * Parses object literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ObjectLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseObjectLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const properties = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ properties.push(parser.token === 14 /* Ellipsis */ ?
+ parseSpreadProperties(parser, context) :
+ parsePropertyDefinition(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ parser.flags &= ~exports.Flags.HasProtoField;
+ return finishNode(context, parser, pos, {
+ type: 'ObjectExpression',
+ properties,
+ });
+}
+/**
+ * Parse property definition
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyDefinition)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePropertyDefinition(parser, context) {
+ const pos = getLocation(parser);
+ const flags = parser.flags;
+ let value;
+ let state = consume(parser, context, 167774771 /* Multiply */) ? exports.ObjectState.Generator | exports.ObjectState.Method : exports.ObjectState.Method;
+ const t = parser.token;
+ let key = parsePropertyName(parser, context);
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & exports.Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ else if (!(state & exports.ObjectState.Generator) && t & 524288 /* IsAsync */ && !(parser.flags & exports.Flags.NewLine)) {
+ state |= consume(parser, context, 167774771 /* Multiply */) ? exports.ObjectState.Generator | exports.ObjectState.Async : exports.ObjectState.Async;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69743 /* GetKeyword */) {
+ state = state & ~exports.ObjectState.Method | exports.ObjectState.Getter;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69744 /* SetKeyword */) {
+ state = state & ~exports.ObjectState.Method | exports.ObjectState.Setter;
+ key = parsePropertyName(parser, context);
+ }
+ if (state & (exports.ObjectState.Getter | exports.ObjectState.Setter)) {
+ if (state & exports.ObjectState.Generator)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ state &= ~exports.ObjectState.Method;
+ if (parser.token === 16777237 /* Colon */) {
+ if ((state & (exports.ObjectState.Async | exports.ObjectState.Generator))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ else if (t !== 41943059 /* LeftBracket */ && parser.tokenValue === '__proto__') {
+ if (parser.flags & exports.Flags.HasProtoField) {
+ // Record the error and put it on hold until we've determined
+ // whether or not we're destructuring
+ setPendingExpressionError(parser, 63 /* DuplicateProto */);
+ }
+ else
+ parser.flags |= exports.Flags.HasProtoField;
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ // Invalid: 'async ({a: await}) => 1'
+ if (parser.token & 262144 /* IsAwait */)
+ parser.flags |= exports.Flags.HasAwait;
+ value = restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ }
+ else {
+ if ((state & (exports.ObjectState.Generator | exports.ObjectState.Async)) || !isValidIdentifier(context, t)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(t));
+ }
+ else if (context & (exports.Context.Strict | exports.Context.Yield) && t & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasYield;
+ }
+ state |= exports.ObjectState.Shorthand;
+ if (parser.token === 83886109 /* Assign */) {
+ if (context & exports.Context.Strict && t & 4194304 /* IsEvalOrArguments */) {
+ report(parser, 47 /* StrictEvalArguments */);
+ }
+ else
+ setPendingExpressionError(parser, 91 /* InvalidCoverInitializedName */);
+ expect(parser, context, 83886109 /* Assign */);
+ if (context & (exports.Context.Strict | exports.Context.Yield | exports.Context.Async) && parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */)) {
+ setPendingError(parser);
+ parser.flags |= parser.token & 1073741824 /* IsYield */ ? exports.Flags.HasYield : exports.Flags.HasAwait;
+ }
+ value = parseAssignmentPattern(parser, context, key, pos);
+ }
+ else {
+ if (t & 262144 /* IsAwait */) {
+ if (context & exports.Context.Async)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasAwait;
+ }
+ value = key;
+ }
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ key,
+ value,
+ kind: !(state & exports.ObjectState.Getter | state & exports.ObjectState.Setter) ? 'init' : (state & exports.ObjectState.Setter) ? 'set' : 'get',
+ computed: t === 41943059 /* LeftBracket */,
+ method: !!(state & exports.ObjectState.Method),
+ shorthand: !!(state & exports.ObjectState.Shorthand),
+ });
+}
+/**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseMethodDeclaration(parser, context, state) {
+ const pos = getLocation(parser);
+ const isGenerator = state & exports.ObjectState.Generator ? exports.ModifierState.Generator : exports.ModifierState.None;
+ const isAsync = state & exports.ObjectState.Async ? exports.ModifierState.Await : exports.ModifierState.None;
+ const { params, body } = swapContext(parser, context | exports.Context.Method, isGenerator | isAsync, parseFormalListAndBody, state);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: !!(state & exports.ObjectState.Async),
+ generator: !!(state & exports.ObjectState.Generator),
+ expression: false,
+ id: null,
+ });
+}
+/**
+ * Parse arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseArrowFunction(parser, context, pos, params) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, '=>');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context & ~exports.Context.Async, params, pos, exports.ModifierState.None);
+}
+/**
+ * Parse async arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncArrowFunction(parser, context, state, pos, params) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context | exports.Context.Async, params, pos, state);
+}
+/**
+ * Shared helper function for both async arrow and arrows
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+// https://tc39.github.io/ecma262/#prod-AsyncArrowFunction
+function parseArrowBody(parser, context, params, pos, state) {
+ parser.pendingExpressionError = null;
+ for (const i in params)
+ reinterpret(parser, context | exports.Context.InParameter, params[i]);
+ const expression = parser.token !== 41943052 /* LeftBrace */;
+ const body = expression ? parseExpressionCoverGrammar(parser, context & ~(exports.Context.Yield | exports.Context.InParameter), parseAssignmentExpression) :
+ swapContext(parser, context & ~(exports.Context.Yield | exports.Context.AllowDecorator) | exports.Context.InFunctionBody, state, parseFunctionBody);
+ return finishNode(context, parser, pos, {
+ type: 'ArrowFunctionExpression',
+ body,
+ params,
+ id: null,
+ async: !!(state & exports.ModifierState.Await),
+ generator: false,
+ expression,
+ });
+}
+/**
+ * Parses formal parameters and function body.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFormalListAndBody(parser, context, state) {
+ const paramList = parseFormalParameters(parser, context | exports.Context.InParameter, state);
+ const args = paramList.args;
+ const params = paramList.params;
+ const body = parseFunctionBody(parser, context & ~exports.Context.AllowDecorator | exports.Context.InFunctionBody, args);
+ return { params, body };
+}
+/**
+ * Parse funciton body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionBody(parser, context, params) {
+ // Note! The 'params' has an 'any' type now because it's really shouldn't be there. This should have been
+ // on the parser object instead. So for now the 'params' arg are only used within the
+ // 'parseFormalListAndBody' method, and not within the arrow function body.
+ const pos = getLocation(parser);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const body = [];
+ while (parser.token === 33554435 /* StringLiteral */) {
+ const { tokenRaw, tokenValue } = parser;
+ body.push(parseDirective(parser, context));
+ if (tokenRaw.length === /* length of prologue*/ 12 && tokenValue === 'use strict') {
+ if (parser.flags & exports.Flags.SimpleParameterList) {
+ tolerant(parser, context, 64 /* IllegalUseStrict */);
+ }
+ else if (parser.flags & (exports.Flags.HasStrictReserved | exports.Flags.StrictFunctionName)) {
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ }
+ else if (parser.flags & exports.Flags.StrictEvalArguments) {
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ }
+ context |= exports.Context.Strict;
+ }
+ }
+ if (context & exports.Context.Strict) {
+ validateParams(parser, context, params);
+ }
+ const { labelSet } = parser;
+ parser.labelSet = {};
+ const savedFlags = parser.flags;
+ parser.flags = parser.flags & ~(exports.Flags.StrictFunctionName | exports.Flags.StrictEvalArguments | exports.Flags.InSwitchStatement | exports.Flags.InIterationStatement) | exports.Flags.AllowDestructuring;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ if (savedFlags & exports.Flags.InIterationStatement)
+ parser.flags |= exports.Flags.InIterationStatement;
+ if (savedFlags & exports.Flags.InSwitchStatement)
+ parser.flags |= exports.Flags.InSwitchStatement;
+ parser.labelSet = labelSet;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body,
+ });
+}
+/**
+ * Parse formal parameters
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param Parser object
+ * @param Context masks
+ * @param Optional objectstate. Default to none
+ */
+function parseFormalParameters(parser, context, state) {
+ // FormalParameterList :
+ // [empty]
+ // FunctionRestParameter
+ // FormalsList
+ // FormalsList , FunctionRestParameter
+ //
+ // FunctionRestParameter :
+ // ... BindingIdentifier
+ //
+ // FormalsList :
+ // FormalParameter
+ // FormalsList , FormalParameter
+ //
+ // FormalParameter :
+ // BindingElement
+ //
+ // BindingElement :
+ // SingleNameBinding
+ // BindingPattern Initializeropt
+ expect(parser, context, 50331659 /* LeftParen */);
+ parser.flags &= ~(exports.Flags.SimpleParameterList | exports.Flags.HasStrictReserved);
+ const args = [];
+ const params = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (state & exports.ObjectState.Setter)
+ tolerant(parser, context, 67 /* BadSetterRestParameter */);
+ parser.flags |= exports.Flags.SimpleParameterList;
+ params.push(parseRestElement(parser, context, args));
+ break;
+ }
+ params.push(parseFormalParameterList(parser, context, args));
+ if (!consume(parser, context, 16777234 /* Comma */))
+ break;
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ if (state & exports.ObjectState.Setter && params.length !== 1) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Setter', 'one', '');
+ }
+ if (state & exports.ObjectState.Getter && params.length > 0) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Getter', 'no', 's');
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return { params, args };
+}
+/**
+ * Parse formal parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFormalParameterList(parser, context, args) {
+ const pos = getLocation(parser);
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (hasBit(parser.token, 20480 /* FutureReserved */)) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= exports.Flags.StrictFunctionName;
+ }
+ if (hasBit(parser.token, 4194304 /* IsEvalOrArguments */)) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ }
+ else {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ }
+ const left = parseBindingIdentifierOrPattern(parser, context, args);
+ if (!consume(parser, context, 83886109 /* Assign */))
+ return left;
+ if (parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */) && context & (exports.Context.Yield | exports.Context.Async)) {
+ tolerant(parser, context, parser.token & 262144 /* IsAwait */ ? 52 /* AwaitInParameter */ : 51 /* YieldInParameter */);
+ }
+ parser.flags |= exports.Flags.SimpleParameterList;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse class expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassExpression(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & exports.Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const { token } = parser;
+ let state = exports.ObjectState.None;
+ let id = null;
+ let superClass = null;
+ if ((token !== 41943052 /* LeftBrace */ && token !== 12372 /* ExtendsKeyword */)) {
+ if (context & exports.Context.Async && token & 262144 /* IsAwait */) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context | exports.Context.Strict);
+ }
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | exports.Context.Strict, pos);
+ state |= exports.ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context | exports.Context.Strict, state);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ });
+}
+/**
+ * Parse class body and element list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElementList)
+ *
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassBodyAndElementList(parser, context, state) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const body = [];
+ let decorators = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (!consume(parser, context, 17825809 /* Semicolon */)) {
+ if (context & exports.Context.OptionsExperimental) {
+ decorators = parseDecorators(parser, context);
+ if (parser.token === 17825807 /* RightBrace */)
+ report(parser, 92 /* TrailingDecorators */);
+ if (decorators.length !== 0 && parser.tokenValue === 'constructor') {
+ report(parser, 93 /* GeneratorConstructor */);
+ }
+ }
+ body.push(context & exports.Context.OptionsNext && parser.token === 115 /* Hash */
+ ? parsePrivateFields(parser, context, decorators)
+ : parseClassElement(parser, context, state, decorators));
+ }
+ }
+ parser.flags &= ~exports.Flags.HasConstructor;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ClassBody',
+ body,
+ });
+}
+/**
+ * Parse class element and class public instance fields & private instance fields
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElement)
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassElement(parser, context, state, decorators) {
+ const pos = getLocation(parser);
+ let { tokenValue, token } = parser;
+ const flags = parser.flags;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ state |= exports.ObjectState.Generator;
+ }
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ if (parser.tokenValue === 'constructor') {
+ if (state & exports.ObjectState.Generator)
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'generator');
+ else if (state & exports.ObjectState.Heritage)
+ context |= exports.Context.AllowSuperProperty;
+ state |= exports.ObjectState.Constructor;
+ }
+ let key = parsePropertyName(parser, context);
+ let value;
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ if (token === 20585 /* StaticKeyword */) {
+ token = parser.token;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= exports.ObjectState.Generator;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ if (parser.tokenValue === 'prototype')
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ state |= exports.ObjectState.Static;
+ key = parsePropertyName(parser, context);
+ if (context & exports.Context.OptionsNext && isInstanceField(parser)) {
+ if (tokenValue === 'constructor')
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ }
+ }
+ if (parser.token !== 50331659 /* LeftParen */) {
+ if (token & 524288 /* IsAsync */ && !(state & exports.ObjectState.Generator) && !(parser.flags & exports.Flags.NewLine)) {
+ token = parser.token;
+ tokenValue = parser.tokenValue;
+ state |= exports.ObjectState.Async;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= exports.ObjectState.Generator;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ key = parsePropertyName(parser, context);
+ }
+ else if ((token === 69743 /* GetKeyword */ || token === 69744 /* SetKeyword */)) {
+ state |= token === 69743 /* GetKeyword */ ? exports.ObjectState.Getter : exports.ObjectState.Setter;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ key = parsePropertyName(parser, context & ~exports.Context.Strict);
+ }
+ if (tokenValue === 'prototype') {
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ }
+ else if (!(state & exports.ObjectState.Static) && tokenValue === 'constructor') {
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'accessor');
+ }
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ if (!(state & exports.ObjectState.Computed) && state & exports.ObjectState.Constructor) {
+ if (parser.flags & exports.Flags.HasConstructor)
+ report(parser, 12 /* DuplicateConstructor */);
+ else
+ parser.flags |= exports.Flags.HasConstructor;
+ }
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ if (context & exports.Context.OptionsNext)
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const kind = (state & exports.ObjectState.Constructor) ? 'constructor' : (state & exports.ObjectState.Getter) ? 'get' :
+ (state & exports.ObjectState.Setter) ? 'set' : 'method';
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & exports.ObjectState.Static),
+ computed: !!(state & exports.ObjectState.Computed),
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & exports.ObjectState.Static),
+ computed: !!(state & exports.ObjectState.Computed),
+ key,
+ value,
+ });
+}
+/**
+ * Parses field definition.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFieldDefinition(parser, context, key, state, pos, decorators) {
+ if (state & exports.ObjectState.Constructor)
+ tolerant(parser, context, 0 /* Unexpected */);
+ let value = null;
+ if (state & (exports.ObjectState.Async | exports.ObjectState.Generator))
+ tolerant(parser, context, 0 /* Unexpected */);
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & exports.ObjectState.Computed),
+ static: !!(state & exports.ObjectState.Static),
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & exports.ObjectState.Computed),
+ static: !!(state & exports.ObjectState.Static),
+ });
+}
+/**
+ * Parse private name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePrivateName(parser, context, pos) {
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+}
+/**
+ * Parses private instance fields
+ *
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePrivateFields(parser, context, decorators) {
+ const pos = getLocation(parser);
+ expect(parser, context | exports.Context.InClass, 115 /* Hash */);
+ if (parser.tokenValue === 'constructor')
+ tolerant(parser, context, 41 /* PrivateFieldConstructor */);
+ const key = parsePrivateName(parser, context, pos);
+ if (parser.token === 50331659 /* LeftParen */)
+ return parsePrivateMethod(parser, context, key, pos, decorators);
+ let value = null;
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ });
+}
+function parsePrivateMethod(parser, context, key, pos, decorators) {
+ const value = parseMethodDeclaration(parser, context | exports.Context.Strict, exports.ObjectState.None);
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ });
+}
+/**
+ * Parse either call expression or import expressions
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCallImportOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ // Import.meta - Stage 3 proposal
+ if (consume(parser, context, 16777229 /* Period */)) {
+ if (context & exports.Context.Module && parser.tokenValue === 'meta')
+ return parseMetaProperty(parser, context, id, pos);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ let expr = parseImportExpression(parser, context, pos);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16 /* RightParen */);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: [args],
+ });
+ return expr;
+}
+/**
+ * Parse Import() expression. (Stage 3 proposal)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+function parseImportExpression(parser, context, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'Import',
+ });
+}
+/**
+ * Parse meta property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Identifier
+ * @param pos Location
+ */
+function parseMetaProperty(parser, context, meta, pos) {
+ return finishNode(context, parser, pos, {
+ meta,
+ type: 'MetaProperty',
+ property: parseIdentifier(parser, context),
+ });
+}
+/**
+ * Parse new expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NewExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNewExpressionOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ if (consume(parser, context | exports.Context.DisallowEscapedKeyword, 16777229 /* Period */)) {
+ if (parser.tokenValue !== 'target' ||
+ !(context & (exports.Context.InParameter | exports.Context.InFunctionBody)))
+ tolerant(parser, context, 53 /* MetaNotInFunctionBody */);
+ return parseMetaProperty(parser, context, id, pos);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'NewExpression',
+ callee: parseImportOrMemberExpression(parser, context, pos),
+ arguments: parser.token === 50331659 /* LeftParen */ ? parseArgumentList(parser, context) : [],
+ });
+}
+/**
+ * Parse either import or member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportOrMemberExpression(parser, context, pos) {
+ const { token } = parser;
+ if (context & exports.Context.OptionsNext && token === 33566810 /* ImportKeyword */) {
+ // Invalid: '"new import(x)"'
+ if (lookahead(parser, context, nextTokenIsLeftParen))
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ // Fixes cases like ''new import.meta','
+ return parseCallImportOrMetaProperty(parser, context);
+ }
+ return parseMemberExpression(parser, context, pos);
+}
+/**
+ * Parse super property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SuperProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSuperProperty(parser, context) {
+ // SuperProperty[Yield, Await]:
+ // super[Expression[+In, ?Yield, ?Await]]
+ // super.IdentifierName
+ const pos = getLocation(parser);
+ expect(parser, context, 33566813 /* SuperKeyword */);
+ switch (parser.token) {
+ case 50331659 /* LeftParen */:
+ // The super property has to be within a class constructor
+ if (!(context & exports.Context.AllowSuperProperty))
+ tolerant(parser, context, 54 /* BadSuperCall */);
+ break;
+ case 41943059 /* LeftBracket */:
+ case 16777229 /* Period */:
+ if (!(context & exports.Context.Method))
+ tolerant(parser, context, 55 /* UnexpectedSuper */);
+ break;
+ default:
+ tolerant(parser, context, 56 /* LoneSuper */);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Super',
+ });
+}
+/**
+ * Parse template literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseTemplateLiteral(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions: [],
+ quasis: [parseTemplateSpans(parser, context)],
+ });
+}
+/**
+ * Parse template head
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param cooked Cooked template value
+ * @param raw Raw template value
+ * @param pos Current location
+ */
+function parseTemplateHead(parser, context, cooked = null, raw, pos) {
+ parser.token = consumeTemplateBrace(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked,
+ raw,
+ },
+ tail: false,
+ });
+}
+/**
+ * Parse template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expression Expression AST node
+ * @param quasis Array of Template elements
+ */
+function parseTemplate(parser, context, expressions = [], quasis = []) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554440 /* TemplateCont */);
+ expressions.push(parseExpression(parser, context));
+ const t = getLocation(parser);
+ quasis.push(parseTemplateHead(parser, context, tokenValue, tokenRaw, pos));
+ if (parser.token === 33554441 /* TemplateTail */) {
+ quasis.push(parseTemplateSpans(parser, context, t));
+ }
+ else {
+ parseTemplate(parser, context, expressions, quasis);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions,
+ quasis,
+ });
+}
+/**
+ * Parse template spans
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateSpans)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param loc Current AST node location
+ */
+function parseTemplateSpans(parser, context, pos = getLocation(parser)) {
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554441 /* TemplateTail */);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked: tokenValue,
+ raw: tokenRaw,
+ },
+ tail: true,
+ });
+}
+/**
+ * Parses decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDecoratorList(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'Decorator',
+ expression: parseLeftHandSideExpression(parser, context, pos)
+ });
+}
+/**
+ * Parses a list of decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDecorators(parser, context) {
+ const decoratorList = [];
+ while (consume(parser, context, 120 /* At */)) {
+ decoratorList.push(parseDecoratorList(parser, context | exports.Context.AllowDecorator));
+ }
+ return decoratorList;
+} + +(function (Context) {
+ Context[Context["Empty"] = 0] = "Empty";
+ Context[Context["OptionsNext"] = 1] = "OptionsNext";
+ Context[Context["OptionsRanges"] = 2] = "OptionsRanges";
+ Context[Context["OptionsJSX"] = 4] = "OptionsJSX";
+ Context[Context["OptionsRaw"] = 8] = "OptionsRaw";
+ Context[Context["OptionsLoc"] = 16] = "OptionsLoc";
+ Context[Context["OptionsGlobalReturn"] = 32] = "OptionsGlobalReturn";
+ Context[Context["OptionsComments"] = 64] = "OptionsComments";
+ Context[Context["OptionsShebang"] = 128] = "OptionsShebang";
+ Context[Context["OptionsRawidentifiers"] = 256] = "OptionsRawidentifiers";
+ Context[Context["OptionsTolerant"] = 512] = "OptionsTolerant";
+ Context[Context["OptionsNode"] = 1024] = "OptionsNode";
+ Context[Context["OptionsExperimental"] = 2048] = "OptionsExperimental";
+ Context[Context["Strict"] = 4096] = "Strict";
+ Context[Context["Module"] = 8192] = "Module";
+ Context[Context["TaggedTemplate"] = 16384] = "TaggedTemplate";
+ Context[Context["InClass"] = 32768] = "InClass";
+ Context[Context["AllowIn"] = 65536] = "AllowIn";
+ Context[Context["Async"] = 131072] = "Async";
+ Context[Context["Yield"] = 262144] = "Yield";
+ Context[Context["InParameter"] = 524288] = "InParameter";
+ Context[Context["InFunctionBody"] = 1048576] = "InFunctionBody";
+ Context[Context["AllowSingleStatement"] = 2097152] = "AllowSingleStatement";
+ Context[Context["BlockScope"] = 4194304] = "BlockScope";
+ Context[Context["ForStatement"] = 8388608] = "ForStatement";
+ Context[Context["RequireIdentifier"] = 16777216] = "RequireIdentifier";
+ Context[Context["Method"] = 33554432] = "Method";
+ Context[Context["AllowSuperProperty"] = 67108864] = "AllowSuperProperty";
+ Context[Context["InParen"] = 134217728] = "InParen";
+ Context[Context["InJSXChild"] = 268435456] = "InJSXChild";
+ Context[Context["DisallowEscapedKeyword"] = 536870912] = "DisallowEscapedKeyword";
+ Context[Context["AllowDecorator"] = 1073741824] = "AllowDecorator";
+ Context[Context["LocationTracker"] = 18] = "LocationTracker";
+})(exports.Context || (exports.Context = {}));
+(function (Flags) {
+ Flags[Flags["None"] = 0] = "None";
+ Flags[Flags["NewLine"] = 1] = "NewLine";
+ Flags[Flags["AllowBinding"] = 2] = "AllowBinding";
+ Flags[Flags["AllowDestructuring"] = 4] = "AllowDestructuring";
+ Flags[Flags["SimpleParameterList"] = 8] = "SimpleParameterList";
+ Flags[Flags["InSwitchStatement"] = 16] = "InSwitchStatement";
+ Flags[Flags["InIterationStatement"] = 32] = "InIterationStatement";
+ Flags[Flags["HasStrictReserved"] = 64] = "HasStrictReserved";
+ Flags[Flags["HasOctal"] = 128] = "HasOctal";
+ Flags[Flags["SimpleAssignmentTarget"] = 256] = "SimpleAssignmentTarget";
+ Flags[Flags["HasProtoField"] = 512] = "HasProtoField";
+ Flags[Flags["StrictFunctionName"] = 1024] = "StrictFunctionName";
+ Flags[Flags["StrictEvalArguments"] = 2048] = "StrictEvalArguments";
+ Flags[Flags["InFunctionBody"] = 4096] = "InFunctionBody";
+ Flags[Flags["HasAwait"] = 8192] = "HasAwait";
+ Flags[Flags["HasYield"] = 16384] = "HasYield";
+ Flags[Flags["EscapedKeyword"] = 32768] = "EscapedKeyword";
+ Flags[Flags["HasConstructor"] = 65536] = "HasConstructor";
+})(exports.Flags || (exports.Flags = {}));
+(function (Labels) {
+ Labels[Labels["None"] = 0] = "None";
+ Labels[Labels["NotNested"] = 1] = "NotNested";
+ Labels[Labels["Nested"] = 2] = "Nested";
+})(exports.Labels || (exports.Labels = {}));
+(function (NumericState) {
+ NumericState[NumericState["None"] = 0] = "None";
+ NumericState[NumericState["SeenSeparator"] = 1] = "SeenSeparator";
+ NumericState[NumericState["EigthOrNine"] = 2] = "EigthOrNine";
+ NumericState[NumericState["Float"] = 4] = "Float";
+ NumericState[NumericState["BigInt"] = 8] = "BigInt";
+})(exports.NumericState || (exports.NumericState = {}));
+(function (ScannerState) {
+ ScannerState[ScannerState["None"] = 0] = "None";
+ ScannerState[ScannerState["NewLine"] = 1] = "NewLine";
+ ScannerState[ScannerState["LastIsCR"] = 2] = "LastIsCR";
+})(exports.ScannerState || (exports.ScannerState = {}));
+(function (ModifierState) {
+ ModifierState[ModifierState["None"] = 0] = "None";
+ ModifierState[ModifierState["Generator"] = 1] = "Generator";
+ ModifierState[ModifierState["Await"] = 2] = "Await";
+})(exports.ModifierState || (exports.ModifierState = {}));
+(function (CoverParenthesizedState) {
+ CoverParenthesizedState[CoverParenthesizedState["None"] = 0] = "None";
+ CoverParenthesizedState[CoverParenthesizedState["SequenceExpression"] = 1] = "SequenceExpression";
+ CoverParenthesizedState[CoverParenthesizedState["HasEvalOrArguments"] = 2] = "HasEvalOrArguments";
+ CoverParenthesizedState[CoverParenthesizedState["HasReservedWords"] = 4] = "HasReservedWords";
+ CoverParenthesizedState[CoverParenthesizedState["HasYield"] = 8] = "HasYield";
+ CoverParenthesizedState[CoverParenthesizedState["HasBinding"] = 16] = "HasBinding";
+})(exports.CoverParenthesizedState || (exports.CoverParenthesizedState = {}));
+(function (Escape) {
+ Escape[Escape["Empty"] = -1] = "Empty";
+ Escape[Escape["StrictOctal"] = -2] = "StrictOctal";
+ Escape[Escape["EightOrNine"] = -3] = "EightOrNine";
+ Escape[Escape["InvalidHex"] = -4] = "InvalidHex";
+ Escape[Escape["OutOfRange"] = -5] = "OutOfRange";
+})(exports.Escape || (exports.Escape = {}));
+(function (RegexFlags) {
+ RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
+ RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
+ RegexFlags[RegexFlags["Global"] = 2] = "Global";
+ RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
+ RegexFlags[RegexFlags["Unicode"] = 8] = "Unicode";
+ RegexFlags[RegexFlags["Sticky"] = 16] = "Sticky";
+ RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
+})(exports.RegexFlags || (exports.RegexFlags = {}));
+(function (CoverCallState) {
+ CoverCallState[CoverCallState["Empty"] = 0] = "Empty";
+ CoverCallState[CoverCallState["SeenSpread"] = 1] = "SeenSpread";
+ CoverCallState[CoverCallState["HasSpread"] = 2] = "HasSpread";
+ CoverCallState[CoverCallState["SimpleParameter"] = 4] = "SimpleParameter";
+ CoverCallState[CoverCallState["EvalOrArguments"] = 8] = "EvalOrArguments";
+ CoverCallState[CoverCallState["Yield"] = 16] = "Yield";
+ CoverCallState[CoverCallState["Await"] = 32] = "Await";
+})(exports.CoverCallState || (exports.CoverCallState = {}));
+(function (RegexState) {
+ RegexState[RegexState["Empty"] = 0] = "Empty";
+ RegexState[RegexState["Escape"] = 1] = "Escape";
+ RegexState[RegexState["Class"] = 2] = "Class";
+})(exports.RegexState || (exports.RegexState = {}));
+(function (ObjectState) {
+ ObjectState[ObjectState["None"] = 0] = "None";
+ ObjectState[ObjectState["Async"] = 1] = "Async";
+ ObjectState[ObjectState["Generator"] = 2] = "Generator";
+ ObjectState[ObjectState["Getter"] = 4] = "Getter";
+ ObjectState[ObjectState["Setter"] = 8] = "Setter";
+ ObjectState[ObjectState["Computed"] = 16] = "Computed";
+ ObjectState[ObjectState["Method"] = 32] = "Method";
+ ObjectState[ObjectState["Shorthand"] = 64] = "Shorthand";
+ ObjectState[ObjectState["Static"] = 128] = "Static";
+ ObjectState[ObjectState["Constructor"] = 256] = "Constructor";
+ ObjectState[ObjectState["Heritage"] = 512] = "Heritage";
+})(exports.ObjectState || (exports.ObjectState = {}));
+/**
+ * Validate break and continue statement
+ *
+ * @param parser Parser object
+ * @param label label
+ * @param isContinue true if validation continue statement
+ */
+function validateBreakOrContinueLabel(parser, context, label, isContinue) {
+ const state = hasLabel(parser, label);
+ if (!state)
+ tolerant(parser, context, 32 /* UnknownLabel */, label);
+ if (isContinue && !(state & exports.Labels.Nested))
+ tolerant(parser, context, 31 /* IllegalContinue */, label);
+}
+/**
+ * Add label to the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+function addLabel(parser, label) {
+ if (parser.labelSet === undefined)
+ parser.labelSet = {};
+ parser.labelSet[`$${label}`] = isIterationStatement(parser.token) ? exports.Labels.Nested : exports.Labels.NotNested;
+}
+/**
+ * Remove label from the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+function popLabel(parser, label) {
+ parser.labelSet[`$${label}`] = exports.Labels.None;
+}
+/**
+ * Returns either true or false. Depends if the label exist.
+ *
+ * @param parser Parser object
+ * @param label Label
+ */
+function hasLabel(parser, label) {
+ return !parser.labelSet ? exports.Labels.None : parser.labelSet[`$${label}`];
+}
+/**
+ * Finish each the node for each parse. Set line / and column on the node if the
+ * options are set for it
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Line / column
+ * @param node AST node
+ */
+function finishNode(context, parser, meta, node) {
+ const { lastIndex, lastLine, lastColumn, sourceFile, index } = parser;
+ if (context & exports.Context.LocationTracker) {
+ if (context & exports.Context.OptionsRanges) {
+ node.start = meta.index;
+ node.end = lastIndex;
+ }
+ if (context & exports.Context.OptionsLoc) {
+ node.loc = {
+ start: { line: meta.line, column: meta.column },
+ end: { line: lastLine, column: lastColumn }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ return node;
+}
+/**
+ * Consumes the next token. If the consumed token is not of the expected type
+ * then report an error and return null. Otherwise return true.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ * @param Err Optionally error message to be thrown
+ */
+function expect(parser, context, token, err = 1 /* UnexpectedToken */) {
+ if (parser.token !== token)
+ report(parser, err, tokenDesc(parser.token));
+ nextToken(parser, context);
+ return true;
+}
+/**
+ * If the next token matches the given token, this consumes the token
+ * and returns true. Otherwise return false.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ */
+function consume(parser, context, token) {
+ if (parser.token !== token)
+ return false;
+ nextToken(parser, context);
+ return true;
+}
+/**
+ * Advance and return the next token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextToken(parser, context) {
+ parser.lastIndex = parser.index;
+ parser.lastLine = parser.line;
+ parser.lastColumn = parser.column;
+ return (parser.token = scan(parser, context));
+}
+const hasBit = (mask, flags) => (mask & flags) === flags;
+/**
+ * Automatic Semicolon Insertion
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeSemicolon(parser, context) {
+ return parser.token & 1048576 /* ASI */ || parser.flags & exports.Flags.NewLine
+ ? consume(parser, context, 17825809 /* Semicolon */)
+ : report(parser, !(context & exports.Context.Async) && parser.token & 262144 /* IsAwait */ ? 38 /* AwaitOutsideAsync */ : 1 /* UnexpectedToken */, tokenDesc(parser.token));
+}
+/**
+ * Bit fiddle current grammar state and keep track of the state during the parse and restore
+ * it back to original state after finish parsing or throw.
+ *
+ * Ideas for this is basicly from V8 and SM, but also the Esprima parser does this in a similar way.
+ *
+ * However this implementation is an major improvement over similiar implementations, and
+ * does not require additonal bitmasks to be set / unset during the parsing outside this function.
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ * @param errMsg Optional error message
+ */
+function parseExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // If there exist an pending expression error, we throw an error at
+ // the same location it was recorded
+ if (!!parser.pendingExpressionError) {
+ const { error, line, column, index } = parser.pendingExpressionError;
+ constructError(parser, context, index, line, column, error);
+ }
+ // Here we - just in case - disallow both binding and destructuring
+ // and only set the bitmaks if the previous flags (before the callback)
+ // is positive.
+ // Note that this bitmasks may have been turned off during parsing
+ // the callback
+ parser.flags &= ~(exports.Flags.AllowBinding | exports.Flags.AllowDestructuring);
+ if (flags & exports.Flags.AllowBinding)
+ parser.flags |= exports.Flags.AllowBinding;
+ if (flags & exports.Flags.AllowDestructuring)
+ parser.flags |= exports.Flags.AllowDestructuring;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+}
+/**
+ * Restor current grammar to previous state, or unset necessary bitmasks
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ */
+function restoreExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ // Clear pending expression error
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // Both the previous bitmasks and bitmasks set during parsing the callback
+ // has to be positive for us to allow further binding or destructuring.
+ // Note that we allow both before the callback, so this is the only thing
+ // we need to check for.
+ if (!(parser.flags & exports.Flags.AllowBinding) || !(flags & exports.Flags.AllowBinding)) {
+ parser.flags &= ~exports.Flags.AllowBinding;
+ }
+ if (!(parser.flags & exports.Flags.AllowDestructuring) || !(flags & exports.Flags.AllowDestructuring)) {
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ }
+ // Here we either
+ // 1) restore to previous pending expression error
+ // or
+ // 2) if a pending expression error have been set during the parse (*only in object literal*)
+ // we overwrite previous error, and keep the new one
+ parser.pendingExpressionError = pendingExpressionError || parser.pendingExpressionError;
+ return res;
+}
+/**
+ * Set / unset yield / await context masks based on the
+ * ModifierState masks before invoking the callback and
+ * returning it's content
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Modifier state
+ * @param callback Callback function to be invoked
+ * @param methodState Optional Objectstate.
+ */
+function swapContext(parser, context, state, callback, methodState = exports.ObjectState.None) {
+ context &= ~(exports.Context.Async | exports.Context.Yield | exports.Context.InParameter);
+ if (state & exports.ModifierState.Generator)
+ context |= exports.Context.Yield;
+ if (state & exports.ModifierState.Await)
+ context |= exports.Context.Async;
+ return callback(parser, context, methodState);
+}
+/**
+ * Validates function params
+ *
+ * Note! In case anyone want to enable full scoping, replace 'paramSet' with an similiar
+ * object on the parser object itself. Then push / set the tokenValue to
+ * it an use an bitmask to mark it as an 'variable' not 'blockscope'. Then when
+ * implementing lexical scoping, you can use that for validation.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param params Array of token values
+ */
+function validateParams(parser, context, params) {
+ const paramSet = new Map();
+ for (let i = 0; i < params.length; i++) {
+ const key = `@${params[i]}`;
+ if (paramSet.get(key)) {
+ tolerant(parser, context, 81 /* ParamDupe */);
+ }
+ else
+ paramSet.set(key, true);
+ }
+}
+/**
+ * Reinterpret various expressions as pattern
+ * This is only used for assignment and arrow parameter list
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param node AST node
+ */
+const reinterpret = (parser, context, node) => {
+ switch (node.type) {
+ case 'Identifier':
+ if (context & exports.Context.Strict && nameIsArgumentsOrEval(node.name))
+ report(parser, 3 /* InvalidEscapedReservedWord */);
+ case 'ArrayPattern':
+ case 'AssignmentPattern':
+ case 'ObjectPattern':
+ case 'RestElement':
+ case 'MetaProperty':
+ return;
+ case 'ArrayExpression':
+ node.type = 'ArrayPattern';
+ for (let i = 0; i < node.elements.length; ++i) {
+ // skip holes in pattern
+ if (node.elements[i] !== null) {
+ reinterpret(parser, context, node.elements[i]);
+ }
+ }
+ return;
+ case 'ObjectExpression':
+ node.type = 'ObjectPattern';
+ for (let i = 0; i < node.properties.length; i++) {
+ reinterpret(parser, context, node.properties[i]);
+ }
+ return;
+ case 'Property':
+ reinterpret(parser, context, node.value);
+ return;
+ case 'SpreadElement':
+ node.type = 'RestElement';
+ if (node.argument.type !== 'ArrayExpression' &&
+ node.argument.type !== 'ObjectExpression' &&
+ !isValidSimpleAssignmentTarget(node.argument)) {
+ tolerant(parser, context, 71 /* RestDefaultInitializer */);
+ }
+ reinterpret(parser, context, node.argument);
+ break;
+ case 'AssignmentExpression':
+ node.type = 'AssignmentPattern';
+ delete node.operator; // operator is not relevant for assignment pattern
+ reinterpret(parser, context, node.left); // recursive descent
+ return;
+ case 'MemberExpression':
+ if (!(context & exports.Context.InParameter))
+ return;
+ // Fall through
+ default:
+ tolerant(parser, context, context & exports.Context.InParameter ? 77 /* NotBindable */ : 73 /* InvalidDestructuringTarget */, node.type);
+ }
+};
+/**
+ * Does a lookahead.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param callback Callback function to be invoked
+ */
+function lookahead(parser, context, callback) {
+ const { tokenValue, flags, line, column, startColumn, index, lastColumn, startLine, lastLine, lastIndex, startIndex, tokenRaw, token, lastValue, tokenRegExp, labelSet, errors, errorLocation, pendingExpressionError } = parser;
+ const res = callback(parser, context);
+ parser.index = index;
+ parser.token = token;
+ parser.tokenValue = tokenValue;
+ parser.tokenValue = tokenValue;
+ parser.flags = flags;
+ parser.line = line;
+ parser.column = column;
+ parser.tokenRaw = tokenRaw;
+ parser.lastValue = lastValue;
+ parser.startColumn = startColumn;
+ parser.lastColumn = lastColumn;
+ parser.startLine = startLine;
+ parser.lastLine = lastLine;
+ parser.lastIndex = lastIndex;
+ parser.startIndex = startIndex;
+ parser.tokenRegExp = tokenRegExp;
+ parser.labelSet = labelSet;
+ parser.errors = errors;
+ parser.errorLocation = errorLocation;
+ parser.tokenRegExp = tokenRegExp;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+}
+/**
+ * Returns true if this an valid simple assignment target
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isValidSimpleAssignmentTarget(node) {
+ return node.type === 'Identifier' || node.type === 'MemberExpression' ? true : false;
+}
+/**
+ * Get current node location
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function getLocation(parser) {
+ return {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+}
+/**
+ * Returns true if this is an valid identifier
+ *
+ * @param context Context masks
+ * @param t Token
+ */
+function isValidIdentifier(context, t) {
+ if (context & exports.Context.Strict) {
+ if (context & exports.Context.Module && t & 262144 /* IsAwait */)
+ return false;
+ if (t & 1073741824 /* IsYield */)
+ return false;
+ return (t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (t & 69632 /* Contextual */) === 69632 /* Contextual */;
+ }
+ return ((t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (t & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (t & 20480 /* FutureReserved */) === 20480 /* FutureReserved */);
+}
+/**
+ * Returns true if this an valid lexical binding and not an identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isLexical(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return !!(token & (131072 /* IsIdentifier */ | 8388608 /* IsBindingPattern */ | 1073741824 /* IsYield */ | 262144 /* IsAwait */) ||
+ token === 33574984 /* LetKeyword */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */);
+}
+/**
+ * Returns true if this is end of case or default clauses
+ *
+ * @param parser Parser object
+ */
+function isEndOfCaseOrDefaultClauses(parser) {
+ return (parser.token === 12368 /* DefaultKeyword */ || parser.token === 17825807 /* RightBrace */ || parser.token === 12363 /* CaseKeyword */);
+}
+/**
+ * Validates if the next token in the stream is a left paren or a period
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsLeftParenOrPeriod(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */ || parser.token === 16777229 /* Period */;
+}
+/**
+ * Validates if the next token in the stream is a identifier or left paren
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenisIdentifierOrParen(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return token & (131072 /* IsIdentifier */ | 1073741824 /* IsYield */) || token === 50331659 /* LeftParen */;
+}
+/**
+ * Validates if the next token in the stream is left parenthesis.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsLeftParen(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */;
+}
+/**
+ * Validates if the next token in the stream is a function keyword on the same line.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsFuncKeywordOnSameLine(parser, context) {
+ nextToken(parser, context);
+ return !(parser.flags & exports.Flags.NewLine) && parser.token === 33566808 /* FunctionKeyword */;
+}
+/**
+ * Checks if the property has any private field key
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isPropertyWithPrivateFieldKey(expr) {
+ return !expr.property ? false : expr.property.type === 'PrivateName';
+}
+/**
+ * Parse and classify itendifier - similar method as in V8
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAndClassifyIdentifier(parser, context) {
+ const { token, tokenValue: name } = parser;
+ if (context & exports.Context.Strict) {
+ if (context & exports.Context.Module && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (token & 69632 /* Contextual */) === 69632 /* Contextual */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (context & exports.Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+}
+function nameIsArgumentsOrEval(value) {
+ return value === 'eval' || value === 'arguments';
+}
+/**
+ * Records an error from current position. If we report an error later, we'll do it from
+ * this position.
+ *
+ * @param parser Parser object
+ */
+function setPendingError(parser) {
+ parser.errorLocation = {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+}
+/**
+ * Returns tagName for JSX element
+ *
+ * @param elementName JSX Element name
+ */
+function isEqualTagNames(elementName) {
+ // tslint:disable-next-line:switch-default | this switch is exhaustive
+ switch (elementName.type) {
+ case 'JSXIdentifier':
+ return elementName.name;
+ case 'JSXNamespacedName':
+ return `${isEqualTagNames(elementName.namespace)}:${isEqualTagNames(elementName.name)}`;
+ case 'JSXMemberExpression':
+ return `${isEqualTagNames(elementName.object)}.${isEqualTagNames(elementName.property)}`;
+ }
+}
+/**
+ * Returns true if this is an instance field ( stage 3 proposal)
+ *
+ * @param parser Parser object
+ */
+function isInstanceField(parser) {
+ const { token } = parser;
+ return token === 17825807 /* RightBrace */ || token === 17825809 /* Semicolon */ || token === 83886109 /* Assign */;
+}
+/**
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expr AST expressions
+ * @param prefix prefix
+ */
+function validateUpdateExpression(parser, context, expr, prefix) {
+ if (context & exports.Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 68 /* StrictLHSPrefixPostFix */, prefix);
+ }
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+}
+/**
+ * Record expression error
+ *
+ * @param parser Parser object
+ * @param error Error message
+ */
+function setPendingExpressionError(parser, type) {
+ parser.pendingExpressionError = {
+ error: errorMessages[type],
+ line: parser.line,
+ column: parser.column,
+ index: parser.index
+ };
+}
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+function validateCoverParenthesizedExpression(parser, state) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= exports.CoverParenthesizedState.HasEvalOrArguments;
+ }
+ else if ((token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ setPendingError(parser);
+ state |= exports.CoverParenthesizedState.HasReservedWords;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasAwait;
+ }
+ }
+ return state;
+}
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+function validateAsyncArgumentList(parser, context, state) {
+ const { token } = parser;
+ if (!(parser.flags & exports.Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= exports.CoverCallState.EvalOrArguments;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ state |= exports.CoverCallState.Await;
+ }
+ else if ((token & 1073741824 /* IsYield */) === 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ state |= exports.CoverCallState.Yield;
+ }
+ }
+ return state;
+}
+/**
+ * Returns true if iteration statement. Otherwise return false,
+ *
+ * @param t Token
+ */
+function isIterationStatement(t) {
+ return t === 12369 /* DoKeyword */ || t === 12386 /* WhileKeyword */ || t === 12374 /* ForKeyword */;
+}
+/**
+ * Returns true if in or of token. Otherwise return false,
+ *
+ * @param t Token
+ */
+function isInOrOf(t) {
+ return t === 69746 /* OfKeyword */ || t === 167786289 /* InKeyword */;
+} + +/*@internal*/
+const errorMessages = {
+ [0 /* Unexpected */]: 'Unexpected token',
+ [1 /* UnexpectedToken */]: 'Unexpected token \'%0\'',
+ [2 /* ExpectedToken */]: 'Expected token \'%0\'',
+ [3 /* InvalidEscapedReservedWord */]: 'Keyword must not contain escaped characters',
+ [4 /* UnexpectedKeyword */]: 'Keyword \'%0\' is reserved',
+ [5 /* InvalidLHSInAssignment */]: 'Invalid left-hand side in assignment',
+ [6 /* UnterminatedString */]: 'Unterminated string literal',
+ [7 /* UnterminatedRegExp */]: 'Unterminated regular expression literal',
+ [8 /* UnterminatedComment */]: 'Unterminated MultiLineComment',
+ [9 /* UnterminatedTemplate */]: 'Unterminated template literal',
+ [10 /* UnexpectedChar */]: 'Invalid character \'%0\'',
+ [11 /* StrictOctalEscape */]: 'Octal escapes are not allowed in strict mode',
+ [13 /* InvalidEightAndNine */]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
+ [14 /* UnicodeOutOfRange */]: 'Unicode escape code point out of range',
+ [15 /* DuplicateRegExpFlag */]: 'Duplicate regular expression flag \'%0\'',
+ [16 /* UnexpectedTokenRegExpFlag */]: 'Unexpected regular expression flag \'%0\'',
+ [17 /* StrictLHSAssignment */]: 'Eval or arguments can\'t be assigned to in strict mode code',
+ [18 /* IllegalReturn */]: 'Illegal return statement',
+ [19 /* StrictFunction */]: 'In strict mode code, functions can only be declared at top level or inside a block',
+ [20 /* SloppyFunction */]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
+ [21 /* ForbiddenAsStatement */]: '%0 can\'t appear in single-statement context',
+ [22 /* GeneratorInSingleStatementContext */]: 'Generators can only be declared at the top level or inside a block',
+ [23 /* ForAwaitNotOf */]: '\'for await\' loop should be used with \'of\'',
+ [24 /* DeclarationMissingInitializer */]: 'Missing initializer in %0 declaration',
+ [25 /* ForInOfLoopInitializer */]: '\'for-%0\' loop variable declaration may not have an initializer',
+ [26 /* ForInOfLoopMultiBindings */]: 'Invalid left-hand side in for-%0 loop: Must have a single binding.',
+ [27 /* LetInLexicalBinding */]: 'let is disallowed as a lexically bound name',
+ [28 /* UnexpectedLexicalDeclaration */]: 'Lexical declaration cannot appear in a single-statement context',
+ [29 /* LabelRedeclaration */]: 'Label \'%0\' has already been declared',
+ [30 /* InvalidNestedStatement */]: '%0 statement must be nested within an iteration statement',
+ [31 /* IllegalContinue */]: 'Illegal continue statement: \'%0\' does not denote an iteration statement',
+ [32 /* UnknownLabel */]: 'Undefined label \'%0\'',
+ [33 /* MultipleDefaultsInSwitch */]: 'More than one default clause in switch statement',
+ [34 /* ImportExportDeclAtTopLevel */]: '%0 declarations may only appear at top level of a module',
+ [35 /* AsyncFunctionInSingleStatementContext */]: 'Async functions can only be declared at the top level or inside a block',
+ [36 /* InvalidLineBreak */]: 'No line break is allowed after \'%0\'',
+ [37 /* StrictModeWith */]: 'Strict mode code may not include a with statement',
+ [38 /* AwaitOutsideAsync */]: 'Await is only valid in async functions',
+ [39 /* UnNamedFunctionDecl */]: 'Function declaration must have a name in this context',
+ [12 /* DuplicateConstructor */]: 'Duplicate constructor method in class',
+ [40 /* DisallowedInContext */]: '\'%0\' may not be used as an identifier in this context',
+ [43 /* StrictDelete */]: 'Delete of an unqualified identifier in strict mode',
+ [44 /* DeletePrivateField */]: 'Private fields can not be deleted',
+ [41 /* PrivateFieldConstructor */]: 'Classes may not have a private field named \'#constructor\'',
+ [42 /* PublicFieldConstructor */]: 'Classes may not have a field named \'constructor\'',
+ [45 /* InvalidConstructor */]: 'Class constructor may not be a \'%0\'',
+ [46 /* UnexpectedReserved */]: 'Unexpected reserved word',
+ [47 /* StrictEvalArguments */]: 'Unexpected eval or arguments in strict mode',
+ [48 /* AwaitBindingIdentifier */]: '\'await\' is not a valid identifier inside an async function',
+ [49 /* YieldBindingIdentifier */]: '\'yield\' is not a valid identifier inside an generator function',
+ [50 /* UnexpectedStrictReserved */]: 'Unexpected strict mode reserved word',
+ [52 /* AwaitInParameter */]: 'Await expression not allowed in formal parameter',
+ [51 /* YieldInParameter */]: 'Yield expression not allowed in formal parameter',
+ [53 /* MetaNotInFunctionBody */]: 'new.target only allowed within functions',
+ [54 /* BadSuperCall */]: 'super() is not allowed in this context',
+ [55 /* UnexpectedSuper */]: 'Member access from super not allowed in this context',
+ [56 /* LoneSuper */]: 'Only "(" or "." or "[" are allowed after \'super\'',
+ [57 /* YieldReservedKeyword */]: '\'yield\' is a reserved keyword within generator function bodies',
+ [58 /* ContinuousNumericSeparator */]: 'Only one underscore is allowed as numeric separator',
+ [59 /* TrailingNumericSeparator */]: 'Numeric separators are not allowed at the end of numeric literals',
+ [60 /* ZeroDigitNumericSeparator */]: 'Numeric separator can not be used after leading 0.',
+ [61 /* StrictOctalLiteral */]: 'Legacy octal literals are not allowed in strict mode',
+ [62 /* InvalidLhsInAssignment */]: 'Invalid left-hand side in assignment',
+ [63 /* DuplicateProto */]: 'Property name __proto__ appears more than once in object literal',
+ [64 /* IllegalUseStrict */]: 'Illegal \'use strict\' directive in function with non-simple parameter list',
+ [65 /* StaticPrototype */]: 'Classes may not have a static property named \'prototype\'',
+ [66 /* AccessorWrongArgs */]: '%0 functions must have %1 argument%2',
+ [67 /* BadSetterRestParameter */]: 'Setter function argument must not be a rest parameter',
+ [68 /* StrictLHSPrefixPostFix */]: '%0 increment/decrement may not have eval or arguments operand in strict mode',
+ [69 /* InvalidElisonInObjPropList */]: 'Elision not allowed in object property list',
+ [70 /* ElementAfterRest */]: 'Rest element must be last element',
+ [72 /* ElementAfterSpread */]: 'Spread element must be last element',
+ [71 /* RestDefaultInitializer */]: 'Rest parameter may not have a default initializer',
+ [73 /* InvalidDestructuringTarget */]: 'Invalid destructuring assignment target',
+ [74 /* UnexpectedSurrogate */]: 'Unexpected surrogate pair',
+ [75 /* MalformedEscape */]: 'Malformed %0 character escape sequence',
+ [76 /* TemplateOctalLiteral */]: 'Template literals may not contain octal escape sequences',
+ [77 /* NotBindable */]: 'Invalid binding pattern',
+ [78 /* ParamAfterRest */]: 'Rest parameter must be last formal parameter',
+ [79 /* NoCatchOrFinally */]: 'Missing catch or finally after try',
+ [80 /* NewlineAfterThrow */]: 'Illegal newline after throw',
+ [81 /* ParamDupe */]: 'Duplicate parameter name not allowed in this context',
+ [82 /* AsAfterImportStart */]: 'Missing keyword \'as\' after import *',
+ [83 /* LabelNoColon */]: 'Labels must be followed by a \':\'',
+ [84 /* NonEmptyJSXExpression */]: 'JSX attributes must only be assigned a non-empty \'expression\'',
+ [85 /* ExpectedJSXClosingTag */]: 'Expected corresponding JSX closing tag for %0',
+ [86 /* AdjacentJSXElements */]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
+ [87 /* InvalidJSXAttributeValue */]: 'Invalid JSX attribute value',
+ [88 /* RestWithComma */]: 'Rest element may not have a trailing comma',
+ [89 /* UndefinedUnicodeCodePoint */]: 'Undefined Unicode code-point',
+ [90 /* HtmlCommentInModule */]: 'HTML comments are not allowed in modules',
+ [91 /* InvalidCoverInitializedName */]: 'Invalid shorthand property initializer',
+ [92 /* TrailingDecorators */]: 'Trailing decorator may be followed by method',
+ [93 /* GeneratorConstructor */]: 'Decorators can\'t be used with a constructor',
+ [94 /* InvalidRestBindingPattern */]: '`...` must be followed by an identifier in declaration contexts',
+};
+/**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param index The 0-based end index of the error.
+ * @param line The 0-based line position of the error.
+ * @param column The 0-based column position of the error.
+ * @param parser The 0-based end index of the current node.
+ * @param description Error description
+ */
+/*@internal*/
+function constructError(parser, context, index, line, column, description) {
+ const error = new SyntaxError(`Line ${line}, column ${column}: ${description}`);
+ error.index = index;
+ error.line = line;
+ error.column = column;
+ error.description = description;
+ if (context & exports.Context.OptionsTolerant) {
+ parser.errors.push(error);
+ }
+ else
+ throw error;
+}
+/**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ */
+function getErrorLocation(parser) {
+ let { index, startLine: line, startColumn: column } = parser;
+ const errorLoc = parser.errorLocation;
+ if (!!errorLoc) {
+ index = errorLoc.index;
+ line = errorLoc.line;
+ column = errorLoc.column;
+ }
+ return { index, line, column };
+}
+/**
+ * Throws an error
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+/*@internal*/
+function report(parser, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, exports.Context.Empty, index, line, column, errorMessage);
+}
+/**
+ * If in tolerant mode, all errors are pushed to a top-level error array containing
+ * otherwise throws
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+/*@internal*/
+function tolerant(parser, context, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, context, index, line, column, errorMessage);
+} + +// Declarations
+/**
+ * Parses class declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & exports.Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const id = (context & exports.Context.RequireIdentifier && (parser.token !== 33685505 /* Identifier */))
+ ? null :
+ parseBindingIdentifier(parser, context | exports.Context.Strict | exports.Context.DisallowEscapedKeyword);
+ let state = exports.ObjectState.None;
+ let superClass = null;
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | exports.Context.Strict, pos);
+ state |= exports.ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context & ~exports.Context.RequireIdentifier | exports.Context.Strict | exports.Context.InClass, state);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body
+ });
+}
+/**
+ * Parses function declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ let isGenerator = exports.ModifierState.None;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ if (context & exports.Context.AllowSingleStatement && !(context & exports.Context.InFunctionBody)) {
+ tolerant(parser, context, 22 /* GeneratorInSingleStatementContext */);
+ }
+ isGenerator = exports.ModifierState.Generator;
+ }
+ return parseFunctionDeclarationBody(parser, context, isGenerator, pos);
+}
+/**
+ * Parses out a function declartion body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context mask
+ * @param state Modifier state
+ * @param pos Current location
+ */
+function parseFunctionDeclarationBody(parser, context, state, pos) {
+ const { token } = parser;
+ let id = null;
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (context & exports.Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (token !== 50331659 /* LeftParen */) {
+ id = parseBindingIdentifier(parser, context);
+ // Unnamed functions are forbidden in statement context.
+ }
+ else if (!(context & exports.Context.RequireIdentifier))
+ tolerant(parser, context, 39 /* UnNamedFunctionDecl */);
+ const { params, body } = swapContext(parser, context & ~(exports.Context.Method | exports.Context.AllowSuperProperty | exports.Context.RequireIdentifier), state, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionDeclaration',
+ params,
+ body,
+ async: !!(state & exports.ModifierState.Await),
+ generator: !!(state & exports.ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parses async function or async generator declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isAwait = exports.ModifierState.Await;
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? exports.ModifierState.Generator : exports.ModifierState.None;
+ return parseFunctionDeclarationBody(parser, context, isGenerator | isAwait, pos);
+}
+/**
+ * VariableDeclaration :
+ * BindingIdentifier Initializeropt
+ * BindingPattern Initializer
+ *
+ * VariableDeclarationNoIn :
+ * BindingIdentifier InitializerNoInopt
+ * BindingPattern InitializerNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableDeclaration(parser, context, isConst) {
+ const pos = getLocation(parser);
+ const isBindingPattern = (parser.token & 8388608 /* IsBindingPattern */) !== 0;
+ const id = parseBindingIdentifierOrPattern(parser, context);
+ let init = null;
+ if (consume(parser, context | exports.Context.DisallowEscapedKeyword, 83886109 /* Assign */)) {
+ init = parseExpressionCoverGrammar(parser, context & ~(exports.Context.BlockScope | exports.Context.ForStatement), parseAssignmentExpression);
+ if (isInOrOf(parser.token) && (context & exports.Context.ForStatement || isBindingPattern)) {
+ if (parser.token === 167786289 /* InKeyword */) {
+ // https://github.com/tc39/test262/blob/master/test/annexB/language/statements/for-in/strict-initializer.js
+ if (context & (exports.Context.BlockScope | exports.Context.Strict | exports.Context.Async) || isBindingPattern) {
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ }
+ else
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ // Note: Initializers are required for 'const' and binding patterns
+ }
+ else if (!isInOrOf(parser.token) && (isConst || isBindingPattern)) {
+ tolerant(parser, context, 24 /* DeclarationMissingInitializer */, isConst ? 'const' : 'destructuring');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclarator',
+ init,
+ id,
+ });
+}
+/**
+ * Parses variable declaration list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclarationList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableDeclarationList(parser, context, isConst) {
+ const list = [parseVariableDeclaration(parser, context, isConst)];
+ while (consume(parser, context, 16777234 /* Comma */))
+ list.push(parseVariableDeclaration(parser, context, isConst));
+ if (context & exports.Context.ForStatement && isInOrOf(parser.token) && list.length !== 1) {
+ tolerant(parser, context, 26 /* ForInOfLoopMultiBindings */, tokenDesc(parser.token));
+ }
+ return list;
+} + +// Statements
+/**
+ * Parses statement list items
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementListItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseStatementListItem(parser, context) {
+ switch (parser.token) {
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionDeclaration(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassDeclaration(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetOrExpressionStatement(parser, context | exports.Context.AllowIn);
+ case 33566793 /* ConstKeyword */:
+ return parseVariableStatement(parser, context | exports.Context.BlockScope | exports.Context.AllowIn);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionDeclarationOrStatement(parser, context);
+ case 33566810 /* ImportKeyword */: {
+ if (context & exports.Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod)) {
+ return parseExpressionStatement(parser, context | exports.Context.AllowIn);
+ }
+ }
+ case 12371 /* ExportKeyword */:
+ if (context & exports.Context.Module) {
+ tolerant(parser, context, 34 /* ImportExportDeclAtTopLevel */, tokenDesc(parser.token));
+ }
+ default:
+ return parseStatement(parser, context | exports.Context.AllowSingleStatement);
+ }
+}
+/**
+ * Parses statements
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseStatement(parser, context) {
+ switch (parser.token) {
+ case 33566791 /* VarKeyword */:
+ return parseVariableStatement(parser, context | exports.Context.AllowIn);
+ case 17825809 /* Semicolon */:
+ return parseEmptyStatement(parser, context);
+ case 33566814 /* SwitchKeyword */:
+ return parseSwitchStatement(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseBlockStatement(parser, context);
+ case 12380 /* ReturnKeyword */:
+ return parseReturnStatement(parser, context);
+ case 12377 /* IfKeyword */:
+ return parseIfStatement(parser, context);
+ case 12369 /* DoKeyword */:
+ return parseDoWhileStatement(parser, context);
+ case 12386 /* WhileKeyword */:
+ return parseWhileStatement(parser, context);
+ case 12387 /* WithKeyword */:
+ return parseWithStatement(parser, context);
+ case 12362 /* BreakKeyword */:
+ return parseBreakStatement(parser, context);
+ case 12366 /* ContinueKeyword */:
+ return parseContinueStatement(parser, context);
+ case 12367 /* DebuggerKeyword */:
+ return parseDebuggerStatement(parser, context);
+ case 302002272 /* ThrowKeyword */:
+ return parseThrowStatement(parser, context);
+ case 12385 /* TryKeyword */:
+ return parseTryStatement(parser, context | exports.Context.DisallowEscapedKeyword);
+ case 12374 /* ForKeyword */:
+ return parseForStatement(parser, context | exports.Context.ForStatement);
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ tolerant(parser, context, 35 /* AsyncFunctionInSingleStatementContext */);
+ }
+ return parseExpressionOrLabelledStatement(parser, context | exports.Context.AllowSingleStatement);
+ case 33566808 /* FunctionKeyword */:
+ // V8
+ tolerant(parser, context, context & exports.Context.Strict ? 19 /* StrictFunction */ : 20 /* SloppyFunction */);
+ case 33566797 /* ClassKeyword */:
+ tolerant(parser, context, 21 /* ForbiddenAsStatement */, tokenDesc(parser.token));
+ default:
+ return parseExpressionOrLabelledStatement(parser, context);
+ }
+}
+/**
+ * Parses empty statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-EmptyStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseEmptyStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'EmptyStatement'
+ });
+}
+/**
+ * Parses the continue statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ContinueStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseContinueStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ // Appearing of continue without an IterationStatement leads to syntax error
+ if (!(parser.flags & (exports.Flags.InSwitchStatement | exports.Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, tokenDesc(parser.token));
+ }
+ let label = null;
+ if (!(parser.flags & exports.Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, true);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ContinueStatement',
+ label
+ });
+}
+/**
+ * Parses the break statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BreakStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBreakStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let label = null;
+ if (!(parser.flags & exports.Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, false);
+ }
+ else if (!(parser.flags & (exports.Flags.InSwitchStatement | exports.Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, 'break');
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'BreakStatement',
+ label
+ });
+}
+/**
+ * Parses the if statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-if-statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIfStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const consequent = parseConsequentOrAlternate(parser, context | exports.Context.DisallowEscapedKeyword);
+ const alternate = consume(parser, context, 12370 /* ElseKeyword */) ? parseConsequentOrAlternate(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'IfStatement',
+ test,
+ consequent,
+ alternate
+ });
+}
+/**
+ * Parse either consequent or alternate. Supports AnnexB.
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseConsequentOrAlternate(parser, context) {
+ return context & exports.Context.Strict || parser.token !== 33566808 /* FunctionKeyword */
+ ? parseStatement(parser, context & ~exports.Context.AllowSingleStatement)
+ : parseFunctionDeclaration(parser, context);
+}
+/**
+ * Parses the debugger statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DebuggerStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDebuggerStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'DebuggerStatement'
+ });
+}
+/**
+ * Parses try statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TryStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseTryStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const block = parseBlockStatement(parser, context);
+ const handler = parser.token === 12364 /* CatchKeyword */ ? parseCatchBlock(parser, context) : null;
+ const finalizer = consume(parser, context, 12373 /* FinallyKeyword */) ? parseBlockStatement(parser, context) : null;
+ if (!handler && !finalizer)
+ tolerant(parser, context, 79 /* NoCatchOrFinally */);
+ return finishNode(context, parser, pos, {
+ type: 'TryStatement',
+ block,
+ handler,
+ finalizer
+ });
+}
+/**
+ * Parses catch block
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Catch)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCatchBlock(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let param = null;
+ if (consume(parser, context, 50331659 /* LeftParen */)) {
+ const params = [];
+ param = parseBindingIdentifierOrPattern(parser, context, params);
+ validateParams(parser, context, params);
+ expect(parser, context, 16 /* RightParen */);
+ }
+ const body = parseBlockStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'CatchClause',
+ param,
+ body
+ });
+}
+/**
+ * Parses throw statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ThrowStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseThrowStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 80 /* NewlineAfterThrow */);
+ const argument = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ThrowStatement',
+ argument
+ });
+}
+/**
+ * Parses expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpressionStatement(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+}
+/**
+ * Parse directive node
+ *
+ * * @see [Link](https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDirective(parser, context) {
+ const pos = getLocation(parser);
+ const directive = parser.tokenRaw.slice(1, -1);
+ const expr = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr,
+ directive
+ });
+}
+/**
+ * Parses either expression or labelled statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LabelledStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpressionOrLabelledStatement(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, token } = parser;
+ const expr = parseExpression(parser, (context & ~(exports.Context.AllowSingleStatement | exports.Context.AllowDecorator)) | exports.Context.AllowIn);
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */) && parser.token === 16777237 /* Colon */) {
+ // If within generator function bodies, we do it like this so we can throw an nice error message
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 57 /* YieldReservedKeyword */);
+ expect(parser, context, 16777237 /* Colon */, 83 /* LabelNoColon */);
+ if (hasLabel(parser, tokenValue))
+ tolerant(parser, context, 29 /* LabelRedeclaration */, tokenValue);
+ addLabel(parser, tokenValue);
+ const body = !(context & exports.Context.Strict) &&
+ context & exports.Context.AllowSingleStatement &&
+ parser.token === 33566808 /* FunctionKeyword */
+ ? parseFunctionDeclaration(parser, context)
+ : parseStatement(parser, context);
+ popLabel(parser, tokenValue);
+ return finishNode(context, parser, pos, {
+ type: 'LabeledStatement',
+ label: expr,
+ body
+ });
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+}
+/**
+ * Parses do while statement
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDoWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const body = parseIterationStatement(parser, context);
+ expect(parser, context, 12386 /* WhileKeyword */);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ consume(parser, context, 17825809 /* Semicolon */);
+ return finishNode(context, parser, pos, {
+ type: 'DoWhileStatement',
+ body,
+ test
+ });
+}
+/**
+ * Parses while statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-WhileStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'WhileStatement',
+ test,
+ body
+ });
+}
+/**
+ * Parses block statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BlockStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Block)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBlockStatement(parser, context) {
+ const pos = getLocation(parser);
+ const body = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body
+ });
+}
+/**
+ * Parses return statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ReturnStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseReturnStatement(parser, context) {
+ const pos = getLocation(parser);
+ if (!(context & (exports.Context.OptionsGlobalReturn | exports.Context.InFunctionBody))) {
+ tolerant(parser, context, 18 /* IllegalReturn */);
+ }
+ if (parser.flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const argument = !(parser.token & 1048576 /* ASI */) && !(parser.flags & exports.Flags.NewLine)
+ ? parseExpression(parser, (context & ~(exports.Context.InFunctionBody | exports.Context.AllowDecorator)) | exports.Context.AllowIn)
+ : null;
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ReturnStatement',
+ argument
+ });
+}
+/**
+ * Sets the necessary mutable parser flags. The parser flags will
+ * be unset after done parsing out the statements.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-IterationStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIterationStatement(parser, context) {
+ // Note: We are deviating from the original grammar here beauce the original grammar says that the
+ // 'iterationStatement' should return either'for', 'do' or 'while' statements. We are doing some
+ // bitfiddling before and after to modify the parser state before we let the 'parseStatement'
+ // return the mentioned statements (to match the original grammar).
+ const savedFlags = parser.flags;
+ parser.flags |= exports.Flags.InIterationStatement | exports.Flags.AllowDestructuring;
+ const body = parseStatement(parser, (context & ~exports.Context.AllowSingleStatement) | exports.Context.DisallowEscapedKeyword);
+ parser.flags = savedFlags;
+ return body;
+}
+/**
+ * Parses with statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-WithStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseWithStatement(parser, context) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 37 /* StrictModeWith */);
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const object = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseStatement(parser, context & ~exports.Context.AllowSingleStatement);
+ return finishNode(context, parser, pos, {
+ type: 'WithStatement',
+ object,
+ body
+ });
+}
+/**
+ * Parses switch statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SwitchStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSwitchStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const discriminant = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const cases = [];
+ const savedFlags = parser.flags;
+ parser.flags |= exports.Flags.InSwitchStatement;
+ let seenDefault = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ const clause = parseCaseOrDefaultClauses(parser, context);
+ cases.push(clause);
+ if (clause.test === null) {
+ if (seenDefault)
+ tolerant(parser, context, 33 /* MultipleDefaultsInSwitch */);
+ seenDefault = true;
+ }
+ }
+ parser.flags = savedFlags;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'SwitchStatement',
+ discriminant,
+ cases
+ });
+}
+/**
+ * Parses either default clause or case clauses
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CaseClauses)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DefaultClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCaseOrDefaultClauses(parser, context) {
+ const pos = getLocation(parser);
+ let test = null;
+ if (consume(parser, context, 12363 /* CaseKeyword */)) {
+ test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ }
+ else {
+ expect(parser, context, 12368 /* DefaultKeyword */);
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ const consequent = [];
+ while (!isEndOfCaseOrDefaultClauses(parser)) {
+ consequent.push(parseStatementListItem(parser, context | exports.Context.AllowIn));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SwitchCase',
+ test,
+ consequent
+ });
+}
+/**
+ * Parses variable statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableStatement(parser, context, shouldConsume = true) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const isConst = token === 33566793 /* ConstKeyword */;
+ nextToken(parser, context);
+ const declarations = parseVariableDeclarationList(parser, context, isConst);
+ // Only consume semicolons if not inside the 'ForStatement' production
+ if (shouldConsume)
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclaration',
+ kind: tokenDesc(token),
+ declarations
+ });
+}
+/**
+ * Parses either an lexical declaration (let) or an expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-let-and-const-declarations)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseLetOrExpressionStatement(parser, context, shouldConsume = true) {
+ return lookahead(parser, context, isLexical)
+ ? parseVariableStatement(parser, context | exports.Context.BlockScope, shouldConsume)
+ : parseExpressionOrLabelledStatement(parser, context);
+}
+/**
+ * Parses either async function declaration or statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionDeclarationOrStatement(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)
+ ? parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context)
+ : parseStatement(parser, context);
+}
+/**
+ * Parses either For, ForIn or ForOf statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-statement)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseForStatement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 12374 /* ForKeyword */);
+ const awaitToken = !!(context & exports.Context.Async && consume(parser, context, 34017389 /* AwaitKeyword */));
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 50331659 /* LeftParen */);
+ const { token } = parser;
+ let init = null;
+ let sequencePos = null;
+ let variableStatement = null;
+ let type = 'ForStatement';
+ let test = null;
+ let update = null;
+ let right;
+ if (token === 33566793 /* ConstKeyword */ || (token === 33574984 /* LetKeyword */ && lookahead(parser, context, isLexical))) {
+ variableStatement = parseVariableStatement(parser, (context & ~exports.Context.AllowIn) | exports.Context.BlockScope, false);
+ }
+ else if (token === 33566791 /* VarKeyword */) {
+ variableStatement = parseVariableStatement(parser, context & ~exports.Context.AllowIn, false);
+ }
+ else if (token !== 17825809 /* Semicolon */) {
+ sequencePos = getLocation(parser);
+ init = restoreExpressionCoverGrammar(parser, (context & ~exports.Context.AllowIn) | exports.Context.DisallowEscapedKeyword, parseAssignmentExpression);
+ }
+ if (consume(parser, context, 69746 /* OfKeyword */)) {
+ type = 'ForOfStatement';
+ if (init) {
+ if (!(parser.flags & exports.Flags.AllowDestructuring) || init.type === 'AssignmentExpression') {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ right = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ }
+ else if (consume(parser, context, 167786289 /* InKeyword */)) {
+ if (init) {
+ if (!(parser.flags & exports.Flags.AllowDestructuring))
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ type = 'ForInStatement';
+ right = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ }
+ else {
+ if (parser.token === 16777234 /* Comma */)
+ init = parseSequenceExpression(parser, context, init, sequencePos);
+ if (variableStatement)
+ init = variableStatement;
+ expect(parser, context, 17825809 /* Semicolon */);
+ test = parser.token !== 17825809 /* Semicolon */
+ ? parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn)
+ : null;
+ expect(parser, context, 17825809 /* Semicolon */);
+ update = parser.token !== 16 /* RightParen */
+ ? parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn)
+ : null;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, type === 'ForOfStatement'
+ ? {
+ type,
+ body,
+ left: init,
+ right,
+ await: awaitToken
+ }
+ : right
+ ? {
+ type: type,
+ body,
+ left: init,
+ right
+ }
+ : {
+ type: type,
+ body,
+ init,
+ test,
+ update
+ });
+} + +// 15.2 Modules
+/**
+ * Parse module item list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItemList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleItemList(parser, context) {
+ // Prime the scanner
+ nextToken(parser, context);
+ const statements = [];
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ statements.push(parser.token === 33554435 /* StringLiteral */ ?
+ parseDirective(parser, context) :
+ parseModuleItem(parser, context | exports.Context.AllowIn));
+ }
+ return statements;
+}
+/**
+ * Parse module item
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleItem(parser, context) {
+ switch (parser.token) {
+ // @decorator
+ case 120 /* At */:
+ return parseDecorators(parser, context);
+ // ExportDeclaration
+ case 12371 /* ExportKeyword */:
+ return parseExportDeclaration(parser, context);
+ // ImportDeclaration
+ case 33566810 /* ImportKeyword */:
+ // 'Dynamic Import' or meta property disallowed here
+ if (!(context & exports.Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod))) {
+ return parseImportDeclaration(parser, context);
+ }
+ // falls through
+ default:
+ return parseStatementListItem(parser, context);
+ }
+}
+/**
+ * Parse export declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ const specifiers = [];
+ let source = null;
+ let declaration = null;
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 12371 /* ExportKeyword */);
+ switch (parser.token) {
+ // export * FromClause ;
+ case 167774771 /* Multiply */:
+ return parseExportAllDeclaration(parser, context, pos);
+ case 12368 /* DefaultKeyword */:
+ return parseExportDefault(parser, context, pos);
+ case 41943052 /* LeftBrace */:
+ {
+ // export ExportClause FromClause ;
+ // export ExportClause ;
+ expect(parser, context, 41943052 /* LeftBrace */);
+ let hasReservedWord = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token !== 69743 /* GetKeyword */ && parser.token & 12288 /* Reserved */) {
+ hasReservedWord = true;
+ setPendingError(parser);
+ }
+ specifiers.push(parseNamedExportDeclaration(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 17825807 /* RightBrace */);
+ if (parser.token === 69745 /* FromKeyword */) {
+ source = parseModuleSpecifier(parser, context);
+ // The left hand side can't be a keyword where there is no
+ // 'from' keyword since it references a local binding.
+ }
+ else if (hasReservedWord)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ consumeSemicolon(parser, context);
+ break;
+ }
+ // export ClassDeclaration
+ case 33566797 /* ClassKeyword */:
+ declaration = (parseClassDeclaration(parser, context));
+ break;
+ // export LexicalDeclaration
+ case 33574984 /* LetKeyword */:
+ case 33566793 /* ConstKeyword */:
+ declaration = parseVariableStatement(parser, context | exports.Context.BlockScope);
+ break;
+ // export VariableDeclaration
+ case 33566791 /* VarKeyword */:
+ declaration = parseVariableStatement(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ declaration = parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context);
+ break;
+ }
+ // Falls through
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportNamedDeclaration',
+ source,
+ specifiers,
+ declaration,
+ });
+}
+/**
+ * Parse export all declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExportAllDeclaration(parser, context, pos) {
+ expect(parser, context, 167774771 /* Multiply */);
+ const source = parseModuleSpecifier(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExportAllDeclaration',
+ source,
+ });
+}
+/**
+ * Parse named export declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNamedExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ // ExportSpecifier :
+ // IdentifierName
+ // IdentifierName as IdentifierName
+ const local = parseIdentifierName(parser, context | exports.Context.DisallowEscapedKeyword, parser.token);
+ const exported = consume(parser, context, 167843947 /* AsKeyword */)
+ ? parseIdentifierName(parser, context, parser.token)
+ : local;
+ return finishNode(context, parser, pos, {
+ type: 'ExportSpecifier',
+ local,
+ exported,
+ });
+}
+/**
+ * Parse export default
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+function parseExportDefault(parser, context, pos) {
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 12368 /* DefaultKeyword */);
+ let declaration;
+ switch (parser.token) {
+ // export default HoistableDeclaration[Default]
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context | exports.Context.RequireIdentifier);
+ break;
+ // export default ClassDeclaration[Default]
+ // export default @decl ClassDeclaration[Default]
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ declaration = parseClassDeclaration(parser, context & ~exports.Context.AllowIn | exports.Context.RequireIdentifier);
+ break;
+ // export default HoistableDeclaration[Default]
+ case 594028 /* AsyncKeyword */:
+ declaration = parseAsyncFunctionOrAssignmentExpression(parser, context | exports.Context.RequireIdentifier);
+ break;
+ default:
+ // export default [lookahead ∉ {function, class}] AssignmentExpression[In] ;
+ declaration = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportDefaultDeclaration',
+ declaration,
+ });
+}
+/**
+ * Parse import declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566810 /* ImportKeyword */);
+ let source;
+ let specifiers = [];
+ // 'import' ModuleSpecifier ';'
+ if (parser.token === 33554435 /* StringLiteral */) {
+ source = parseLiteral(parser, context);
+ }
+ else {
+ specifiers = parseImportClause(parser, context | exports.Context.DisallowEscapedKeyword);
+ source = parseModuleSpecifier(parser, context);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ImportDeclaration',
+ specifiers,
+ source,
+ });
+}
+/**
+ * Parse import clause
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportClause(parser, context) {
+ const specifiers = [];
+ switch (parser.token) {
+ // 'import' ModuleSpecifier ';'
+ case 33685505 /* Identifier */:
+ {
+ specifiers.push(parseImportDefaultSpecifier(parser, context));
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ switch (parser.token) {
+ // import a, * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ // import a, {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ default:
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ break;
+ }
+ // import {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ // import * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return specifiers;
+}
+/**
+ * Parse named imports
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NamedImports)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNamedImports(parser, context, specifiers) {
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ specifiers.push(parseImportSpecifier(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+}
+/**
+ * Parse import specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportSpecifier(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const imported = parseIdentifierName(parser, context | exports.Context.DisallowEscapedKeyword, token);
+ let local;
+ if (consume(parser, context, 167843947 /* AsKeyword */)) {
+ local = parseBindingIdentifier(parser, context);
+ }
+ else {
+ // An import name that is a keyword is a syntax error if it is not followed
+ // by the keyword 'as'.
+ if (hasBit(token, 12288 /* Reserved */))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ if (hasBit(token, 4194304 /* IsEvalOrArguments */))
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ local = imported;
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ImportSpecifier',
+ local,
+ imported,
+ });
+}
+/**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NameSpaceImport)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNameSpaceImport(parser, context, specifiers) {
+ // NameSpaceImport:
+ // * as ImportedBinding
+ const pos = getLocation(parser);
+ expect(parser, context, 167774771 /* Multiply */);
+ expect(parser, context, 167843947 /* AsKeyword */, 82 /* AsAfterImportStart */);
+ const local = parseBindingIdentifier(parser, context);
+ specifiers.push(finishNode(context, parser, pos, {
+ type: 'ImportNamespaceSpecifier',
+ local,
+ }));
+}
+/**
+ * Parse module specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleSpecifier(parser, context) {
+ // ModuleSpecifier :
+ // StringLiteral
+ expect(parser, context, 69745 /* FromKeyword */);
+ if (parser.token !== 33554435 /* StringLiteral */)
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseLiteral(parser, context);
+}
+/**
+ * Parse import default specifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportDefaultSpecifier(parser, context) {
+ return finishNode(context, parser, getLocation(parser), {
+ type: 'ImportDefaultSpecifier',
+ local: parseIdentifier(parser, context),
+ });
+}
+/**
+ * Parses either async function or assignment expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAssignmentExpression(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context | exports.Context.RequireIdentifier) :
+ parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+} + +/**
+ * Creates the parser object
+ *
+ * @param source The source coode to parser
+ * @param sourceFile Optional source file info to be attached in every node
+ */
+function createParser(source, sourceFile) {
+ return {
+ // The source code to parse
+ source,
+ // Source length
+ length: source.length,
+ // Current position
+ index: 0,
+ // Current line
+ line: 1,
+ // Current column
+ column: 0,
+ // Start position before current token
+ startIndex: 0,
+ // Start position column before current token
+ startColumn: 0,
+ // Start position line before current token
+ startLine: 1,
+ // End position after parsing after current token
+ lastIndex: 0,
+ // End column position after current token
+ lastColumn: 0,
+ // End line position after current token
+ lastLine: 0,
+ // Pending cover grammar errors
+ pendingExpressionError: undefined,
+ // Mutable parser flags. Allows destructuring by default.
+ flags: exports.Flags.AllowDestructuring,
+ // The tokens
+ token: 1048576 /* EndOfSource */,
+ // Misc
+ tokenRaw: '',
+ lastValue: 0,
+ comments: [],
+ sourceFile,
+ tokenRegExp: undefined,
+ tokenValue: undefined,
+ labelSet: undefined,
+ errorLocation: undefined,
+ errors: [],
+ };
+}
+/**
+ * Creating the parser
+ *
+ * @param source The source coode to parser
+ * @param options The parser options
+ * @param context Context masks
+ */
+function parseSource(source, options, /*@internal*/ context) {
+ let sourceFile = '';
+ if (!!options) {
+ // The flag to enable module syntax support
+ if (options.module)
+ context |= exports.Context.Module;
+ // The flag to enable stage 3 support (ESNext)
+ if (options.next)
+ context |= exports.Context.OptionsNext;
+ // The flag to enable React JSX parsing
+ if (options.jsx)
+ context |= exports.Context.OptionsJSX;
+ // The flag to enable start and end offsets to each node
+ if (options.ranges)
+ context |= exports.Context.OptionsRanges;
+ // The flag to enable line/column location information to each node
+ if (options.loc)
+ context |= exports.Context.OptionsLoc;
+ // The flag to attach raw property to each literal node
+ if (options.raw)
+ context |= exports.Context.OptionsRaw;
+ // Attach raw property to each identifier node
+ if (options.rawIdentifier)
+ context |= exports.Context.OptionsRawidentifiers;
+ // The flag to allow return in the global scope
+ if (options.globalReturn)
+ context |= exports.Context.OptionsGlobalReturn;
+ // The flag to allow to skip shebang - '#'
+ if (options.skipShebang)
+ context |= exports.Context.OptionsShebang;
+ // Enable tolerant mode
+ if (options.tolerant)
+ context |= exports.Context.OptionsTolerant;
+ // Set to true to record the source file in every node's loc object when the loc option is set.
+ if (!!options.source)
+ sourceFile = options.source;
+ // Create a top-level comments array containing all comments
+ if (!!options.comments)
+ context |= exports.Context.OptionsComments;
+ // The flag to enable implied strict mode
+ if (options.impliedStrict)
+ context |= exports.Context.Strict;
+ // The flag to enable experimental features
+ if (options.experimental)
+ context |= exports.Context.OptionsExperimental;
+ // The flag to set to bypass methods in Node
+ if (options.node)
+ context |= exports.Context.OptionsNode;
+ // Accepts a callback function to be invoked for each syntax node (as the node is constructed)
+ }
+ const parser = createParser(source, sourceFile);
+ const body = context & exports.Context.Module ?
+ parseModuleItemList(parser, context) :
+ parseStatementList(parser, context);
+ const node = {
+ type: 'Program',
+ sourceType: context & exports.Context.Module ? 'module' : 'script',
+ body: body,
+ };
+ if (context & exports.Context.LocationTracker) {
+ if (context & exports.Context.OptionsRanges) {
+ node.start = 0;
+ node.end = source.length;
+ }
+ if (context & exports.Context.OptionsLoc) {
+ node.loc = {
+ start: { line: 1, column: 0 },
+ end: { line: parser.line, column: parser.column
+ }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ if (context & exports.Context.OptionsComments)
+ node.comments = parser.comments;
+ if (context & exports.Context.OptionsTolerant)
+ node.errors = parser.errors;
+ return node;
+}
+/**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function parseStatementList(parser, context) {
+ const statements = [];
+ let hasProlog = true; // Parsing directive prologue.
+ // prime the scanner
+ nextToken(parser, context | exports.Context.DisallowEscapedKeyword);
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ if (hasProlog && parser.token !== 33554435 /* StringLiteral */)
+ hasProlog = false;
+ if (hasProlog) {
+ if (!(context & exports.Context.Strict) && parser.tokenRaw.length === 12 && parser.tokenValue === 'use strict') {
+ context |= exports.Context.Strict;
+ }
+ statements.push(parseDirective(parser, context));
+ }
+ else {
+ statements.push(parseStatementListItem(parser, context));
+ }
+ }
+ return statements;
+}
+/**
+ * Parse either script code or module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parse(source, options) {
+ return options && options.module
+ ? parseModule(source, options)
+ : parseScript(source, options);
+}
+/**
+ * Parse script code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parseScript(source, options) {
+ return parseSource(source, options, exports.Context.Empty);
+}
+/**
+ * Parse module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parseModule(source, options) {
+ return parseSource(source, options, exports.Context.Strict | exports.Context.Module);
+} + + + +var estree = /*#__PURE__*/Object.freeze({ + +}); + + + +var index = /*#__PURE__*/Object.freeze({ + scanIdentifier: scanIdentifier, + scanMaybeIdentifier: scanMaybeIdentifier, + scanHexIntegerLiteral: scanHexIntegerLiteral, + scanOctalOrBinary: scanOctalOrBinary, + scanImplicitOctalDigits: scanImplicitOctalDigits, + scanSignedInteger: scanSignedInteger, + scanNumericLiteral: scanNumericLiteral, + scanNumericSeparator: scanNumericSeparator, + scanDecimalDigitsOrSeparator: scanDecimalDigitsOrSeparator, + scanDecimalAsSmi: scanDecimalAsSmi, + scanRegularExpression: scanRegularExpression, + scan: scan, + scanEscapeSequence: scanEscapeSequence, + throwStringError: throwStringError, + scanString: scanString, + consumeTemplateBrace: consumeTemplateBrace, + scanTemplate: scanTemplate, + skipSingleHTMLComment: skipSingleHTMLComment, + skipSingleLineComment: skipSingleLineComment, + skipMultiLineComment: skipMultiLineComment, + addComment: addComment, + nextUnicodeChar: nextUnicodeChar, + isIdentifierPart: isIdentifierPart, + escapeInvalidCharacters: escapeInvalidCharacters, + consumeOpt: consumeOpt, + consumeLineFeed: consumeLineFeed, + scanPrivateName: scanPrivateName, + advanceNewline: advanceNewline, + fromCodePoint: fromCodePoint, + readNext: readNext, + toHex: toHex, + advanceOnMaybeAstral: advanceOnMaybeAstral +}); + + + +var parser = /*#__PURE__*/Object.freeze({ + parseClassDeclaration: parseClassDeclaration, + parseFunctionDeclaration: parseFunctionDeclaration, + parseAsyncFunctionOrAsyncGeneratorDeclaration: parseAsyncFunctionOrAsyncGeneratorDeclaration, + parseVariableDeclarationList: parseVariableDeclarationList, + parseExpression: parseExpression, + parseSequenceExpression: parseSequenceExpression, + parseAssignmentExpression: parseAssignmentExpression, + parseRestElement: parseRestElement, + parseLeftHandSideExpression: parseLeftHandSideExpression, + parsePrimaryExpression: parsePrimaryExpression, + parseIdentifier: parseIdentifier, + parseLiteral: parseLiteral, + parseBigIntLiteral: parseBigIntLiteral, + parseIdentifierName: parseIdentifierName, + parseFunctionExpression: parseFunctionExpression, + parseAsyncFunctionOrAsyncGeneratorExpression: parseAsyncFunctionOrAsyncGeneratorExpression, + parsePropertyName: parsePropertyName, + parseObjectLiteral: parseObjectLiteral, + parseFormalListAndBody: parseFormalListAndBody, + parseFunctionBody: parseFunctionBody, + parseFormalParameters: parseFormalParameters, + parseFormalParameterList: parseFormalParameterList, + parseClassBodyAndElementList: parseClassBodyAndElementList, + parseClassElement: parseClassElement, + parseDecorators: parseDecorators, + parseModuleItemList: parseModuleItemList, + parseModuleItem: parseModuleItem, + parseExportDeclaration: parseExportDeclaration, + parseImportDeclaration: parseImportDeclaration, + createParser: createParser, + parseSource: parseSource, + parseStatementList: parseStatementList, + parse: parse, + parseScript: parseScript, + parseModule: parseModule, + parseBindingIdentifierOrPattern: parseBindingIdentifierOrPattern, + parseBindingIdentifier: parseBindingIdentifier, + parseAssignmentRestElement: parseAssignmentRestElement, + parseAssignmentPattern: parseAssignmentPattern, + parseBindingInitializer: parseBindingInitializer, + parseStatementListItem: parseStatementListItem, + parseStatement: parseStatement, + parseEmptyStatement: parseEmptyStatement, + parseContinueStatement: parseContinueStatement, + parseBreakStatement: parseBreakStatement, + parseIfStatement: parseIfStatement, + parseDebuggerStatement: parseDebuggerStatement, + parseTryStatement: parseTryStatement, + parseCatchBlock: parseCatchBlock, + parseThrowStatement: parseThrowStatement, + parseExpressionStatement: parseExpressionStatement, + parseDirective: parseDirective, + parseExpressionOrLabelledStatement: parseExpressionOrLabelledStatement, + parseDoWhileStatement: parseDoWhileStatement, + parseWhileStatement: parseWhileStatement, + parseBlockStatement: parseBlockStatement, + parseReturnStatement: parseReturnStatement, + parseIterationStatement: parseIterationStatement, + parseWithStatement: parseWithStatement, + parseSwitchStatement: parseSwitchStatement, + parseCaseOrDefaultClauses: parseCaseOrDefaultClauses, + parseVariableStatement: parseVariableStatement, + parseJSXRootElement: parseJSXRootElement, + parseJSXOpeningElement: parseJSXOpeningElement, + nextJSXToken: nextJSXToken, + scanJSXToken: scanJSXToken, + parseJSXText: parseJSXText, + parseJSXAttributes: parseJSXAttributes, + parseJSXSpreadAttribute: parseJSXSpreadAttribute, + parseJSXNamespacedName: parseJSXNamespacedName, + parseJSXAttributeName: parseJSXAttributeName, + parseJSXAttribute: parseJSXAttribute, + parseJSXEmptyExpression: parseJSXEmptyExpression, + parseJSXSpreadChild: parseJSXSpreadChild, + parseJSXExpressionContainer: parseJSXExpressionContainer, + parseJSXExpression: parseJSXExpression, + parseJSXClosingFragment: parseJSXClosingFragment, + parseJSXClosingElement: parseJSXClosingElement, + parseJSXIdentifier: parseJSXIdentifier, + parseJSXMemberExpression: parseJSXMemberExpression, + parseJSXElementName: parseJSXElementName, + scanJSXIdentifier: scanJSXIdentifier +}); + +// tslint:disable-next-line:variable-name
+const Parser = parser; + +const version = '1.6.9'; + +exports.version = version; +exports.ESTree = estree; +exports.Scanner = index; +exports.parse = parse; +exports.parseSource = parseSource; +exports.parseModule = parseModule; +exports.parseScript = parseScript; +exports.characterType = characterType; +exports.errorMessages = errorMessages; +exports.constructError = constructError; +exports.report = report; +exports.tolerant = tolerant; +exports.tokenDesc = tokenDesc; +exports.descKeyword = descKeyword; +exports.Parser = Parser; +exports.isValidIdentifierPart = isValidIdentifierPart; +exports.isValidIdentifierStart = isValidIdentifierStart; +exports.mustEscape = mustEscape; +exports.validateBreakOrContinueLabel = validateBreakOrContinueLabel; +exports.addLabel = addLabel; +exports.popLabel = popLabel; +exports.hasLabel = hasLabel; +exports.finishNode = finishNode; +exports.expect = expect; +exports.consume = consume; +exports.nextToken = nextToken; +exports.hasBit = hasBit; +exports.consumeSemicolon = consumeSemicolon; +exports.parseExpressionCoverGrammar = parseExpressionCoverGrammar; +exports.restoreExpressionCoverGrammar = restoreExpressionCoverGrammar; +exports.swapContext = swapContext; +exports.validateParams = validateParams; +exports.reinterpret = reinterpret; +exports.lookahead = lookahead; +exports.isValidSimpleAssignmentTarget = isValidSimpleAssignmentTarget; +exports.getLocation = getLocation; +exports.isValidIdentifier = isValidIdentifier; +exports.isLexical = isLexical; +exports.isEndOfCaseOrDefaultClauses = isEndOfCaseOrDefaultClauses; +exports.nextTokenIsLeftParenOrPeriod = nextTokenIsLeftParenOrPeriod; +exports.nextTokenisIdentifierOrParen = nextTokenisIdentifierOrParen; +exports.nextTokenIsLeftParen = nextTokenIsLeftParen; +exports.nextTokenIsFuncKeywordOnSameLine = nextTokenIsFuncKeywordOnSameLine; +exports.isPropertyWithPrivateFieldKey = isPropertyWithPrivateFieldKey; +exports.parseAndClassifyIdentifier = parseAndClassifyIdentifier; +exports.nameIsArgumentsOrEval = nameIsArgumentsOrEval; +exports.setPendingError = setPendingError; +exports.isEqualTagNames = isEqualTagNames; +exports.isInstanceField = isInstanceField; +exports.validateUpdateExpression = validateUpdateExpression; +exports.setPendingExpressionError = setPendingExpressionError; +exports.validateCoverParenthesizedExpression = validateCoverParenthesizedExpression; +exports.validateAsyncArgumentList = validateAsyncArgumentList; +exports.isInOrOf = isInOrOf; diff --git a/node_modules/cherow/dist/commonjs/cherow.min.js b/node_modules/cherow/dist/commonjs/cherow.min.js new file mode 100644 index 0000000..1fb02f4 --- /dev/null +++ b/node_modules/cherow/dist/commonjs/cherow.min.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const keywordDescTable=["end of source","identifier","number","string","regular expression","false","true","null","template continuation","template end","=>","(","{",".","...","}",")",";",",","[","]",":","?","'",'"',"</","/>","++","--","=","<<=",">>=",">>>=","**=","+=","-=","*=","/=","%=","^=","|=","&=","typeof","delete","void","!","~","+","-","in","instanceof","*","%","/","**","&&","||","===","!==","==","!=","<=",">=","<",">","<<",">>",">>>","&","|","^","var","let","const","break","case","catch","class","continue","debugger","default","do","else","export","extends","finally","for","function","if","import","new","return","super","switch","this","throw","try","while","with","implements","interface","package","private","protected","public","static","yield","as","async","await","constructor","get","set","from","of","#","eval","arguments","enum","BigInt","@","JSXText","KeyOf","ReadOnly","is","unique","declare","type","namespace","abstract","module","global","require","target"];function tokenDesc(e){return keywordDescTable[255&e]}const descKeywordTable=Object.create(null,{this:{value:33566815},function:{value:33566808},if:{value:12377},return:{value:12380},var:{value:33566791},else:{value:12370},for:{value:12374},new:{value:33566811},in:{value:167786289},typeof:{value:302002218},while:{value:12386},case:{value:12363},break:{value:12362},try:{value:12385},catch:{value:12364},delete:{value:302002219},throw:{value:302002272},switch:{value:33566814},continue:{value:12366},default:{value:12368},instanceof:{value:167786290},do:{value:12369},void:{value:302002220},finally:{value:12373},arguments:{value:37879925},keyof:{value:131194},readonly:{value:131195},unique:{value:131197},declare:{value:131198},async:{value:594028},await:{value:34017389},class:{value:33566797},const:{value:33566793},constructor:{value:69742},debugger:{value:12367},enum:{value:12406},eval:{value:37879924},export:{value:12371},extends:{value:12372},false:{value:33566725},from:{value:69745},get:{value:69743},implements:{value:20579},import:{value:33566810},interface:{value:20580},let:{value:33574984},null:{value:33566727},of:{value:69746},package:{value:20581},private:{value:20582},protected:{value:20583},public:{value:20584},set:{value:69744},static:{value:20585},super:{value:33566813},true:{value:33566726},with:{value:12387},yield:{value:1107316842},is:{value:131196},type:{value:131199},namespace:{value:131200},abstract:{value:131201},as:{value:167843947},module:{value:131202},global:{value:131203},require:{value:131204},target:{value:131205}});function descKeyword(e){return 0|descKeywordTable[e]}const characterType=[0,0,0,0,0,0,0,0,0,16,48,16,16,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0];function isValidIdentifierPart(e){return 0!=(1&convert[0+(e>>>5)]>>>e)}function isValidIdentifierStart(e){return 0!=(1&convert[34816+(e>>>5)]>>>e)}function mustEscape(e){return 0!=(1&convert[69632+(e>>>5)]>>>e)}const convert=((e,t)=>{const n=new Uint32Array(104448);let r=0,o=0;for(;r<3392;){const s=e[r++];if(s<0)o-=s;else{let a=e[r++];2&s&&(a=t[a]),1&s?n.fill(a,o,o+=e[r++]):n[o++]=a}}return n})([-1,2,28,2,29,2,5,-1,0,77595648,3,46,2,3,0,14,2,57,2,58,3,0,3,0,3168796671,0,4294956992,2,1,2,0,2,59,3,0,4,0,4294966523,3,0,4,2,15,2,60,2,0,0,4294836735,0,3221225471,0,4294901942,2,61,0,134152192,3,0,2,0,4294951935,3,0,2,0,2683305983,0,2684354047,2,17,2,0,0,4294961151,3,0,2,2,20,2,0,0,608174079,2,0,2,127,2,6,2,62,-1,2,64,2,26,2,1,3,0,3,0,4294901711,2,40,0,4089839103,0,2961209759,0,1342439375,0,4294543342,0,3547201023,0,1577204103,0,4194240,0,4294688750,2,2,0,80831,0,4261478351,0,4294549486,2,2,0,2965387679,0,196559,0,3594373100,0,3288319768,0,8469959,2,171,0,4294828031,0,3825204735,0,123747807,0,65487,2,3,0,4092591615,0,1080049119,0,458703,2,3,2,0,0,2163244511,0,4227923919,0,4236247020,2,68,0,4284449919,0,851904,2,4,2,16,0,67076095,-1,2,69,0,1006628014,0,4093591391,-1,0,50331649,0,3265266687,2,34,0,4294844415,0,4278190047,2,23,2,125,-1,3,0,2,2,33,2,0,2,9,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,10,0,261632,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,2088959,2,31,2,8,0,909311,3,0,2,0,814743551,2,42,0,67057664,3,0,2,2,45,2,0,2,32,2,0,2,18,2,7,0,268374015,2,30,2,51,2,0,2,78,0,134153215,-1,2,6,2,0,2,7,0,2684354559,0,67044351,0,1073676416,-2,3,0,2,2,43,0,1046528,3,0,3,2,8,2,0,2,41,0,4294960127,2,9,2,39,2,10,0,4294377472,2,21,3,0,7,0,4227858431,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-1,2,122,0,1048577,2,84,2,12,-1,2,12,0,131042,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,1046559,2,0,2,13,2,0,0,2147516671,2,24,3,88,2,2,0,-16,2,89,0,524222462,2,4,2,0,0,4269801471,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,2,119,2,0,0,3220242431,3,0,3,2,20,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,2,0,2,27,2,0,2,8,3,0,2,0,67043391,0,3909091327,2,0,2,25,2,8,2,23,3,0,2,0,67076097,2,7,2,0,2,24,0,67059711,0,4236247039,3,0,2,0,939524103,0,8191999,2,97,2,98,2,14,2,95,3,0,3,0,67057663,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,3774349439,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,2,19,0,1638399,2,169,2,104,3,0,3,2,23,2,28,2,29,2,5,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-3,2,146,-4,2,23,2,0,2,37,0,1,2,0,2,63,2,32,2,16,2,9,2,0,2,109,-1,3,0,4,2,9,2,33,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277137519,0,2269118463,-1,3,23,2,-1,2,34,2,38,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,48,-14,2,23,2,44,2,37,-5,3,0,2,2,38,0,2147549120,2,0,2,16,2,17,2,130,2,0,2,52,0,4294901872,0,5242879,3,0,2,0,402595359,-1,2,118,0,1090519039,-2,2,120,2,39,2,0,2,55,2,40,0,4226678271,0,3766565279,0,2039759,-4,3,0,2,0,1140787199,-1,3,0,2,0,67043519,-5,2,0,0,4282384383,0,1056964609,-1,3,0,2,0,67043345,-1,2,0,2,41,2,42,-1,2,10,2,43,-6,2,0,2,16,-3,3,0,2,0,2147484671,-8,2,0,2,7,2,44,2,0,0,603979727,-1,2,0,2,45,-8,2,54,2,46,0,67043329,2,123,2,47,0,8388351,-2,2,124,0,3028287487,2,48,2,126,0,33259519,2,42,-9,2,24,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,2,42,-2,2,17,2,51,2,0,2,24,0,67043343,2,128,2,19,-21,3,0,2,-4,3,0,2,0,4294901791,2,7,2,164,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,0,1677656575,-166,0,4161266656,0,4071,0,15360,-4,0,28,-13,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,0,4294954999,2,0,-16,2,0,2,90,2,0,0,2105343,0,4160749584,0,65534,-42,0,4194303871,0,2011,-62,3,0,6,0,8323103,-1,3,0,2,2,55,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-22583,3,0,7,2,19,-6130,3,5,2,-1,0,69207040,3,46,2,3,0,14,2,57,2,58,-3,0,3168731136,0,4294956864,2,1,2,0,2,59,3,0,4,0,4294966275,3,0,4,2,15,2,60,2,0,2,35,-1,2,17,2,61,-1,2,0,2,62,0,4294885376,3,0,2,0,3145727,0,2617294944,0,4294770688,2,19,2,63,3,0,2,0,131135,2,94,0,70256639,0,71303167,0,272,2,45,2,62,-1,2,64,-2,2,96,0,603979775,0,4278255616,0,4294836227,0,4294549473,0,600178175,0,2952806400,0,268632067,0,4294543328,0,57540095,0,1577058304,0,1835008,0,4294688736,2,65,2,66,0,33554435,2,121,2,65,2,147,0,131075,0,3594373096,0,67094296,2,66,-1,2,67,0,603979263,2,156,0,3,0,4294828001,0,602930687,2,180,0,393219,2,67,0,671088639,0,2154840064,0,4227858435,0,4236247008,2,68,2,38,-1,2,4,0,917503,2,38,-1,2,69,0,537783470,0,4026531935,-1,0,1,-1,2,34,2,70,0,7936,-3,2,0,0,2147485695,0,1010761728,0,4292984930,0,16387,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,16,-1,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,253951,3,20,2,0,122879,2,0,2,8,0,276824064,-2,3,0,2,2,45,2,0,0,4294903295,2,0,2,18,2,7,-1,2,17,2,51,2,0,2,78,2,42,-1,2,24,2,0,2,31,-2,0,128,-2,2,79,2,8,0,4064,-1,2,117,0,4227907585,2,0,2,116,2,0,2,50,2,196,2,9,2,39,2,10,-1,0,6544896,3,0,6,-2,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-3,2,84,2,12,-3,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,817183,2,0,2,13,2,0,0,33023,2,24,3,88,2,-17,2,89,0,524157950,2,4,2,0,2,90,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,0,3072,2,0,0,2147516415,2,9,3,0,2,2,19,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,0,4294965179,0,7,2,0,2,8,2,92,2,8,-1,0,1761345536,2,94,2,95,2,38,2,23,2,96,2,36,2,162,0,2080440287,2,0,2,35,2,138,0,3296722943,2,0,0,1046675455,0,939524101,0,1837055,2,97,2,98,2,14,2,95,3,0,3,0,7,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,2700607615,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,-3,2,104,3,0,3,2,23,-1,3,5,2,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-8,2,23,2,0,2,37,-1,2,0,2,63,2,32,2,18,2,9,2,0,2,109,-1,3,0,4,2,9,2,17,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277075969,2,18,-1,3,23,2,-1,2,34,2,139,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,50,-14,2,23,2,44,2,116,-5,2,117,2,41,-2,2,117,2,19,2,17,2,35,2,117,2,38,0,4294901776,0,4718591,2,117,2,36,0,335544350,-1,2,118,2,119,-2,2,120,2,39,2,7,-1,2,121,2,65,0,3758161920,0,3,-4,2,0,2,31,2,174,-1,2,0,2,19,0,176,-5,2,0,2,49,2,182,-1,2,0,2,19,2,194,-1,2,0,2,62,-2,2,16,-7,2,0,2,119,-3,3,0,2,2,122,-8,0,4294965249,0,67633151,0,4026597376,2,0,0,536871887,-1,2,0,2,45,-8,2,54,2,49,0,1,2,123,2,19,-3,2,124,2,37,2,125,2,126,0,16778239,-10,2,36,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,-3,2,17,2,127,2,0,2,19,2,50,2,128,2,19,-21,3,0,2,-4,3,0,2,0,65567,-1,2,26,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,2,130,-187,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,2,138,-129,3,0,6,2,139,-1,3,0,2,2,50,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-28719,2,0,0,1,-1,2,122,2,0,0,8193,-21,0,50331648,0,10255,0,4,-11,2,66,2,168,-1,0,71680,-1,2,157,0,4292900864,0,805306431,-5,2,146,-1,2,176,-1,0,6144,-2,2,123,-1,2,150,-1,2,153,2,147,2,161,2,0,0,3223322624,2,36,0,4,-4,2,188,0,205128192,0,1333757536,0,2147483696,0,423953,0,747766272,0,2717763192,0,4286578751,0,278545,2,148,0,4294886464,0,33292336,0,417809,2,148,0,1329579616,0,4278190128,0,700594195,0,1006647527,0,4286497336,0,4160749631,2,149,0,469762560,0,4171219488,0,16711728,2,149,0,202375680,0,3214918176,0,4294508592,0,139280,-1,0,983584,2,190,0,58720275,0,3489923072,0,10517376,0,4293066815,0,1,0,2013265920,2,175,2,0,0,17816169,0,3288339281,0,201375904,2,0,-2,0,256,0,122880,0,16777216,2,146,0,4160757760,2,0,-6,2,163,-11,0,3263218176,-1,0,49664,0,2160197632,0,8388802,-1,0,12713984,-1,2,150,2,155,2,158,-2,2,159,-20,0,3758096385,-2,2,151,0,4292878336,2,22,2,166,0,4294057984,-2,2,160,2,152,2,172,-2,2,151,-1,2,179,-1,2,167,2,122,0,4026593280,0,14,0,4292919296,-1,2,154,0,939588608,-1,0,805306368,-1,2,122,0,1610612736,2,152,2,153,3,0,2,-2,2,154,2,155,-3,0,267386880,-1,2,156,0,7168,-1,0,65024,2,150,2,157,2,158,-7,2,165,-8,2,159,-1,0,1426112704,2,160,-1,2,185,0,271581216,0,2149777408,2,19,2,157,2,122,0,851967,0,3758129152,-1,2,19,2,178,-4,2,154,-20,2,192,2,161,-56,0,3145728,2,184,-1,2,191,2,122,-1,2,162,2,122,-4,0,32505856,-1,2,163,-1,0,2147385088,2,22,1,2155905152,2,-3,2,164,2,0,2,165,-2,2,166,-6,2,167,0,4026597375,0,1,-1,0,1,-1,2,168,-3,2,139,2,66,-2,2,162,2,177,-1,2,173,2,122,-6,2,122,-213,2,167,-657,2,17,-36,2,169,-1,2,186,-10,0,4294963200,-5,2,170,-5,2,158,2,0,2,24,-1,0,4227919872,-1,2,170,-2,0,4227874752,-3,0,2146435072,2,155,-2,0,1006649344,2,122,-1,2,22,0,201375744,-3,0,134217720,2,22,0,4286677377,0,32896,-1,2,171,-3,2,172,-349,2,173,2,174,2,175,3,0,264,-11,2,176,-2,2,158,2,0,0,520617856,0,2692743168,0,36,-3,0,524284,-11,2,19,-1,2,183,-1,2,181,0,3221291007,2,158,-1,0,524288,0,2158720,-3,2,155,0,1,-4,2,122,0,3808625411,0,3489628288,0,4096,0,1207959680,0,3221274624,2,0,-3,2,177,0,120,0,7340032,-2,0,4026564608,2,4,2,19,2,160,3,0,4,2,155,-1,2,178,2,175,-1,0,8176,2,179,2,177,2,180,-1,0,4290773232,2,0,-4,2,160,2,187,0,15728640,2,175,-1,2,157,-1,0,4294934512,3,0,4,-9,2,22,2,167,2,181,3,0,4,0,704,0,1849688064,0,4194304,-1,2,122,0,4294901887,2,0,0,130547712,0,1879048192,0,2080374784,3,0,2,-1,2,182,2,183,-1,0,17829776,0,2025848832,0,4261477888,-2,2,0,-1,0,4286580608,-1,0,29360128,2,184,0,16252928,0,3791388672,2,39,3,0,2,-2,2,193,2,0,-1,2,26,-1,0,66584576,-1,2,189,3,0,9,2,122,3,0,4,-1,2,157,2,158,3,0,5,-2,0,245760,0,2147418112,-1,2,146,2,199,0,4227923456,-1,2,185,2,186,2,22,-2,2,176,0,4292870145,0,262144,2,122,3,0,2,0,1073758848,2,187,-1,0,4227921920,2,188,0,68289024,0,528402016,0,4292927536,3,0,4,-2,0,2483027968,2,0,-2,2,189,3,0,5,-1,2,184,2,160,2,0,-2,0,4227923936,2,63,-1,2,170,2,94,2,0,2,150,2,154,3,0,6,-1,2,175,3,0,3,-2,0,2146959360,3,0,8,-2,2,157,-1,2,190,2,117,-1,2,151,3,0,8,2,191,0,8388608,2,171,2,169,2,183,0,4286578944,3,0,2,0,1152,0,1266679808,2,189,0,576,0,4261707776,2,94,3,0,9,2,151,3,0,8,-28,2,158,3,0,3,-3,0,4292902912,-6,2,96,3,0,85,-33,2,164,3,0,126,-18,2,192,3,0,269,-17,2,151,2,122,0,4294917120,3,0,2,2,19,0,4290822144,-2,0,67174336,0,520093700,2,17,3,0,21,-2,2,177,3,0,3,-2,0,65504,2,122,2,49,3,0,2,2,92,-191,2,123,-23,2,26,3,0,296,-8,2,122,3,0,2,2,19,-11,2,175,3,0,72,-3,0,3758159872,0,201391616,3,0,155,-7,2,167,-1,0,384,-1,0,133693440,-3,2,193,-2,2,30,3,0,4,2,166,-2,2,22,2,151,3,0,4,-2,2,185,-1,2,146,0,335552923,2,194,-1,0,538974272,0,2214592512,0,132e3,-10,0,192,-8,0,12288,-21,0,134213632,0,4294901761,3,0,42,0,100663424,0,4294965284,3,0,62,-6,0,4286578784,2,0,-2,0,1006696448,3,0,24,2,37,-1,2,195,3,0,10,2,194,0,4110942569,0,1432950139,0,2701658217,0,4026532864,0,4026532881,2,0,2,47,3,0,8,-1,2,154,-2,2,166,0,98304,0,65537,2,167,2,169,-2,2,154,-1,2,63,2,0,2,116,2,197,2,175,0,4294770176,2,30,3,0,4,-30,2,195,2,196,-3,2,166,-2,2,151,2,0,2,154,-1,2,189,-1,2,157,2,198,3,0,2,2,154,2,122,-1,0,193331200,-1,0,4227923960,2,197,-1,3,0,3,2,198,3,0,44,-1334,2,22,2,0,-129,2,195,-6,2,160,-180,2,199,-233,2,4,3,0,96,-16,2,160,3,0,22583,-7,2,17,3,0,6128],[4294967295,4294967291,4092460543,4294828015,4294967294,134217726,268435455,2147483647,1048575,1073741823,3892314111,1061158911,536805376,4294910143,4160749567,4294901759,134217727,4294901760,4194303,65535,262143,67108863,4286578688,536870911,8388607,4294918143,4294443008,255,67043328,2281701374,4294967232,2097151,4294903807,4294902783,4294967039,511,524287,131071,127,4294902271,4294549487,16777215,1023,67047423,4294901888,33554431,4286578687,4294770687,67043583,32767,15,2047999,4292870143,4294934527,4294966783,67045375,4294967279,262083,20511,4290772991,41943039,493567,2047,4294959104,1071644671,602799615,65536,4294828e3,805044223,4277151126,8191,1031749119,4294917631,2134769663,4286578493,4282253311,4294942719,33540095,4294905855,4294967264,2868854591,1608515583,265232348,534519807,2147614720,1060109444,4093640016,17376,2139062143,224,4169138175,4294909951,4294967292,4294965759,4294966272,4294901823,4294967280,8289918,4294934399,4294901775,4294965375,1602223615,4294967259,268369920,4292804608,486341884,4294963199,3087007615,1073692671,4128527,4279238655,4294902015,4294966591,2445279231,3670015,3238002687,63,4294967288,4294705151,4095,3221208447,4294549472,2147483648,4294705152,4294966143,64,4294966719,16383,3774873592,536807423,67043839,3758096383,3959414372,3755993023,2080374783,4294835295,4294967103,4160749565,4087,31,184024726,2862017156,1593309078,268434431,268434414,4294901763,536870912,2952790016,202506752,139264,402653184,4261412864,4227922944,2147532800,61440,3758096384,117440512,65280,4227858432,3233808384,3221225472,4294965248,32768,57152,4294934528,67108864,4293918720,4290772992,25165824,57344,4278190080,65472,4227907584,65520,1920,4026531840,49152,4160749568,4294836224,63488,1073741824,4294967040,251658240,196608,12582912,2097152,65408,64512,417808,4227923712,48,512,4294967168,4294966784,16,4292870144,4227915776,65528,4294950912,65532]);function nextUnicodeChar(e){const{index:t}=e,n=e.source.charCodeAt(t);if(n<55296||n>56319)return n;const r=e.source.charCodeAt(t+1);return r<56320||r>57343?n:65536+((1023&n)<<10)|1023&r}const isIdentifierPart=e=>0!=(1&characterType[e])||isValidIdentifierPart(e);function escapeInvalidCharacters(e){switch(e){case 0:return"\\0";case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:return mustEscape(e)?e<16?`\\x0${e.toString(16)}`:e<256?`\\x${e.toString(16)}`:e<4096?`\\u0${e.toString(16)}`:e<65536?`\\u${e.toString(16)}`:`\\u{${e.toString(16)}}`:fromCodePoint(e)}}function consumeOpt(e,t){return e.source.charCodeAt(e.index)===t&&(e.index++,e.column++,!0)}function consumeLineFeed(e,t){e.flags|=exports.Flags.NewLine,e.index++,0==(t&exports.ScannerState.LastIsCR)&&(e.column=0,e.line++)}function scanPrivateName(e,t){return t&exports.Context.InClass&&isValidIdentifierStart(e.source.charCodeAt(e.index))||report(e,1,tokenDesc(e.token)),115}function advanceNewline(e){e.flags|=exports.Flags.NewLine,e.index++,e.column=0,e.line++}const fromCodePoint=e=>e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023));function readNext(e){return e.index++,e.column++,e.index>=e.source.length&&report(e,14),nextUnicodeChar(e)}function toHex(e){return e<48?-1:e<=57?e-48:e<65?-1:e<=70?e-65+10:e<97?-1:e<=102?e-97+10:-1}function advanceOnMaybeAstral(e,t){e.index++,e.column++,t>65535&&e.index++}function scanEscapeSequence(e,t,n){switch(n){case 98:return 8;case 102:return 12;case 114:return 13;case 110:return 10;case 116:return 9;case 118:return 11;case 13:case 10:case 8232:case 8233:return e.column=-1,e.line++,exports.Escape.Empty;case 48:case 49:case 50:case 51:{let r=n-48,o=e.index+1,s=e.column+1,a=e.source.charCodeAt(o);if(a<48||a>55){if(0!==r||56===a||57===a){if(t&exports.Context.Strict)return exports.Escape.StrictOctal;e.flags|=exports.Flags.HasOctal}}else{if(t&exports.Context.Strict)return exports.Escape.StrictOctal;e.flags|=exports.Flags.HasOctal,e.lastValue=a,r=8*r+(a-48),o++,s++,(a=e.source.charCodeAt(o))>=48&&a<=55&&(e.lastValue=a,r=8*r+(a-48),o++,s++),e.index=o-1,e.column=s-1}return r}case 52:case 53:case 54:case 55:{if(t&exports.Context.Strict)return exports.Escape.StrictOctal;let r=n-48;const o=e.index+1,s=e.column+1,a=e.source.charCodeAt(o);return a>=48&&a<=55&&(r=8*r+(a-48),e.lastValue=a,e.index=o,e.column=s),r}case 56:case 57:return exports.Escape.EightOrNine;case 120:{const t=toHex(e.lastValue=readNext(e));if(t<0)return exports.Escape.InvalidHex;const n=toHex(e.lastValue=readNext(e));return n<0?exports.Escape.InvalidHex:t<<4|n}case 117:{let t=e.lastValue=readNext(e);if(123===t){let n=toHex(t=e.lastValue=readNext(e));if(n<0)return exports.Escape.InvalidHex;for(t=e.lastValue=readNext(e);125!==t;){const r=toHex(t);if(r<0)return exports.Escape.InvalidHex;if((n=16*n+r)>1114111)return exports.Escape.OutOfRange;t=e.lastValue=readNext(e)}return n}{let n=toHex(t);if(n<0)return exports.Escape.InvalidHex;for(let r=0;r<3;r++){const r=toHex(t=e.lastValue=readNext(e));if(r<0)return exports.Escape.InvalidHex;n=16*n+r}return n}}default:return e.source.charCodeAt(e.index)}}function throwStringError(e,t,n){switch(n){case exports.Escape.Empty:return;case exports.Escape.StrictOctal:report(e,t&exports.Context.TaggedTemplate?76:11);case exports.Escape.EightOrNine:report(e,13);case exports.Escape.InvalidHex:report(e,75,"hexadecimal");case exports.Escape.OutOfRange:report(e,14)}}function scanString(e,t,n){const{index:r,lastValue:o}=e;let s="";e.index++,e.column++;let a=e.source.charCodeAt(e.index);for(;a!==n;){switch(a){case 13:case 10:report(e,6);case 92:if((a=readNext(e))>128)s+=fromCodePoint(a);else{e.lastValue=a;const n=scanEscapeSequence(e,t,a);n>=0?s+=fromCodePoint(n):throwStringError(e,t,n),a=e.lastValue}break;default:s+=fromCodePoint(a)}a=readNext(e)}return e.index++,e.column++,e.tokenRaw=e.source.slice(r,e.index),e.tokenValue=s,e.lastValue=o,33554435}function consumeTemplateBrace(e,t){return e.index>=e.length&&report(e,9),e.index--,e.column--,scanTemplate(e,t)}function scanTemplate(e,t){const{index:n,lastValue:r}=e;let o=!0,s="",a=readNext(e);e:for(;96!==a;){switch(a){case 36:{const t=e.index+1;if(t<e.length&&123===e.source.charCodeAt(t)){e.index=t,e.column++,o=!1;break e}s+="$";break}case 92:if((a=readNext(e))>=128)s+=fromCodePoint(a);else{e.lastValue=a;const n=scanEscapeSequence(e,t|exports.Context.Strict,a);if(n>=0)s+=fromCodePoint(n);else{if(n!==exports.Escape.Empty&&t&exports.Context.TaggedTemplate){s=void 0,(a=scanLooserTemplateSegment(e,e.lastValue))<0&&(o=!1);break e}throwStringError(e,t|exports.Context.TaggedTemplate,n)}a=e.lastValue}break;case 13:case 10:case 8232:case 8233:e.column=-1,e.line++;default:null!=s&&(s+=fromCodePoint(a))}a=readNext(e)}return e.index++,e.column++,e.tokenValue=s,e.lastValue=r,o?(e.tokenRaw=e.source.slice(n+1,e.index-1),33554441):(e.tokenRaw=e.source.slice(n+1,e.index-2),33554440)}function scanLooserTemplateSegment(e,t){for(;96!==t;){if(36===t&&123===e.source.charCodeAt(e.index+1))return e.index++,e.column++,-t;t=readNext(e)}return t}function scanHexIntegerLiteral(e,t){e.index++,e.column++;let n=exports.NumericState.None,r=toHex(e.source.charCodeAt(e.index));for(r<0&&report(e,0),e.index++,e.column++;e.index<e.length;){const o=e.source.charCodeAt(e.index);if(t&exports.Context.OptionsNext&&95===o){n=scanNumericSeparator(e,n);continue}n&=~exports.NumericState.SeenSeparator;const s=toHex(o);if(s<0)break;r=16*r+s,e.index++,e.column++}return n&exports.NumericState.SeenSeparator&&report(e,59),assembleNumericLiteral(e,t,r,consumeOpt(e,110))}function scanOctalOrBinary(e,t,n){e.index++,e.column++;let r,o=0,s=0,a=exports.NumericState.None;for(;e.index<e.length;){if(r=e.source.charCodeAt(e.index),t&exports.Context.OptionsNext&&95===r){a=scanNumericSeparator(e,a);continue}a&=~exports.NumericState.SeenSeparator;const i=r-48;if(!(r>=48&&r<=57)||i>=n)break;s=s*n+i,e.index++,e.column++,o++}return 0===o&&report(e,0),a&exports.NumericState.SeenSeparator&&report(e,59),assembleNumericLiteral(e,t,s,consumeOpt(e,110))}function scanImplicitOctalDigits(e,t){switch(e.source.charCodeAt(e.index)){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:{t&exports.Context.Strict&&report(e,0);let n=e.index,r=e.column,o=0;for(e.flags|=exports.Flags.HasOctal;n<e.length;){const s=e.source.charCodeAt(n);if(95===s)report(e,60);else{if(s<48||s>55)return scanNumericLiteral(e,t);o=8*o+(s-48),n++,r++}}return e.index=n,e.column=r,assembleNumericLiteral(e,t,o,consumeOpt(e,110))}case 56:case 57:e.flags|=exports.Flags.HasOctal;default:return t&exports.Context.OptionsNext&&95===e.source.charCodeAt(e.index)&&report(e,60),scanNumericLiteral(e,t)}}function scanSignedInteger(e,t){let n=e.source.charCodeAt(e.index);43!==n&&45!==n||(e.index++,e.column++,n=e.source.charCodeAt(e.index)),n>=48&&n<=57||report(e,0);const r=e.index,o=scanDecimalDigitsOrSeparator(e);return e.source.substring(t,r)+o}function scanNumericLiteral(e,t,n=exports.NumericState.None){let r=n&exports.NumericState.Float?0:scanDecimalAsSmi(e,t);const o=e.source.charCodeAt(e.index);if(46!==o&&95!==o&&!isValidIdentifierStart(o))return assembleNumericLiteral(e,t,r);consumeOpt(e,46)&&(t&exports.Context.OptionsNext&&95===e.source.charCodeAt(e.index)&&report(e,60),n|=exports.NumericState.Float,r=`${r}.${scanDecimalDigitsOrSeparator(e)}`);const s=e.index;return consumeOpt(e,110)&&(n&exports.NumericState.Float&&report(e,0),n|=exports.NumericState.BigInt),(consumeOpt(e,101)||consumeOpt(e,69))&&(n|=exports.NumericState.Float,r+=scanSignedInteger(e,s)),isValidIdentifierStart(e.source.charCodeAt(e.index))&&report(e,0),assembleNumericLiteral(e,t,n&exports.NumericState.Float?parseFloat(r):parseInt(r,10),!!(n&exports.NumericState.BigInt))}function scanNumericSeparator(e,t){return e.index++,e.column++,t&exports.NumericState.SeenSeparator&&report(e,59),t|=exports.NumericState.SeenSeparator}function scanDecimalDigitsOrSeparator(e){let t=e.index,n=exports.NumericState.None,r="";e:for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 95:const o=e.index;n=scanNumericSeparator(e,n),r+=e.source.substring(t,o),t=e.index;continue;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:n&=~exports.NumericState.SeenSeparator,e.index++,e.column++;break;default:break e}return n&exports.NumericState.SeenSeparator&&report(e,59),r+e.source.substring(t,e.index)}function scanDecimalAsSmi(e,t){let n=exports.NumericState.None,r=0,o=e.source.charCodeAt(e.index);for(;o>=48&&o<=57||95===o;)t&exports.Context.OptionsNext&&95===o?(n=scanNumericSeparator(e,n),o=e.source.charCodeAt(e.index)):(n&=~exports.NumericState.SeenSeparator,r=10*r+(o-48),e.index++,e.column++,o=e.source.charCodeAt(e.index));return n&exports.NumericState.SeenSeparator&&report(e,59),r}function assembleNumericLiteral(e,t,n,r=!1){return e.tokenValue=n,t&exports.Context.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),r?33554551:33554434}function scanIdentifier(e,t,n){let r=e.index,o="",s=!1;n&&advanceOnMaybeAstral(e,n);e:for(;e.index<e.length;){const t=e.index;let n=e.source.charCodeAt(t);switch(n){case 92:o+=e.source.slice(r,t),o+=scanUnicodeCodePointEscape(e),r=e.index,s=!0;break;default:if(n>=55296&&n<=56319){n=(1023&n)<<10|1023&e.source.charCodeAt(t+1)|65536}if(!isIdentifierPart(n))break e;advanceOnMaybeAstral(e,n)}}r<e.index&&(o+=e.source.slice(r,e.index)),e.tokenValue=o;const a=o.length;if(a>=2&&a<=11){const n=descKeyword(o);if(n>0)return s&&(t&exports.Context.DisallowEscapedKeyword&&tolerant(e,t,3),e.flags|=exports.Flags.EscapedKeyword),n}return t&exports.Context.OptionsRawidentifiers&&(e.tokenRaw=e.source.slice(r,e.index)),33685505}function scanMaybeIdentifier(e,t,n){return isValidIdentifierStart(n=nextUnicodeChar(e))||report(e,10,escapeInvalidCharacters(n)),scanIdentifier(e,t,n)}function scanUnicodeCodePointEscape(e){const{index:t}=e;if(t+5<e.length){117!==e.source.charCodeAt(t+1)&&report(e,0),e.index+=2,e.column+=2;const n=scanIdentifierUnicodeEscape(e);return n>=55296&&n<=56319&&report(e,74),isIdentifierPart(n)||report(e,75,"unicode"),fromCodePoint(n)}report(e,0)}function scanIdentifierUnicodeEscape(e){let t=e.source.charCodeAt(e.index),n=0;if(123===t){let r=toHex(t=readNext(e));for(;r>=0;)(n=n<<4|r)>1114111&&report(e,89),e.index++,e.column++,r=toHex(e.source.charCodeAt(e.index));125!==e.source.charCodeAt(e.index)&&report(e,75,"unicode"),consumeOpt(e,125)}else for(let r=0;r<4;r++){const r=toHex(t=e.source.charCodeAt(e.index));r<0&&report(e,75,"unicode"),n=n<<4|r,e.index++,e.column++}return n}function skipSingleHTMLComment(e,t,n,r){return t&exports.Context.Module&&report(e,90),skipSingleLineComment(e,t,n,r)}function skipSingleLineComment(e,t,n,r){const o=e.index,s=!!(t&exports.Context.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 13:return advanceNewline(e),e.index<e.length&&10===e.source.charCodeAt(e.index)&&e.index++,n|exports.ScannerState.NewLine;case 10:case 8232:case 8233:return advanceNewline(e),s&&addComment(e,t,r,o),n|exports.ScannerState.NewLine;default:e.index++,e.column++}return s&&addComment(e,t,r,o),n}function skipMultiLineComment(e,t,n){const r=e.index,o=!!(t&exports.Context.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 42:if(e.index++,e.column++,n&=~exports.ScannerState.LastIsCR,consumeOpt(e,47))return o&&addComment(e,t,"MultiLine",r),n;break;case 13:n|=exports.ScannerState.NewLine|exports.ScannerState.LastIsCR,advanceNewline(e);break;case 10:consumeLineFeed(e,n),n=n&~exports.ScannerState.LastIsCR|exports.ScannerState.NewLine;break;case 8232:case 8233:n=n&~exports.ScannerState.LastIsCR|exports.ScannerState.NewLine,advanceNewline(e);break;default:n&=~exports.ScannerState.LastIsCR,e.index++,e.column++}tolerant(e,t,8)}function addComment(e,t,n,r){const{index:o,startIndex:s,startLine:a,startColumn:i,lastLine:p,lastColumn:c}=e,l={type:n,value:e.source.slice(r,"MultiLine"===n?o-2:o),start:s,end:o};t&exports.Context.OptionsLoc&&(l.loc={start:{line:a,column:i},end:{line:p,column:c}}),e.comments.push(l)}function scan(e,t){e.flags&=~exports.Flags.NewLine|exports.Flags.EscapedKeyword;const n=0===e.index;let r=exports.ScannerState.None;for(;e.index<e.length;){n||(e.startIndex=e.index,e.startColumn=e.column,e.startLine=e.line);const o=e.source.charCodeAt(e.index);if(o>128)switch(o){case 8232:case 8233:r=r&~exports.ScannerState.LastIsCR|exports.ScannerState.NewLine,advanceNewline(e);break;case 65519:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:case 8205:e.index++,e.column++;break;default:return scanMaybeIdentifier(e,t,o)}else switch(o){case 13:r|=exports.ScannerState.NewLine|exports.ScannerState.LastIsCR,advanceNewline(e);break;case 10:consumeLineFeed(e,r),r=r&~exports.ScannerState.LastIsCR|exports.ScannerState.NewLine;break;case 9:case 11:case 12:case 32:e.index++,e.column++;break;case 40:return e.index++,e.column++,50331659;case 41:return e.index++,e.column++,16;case 44:return e.index++,e.column++,16777234;case 58:return e.index++,e.column++,16777237;case 59:return e.index++,e.column++,17825809;case 63:return e.index++,e.column++,22;case 93:return e.index++,e.column++,20;case 123:return e.index++,e.column++,41943052;case 125:return e.index++,e.column++,17825807;case 126:return e.index++,e.column++,301989934;case 91:return e.index++,e.column++,41943059;case 64:return e.index++,e.column++,120;case 47:if(e.index++,e.column++,e.index>=e.length)return 167774773;switch(e.source.charCodeAt(e.index)){case 47:e.index++,e.column++,r=skipSingleLineComment(e,t,r,"SingleLine");continue;case 42:e.index++,e.column++,r=skipMultiLineComment(e,t,r);continue;case 61:return e.index++,e.column++,100663333;default:return 167774773}case 45:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 45:if(e.index++,e.column++,(r&exports.ScannerState.NewLine||n)&&consumeOpt(e,62)){r=skipSingleHTMLComment(e,t,r,"HTMLClose");continue}return 570425372;case 61:return e.index++,e.column++,67108899;default:return 436209968}case 60:if(e.index++,e.column++,consumeOpt(e,33)&&consumeOpt(e,45)&&consumeOpt(e,45)){r=skipSingleHTMLComment(e,t,r,"HTMLOpen");continue}switch(e.source.charCodeAt(e.index)){case 60:return e.index++,e.column++,consumeOpt(e,61)?67108894:167774273;case 61:return e.index++,e.column++,167774013;case 47:{if(!(t&exports.Context.OptionsJSX))break;const n=e.index+1;if(n<e.length){const t=e.source.charCodeAt(n);if(42===t||47===t)break}return e.index++,e.column++,25}default:return 167774015}case 33:return e.index++,e.column++,consumeOpt(e,61)?consumeOpt(e,61)?167773754:167773756:301989933;case 39:case 34:return scanString(e,t,o);case 37:return e.index++,e.column++,consumeOpt(e,61)?67108902:167774772;case 38:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 38===t?(e.index++,e.column++,169869879):61===t?(e.index++,e.column++,67108905):167773508}case 42:{if(e.index++,e.column++,e.index>=e.length)return 167774771;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,67108900):42!==t?167774771:(e.index++,e.column++,consumeOpt(e,61)?67108897:167775030)}case 43:{if(e.index++,e.column++,e.index>=e.length)return 436209967;const t=e.source.charCodeAt(e.index);return 43===t?(e.index++,e.column++,570425371):61===t?(e.index++,e.column++,67108898):436209967}case 92:return scanIdentifier(e,t);case 61:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,consumeOpt(e,61)?167773753:167773755):62===t?(e.index++,e.column++,10):83886109}case 62:{if(e.index++,e.column++,e.index>=e.length)return 167774016;if(t&exports.Context.InJSXChild)return 167774016;let n=e.source.charCodeAt(e.index);return 61===n?(e.index++,e.column++,167774014):62!==n?167774016:(e.index++,e.column++,62===(n=e.source.charCodeAt(e.index))?(e.index++,e.column++,consumeOpt(e,61)?67108896:167774275):61===n?(e.index++,e.column++,67108895):167774274)}case 94:return e.index++,e.column++,consumeOpt(e,61)?67108903:167773254;case 96:return scanTemplate(e,t);case 124:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 124===t?(e.index++,e.column++,169869624):61===t?(e.index++,e.column++,67108904):167772997}case 46:{let n=e.index+1;const r=e.source.charCodeAt(n);return r>=48&&r<=57?(scanNumericLiteral(e,t,exports.NumericState.Float),33554434):46===r&&++n<e.length&&46===e.source.charCodeAt(n)?(e.index=n+1,e.column+=3,14):(e.index++,e.column++,16777229)}case 35:{e.index++,e.column++;const r=e.index,o=e.source.charCodeAt(r);if(t&exports.Context.OptionsShebang&&n&&33===o){e.index=r+1,skipSingleLineComment(e,t,exports.ScannerState.None,"SheBang");continue}return scanPrivateName(e,t)}case 48:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 88:case 120:return scanHexIntegerLiteral(e,t);case 66:case 98:return scanOctalOrBinary(e,t,2);case 79:case 111:return scanOctalOrBinary(e,t,8);default:return scanImplicitOctalDigits(e,t)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return scanNumericLiteral(e,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 36:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:default:return scanIdentifier(e,t,o)}}return 1048576}function scanRegularExpression(e,t){const n=e.index;let r=exports.RegexState.Empty;e:for(;;){const t=e.source.charCodeAt(e.index);if(e.index++,e.column++,r&exports.RegexState.Escape)r&=~exports.RegexState.Escape;else switch(t){case 47:if(r)break;break e;case 92:r|=exports.RegexState.Escape;break;case 91:r|=exports.RegexState.Class;break;case 93:r&=exports.RegexState.Escape;break;case 13:case 10:case 8232:case 8233:report(e,7)}e.index>=e.source.length&&report(e,7)}const o=e.index-1;let s=exports.RegexFlags.Empty;const{index:a}=e;e:for(;e.index<e.source.length;){const n=e.source.charCodeAt(e.index);switch(n){case 103:s&exports.RegexFlags.Global&&tolerant(e,t,15,"g"),s|=exports.RegexFlags.Global;break;case 105:s&exports.RegexFlags.IgnoreCase&&tolerant(e,t,15,"i"),s|=exports.RegexFlags.IgnoreCase;break;case 109:s&exports.RegexFlags.Multiline&&tolerant(e,t,15,"m"),s|=exports.RegexFlags.Multiline;break;case 117:s&exports.RegexFlags.Unicode&&tolerant(e,t,15,"u"),s|=exports.RegexFlags.Unicode;break;case 121:s&exports.RegexFlags.Sticky&&tolerant(e,t,15,"y"),s|=exports.RegexFlags.Sticky;break;case 115:s&exports.RegexFlags.DotAll&&tolerant(e,t,15,"s"),s|=exports.RegexFlags.DotAll;break;default:if(!isIdentifierPart(n))break e;report(e,16,fromCodePoint(n))}e.index++,e.column++}const i=e.source.slice(a,e.index),p=e.source.slice(n,o);return e.tokenRegExp={pattern:p,flags:i},t&exports.Context.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),e.tokenValue=validate(e,t,p,i),33554436}function validate(e,t,n,r){exports.Context.OptionsNode;try{return new RegExp(n,r)}catch(e){return null}}function parseBindingIdentifierOrPattern(e,t,n=[]){const{token:r}=e;return 8388608&r?41943052===r?parserObjectAssignmentPattern(e,t):parseArrayAssignmentPattern(e,t,n):(1074003968&r&&(262144&r&&t&(exports.Context.Async|exports.Context.Module)?tolerant(e,t,48):1073741824&r&&t&(exports.Context.Yield|exports.Context.Strict)&&tolerant(e,t,49)),n.push(e.tokenValue),parseBindingIdentifier(e,t))}function parseBindingIdentifier(e,t){const{token:n}=e;4194304&n?(t&exports.Context.Strict&&tolerant(e,t,17),e.flags|=exports.Flags.StrictEvalArguments):t&exports.Context.BlockScope&&33574984===n?tolerant(e,t,27):hasBit(n,20480)?(t&exports.Context.Strict&&tolerant(e,t,1,tokenDesc(n)),e.flags|=exports.Flags.StrictFunctionName):isValidIdentifier(t,n)||tolerant(e,t,1,tokenDesc(n));const r=getLocation(e),o=e.tokenValue;return nextToken(e,t),finishNode(t,e,r,{type:"Identifier",name:o})}function parseAssignmentRestElement(e,t,n){const r=getLocation(e);expect(e,t,14);const o=parseBindingIdentifierOrPattern(e,t,n);return 16777234===e.token&&tolerant(e,t,88),finishNode(t,e,r,{type:"RestElement",argument:o})}function AssignmentRestProperty(e,t){const n=getLocation(e);expect(e,t,14);const{token:r}=e,o=parseBindingIdentifierOrPattern(e,t);return hasBit(r,8388608)&&tolerant(e,t,94),16777234===e.token&&tolerant(e,t,88),finishNode(t,e,n,{type:"RestElement",argument:o})}function parseArrayAssignmentPattern(e,t,n){const r=getLocation(e);nextToken(e,t);const o=[];for(;20!==e.token;)if(consume(e,t,16777234))o.push(null);else{if(14===e.token){o.push(parseAssignmentRestElement(e,t,n));break}o.push(parseExpressionCoverGrammar(e,t|exports.Context.AllowIn,parseBindingInitializer)),20!==e.token&&expect(e,t,16777234)}return expect(e,t,20),finishNode(t,e,r,{type:"ArrayPattern",elements:o})}function parserObjectAssignmentPattern(e,t){const n=getLocation(e),r=[];for(expect(e,t,41943052);17825807!==e.token;){if(14===e.token){r.push(AssignmentRestProperty(e,t));break}r.push(parseAssignmentProperty(e,t)),17825807!==e.token&&expect(e,t,16777234)}return expect(e,t,17825807),finishNode(t,e,n,{type:"ObjectPattern",properties:r})}function parseAssignmentPattern(e,t,n,r){return finishNode(t,e,r,{type:"AssignmentPattern",left:n,right:parseExpressionCoverGrammar(e,t|exports.Context.AllowIn,parseAssignmentExpression)})}function parseBindingInitializer(e,t){const n=getLocation(e),r=parseBindingIdentifierOrPattern(e,t);return consume(e,t,83886109)?finishNode(t,e,n,{type:"AssignmentPattern",left:r,right:parseAssignmentExpression(e,t|exports.Context.AllowIn)}):r}function parseAssignmentProperty(e,t){const n=getLocation(e),{token:r}=e;let o,s,a=!1,i=!1;if(135168&r)if(o=parseIdentifier(e,t),i=!consume(e,t,16777237)){const a=consume(e,t,83886109);t&exports.Context.Yield&&1073741824&r&&tolerant(e,t,49),isValidIdentifier(t,r)||tolerant(e,t,46),s=a?parseAssignmentPattern(e,t,o,n):o}else s=parseBindingInitializer(e,t);else a=41943059===r,o=parsePropertyName(e,t),expect(e,t,16777237),s=parseExpressionCoverGrammar(e,t,parseBindingInitializer);return finishNode(t,e,n,{type:"Property",kind:"init",key:o,computed:a,value:s,method:!1,shorthand:i})}function parseJSXRootElement(e,t){const n=getLocation(e);let r,o=[],s=null,a=!1;expect(e,t,167774015);const i=167774016===e.token;if(i)r=parseJSXOpeningFragment(e,t,n);else{r=parseJSXOpeningElement(e,t,parseJSXElementName(e,t),parseJSXAttributes(e,t),a=consume(e,t,167774773),n)}if(i)return parseJSXFragment(e,t,r,n);if(!a){o=parseJSXChildren(e,t),s=parseJSXClosingElement(e,t);const n=isEqualTagNames(r.name),a=isEqualTagNames(s.name);n!==a&&report(e,85,a)}return finishNode(t,e,n,{type:"JSXElement",children:o,openingElement:r,closingElement:s})}function parseJSXOpeningElement(e,t,n,r,o,s){return t&exports.Context.InJSXChild&&o?expect(e,t,167774016):nextJSXToken(e),finishNode(t,e,s,{type:"JSXOpeningElement",name:n,attributes:r,selfClosing:o})}function parseJSXFragment(e,t,n,r){return finishNode(t,e,r,{type:"JSXFragment",children:parseJSXChildren(e,t),openingElement:n,closingFragment:parseJSXClosingFragment(e,t)})}function parseJSXOpeningFragment(e,t,n){return nextJSXToken(e),finishNode(t,e,n,{type:"JSXOpeningFragment"})}function nextJSXToken(e){return e.token=scanJSXToken(e)}function scanJSXToken(e){if(e.index>=e.source.length)return 1048576;e.lastIndex=e.startIndex=e.index;const t=e.source.charCodeAt(e.index);if(60===t)return e.index++,e.column++,consumeOpt(e,47)?25:167774015;if(123===t)return e.index++,e.column++,41943052;for(;e.index<e.source.length;){e.index++,e.column++;const t=e.source.charCodeAt(e.index);if(123===t||60===t)break}return 121}function parseJSXChildren(e,t){const n=[];for(;25!==e.token;)n.push(parseJSXChild(e,t));return n}function parseJSXText(e,t){const n=getLocation(e),r=e.source.slice(e.startIndex,e.index);e.token=scanJSXToken(e);const o=finishNode(t,e,n,{type:"JSXText",value:r});return t&exports.Context.OptionsRaw&&(o.raw=r),o}function parseJSXChild(e,t){switch(e.token){case 33685505:case 121:return parseJSXText(e,t);case 41943052:return parseJSXExpression(e,t&~exports.Context.InJSXChild);case 167774015:return parseJSXRootElement(e,t&~exports.Context.InJSXChild);default:report(e,0)}}function parseJSXAttributes(e,t){const n=[];for(;e.index<e.source.length&&167774773!==e.token&&167774016!==e.token;)n.push(parseJSXAttribute(e,t));return n}function parseJSXSpreadAttribute(e,t){const n=getLocation(e);expect(e,t,41943052),expect(e,t,14);const r=parseExpressionCoverGrammar(e,t&~exports.Context.InJSXChild,parseAssignmentExpression);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXSpreadAttribute",argument:r})}function parseJSXNamespacedName(e,t,n,r){return expect(e,t,16777237),finishNode(t,e,r,{type:"JSXNamespacedName",namespace:n,name:parseJSXIdentifier(e,t)})}function parseJSXAttributeName(e,t){const n=getLocation(e),r=parseJSXIdentifier(e,t);return 16777237===e.token?parseJSXNamespacedName(e,t,r,n):r}function parseJSXAttributeValue(e,t){switch(scanJSXAttributeValue(e,t)){case 33554435:return parseLiteral(e,t);case 41943052:return parseJSXExpressionContainer(e,t|exports.Context.InJSXChild);case 167774015:return parseJSXRootElement(e,t|exports.Context.InJSXChild);default:return void tolerant(e,t,87)}}function parseJSXAttribute(e,t){const n=getLocation(e);if(41943052===e.token)return parseJSXSpreadAttribute(e,t);scanJSXIdentifier(e);const r=parseJSXAttributeName(e,t);return finishNode(t,e,n,{type:"JSXAttribute",value:83886109===e.token?parseJSXAttributeValue(e,t):null,name:r})}function scanJSXAttributeValue(e,t){e.lastIndex=e.index;const n=e.source.charCodeAt(e.index);switch(n){case 34:case 39:return scanJSXString(e,t,n);default:return nextToken(e,t)}}function scanJSXString(e,t,n){const r=e.index;e.index++,e.column++;let o="",s=e.source.charCodeAt(e.index);for(;s!==n;)o+=fromCodePoint(s),e.index++,e.column++,s=e.source.charCodeAt(e.index),e.index>=e.source.length&&report(e,6);return e.index++,e.column++,t&exports.Context.OptionsRaw&&(e.tokenRaw=e.source.slice(r,e.index)),e.tokenValue=o,33554435}function parseJSXEmptyExpression(e,t){return finishNode(t,e,getLocation(e),{type:"JSXEmptyExpression"})}function parseJSXSpreadChild(e,t){const n=getLocation(e);expect(e,t,14);const r=parseExpression(e,t);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXSpreadChild",expression:r})}function parseJSXExpressionContainer(e,t){const n=getLocation(e);expect(e,t,41943052),17825807===e.token&&tolerant(e,t,84);const r=parseExpressionCoverGrammar(e,t&~exports.Context.InJSXChild,parseAssignmentExpression);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXExpressionContainer",expression:r})}function parseJSXExpression(e,t){const n=getLocation(e);if(expect(e,t,41943052),14===e.token)return parseJSXSpreadChild(e,t);const r=17825807===e.token?parseJSXEmptyExpression(e,t):parseExpressionCoverGrammar(e,t,parseAssignmentExpression);return nextJSXToken(e),finishNode(t,e,n,{type:"JSXExpressionContainer",expression:r})}function parseJSXClosingFragment(e,t){const n=getLocation(e);return expect(e,t,25),expect(e,t,167774016),finishNode(t,e,n,{type:"JSXClosingFragment"})}function parseJSXClosingElement(e,t){const n=getLocation(e);expect(e,t,25);const r=parseJSXElementName(e,t);return t&exports.Context.InJSXChild?expect(e,t,167774016):nextJSXToken(e),finishNode(t,e,n,{type:"JSXClosingElement",name:r})}function parseJSXIdentifier(e,t){const{token:n,tokenValue:r,tokenRaw:o}=e;135168&n||tolerant(e,t,1,tokenDesc(e.token));const s=getLocation(e);nextToken(e,t);const a=finishNode(t,e,s,{type:"JSXIdentifier",name:r});return t&exports.Context.OptionsRawidentifiers&&(a.raw=o),a}function parseJSXMemberExpression(e,t,n,r){return scanJSXIdentifier(e),finishNode(t,e,r,{type:"JSXMemberExpression",object:n,property:parseJSXIdentifier(e,t)})}function parseJSXElementName(e,t){const n=getLocation(e);scanJSXIdentifier(e);let r=parseJSXIdentifier(e,t);if(16777237===e.token)return parseJSXNamespacedName(e,t,r,n);for(;consume(e,t,16777229);)r=parseJSXMemberExpression(e,t,r,n);return r}function scanJSXIdentifier(e){const{token:t}=e;if(135168&t){const t=e.index;let n=e.source.charCodeAt(e.index);for(;e.index<e.source.length&&(45===n||isValidIdentifierPart(n));)n=readNext(e);e.tokenValue+=e.source.substr(t,e.index-t)}return e.token}function parseExpression(e,t){const n=getLocation(e),r=parseExpressionCoverGrammar(e,t,parseAssignmentExpression);return 16777234===e.token?parseSequenceExpression(e,t,r,n):r}function parseSequenceExpression(e,t,n,r){const o=[n];for(;consume(e,t,16777234);)o.push(parseExpressionCoverGrammar(e,t,parseAssignmentExpression));return finishNode(t,e,r,{type:"SequenceExpression",expressions:o})}function parseYieldExpression(e,t,n){t&exports.Context.InParameter&&tolerant(e,t,51),expect(e,t,1107316842);let r=null,o=!1;return e.flags&exports.Flags.NewLine||((o=consume(e,t,167774771))||33554432&e.token)&&(r=parseAssignmentExpression(e,t)),finishNode(t,e,n,{type:"YieldExpression",argument:r,delegate:o})}function parseAssignmentExpression(e,t){const n=getLocation(e);let{token:r}=e;if(t&exports.Context.Yield&&1073741824&r)return parseYieldExpression(e,t,n);let o=524288&r&&lookahead(e,t,nextTokenisIdentifierOrParen)?parserCoverCallExpressionAndAsyncArrowHead(e,t):parseConditionalExpression(e,t,n);if(10===e.token)return 135168&r&&(4214784&r&&(20480&r&&(e.flags|=exports.Flags.HasStrictReserved),4194304&r&&(t&exports.Context.Strict&&tolerant(e,t,47),e.flags|=exports.Flags.StrictEvalArguments)),o=[o]),parseArrowFunction(e,t&=~exports.Context.Async,n,o);if(hasBit(e.token,67108864)){r=e.token,t&exports.Context.Strict&&nameIsArgumentsOrEval(o.name)?tolerant(e,t,17):consume(e,t,83886109)?(e.flags&exports.Flags.AllowDestructuring||tolerant(e,t,73),t&exports.Context.InParameter||reinterpret(e,t,o),t&exports.Context.InParen&&(e.flags|=exports.Flags.SimpleParameterList),262144&e.token?(setPendingError(e),e.flags|=exports.Flags.HasAwait):t&exports.Context.InParen&&t&(exports.Context.Strict|exports.Context.Yield)&&1073741824&e.token&&(setPendingError(e),e.flags|=exports.Flags.HasYield)):(isValidSimpleAssignmentTarget(o)||tolerant(e,t,5),e.flags&=~(exports.Flags.AllowDestructuring|exports.Flags.AllowBinding),nextToken(e,t));const s=parseExpressionCoverGrammar(e,t|exports.Context.AllowIn,parseAssignmentExpression);return e.pendingExpressionError=null,finishNode(t,e,n,{type:"AssignmentExpression",left:o,operator:tokenDesc(r),right:s})}return o}function parseConditionalExpression(e,t,n){const r=parseBinaryExpression(e,t,0,n);if(!consume(e,t,22))return r;const o=parseExpressionCoverGrammar(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn,parseAssignmentExpression);return expect(e,t,16777237),finishNode(t,e,n,{type:"ConditionalExpression",test:r,consequent:o,alternate:parseExpressionCoverGrammar(e,t,parseAssignmentExpression)})}function parseBinaryExpression(e,t,n,r,o=parseUnaryExpression(e,t)){const s=t&exports.Context.AllowIn^exports.Context.AllowIn;for(;hasBit(e.token,167772160);){const a=e.token,i=3840&a;if(s&&167786289===a)break;if(i+((167775030===a)<<8)<=n)break;nextToken(e,t),o=finishNode(t,e,r,{type:2097152&a?"LogicalExpression":"BinaryExpression",left:o,right:parseBinaryExpression(e,t&~exports.Context.AllowIn,i,getLocation(e)),operator:tokenDesc(a)})}return o}function parseAwaitExpression(e,t,n){return t&exports.Context.InParameter&&tolerant(e,t,52),expect(e,t,34017389),finishNode(t,e,n,{type:"AwaitExpression",argument:parseUnaryExpression(e,t)})}function parseUnaryExpression(e,t){const n=getLocation(e),{token:r}=e;if(hasBit(r,301989888)){nextToken(e,t),e.flags&exports.Flags.EscapedKeyword&&tolerant(e,t,3);const o=parseExpressionCoverGrammar(e,t,parseUnaryExpression);return 167775030===e.token&&tolerant(e,t,1,tokenDesc(e.token)),t&exports.Context.Strict&&302002219===r&&("Identifier"===o.type?tolerant(e,t,43):isPropertyWithPrivateFieldKey(o)&&tolerant(e,t,44)),finishNode(t,e,n,{type:"UnaryExpression",operator:tokenDesc(r),argument:o,prefix:!0})}return t&exports.Context.Async&&262144&r?parseAwaitExpression(e,t,n):parseUpdateExpression(e,t,n)}function parseUpdateExpression(e,t,n){const{token:r}=e;if(hasBit(e.token,570425344)){nextToken(e,t);const o=parseLeftHandSideExpression(e,t,n);return validateUpdateExpression(e,t,o,"Prefix"),finishNode(t,e,n,{type:"UpdateExpression",argument:o,operator:tokenDesc(r),prefix:!0})}if(t&exports.Context.OptionsJSX&&167774015===r)return parseJSXRootElement(e,t|exports.Context.InJSXChild);const o=parseLeftHandSideExpression(e,t,n);if(hasBit(e.token,570425344)&&!(e.flags&exports.Flags.NewLine)){validateUpdateExpression(e,t,o,"Postfix");const r=e.token;return nextToken(e,t),finishNode(t,e,n,{type:"UpdateExpression",argument:o,operator:tokenDesc(r),prefix:!1})}return o}function parseRestElement(e,t,n=[]){const r=getLocation(e);return expect(e,t,14),t&exports.Context.InParen&&262144&e.token&&(e.flags|=exports.Flags.HasAwait),finishNode(t,e,r,{type:"RestElement",argument:parseBindingIdentifierOrPattern(e,t,n)})}function parseSpreadElement(e,t){const n=getLocation(e);return expect(e,t,14),finishNode(t,e,n,{type:"SpreadElement",argument:restoreExpressionCoverGrammar(e,t|exports.Context.AllowIn,parseAssignmentExpression)})}function parseLeftHandSideExpression(e,t,n){const r=t&exports.Context.OptionsNext&&33566810===e.token?parseCallImportOrMetaProperty(e,t|exports.Context.AllowIn):parseMemberExpression(e,t|exports.Context.AllowIn,n);return parseCallExpression(e,t|exports.Context.AllowIn,n,r)}function parseMemberExpression(e,t,n,r=parsePrimaryExpression(e,t)){for(;;)switch(e.token){case 16777229:consume(e,t,16777229),e.flags=e.flags&~exports.Flags.AllowBinding|exports.Flags.AllowDestructuring,r=finishNode(t,e,n,{type:"MemberExpression",object:r,computed:!1,property:parseIdentifierNameOrPrivateName(e,t)});continue;case 41943059:{consume(e,t,41943059),e.flags=e.flags&~exports.Flags.AllowBinding|exports.Flags.AllowDestructuring;const o=parseExpression(e,t);expect(e,t,20),r=finishNode(t,e,n,{type:"MemberExpression",object:r,computed:!0,property:o});continue}case 33554441:r=finishNode(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:parseTemplateLiteral(e,t)});continue;case 33554440:r=finishNode(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:parseTemplate(e,t|exports.Context.TaggedTemplate)});continue;default:return r}}function parseCallExpression(e,t,n,r){for(;;){if(r=parseMemberExpression(e,t,n,r),50331659!==e.token)return r;r=finishNode(t,e,n,{type:"CallExpression",callee:r,arguments:parseArgumentList(e,t&~exports.Context.AllowDecorator)})}}function parserCoverCallExpressionAndAsyncArrowHead(e,t){const n=getLocation(e);let r=parseMemberExpression(e,t|exports.Context.AllowIn,n);if(135168&e.token)return 262144&e.token&&tolerant(e,t,40),parseAsyncArrowFunction(e,t,exports.ModifierState.Await,n,[parseAndClassifyIdentifier(e,t)]);for(e.flags&exports.Flags.NewLine&&tolerant(e,t,36,"async");50331659===e.token;){r=parseMemberExpression(e,t,n,r);const o=parseAsyncArgumentList(e,t);if(10===e.token){r=parseAsyncArrowFunction(e,t,exports.ModifierState.Await,n,o);break}r=finishNode(t,e,n,{type:"CallExpression",callee:r,arguments:o})}return r}function parseArgumentList(e,t){expect(e,t,50331659);const n=[];for(;16!==e.token;)14===e.token?n.push(parseSpreadElement(e,t)):(t&exports.Context.Yield&&hasBit(e.token,1073741824)&&(e.flags|=exports.Flags.HasYield,setPendingError(e)),n.push(parseExpressionCoverGrammar(e,t|exports.Context.AllowIn,parseAssignmentExpression))),16!==e.token&&expect(e,t,16777234);return expect(e,t,16),n}function parseAsyncArgumentList(e,t){expect(e,t,50331659);const n=[];let{token:r}=e,o=exports.CoverCallState.Empty;for(;16!==e.token&&(14===e.token?(e.flags|=exports.Flags.SimpleParameterList,n.push(parseSpreadElement(e,t)),o=exports.CoverCallState.HasSpread):(r=e.token,o=validateAsyncArgumentList(e,t,o),n.push(restoreExpressionCoverGrammar(e,t|exports.Context.AllowIn,parseAssignmentExpression))),consume(e,t,16777234)&&(e.flags&=~exports.Flags.AllowDestructuring,o&exports.CoverCallState.HasSpread&&(o=exports.CoverCallState.SeenSpread)),16!==e.token););return expect(e,t,16),10===e.token&&(o&exports.CoverCallState.SeenSpread?tolerant(e,t,78):o&exports.CoverCallState.EvalOrArguments?(t&exports.Context.Strict&&tolerant(e,t,47),e.flags|=exports.Flags.StrictEvalArguments):o&exports.CoverCallState.Yield?(t&exports.Context.Strict&&tolerant(e,t,51),e.flags|=exports.Flags.HasStrictReserved):e.flags&exports.Flags.HasYield?tolerant(e,t,51):(o&exports.CoverCallState.Await||e.flags&exports.Flags.HasAwait)&&tolerant(e,t,52)),n}function parsePrimaryExpression(e,t){switch(e.token){case 33685505:return parseIdentifier(e,t);case 33554434:case 33554435:return parseLiteral(e,t);case 594028:return parseAsyncFunctionOrIdentifier(e,t);case 50331659:return parseParenthesizedExpression(e,t|exports.Context.InParen);case 41943059:return restoreExpressionCoverGrammar(e,t,parseArrayLiteral);case 41943052:return restoreExpressionCoverGrammar(e,t,parseObjectLiteral);case 33566808:return parseFunctionExpression(e,t);case 33566727:case 33566726:case 33566725:return parseNullOrTrueOrFalseLiteral(e,t);case 120:case 33566797:return parseClassExpression(e,t);case 33566811:return parseNewExpressionOrMetaProperty(e,t);case 33566813:return parseSuperProperty(e,t);case 33554551:return parseBigIntLiteral(e,t);case 33566815:return parseThisExpression(e,t);case 115:return parseIdentifierNameOrPrivateName(e,t);case 167774773:case 100663333:return scanRegularExpression(e,t),parseRegularExpressionLiteral(e,t);case 33554441:return parseTemplateLiteral(e,t);case 33554440:return parseTemplate(e,t);case 33574984:return parseLetAsIdentifier(e,t);case 12369:if(t&exports.Context.OptionsExperimental)return parseDoExpression(e,t);default:return parseAndClassifyIdentifier(e,t)}}function parseDoExpression(e,t){const n=getLocation(e);return expect(e,t,12369),finishNode(t,e,n,{type:"DoExpression",body:parseBlockStatement(e,t)})}function parseLetAsIdentifier(e,t){t&exports.Context.Strict&&tolerant(e,t,50);const n=getLocation(e),r=e.tokenValue;return nextToken(e,t),e.flags&exports.Flags.NewLine&&41943059===e.token&&tolerant(e,t,1,"let"),finishNode(t,e,n,{type:"Identifier",name:r})}function parseAsyncFunctionOrIdentifier(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorExpression(e,t):parseIdentifier(e,t)}function parseIdentifier(e,t){const n=getLocation(e),r=e.tokenValue;nextToken(e,t|exports.Context.TaggedTemplate);const o=finishNode(t,e,n,{type:"Identifier",name:r});return t&exports.Context.OptionsRawidentifiers&&(o.raw=e.tokenRaw),o}function parseRegularExpressionLiteral(e,t){const n=getLocation(e),{tokenRegExp:r,tokenValue:o,tokenRaw:s}=e;nextToken(e,t);const a=finishNode(t,e,n,{type:"Literal",value:o,regex:r});return t&exports.Context.OptionsRaw&&(a.raw=s),a}function parseLiteral(e,t){const n=getLocation(e),r=e.tokenValue;t&exports.Context.Strict&&e.flags&exports.Flags.HasOctal&&tolerant(e,t,61),nextToken(e,t);const o=finishNode(t,e,n,{type:"Literal",value:r});return t&exports.Context.OptionsRaw&&(o.raw=e.tokenRaw),o}function parseBigIntLiteral(e,t){const n=getLocation(e),{tokenValue:r,tokenRaw:o}=e;nextToken(e,t);const s=finishNode(t,e,n,{type:"Literal",value:r,bigint:o});return t&exports.Context.OptionsRaw&&(s.raw=e.tokenRaw),s}function parseNullOrTrueOrFalseLiteral(e,t){const n=getLocation(e),{token:r}=e,o=tokenDesc(r);e.flags&exports.Flags.EscapedKeyword&&tolerant(e,t,3),nextToken(e,t);const s=finishNode(t,e,n,{type:"Literal",value:33566727===r?null:"true"===o});return t&exports.Context.OptionsRaw&&(s.raw=o),s}function parseThisExpression(e,t){e.flags&exports.Flags.EscapedKeyword&&tolerant(e,t,3);const n=getLocation(e);return nextToken(e,t|exports.Context.DisallowEscapedKeyword),finishNode(t,e,n,{type:"ThisExpression"})}function parseIdentifierName(e,t,n){return 135168&n||tolerant(e,t,4,tokenDesc(n)),parseIdentifier(e,t)}function parseIdentifierNameOrPrivateName(e,t){if(!consume(e,t,115))return parseIdentifierName(e,t,e.token);const{tokenValue:n}=e,r=getLocation(e),o=n;return nextToken(e,t),finishNode(t,e,r,{type:"PrivateName",name:o})}function parseArrayLiteral(e,t){const n=getLocation(e);expect(e,t,41943059);const r=[];for(;20!==e.token;)consume(e,t,16777234)?r.push(null):14===e.token?(r.push(parseSpreadElement(e,t)),20!==e.token&&(e.flags&=~(exports.Flags.AllowDestructuring|exports.Flags.AllowBinding),expect(e,t,16777234))):(r.push(restoreExpressionCoverGrammar(e,t|exports.Context.AllowIn,parseAssignmentExpression)),20!==e.token&&expect(e,t,16777234));return expect(e,t,20),finishNode(t,e,n,{type:"ArrayExpression",elements:r})}function parseParenthesizedExpression(e,t){if(expect(e,t,50331659),consume(e,t,16)){if(e.flags&=~(exports.Flags.AllowDestructuring|exports.Flags.AllowBinding),10===e.token)return[]}else if(14===e.token){const n=[parseRestElement(e,t)];return expect(e,t,16),e.flags=e.flags&~(exports.Flags.AllowDestructuring|exports.Flags.AllowBinding)|exports.Flags.SimpleParameterList,10!==e.token&&tolerant(e,t,1,tokenDesc(e.token)),n}const n=getLocation(e);let r=validateCoverParenthesizedExpression(e,exports.CoverParenthesizedState.None),o=restoreExpressionCoverGrammar(e,t|exports.Context.AllowIn,parseAssignmentExpression);if(16777234===e.token){r|=exports.CoverParenthesizedState.SequenceExpression;const s=[o];for(;consume(e,t|exports.Context.DisallowEscapedKeyword,16777234);){if(14===e.token){e.flags&exports.Flags.AllowBinding||tolerant(e,t,77),e.flags|=exports.Flags.SimpleParameterList;const n=parseRestElement(e,t);return expect(e,t,16),10!==e.token&&tolerant(e,t,78),s.push(n),s}if(consume(e,t,16))return 10!==e.token&&tolerant(e,t,1,tokenDesc(e.token)),s;r=validateCoverParenthesizedExpression(e,r),s.push(restoreExpressionCoverGrammar(e,t,parseAssignmentExpression))}o=finishNode(t,e,n,{type:"SequenceExpression",expressions:s})}return expect(e,t,16),10===e.token?(r&exports.CoverParenthesizedState.HasEvalOrArguments?(t&exports.Context.Strict&&tolerant(e,t,47),e.flags|=exports.Flags.StrictEvalArguments):r&exports.CoverParenthesizedState.HasReservedWords?(t&exports.Context.Strict&&tolerant(e,t,50),e.flags|=exports.Flags.HasStrictReserved):e.flags&exports.Flags.AllowBinding?e.flags&exports.Flags.HasYield?tolerant(e,t,51):t&exports.Context.Async&&e.flags&exports.Flags.HasAwait&&tolerant(e,t,52):tolerant(e,t,77),e.flags&=~(exports.Flags.AllowBinding|exports.Flags.HasAwait|exports.Flags.HasYield),r&exports.CoverParenthesizedState.SequenceExpression?o.expressions:[o]):(e.flags&=~(exports.Flags.HasAwait|exports.Flags.HasYield|exports.Flags.AllowBinding),isValidSimpleAssignmentTarget(o)||(e.flags&=~exports.Flags.AllowDestructuring),o)}function parseFunctionExpression(e,t){const n=getLocation(e);expect(e,t,33566808);const r=consume(e,t,167774771)?exports.ModifierState.Generator:exports.ModifierState.None;let o=null;const{token:s}=e;135168&s&&(4194304&s&&(t&exports.Context.Strict&&tolerant(e,t,47),e.flags|=exports.Flags.StrictEvalArguments),1073741824&e.token&&r&exports.ModifierState.Generator&&tolerant(e,t,49),o=parseBindingIdentifier(e,t));const{params:a,body:i}=swapContext(e,t&~(exports.Context.Method|exports.Context.AllowSuperProperty),r,parseFormalListAndBody);return finishNode(t,e,n,{type:"FunctionExpression",params:a,body:i,async:!1,generator:!!(r&exports.ModifierState.Generator),expression:!1,id:o})}function parseAsyncFunctionOrAsyncGeneratorExpression(e,t){const n=getLocation(e);expect(e,t,594028),expect(e,t,33566808);const r=consume(e,t,167774771)?exports.ModifierState.Generator:exports.ModifierState.None,o=exports.ModifierState.Await;let s=null;const{token:a}=e;135168&a&&(4194304&a&&((t&exports.Context.Strict||o&exports.ModifierState.Await)&&tolerant(e,t,47),e.flags|=exports.Flags.StrictFunctionName),262144&a&&tolerant(e,t,48),1073741824&e.token&&r&exports.ModifierState.Generator&&tolerant(e,t,49),s=parseBindingIdentifier(e,t));const{params:i,body:p}=swapContext(e,t&~(exports.Context.Method|exports.Context.AllowSuperProperty),r|o,parseFormalListAndBody);return finishNode(t,e,n,{type:"FunctionExpression",params:i,body:p,async:!0,generator:!!(r&exports.ModifierState.Generator),expression:!1,id:s})}function parseComputedPropertyName(e,t){expect(e,t,41943059);const n=parseAssignmentExpression(e,t|exports.Context.AllowIn);return expect(e,t,20),n}function parsePropertyName(e,t){switch(e.token){case 33554434:case 33554435:return parseLiteral(e,t);case 41943059:return parseComputedPropertyName(e,t);default:return parseIdentifier(e,t)}}function parseSpreadProperties(e,t){const n=getLocation(e);return expect(e,t,14),8388608&e.token&&(e.flags&=~exports.Flags.AllowDestructuring),finishNode(t,e,n,{type:"SpreadElement",argument:parseAssignmentExpression(e,t|exports.Context.AllowIn)})}function parseObjectLiteral(e,t){const n=getLocation(e);expect(e,t,41943052);const r=[];for(;17825807!==e.token;)r.push(14===e.token?parseSpreadProperties(e,t):parsePropertyDefinition(e,t)),17825807!==e.token&&expect(e,t,16777234);return expect(e,t,17825807),e.flags&=~exports.Flags.HasProtoField,finishNode(t,e,n,{type:"ObjectExpression",properties:r})}function parsePropertyDefinition(e,t){const n=getLocation(e),r=e.flags;let o,s=consume(e,t,167774771)?exports.ObjectState.Generator|exports.ObjectState.Method:exports.ObjectState.Method;const a=e.token;let i=parsePropertyName(e,t);return 16777216&e.token||(r&exports.Flags.EscapedKeyword?tolerant(e,t,3):s&exports.ObjectState.Generator||!(524288&a)||e.flags&exports.Flags.NewLine?69743===a?(s=s&~exports.ObjectState.Method|exports.ObjectState.Getter,i=parsePropertyName(e,t)):69744===a&&(s=s&~exports.ObjectState.Method|exports.ObjectState.Setter,i=parsePropertyName(e,t)):(s|=consume(e,t,167774771)?exports.ObjectState.Generator|exports.ObjectState.Async:exports.ObjectState.Async,i=parsePropertyName(e,t)),s&(exports.ObjectState.Getter|exports.ObjectState.Setter)&&s&exports.ObjectState.Generator&&tolerant(e,t,1,tokenDesc(e.token))),50331659===e.token?o=parseMethodDeclaration(e,t,s):(s&=~exports.ObjectState.Method,16777237===e.token?(s&(exports.ObjectState.Async|exports.ObjectState.Generator)?tolerant(e,t,1,tokenDesc(e.token)):41943059!==a&&"__proto__"===e.tokenValue&&(e.flags&exports.Flags.HasProtoField?setPendingExpressionError(e,63):e.flags|=exports.Flags.HasProtoField),expect(e,t,16777237),262144&e.token&&(e.flags|=exports.Flags.HasAwait),o=restoreExpressionCoverGrammar(e,t,parseAssignmentExpression)):(s&(exports.ObjectState.Generator|exports.ObjectState.Async)||!isValidIdentifier(t,a)?tolerant(e,t,1,tokenDesc(a)):t&(exports.Context.Strict|exports.Context.Yield)&&1073741824&a&&(setPendingError(e),e.flags|=exports.Flags.HasYield),s|=exports.ObjectState.Shorthand,83886109===e.token?(t&exports.Context.Strict&&4194304&a?report(e,47):setPendingExpressionError(e,91),expect(e,t,83886109),t&(exports.Context.Strict|exports.Context.Yield|exports.Context.Async)&&1074003968&e.token&&(setPendingError(e),e.flags|=1073741824&e.token?exports.Flags.HasYield:exports.Flags.HasAwait),o=parseAssignmentPattern(e,t,i,n)):(262144&a&&(t&exports.Context.Async&&tolerant(e,t,46),setPendingError(e),e.flags|=exports.Flags.HasAwait),o=i))),finishNode(t,e,n,{type:"Property",key:i,value:o,kind:s&exports.ObjectState.Getter|s&exports.ObjectState.Setter?s&exports.ObjectState.Setter?"set":"get":"init",computed:41943059===a,method:!!(s&exports.ObjectState.Method),shorthand:!!(s&exports.ObjectState.Shorthand)})}function parseMethodDeclaration(e,t,n){const r=getLocation(e),o=n&exports.ObjectState.Generator?exports.ModifierState.Generator:exports.ModifierState.None,s=n&exports.ObjectState.Async?exports.ModifierState.Await:exports.ModifierState.None,{params:a,body:i}=swapContext(e,t|exports.Context.Method,o|s,parseFormalListAndBody,n);return finishNode(t,e,r,{type:"FunctionExpression",params:a,body:i,async:!!(n&exports.ObjectState.Async),generator:!!(n&exports.ObjectState.Generator),expression:!1,id:null})}function parseArrowFunction(e,t,n,r){return e.flags&=~(exports.Flags.AllowDestructuring|exports.Flags.AllowBinding),e.flags&exports.Flags.NewLine&&tolerant(e,t,36,"=>"),expect(e,t,10),parseArrowBody(e,t&~exports.Context.Async,r,n,exports.ModifierState.None)}function parseAsyncArrowFunction(e,t,n,r,o){return e.flags&=~(exports.Flags.AllowDestructuring|exports.Flags.AllowBinding),e.flags&exports.Flags.NewLine&&tolerant(e,t,36,"async"),expect(e,t,10),parseArrowBody(e,t|exports.Context.Async,o,r,n)}function parseArrowBody(e,t,n,r,o){e.pendingExpressionError=null;for(const r in n)reinterpret(e,t|exports.Context.InParameter,n[r]);const s=41943052!==e.token;return finishNode(t,e,r,{type:"ArrowFunctionExpression",body:s?parseExpressionCoverGrammar(e,t&~(exports.Context.Yield|exports.Context.InParameter),parseAssignmentExpression):swapContext(e,t&~(exports.Context.Yield|exports.Context.AllowDecorator)|exports.Context.InFunctionBody,o,parseFunctionBody),params:n,id:null,async:!!(o&exports.ModifierState.Await),generator:!1,expression:s})}function parseFormalListAndBody(e,t,n){const r=parseFormalParameters(e,t|exports.Context.InParameter,n),o=r.args;return{params:r.params,body:parseFunctionBody(e,t&~exports.Context.AllowDecorator|exports.Context.InFunctionBody,o)}}function parseFunctionBody(e,t,n){const r=getLocation(e);expect(e,t|exports.Context.DisallowEscapedKeyword,41943052);const o=[];for(;33554435===e.token;){const{tokenRaw:n,tokenValue:r}=e;o.push(parseDirective(e,t)),12===n.length&&"use strict"===r&&(e.flags&exports.Flags.SimpleParameterList?tolerant(e,t,64):e.flags&(exports.Flags.HasStrictReserved|exports.Flags.StrictFunctionName)?tolerant(e,t,50):e.flags&exports.Flags.StrictEvalArguments&&tolerant(e,t,47),t|=exports.Context.Strict)}t&exports.Context.Strict&&validateParams(e,t,n);const{labelSet:s}=e;e.labelSet={};const a=e.flags;for(e.flags=e.flags&~(exports.Flags.StrictFunctionName|exports.Flags.StrictEvalArguments|exports.Flags.InSwitchStatement|exports.Flags.InIterationStatement)|exports.Flags.AllowDestructuring;17825807!==e.token;)o.push(parseStatementListItem(e,t));return a&exports.Flags.InIterationStatement&&(e.flags|=exports.Flags.InIterationStatement),a&exports.Flags.InSwitchStatement&&(e.flags|=exports.Flags.InSwitchStatement),e.labelSet=s,expect(e,t,17825807),finishNode(t,e,r,{type:"BlockStatement",body:o})}function parseFormalParameters(e,t,n){expect(e,t,50331659),e.flags&=~(exports.Flags.SimpleParameterList|exports.Flags.HasStrictReserved);const r=[],o=[];for(;16!==e.token;){if(14===e.token){n&exports.ObjectState.Setter&&tolerant(e,t,67),e.flags|=exports.Flags.SimpleParameterList,o.push(parseRestElement(e,t,r));break}if(o.push(parseFormalParameterList(e,t,r)),!consume(e,t,16777234))break;if(16===e.token)break}return n&exports.ObjectState.Setter&&1!==o.length&&tolerant(e,t,66,"Setter","one",""),n&exports.ObjectState.Getter&&o.length>0&&tolerant(e,t,66,"Getter","no","s"),expect(e,t,16),{params:o,args:r}}function parseFormalParameterList(e,t,n){const r=getLocation(e);135168&e.token?(hasBit(e.token,20480)&&(t&exports.Context.Strict&&tolerant(e,t,50),e.flags|=exports.Flags.StrictFunctionName),hasBit(e.token,4194304)&&(t&exports.Context.Strict&&tolerant(e,t,47),e.flags|=exports.Flags.StrictEvalArguments)):e.flags|=exports.Flags.SimpleParameterList;const o=parseBindingIdentifierOrPattern(e,t,n);return consume(e,t,83886109)?(1074003968&e.token&&t&(exports.Context.Yield|exports.Context.Async)&&tolerant(e,t,262144&e.token?52:51),e.flags|=exports.Flags.SimpleParameterList,finishNode(t,e,r,{type:"AssignmentPattern",left:o,right:parseExpressionCoverGrammar(e,t,parseAssignmentExpression)})):o}function parseClassExpression(e,t){const n=getLocation(e);let r=[];t&exports.Context.OptionsExperimental&&(r=parseDecorators(e,t)),expect(e,t|exports.Context.DisallowEscapedKeyword,33566797);const{token:o}=e;let s=exports.ObjectState.None,a=null,i=null;41943052!==o&&12372!==o&&(t&exports.Context.Async&&262144&o&&tolerant(e,t,48),a=parseBindingIdentifier(e,t|exports.Context.Strict)),consume(e,t,12372)&&(i=parseLeftHandSideExpression(e,t|exports.Context.Strict,n),s|=exports.ObjectState.Heritage);const p=parseClassBodyAndElementList(e,t|exports.Context.Strict,s);return finishNode(t,e,n,t&exports.Context.OptionsExperimental?{type:"ClassExpression",id:a,superClass:i,body:p,decorators:r}:{type:"ClassExpression",id:a,superClass:i,body:p})}function parseClassBodyAndElementList(e,t,n){const r=getLocation(e);expect(e,t,41943052);const o=[];let s=[];for(;17825807!==e.token;)consume(e,t,17825809)||(t&exports.Context.OptionsExperimental&&(s=parseDecorators(e,t),17825807===e.token&&report(e,92),0!==s.length&&"constructor"===e.tokenValue&&report(e,93)),o.push(t&exports.Context.OptionsNext&&115===e.token?parsePrivateFields(e,t,s):parseClassElement(e,t,n,s)));return e.flags&=~exports.Flags.HasConstructor,expect(e,t,17825807),finishNode(t,e,r,{type:"ClassBody",body:o})}function parseClassElement(e,t,n,r){const o=getLocation(e);let{tokenValue:s,token:a}=e;const i=e.flags;consume(e,t,167774771)&&(n|=exports.ObjectState.Generator),41943059===e.token&&(n|=exports.ObjectState.Computed),"constructor"===e.tokenValue&&(n&exports.ObjectState.Generator?tolerant(e,t,45,"generator"):n&exports.ObjectState.Heritage&&(t|=exports.Context.AllowSuperProperty),n|=exports.ObjectState.Constructor);let p,c=parsePropertyName(e,t);if(!(16777216&e.token)){if(i&exports.Flags.EscapedKeyword&&tolerant(e,t,3),20585===a&&(a=e.token,consume(e,t,167774771)&&(n|=exports.ObjectState.Generator),s=e.tokenValue,41943059===e.token&&(n|=exports.ObjectState.Computed),"prototype"===e.tokenValue&&tolerant(e,t,65),n|=exports.ObjectState.Static,c=parsePropertyName(e,t),t&exports.Context.OptionsNext&&isInstanceField(e)))return"constructor"===s&&tolerant(e,t,1,tokenDesc(e.token)),parseFieldDefinition(e,t,c,n,o,r);50331659!==e.token&&(!(524288&a)||n&exports.ObjectState.Generator||e.flags&exports.Flags.NewLine?69743!==a&&69744!==a||(n|=69743===a?exports.ObjectState.Getter:exports.ObjectState.Setter,s=e.tokenValue,41943059===e.token&&(n|=exports.ObjectState.Computed),c=parsePropertyName(e,t&~exports.Context.Strict)):(a=e.token,s=e.tokenValue,n|=exports.ObjectState.Async,consume(e,t,167774771)&&(n|=exports.ObjectState.Generator),41943059===e.token&&(n|=exports.ObjectState.Computed),c=parsePropertyName(e,t)),"prototype"===s?tolerant(e,t,65):n&exports.ObjectState.Static||"constructor"!==s||tolerant(e,t,45,"accessor"))}if(50331659===e.token)!(n&exports.ObjectState.Computed)&&n&exports.ObjectState.Constructor&&(e.flags&exports.Flags.HasConstructor?report(e,12):e.flags|=exports.Flags.HasConstructor),p=parseMethodDeclaration(e,t,n);else{if(t&exports.Context.OptionsNext)return parseFieldDefinition(e,t,c,n,o,r);tolerant(e,t,1,tokenDesc(a))}const l=n&exports.ObjectState.Constructor?"constructor":n&exports.ObjectState.Getter?"get":n&exports.ObjectState.Setter?"set":"method";return finishNode(t,e,o,t&exports.Context.OptionsExperimental?{type:"MethodDefinition",kind:l,static:!!(n&exports.ObjectState.Static),computed:!!(n&exports.ObjectState.Computed),key:c,value:p,decorators:r}:{type:"MethodDefinition",kind:l,static:!!(n&exports.ObjectState.Static),computed:!!(n&exports.ObjectState.Computed),key:c,value:p})}function parseFieldDefinition(e,t,n,r,o,s){r&exports.ObjectState.Constructor&&tolerant(e,t,0);let a=null;return r&(exports.ObjectState.Async|exports.ObjectState.Generator)&&tolerant(e,t,0),consume(e,t,83886109)&&(4194304&e.token&&tolerant(e,t,47),a=parseAssignmentExpression(e,t)),consume(e,t,16777234),finishNode(t,e,o,t&exports.Context.OptionsExperimental?{type:"FieldDefinition",key:n,value:a,computed:!!(r&exports.ObjectState.Computed),static:!!(r&exports.ObjectState.Static),decorators:s}:{type:"FieldDefinition",key:n,value:a,computed:!!(r&exports.ObjectState.Computed),static:!!(r&exports.ObjectState.Static)})}function parsePrivateName(e,t,n){const r=e.tokenValue;return nextToken(e,t),finishNode(t,e,n,{type:"PrivateName",name:r})}function parsePrivateFields(e,t,n){const r=getLocation(e);expect(e,t|exports.Context.InClass,115),"constructor"===e.tokenValue&&tolerant(e,t,41);const o=parsePrivateName(e,t,r);if(50331659===e.token)return parsePrivateMethod(e,t,o,r,n);let s=null;return consume(e,t,83886109)&&(4194304&e.token&&tolerant(e,t,47),s=parseAssignmentExpression(e,t)),consume(e,t,16777234),finishNode(t,e,r,t&exports.Context.OptionsExperimental?{type:"FieldDefinition",key:o,value:s,computed:!1,static:!1,decorators:n}:{type:"FieldDefinition",key:o,value:s,computed:!1,static:!1})}function parsePrivateMethod(e,t,n,r,o){const s=parseMethodDeclaration(e,t|exports.Context.Strict,exports.ObjectState.None);return e.flags&=~(exports.Flags.AllowDestructuring|exports.Flags.AllowBinding),finishNode(t,e,r,t&exports.Context.OptionsExperimental?{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:s,decorators:o}:{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:s})}function parseCallImportOrMetaProperty(e,t){const n=getLocation(e),r=parseIdentifier(e,t);if(consume(e,t,16777229)){if(t&exports.Context.Module&&"meta"===e.tokenValue)return parseMetaProperty(e,t,r,n);tolerant(e,t,1,tokenDesc(e.token))}let o=parseImportExpression(e,t,n);expect(e,t,50331659);const s=parseExpressionCoverGrammar(e,t|exports.Context.AllowIn,parseAssignmentExpression);return expect(e,t,16),o=finishNode(t,e,n,{type:"CallExpression",callee:o,arguments:[s]})}function parseImportExpression(e,t,n){return finishNode(t,e,n,{type:"Import"})}function parseMetaProperty(e,t,n,r){return finishNode(t,e,r,{meta:n,type:"MetaProperty",property:parseIdentifier(e,t)})}function parseNewExpressionOrMetaProperty(e,t){const n=getLocation(e),r=parseIdentifier(e,t);return consume(e,t|exports.Context.DisallowEscapedKeyword,16777229)?("target"===e.tokenValue&&t&(exports.Context.InParameter|exports.Context.InFunctionBody)||tolerant(e,t,53),parseMetaProperty(e,t,r,n)):finishNode(t,e,n,{type:"NewExpression",callee:parseImportOrMemberExpression(e,t,n),arguments:50331659===e.token?parseArgumentList(e,t):[]})}function parseImportOrMemberExpression(e,t,n){const{token:r}=e;return t&exports.Context.OptionsNext&&33566810===r?(lookahead(e,t,nextTokenIsLeftParen)&&tolerant(e,t,1,tokenDesc(r)),parseCallImportOrMetaProperty(e,t)):parseMemberExpression(e,t,n)}function parseSuperProperty(e,t){const n=getLocation(e);switch(expect(e,t,33566813),e.token){case 50331659:t&exports.Context.AllowSuperProperty||tolerant(e,t,54);break;case 41943059:case 16777229:t&exports.Context.Method||tolerant(e,t,55);break;default:tolerant(e,t,56)}return finishNode(t,e,n,{type:"Super"})}function parseTemplateLiteral(e,t){return finishNode(t,e,getLocation(e),{type:"TemplateLiteral",expressions:[],quasis:[parseTemplateSpans(e,t)]})}function parseTemplateHead(e,t,n=null,r,o){return e.token=consumeTemplateBrace(e,t),finishNode(t,e,o,{type:"TemplateElement",value:{cooked:n,raw:r},tail:!1})}function parseTemplate(e,t,n=[],r=[]){const o=getLocation(e),{tokenValue:s,tokenRaw:a}=e;expect(e,t,33554440),n.push(parseExpression(e,t));const i=getLocation(e);return r.push(parseTemplateHead(e,t,s,a,o)),33554441===e.token?r.push(parseTemplateSpans(e,t,i)):parseTemplate(e,t,n,r),finishNode(t,e,o,{type:"TemplateLiteral",expressions:n,quasis:r})}function parseTemplateSpans(e,t,n=getLocation(e)){const{tokenValue:r,tokenRaw:o}=e;return expect(e,t,33554441),finishNode(t,e,n,{type:"TemplateElement",value:{cooked:r,raw:o},tail:!0})}function parseDecoratorList(e,t){const n=getLocation(e);return finishNode(t,e,n,{type:"Decorator",expression:parseLeftHandSideExpression(e,t,n)})}function parseDecorators(e,t){const n=[];for(;consume(e,t,120);)n.push(parseDecoratorList(e,t|exports.Context.AllowDecorator));return n}function validateBreakOrContinueLabel(e,t,n,r){const o=hasLabel(e,n);o||tolerant(e,t,32,n),!r||o&exports.Labels.Nested||tolerant(e,t,31,n)}function addLabel(e,t){void 0===e.labelSet&&(e.labelSet={}),e.labelSet[`$${t}`]=isIterationStatement(e.token)?exports.Labels.Nested:exports.Labels.NotNested}function popLabel(e,t){e.labelSet[`$${t}`]=exports.Labels.None}function hasLabel(e,t){return e.labelSet?e.labelSet[`$${t}`]:exports.Labels.None}function finishNode(e,t,n,r){const{lastIndex:o,lastLine:s,lastColumn:a,sourceFile:i,index:p}=t;return e&exports.Context.LocationTracker&&(e&exports.Context.OptionsRanges&&(r.start=n.index,r.end=o),e&exports.Context.OptionsLoc&&(r.loc={start:{line:n.line,column:n.column},end:{line:s,column:a}},i&&(r.loc.source=i))),r}function expect(e,t,n,r=1){return e.token!==n&&report(e,r,tokenDesc(e.token)),nextToken(e,t),!0}function consume(e,t,n){return e.token===n&&(nextToken(e,t),!0)}function nextToken(e,t){return e.lastIndex=e.index,e.lastLine=e.line,e.lastColumn=e.column,e.token=scan(e,t)}!function(e){e[e.Empty=0]="Empty",e[e.OptionsNext=1]="OptionsNext",e[e.OptionsRanges=2]="OptionsRanges",e[e.OptionsJSX=4]="OptionsJSX",e[e.OptionsRaw=8]="OptionsRaw",e[e.OptionsLoc=16]="OptionsLoc",e[e.OptionsGlobalReturn=32]="OptionsGlobalReturn",e[e.OptionsComments=64]="OptionsComments",e[e.OptionsShebang=128]="OptionsShebang",e[e.OptionsRawidentifiers=256]="OptionsRawidentifiers",e[e.OptionsTolerant=512]="OptionsTolerant",e[e.OptionsNode=1024]="OptionsNode",e[e.OptionsExperimental=2048]="OptionsExperimental",e[e.Strict=4096]="Strict",e[e.Module=8192]="Module",e[e.TaggedTemplate=16384]="TaggedTemplate",e[e.InClass=32768]="InClass",e[e.AllowIn=65536]="AllowIn",e[e.Async=131072]="Async",e[e.Yield=262144]="Yield",e[e.InParameter=524288]="InParameter",e[e.InFunctionBody=1048576]="InFunctionBody",e[e.AllowSingleStatement=2097152]="AllowSingleStatement",e[e.BlockScope=4194304]="BlockScope",e[e.ForStatement=8388608]="ForStatement",e[e.RequireIdentifier=16777216]="RequireIdentifier",e[e.Method=33554432]="Method",e[e.AllowSuperProperty=67108864]="AllowSuperProperty",e[e.InParen=134217728]="InParen",e[e.InJSXChild=268435456]="InJSXChild",e[e.DisallowEscapedKeyword=536870912]="DisallowEscapedKeyword",e[e.AllowDecorator=1073741824]="AllowDecorator",e[e.LocationTracker=18]="LocationTracker"}(exports.Context||(exports.Context={})),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.AllowBinding=2]="AllowBinding",e[e.AllowDestructuring=4]="AllowDestructuring",e[e.SimpleParameterList=8]="SimpleParameterList",e[e.InSwitchStatement=16]="InSwitchStatement",e[e.InIterationStatement=32]="InIterationStatement",e[e.HasStrictReserved=64]="HasStrictReserved",e[e.HasOctal=128]="HasOctal",e[e.SimpleAssignmentTarget=256]="SimpleAssignmentTarget",e[e.HasProtoField=512]="HasProtoField",e[e.StrictFunctionName=1024]="StrictFunctionName",e[e.StrictEvalArguments=2048]="StrictEvalArguments",e[e.InFunctionBody=4096]="InFunctionBody",e[e.HasAwait=8192]="HasAwait",e[e.HasYield=16384]="HasYield",e[e.EscapedKeyword=32768]="EscapedKeyword",e[e.HasConstructor=65536]="HasConstructor"}(exports.Flags||(exports.Flags={})),function(e){e[e.None=0]="None",e[e.NotNested=1]="NotNested",e[e.Nested=2]="Nested"}(exports.Labels||(exports.Labels={})),function(e){e[e.None=0]="None",e[e.SeenSeparator=1]="SeenSeparator",e[e.EigthOrNine=2]="EigthOrNine",e[e.Float=4]="Float",e[e.BigInt=8]="BigInt"}(exports.NumericState||(exports.NumericState={})),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.LastIsCR=2]="LastIsCR"}(exports.ScannerState||(exports.ScannerState={})),function(e){e[e.None=0]="None",e[e.Generator=1]="Generator",e[e.Await=2]="Await"}(exports.ModifierState||(exports.ModifierState={})),function(e){e[e.None=0]="None",e[e.SequenceExpression=1]="SequenceExpression",e[e.HasEvalOrArguments=2]="HasEvalOrArguments",e[e.HasReservedWords=4]="HasReservedWords",e[e.HasYield=8]="HasYield",e[e.HasBinding=16]="HasBinding"}(exports.CoverParenthesizedState||(exports.CoverParenthesizedState={})),function(e){e[e.Empty=-1]="Empty",e[e.StrictOctal=-2]="StrictOctal",e[e.EightOrNine=-3]="EightOrNine",e[e.InvalidHex=-4]="InvalidHex",e[e.OutOfRange=-5]="OutOfRange"}(exports.Escape||(exports.Escape={})),function(e){e[e.Empty=0]="Empty",e[e.IgnoreCase=1]="IgnoreCase",e[e.Global=2]="Global",e[e.Multiline=4]="Multiline",e[e.Unicode=8]="Unicode",e[e.Sticky=16]="Sticky",e[e.DotAll=32]="DotAll"}(exports.RegexFlags||(exports.RegexFlags={})),function(e){e[e.Empty=0]="Empty",e[e.SeenSpread=1]="SeenSpread",e[e.HasSpread=2]="HasSpread",e[e.SimpleParameter=4]="SimpleParameter",e[e.EvalOrArguments=8]="EvalOrArguments",e[e.Yield=16]="Yield",e[e.Await=32]="Await"}(exports.CoverCallState||(exports.CoverCallState={})),function(e){e[e.Empty=0]="Empty",e[e.Escape=1]="Escape",e[e.Class=2]="Class"}(exports.RegexState||(exports.RegexState={})),function(e){e[e.None=0]="None",e[e.Async=1]="Async",e[e.Generator=2]="Generator",e[e.Getter=4]="Getter",e[e.Setter=8]="Setter",e[e.Computed=16]="Computed",e[e.Method=32]="Method",e[e.Shorthand=64]="Shorthand",e[e.Static=128]="Static",e[e.Constructor=256]="Constructor",e[e.Heritage=512]="Heritage"}(exports.ObjectState||(exports.ObjectState={}));const hasBit=(e,t)=>(e&t)===t;function consumeSemicolon(e,t){return 1048576&e.token||e.flags&exports.Flags.NewLine?consume(e,t,17825809):report(e,!(t&exports.Context.Async)&&262144&e.token?38:1,tokenDesc(e.token))}function parseExpressionCoverGrammar(e,t,n){const{flags:r,pendingExpressionError:o}=e;e.flags|=exports.Flags.AllowBinding|exports.Flags.AllowDestructuring,e.pendingExpressionError=void 0;const s=n(e,t);if(e.pendingExpressionError){const{error:n,line:r,column:o,index:s}=e.pendingExpressionError;constructError(e,t,s,r,o,n)}return e.flags&=~(exports.Flags.AllowBinding|exports.Flags.AllowDestructuring),r&exports.Flags.AllowBinding&&(e.flags|=exports.Flags.AllowBinding),r&exports.Flags.AllowDestructuring&&(e.flags|=exports.Flags.AllowDestructuring),e.pendingExpressionError=o,s}function restoreExpressionCoverGrammar(e,t,n){const{flags:r,pendingExpressionError:o}=e;e.flags|=exports.Flags.AllowBinding|exports.Flags.AllowDestructuring,e.pendingExpressionError=void 0;const s=n(e,t);return e.flags&exports.Flags.AllowBinding&&r&exports.Flags.AllowBinding||(e.flags&=~exports.Flags.AllowBinding),e.flags&exports.Flags.AllowDestructuring&&r&exports.Flags.AllowDestructuring||(e.flags&=~exports.Flags.AllowDestructuring),e.pendingExpressionError=o||e.pendingExpressionError,s}function swapContext(e,t,n,r,o=exports.ObjectState.None){return t&=~(exports.Context.Async|exports.Context.Yield|exports.Context.InParameter),n&exports.ModifierState.Generator&&(t|=exports.Context.Yield),n&exports.ModifierState.Await&&(t|=exports.Context.Async),r(e,t,o)}function validateParams(e,t,n){const r=new Map;for(let o=0;o<n.length;o++){const s=`@${n[o]}`;r.get(s)?tolerant(e,t,81):r.set(s,!0)}}const reinterpret=(e,t,n)=>{switch(n.type){case"Identifier":t&exports.Context.Strict&&nameIsArgumentsOrEval(n.name)&&report(e,3);case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":case"RestElement":case"MetaProperty":return;case"ArrayExpression":n.type="ArrayPattern";for(let r=0;r<n.elements.length;++r)null!==n.elements[r]&&reinterpret(e,t,n.elements[r]);return;case"ObjectExpression":n.type="ObjectPattern";for(let r=0;r<n.properties.length;r++)reinterpret(e,t,n.properties[r]);return;case"Property":return void reinterpret(e,t,n.value);case"SpreadElement":n.type="RestElement","ArrayExpression"===n.argument.type||"ObjectExpression"===n.argument.type||isValidSimpleAssignmentTarget(n.argument)||tolerant(e,t,71),reinterpret(e,t,n.argument);break;case"AssignmentExpression":return n.type="AssignmentPattern",delete n.operator,void reinterpret(e,t,n.left);case"MemberExpression":if(!(t&exports.Context.InParameter))return;default:tolerant(e,t,t&exports.Context.InParameter?77:73,n.type)}};function lookahead(e,t,n){const{tokenValue:r,flags:o,line:s,column:a,startColumn:i,index:p,lastColumn:c,startLine:l,lastLine:x,lastIndex:u,startIndex:d,tokenRaw:m,token:f,lastValue:g,tokenRegExp:S,labelSet:C,errors:k,errorLocation:E,pendingExpressionError:h}=e,y=n(e,t);return e.index=p,e.token=f,e.tokenValue=r,e.tokenValue=r,e.flags=o,e.line=s,e.column=a,e.tokenRaw=m,e.lastValue=g,e.startColumn=i,e.lastColumn=c,e.startLine=l,e.lastLine=x,e.lastIndex=u,e.startIndex=d,e.tokenRegExp=S,e.labelSet=C,e.errors=k,e.errorLocation=E,e.tokenRegExp=S,e.pendingExpressionError=h,y}function isValidSimpleAssignmentTarget(e){return"Identifier"===e.type||"MemberExpression"===e.type}function getLocation(e){return{line:e.startLine,column:e.startColumn,index:e.startIndex}}function isValidIdentifier(e,t){return e&exports.Context.Strict?!(e&exports.Context.Module&&262144&t)&&(!(1073741824&t)&&(131072==(131072&t)||69632==(69632&t))):131072==(131072&t)||69632==(69632&t)||20480==(20480&t)}function isLexical(e,t){nextToken(e,t);const{token:n}=e;return!!(1082523648&n||33574984===n||69632==(69632&n))}function isEndOfCaseOrDefaultClauses(e){return 12368===e.token||17825807===e.token||12363===e.token}function nextTokenIsLeftParenOrPeriod(e,t){return nextToken(e,t),50331659===e.token||16777229===e.token}function nextTokenisIdentifierOrParen(e,t){nextToken(e,t);const{token:n}=e;return 1073872896&n||50331659===n}function nextTokenIsLeftParen(e,t){return nextToken(e,t),50331659===e.token}function nextTokenIsFuncKeywordOnSameLine(e,t){return nextToken(e,t),!(e.flags&exports.Flags.NewLine)&&33566808===e.token}function isPropertyWithPrivateFieldKey(e){return!!e.property&&"PrivateName"===e.property.type}function parseAndClassifyIdentifier(e,t){const{token:n,tokenValue:r}=e;if(t&exports.Context.Strict){if(t&exports.Context.Module&&262144&n&&tolerant(e,t,40,tokenDesc(e.token)),1073741824&n&&tolerant(e,t,40,tokenDesc(e.token)),131072==(131072&n)||69632==(69632&n))return parseIdentifier(e,t);report(e,1,tokenDesc(e.token))}if(t&exports.Context.Yield&&1073741824&n&&tolerant(e,t,40,tokenDesc(e.token)),t&exports.Context.Async&&262144&n&&tolerant(e,t,40,tokenDesc(e.token)),131072==(131072&n)||69632==(69632&n)||20480==(20480&n))return parseIdentifier(e,t);report(e,1,tokenDesc(e.token))}function nameIsArgumentsOrEval(e){return"eval"===e||"arguments"===e}function setPendingError(e){e.errorLocation={line:e.startLine,column:e.startColumn,index:e.startIndex}}function isEqualTagNames(e){switch(e.type){case"JSXIdentifier":return e.name;case"JSXNamespacedName":return`${isEqualTagNames(e.namespace)}:${isEqualTagNames(e.name)}`;case"JSXMemberExpression":return`${isEqualTagNames(e.object)}.${isEqualTagNames(e.property)}`}}function isInstanceField(e){const{token:t}=e;return 17825807===t||17825809===t||83886109===t}function validateUpdateExpression(e,t,n,r){t&exports.Context.Strict&&nameIsArgumentsOrEval(n.name)&&tolerant(e,t,68,r),isValidSimpleAssignmentTarget(n)||tolerant(e,t,5)}function setPendingExpressionError(e,t){e.pendingExpressionError={error:errorMessages[t],line:e.line,column:e.column,index:e.index}}function validateCoverParenthesizedExpression(e,t){const{token:n}=e;return 8388608&n?e.flags|=exports.Flags.SimpleParameterList:4194304==(4194304&n)?(setPendingError(e),t|=exports.CoverParenthesizedState.HasEvalOrArguments):20480==(20480&n)?(setPendingError(e),t|=exports.CoverParenthesizedState.HasReservedWords):262144==(262144&n)&&(setPendingError(e),e.flags|=exports.Flags.HasAwait),t}function validateAsyncArgumentList(e,t,n){const{token:r}=e;return e.flags&exports.Flags.AllowBinding?8388608&r?e.flags|=exports.Flags.SimpleParameterList:4194304==(4194304&r)?(setPendingError(e),n|=exports.CoverCallState.EvalOrArguments):262144==(262144&r)?(setPendingError(e),n|=exports.CoverCallState.Await):1073741824==(1073741824&r)&&(setPendingError(e),n|=exports.CoverCallState.Yield):tolerant(e,t,77),n}function isIterationStatement(e){return 12369===e||12386===e||12374===e}function isInOrOf(e){return 69746===e||167786289===e}const errorMessages={0:"Unexpected token",1:"Unexpected token '%0'",2:"Expected token '%0'",3:"Keyword must not contain escaped characters",4:"Keyword '%0' is reserved",5:"Invalid left-hand side in assignment",6:"Unterminated string literal",7:"Unterminated regular expression literal",8:"Unterminated MultiLineComment",9:"Unterminated template literal",10:"Invalid character '%0'",11:"Octal escapes are not allowed in strict mode",13:"Escapes \\8 or \\9 are not syntactically valid escapes",14:"Unicode escape code point out of range",15:"Duplicate regular expression flag '%0'",16:"Unexpected regular expression flag '%0'",17:"Eval or arguments can't be assigned to in strict mode code",18:"Illegal return statement",19:"In strict mode code, functions can only be declared at top level or inside a block",20:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",21:"%0 can't appear in single-statement context",22:"Generators can only be declared at the top level or inside a block",23:"'for await' loop should be used with 'of'",24:"Missing initializer in %0 declaration",25:"'for-%0' loop variable declaration may not have an initializer",26:"Invalid left-hand side in for-%0 loop: Must have a single binding.",27:"let is disallowed as a lexically bound name",28:"Lexical declaration cannot appear in a single-statement context",29:"Label '%0' has already been declared",30:"%0 statement must be nested within an iteration statement",31:"Illegal continue statement: '%0' does not denote an iteration statement",32:"Undefined label '%0'",33:"More than one default clause in switch statement",34:"%0 declarations may only appear at top level of a module",35:"Async functions can only be declared at the top level or inside a block",36:"No line break is allowed after '%0'",37:"Strict mode code may not include a with statement",38:"Await is only valid in async functions",39:"Function declaration must have a name in this context",12:"Duplicate constructor method in class",40:"'%0' may not be used as an identifier in this context",43:"Delete of an unqualified identifier in strict mode",44:"Private fields can not be deleted",41:"Classes may not have a private field named '#constructor'",42:"Classes may not have a field named 'constructor'",45:"Class constructor may not be a '%0'",46:"Unexpected reserved word",47:"Unexpected eval or arguments in strict mode",48:"'await' is not a valid identifier inside an async function",49:"'yield' is not a valid identifier inside an generator function",50:"Unexpected strict mode reserved word",52:"Await expression not allowed in formal parameter",51:"Yield expression not allowed in formal parameter",53:"new.target only allowed within functions",54:"super() is not allowed in this context",55:"Member access from super not allowed in this context",56:'Only "(" or "." or "[" are allowed after \'super\'',57:"'yield' is a reserved keyword within generator function bodies",58:"Only one underscore is allowed as numeric separator",59:"Numeric separators are not allowed at the end of numeric literals",60:"Numeric separator can not be used after leading 0.",61:"Legacy octal literals are not allowed in strict mode",62:"Invalid left-hand side in assignment",63:"Property name __proto__ appears more than once in object literal",64:"Illegal 'use strict' directive in function with non-simple parameter list",65:"Classes may not have a static property named 'prototype'",66:"%0 functions must have %1 argument%2",67:"Setter function argument must not be a rest parameter",68:"%0 increment/decrement may not have eval or arguments operand in strict mode",69:"Elision not allowed in object property list",70:"Rest element must be last element",72:"Spread element must be last element",71:"Rest parameter may not have a default initializer",73:"Invalid destructuring assignment target",74:"Unexpected surrogate pair",75:"Malformed %0 character escape sequence",76:"Template literals may not contain octal escape sequences",77:"Invalid binding pattern",78:"Rest parameter must be last formal parameter",79:"Missing catch or finally after try",80:"Illegal newline after throw",81:"Duplicate parameter name not allowed in this context",82:"Missing keyword 'as' after import *",83:"Labels must be followed by a ':'",84:"JSX attributes must only be assigned a non-empty 'expression'",85:"Expected corresponding JSX closing tag for %0",86:"Adjacent JSX elements must be wrapped in an enclosing tag",87:"Invalid JSX attribute value",88:"Rest element may not have a trailing comma",89:"Undefined Unicode code-point",90:"HTML comments are not allowed in modules",91:"Invalid shorthand property initializer",92:"Trailing decorator may be followed by method",93:"Decorators can't be used with a constructor",94:"`...` must be followed by an identifier in declaration contexts"};function constructError(e,t,n,r,o,s){const a=new SyntaxError(`Line ${r}, column ${o}: ${s}`);if(a.index=n,a.line=r,a.column=o,a.description=s,!(t&exports.Context.OptionsTolerant))throw a;e.errors.push(a)}function getErrorLocation(e){let{index:t,startLine:n,startColumn:r}=e;const o=e.errorLocation;return o&&(t=o.index,n=o.line,r=o.column),{index:t,line:n,column:r}}function report(e,t,...n){const{index:r,line:o,column:s}=getErrorLocation(e),a=errorMessages[t].replace(/%(\d+)/g,(e,t)=>n[t]);constructError(e,exports.Context.Empty,r,o,s,a)}function tolerant(e,t,n,...r){const{index:o,line:s,column:a}=getErrorLocation(e);constructError(e,t,o,s,a,errorMessages[n].replace(/%(\d+)/g,(e,t)=>r[t]))}function parseClassDeclaration(e,t){const n=getLocation(e);let r=[];t&exports.Context.OptionsExperimental&&(r=parseDecorators(e,t)),expect(e,t|exports.Context.DisallowEscapedKeyword,33566797);const o=t&exports.Context.RequireIdentifier&&33685505!==e.token?null:parseBindingIdentifier(e,t|exports.Context.Strict|exports.Context.DisallowEscapedKeyword);let s=exports.ObjectState.None,a=null;consume(e,t,12372)&&(a=parseLeftHandSideExpression(e,t|exports.Context.Strict,n),s|=exports.ObjectState.Heritage);const i=parseClassBodyAndElementList(e,t&~exports.Context.RequireIdentifier|exports.Context.Strict|exports.Context.InClass,s);return finishNode(t,e,n,t&exports.Context.OptionsExperimental?{type:"ClassDeclaration",id:o,superClass:a,body:i,decorators:r}:{type:"ClassDeclaration",id:o,superClass:a,body:i})}function parseFunctionDeclaration(e,t){const n=getLocation(e);expect(e,t,33566808);let r=exports.ModifierState.None;return consume(e,t,167774771)&&(t&exports.Context.AllowSingleStatement&&!(t&exports.Context.InFunctionBody)&&tolerant(e,t,22),r=exports.ModifierState.Generator),parseFunctionDeclarationBody(e,t,r,n)}function parseFunctionDeclarationBody(e,t,n,r){const{token:o}=e;let s=null;t&exports.Context.Yield&&1073741824&o&&tolerant(e,t,49),t&exports.Context.Async&&262144&o&&tolerant(e,t,48),50331659!==o?s=parseBindingIdentifier(e,t):t&exports.Context.RequireIdentifier||tolerant(e,t,39);const{params:a,body:i}=swapContext(e,t&~(exports.Context.Method|exports.Context.AllowSuperProperty|exports.Context.RequireIdentifier),n,parseFormalListAndBody);return finishNode(t,e,r,{type:"FunctionDeclaration",params:a,body:i,async:!!(n&exports.ModifierState.Await),generator:!!(n&exports.ModifierState.Generator),expression:!1,id:s})}function parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t){const n=getLocation(e);expect(e,t,594028),expect(e,t,33566808);const r=exports.ModifierState.Await;return parseFunctionDeclarationBody(e,t,(consume(e,t,167774771)?exports.ModifierState.Generator:exports.ModifierState.None)|r,n)}function parseVariableDeclaration(e,t,n){const r=getLocation(e),o=0!=(8388608&e.token),s=parseBindingIdentifierOrPattern(e,t);let a=null;return consume(e,t|exports.Context.DisallowEscapedKeyword,83886109)?(a=parseExpressionCoverGrammar(e,t&~(exports.Context.BlockScope|exports.Context.ForStatement),parseAssignmentExpression),isInOrOf(e.token)&&(t&exports.Context.ForStatement||o)&&(167786289===e.token?(t&(exports.Context.BlockScope|exports.Context.Strict|exports.Context.Async)||o)&&tolerant(e,t,25,tokenDesc(e.token)):tolerant(e,t,25,tokenDesc(e.token)))):isInOrOf(e.token)||!n&&!o||tolerant(e,t,24,n?"const":"destructuring"),finishNode(t,e,r,{type:"VariableDeclarator",init:a,id:s})}function parseVariableDeclarationList(e,t,n){const r=[parseVariableDeclaration(e,t,n)];for(;consume(e,t,16777234);)r.push(parseVariableDeclaration(e,t,n));return t&exports.Context.ForStatement&&isInOrOf(e.token)&&1!==r.length&&tolerant(e,t,26,tokenDesc(e.token)),r}function parseStatementListItem(e,t){switch(e.token){case 33566808:return parseFunctionDeclaration(e,t);case 120:case 33566797:return parseClassDeclaration(e,t);case 33574984:return parseLetOrExpressionStatement(e,t|exports.Context.AllowIn);case 33566793:return parseVariableStatement(e,t|exports.Context.BlockScope|exports.Context.AllowIn);case 594028:return parseAsyncFunctionDeclarationOrStatement(e,t);case 33566810:if(t&exports.Context.OptionsNext&&lookahead(e,t,nextTokenIsLeftParenOrPeriod))return parseExpressionStatement(e,t|exports.Context.AllowIn);case 12371:t&exports.Context.Module&&tolerant(e,t,34,tokenDesc(e.token));default:return parseStatement(e,t|exports.Context.AllowSingleStatement)}}function parseStatement(e,t){switch(e.token){case 33566791:return parseVariableStatement(e,t|exports.Context.AllowIn);case 17825809:return parseEmptyStatement(e,t);case 33566814:return parseSwitchStatement(e,t);case 41943052:return parseBlockStatement(e,t);case 12380:return parseReturnStatement(e,t);case 12377:return parseIfStatement(e,t);case 12369:return parseDoWhileStatement(e,t);case 12386:return parseWhileStatement(e,t);case 12387:return parseWithStatement(e,t);case 12362:return parseBreakStatement(e,t);case 12366:return parseContinueStatement(e,t);case 12367:return parseDebuggerStatement(e,t);case 302002272:return parseThrowStatement(e,t);case 12385:return parseTryStatement(e,t|exports.Context.DisallowEscapedKeyword);case 12374:return parseForStatement(e,t|exports.Context.ForStatement);case 594028:return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)&&tolerant(e,t,35),parseExpressionOrLabelledStatement(e,t|exports.Context.AllowSingleStatement);case 33566808:tolerant(e,t,t&exports.Context.Strict?19:20);case 33566797:tolerant(e,t,21,tokenDesc(e.token));default:return parseExpressionOrLabelledStatement(e,t)}}function parseEmptyStatement(e,t){const n=getLocation(e);return nextToken(e,t),finishNode(t,e,n,{type:"EmptyStatement"})}function parseContinueStatement(e,t){const n=getLocation(e);nextToken(e,t),e.flags&(exports.Flags.InSwitchStatement|exports.Flags.InIterationStatement)||tolerant(e,t,30,tokenDesc(e.token));let r=null;if(!(e.flags&exports.Flags.NewLine)&&135168&e.token){const{tokenValue:n}=e;r=parseIdentifier(e,t),validateBreakOrContinueLabel(e,t,n,!0)}return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ContinueStatement",label:r})}function parseBreakStatement(e,t){const n=getLocation(e);nextToken(e,t);let r=null;if(!(e.flags&exports.Flags.NewLine)&&135168&e.token){const{tokenValue:n}=e;r=parseIdentifier(e,t),validateBreakOrContinueLabel(e,t,n,!1)}else e.flags&(exports.Flags.InSwitchStatement|exports.Flags.InIterationStatement)||tolerant(e,t,30,"break");return consumeSemicolon(e,t),finishNode(t,e,n,{type:"BreakStatement",label:r})}function parseIfStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"IfStatement",test:r,consequent:parseConsequentOrAlternate(e,t|exports.Context.DisallowEscapedKeyword),alternate:consume(e,t,12370)?parseConsequentOrAlternate(e,t):null})}function parseConsequentOrAlternate(e,t){return t&exports.Context.Strict||33566808!==e.token?parseStatement(e,t&~exports.Context.AllowSingleStatement):parseFunctionDeclaration(e,t)}function parseDebuggerStatement(e,t){const n=getLocation(e);return nextToken(e,t),consumeSemicolon(e,t),finishNode(t,e,n,{type:"DebuggerStatement"})}function parseTryStatement(e,t){const n=getLocation(e);nextToken(e,t);const r=parseBlockStatement(e,t),o=12364===e.token?parseCatchBlock(e,t):null,s=consume(e,t,12373)?parseBlockStatement(e,t):null;return o||s||tolerant(e,t,79),finishNode(t,e,n,{type:"TryStatement",block:r,handler:o,finalizer:s})}function parseCatchBlock(e,t){const n=getLocation(e);nextToken(e,t);let r=null;if(consume(e,t,50331659)){const n=[];r=parseBindingIdentifierOrPattern(e,t,n),validateParams(e,t,n),expect(e,t,16)}return finishNode(t,e,n,{type:"CatchClause",param:r,body:parseBlockStatement(e,t)})}function parseThrowStatement(e,t){const n=getLocation(e);nextToken(e,t),e.flags&exports.Flags.NewLine&&tolerant(e,t,80);const r=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ThrowStatement",argument:r})}function parseExpressionStatement(e,t){const n=getLocation(e),r=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:r})}function parseDirective(e,t){const n=getLocation(e),r=e.tokenRaw.slice(1,-1),o=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:o,directive:r})}function parseExpressionOrLabelledStatement(e,t){const n=getLocation(e),{tokenValue:r,token:o}=e,s=parseExpression(e,t&~(exports.Context.AllowSingleStatement|exports.Context.AllowDecorator)|exports.Context.AllowIn);if(135168&o&&16777237===e.token){t&exports.Context.Yield&&1073741824&o&&tolerant(e,t,57),expect(e,t,16777237,83),hasLabel(e,r)&&tolerant(e,t,29,r),addLabel(e,r);const a=!(t&exports.Context.Strict)&&t&exports.Context.AllowSingleStatement&&33566808===e.token?parseFunctionDeclaration(e,t):parseStatement(e,t);return popLabel(e,r),finishNode(t,e,n,{type:"LabeledStatement",label:s,body:a})}return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:s})}function parseDoWhileStatement(e,t){const n=getLocation(e);nextToken(e,t);const r=parseIterationStatement(e,t);expect(e,t,12386),expect(e,t,50331659);const o=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn);return expect(e,t,16),consume(e,t,17825809),finishNode(t,e,n,{type:"DoWhileStatement",body:r,test:o})}function parseWhileStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"WhileStatement",test:r,body:parseIterationStatement(e,t)})}function parseBlockStatement(e,t){const n=getLocation(e),r=[];for(expect(e,t,41943052);17825807!==e.token;)r.push(parseStatementListItem(e,t));return expect(e,t,17825807),finishNode(t,e,n,{type:"BlockStatement",body:r})}function parseReturnStatement(e,t){const n=getLocation(e);t&(exports.Context.OptionsGlobalReturn|exports.Context.InFunctionBody)||tolerant(e,t,18),e.flags&exports.Flags.EscapedKeyword&&tolerant(e,t,3),nextToken(e,t);const r=1048576&e.token||e.flags&exports.Flags.NewLine?null:parseExpression(e,t&~(exports.Context.InFunctionBody|exports.Context.AllowDecorator)|exports.Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ReturnStatement",argument:r})}function parseIterationStatement(e,t){const n=e.flags;e.flags|=exports.Flags.InIterationStatement|exports.Flags.AllowDestructuring;const r=parseStatement(e,t&~exports.Context.AllowSingleStatement|exports.Context.DisallowEscapedKeyword);return e.flags=n,r}function parseWithStatement(e,t){t&exports.Context.Strict&&tolerant(e,t,37);const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"WithStatement",object:r,body:parseStatement(e,t&~exports.Context.AllowSingleStatement)})}function parseSwitchStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn);expect(e,t,16),expect(e,t|exports.Context.DisallowEscapedKeyword,41943052);const o=[],s=e.flags;e.flags|=exports.Flags.InSwitchStatement;let a=!1;for(;17825807!==e.token;){const n=parseCaseOrDefaultClauses(e,t);o.push(n),null===n.test&&(a&&tolerant(e,t,33),a=!0)}return e.flags=s,expect(e,t,17825807),finishNode(t,e,n,{type:"SwitchStatement",discriminant:r,cases:o})}function parseCaseOrDefaultClauses(e,t){const n=getLocation(e);let r=null;consume(e,t,12363)?r=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn):expect(e,t,12368),expect(e,t,16777237);const o=[];for(;!isEndOfCaseOrDefaultClauses(e);)o.push(parseStatementListItem(e,t|exports.Context.AllowIn));return finishNode(t,e,n,{type:"SwitchCase",test:r,consequent:o})}function parseVariableStatement(e,t,n=!0){const r=getLocation(e),{token:o}=e,s=33566793===o;nextToken(e,t);const a=parseVariableDeclarationList(e,t,s);return n&&consumeSemicolon(e,t),finishNode(t,e,r,{type:"VariableDeclaration",kind:tokenDesc(o),declarations:a})}function parseLetOrExpressionStatement(e,t,n=!0){return lookahead(e,t,isLexical)?parseVariableStatement(e,t|exports.Context.BlockScope,n):parseExpressionOrLabelledStatement(e,t)}function parseAsyncFunctionDeclarationOrStatement(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t):parseStatement(e,t)}function parseForStatement(e,t){const n=getLocation(e);expect(e,t,12374);const r=!!(t&exports.Context.Async&&consume(e,t,34017389));expect(e,t|exports.Context.DisallowEscapedKeyword,50331659);const{token:o}=e;let s,a=null,i=null,p=null,c="ForStatement",l=null,x=null;33566793===o||33574984===o&&lookahead(e,t,isLexical)?p=parseVariableStatement(e,t&~exports.Context.AllowIn|exports.Context.BlockScope,!1):33566791===o?p=parseVariableStatement(e,t&~exports.Context.AllowIn,!1):17825809!==o&&(i=getLocation(e),a=restoreExpressionCoverGrammar(e,t&~exports.Context.AllowIn|exports.Context.DisallowEscapedKeyword,parseAssignmentExpression)),consume(e,t,69746)?(c="ForOfStatement",a?(e.flags&exports.Flags.AllowDestructuring&&"AssignmentExpression"!==a.type||tolerant(e,t,73),reinterpret(e,t,a)):a=p,s=parseAssignmentExpression(e,t|exports.Context.AllowIn)):consume(e,t,167786289)?(a?(e.flags&exports.Flags.AllowDestructuring||tolerant(e,t,73),reinterpret(e,t,a)):a=p,c="ForInStatement",s=parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn)):(16777234===e.token&&(a=parseSequenceExpression(e,t,a,i)),p&&(a=p),expect(e,t,17825809),l=17825809!==e.token?parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn):null,expect(e,t,17825809),x=16!==e.token?parseExpression(e,t&~exports.Context.AllowDecorator|exports.Context.AllowIn):null),expect(e,t,16);const u=parseIterationStatement(e,t);return finishNode(t,e,n,"ForOfStatement"===c?{type:c,body:u,left:a,right:s,await:r}:s?{type:c,body:u,left:a,right:s}:{type:c,body:u,init:a,test:l,update:x})}function parseModuleItemList(e,t){nextToken(e,t);const n=[];for(;1048576!==e.token;)n.push(33554435===e.token?parseDirective(e,t):parseModuleItem(e,t|exports.Context.AllowIn));return n}function parseModuleItem(e,t){switch(e.token){case 120:return parseDecorators(e,t);case 12371:return parseExportDeclaration(e,t);case 33566810:if(!(t&exports.Context.OptionsNext&&lookahead(e,t,nextTokenIsLeftParenOrPeriod)))return parseImportDeclaration(e,t);default:return parseStatementListItem(e,t)}}function parseExportDeclaration(e,t){const n=getLocation(e),r=[];let o=null,s=null;switch(expect(e,t|exports.Context.DisallowEscapedKeyword,12371),e.token){case 167774771:return parseExportAllDeclaration(e,t,n);case 12368:return parseExportDefault(e,t,n);case 41943052:{expect(e,t,41943052);let n=!1;for(;17825807!==e.token;)69743!==e.token&&12288&e.token&&(n=!0,setPendingError(e)),r.push(parseNamedExportDeclaration(e,t)),17825807!==e.token&&expect(e,t,16777234);expect(e,t|exports.Context.DisallowEscapedKeyword,17825807),69745===e.token?o=parseModuleSpecifier(e,t):n&&tolerant(e,t,46),consumeSemicolon(e,t);break}case 33566797:s=parseClassDeclaration(e,t);break;case 33574984:case 33566793:s=parseVariableStatement(e,t|exports.Context.BlockScope);break;case 33566791:s=parseVariableStatement(e,t);break;case 33566808:s=parseFunctionDeclaration(e,t);break;case 594028:if(lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)){s=parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t);break}default:report(e,1,tokenDesc(e.token))}return finishNode(t,e,n,{type:"ExportNamedDeclaration",source:o,specifiers:r,declaration:s})}function parseExportAllDeclaration(e,t,n){expect(e,t,167774771);const r=parseModuleSpecifier(e,t);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExportAllDeclaration",source:r})}function parseNamedExportDeclaration(e,t){const n=getLocation(e),r=parseIdentifierName(e,t|exports.Context.DisallowEscapedKeyword,e.token);return finishNode(t,e,n,{type:"ExportSpecifier",local:r,exported:consume(e,t,167843947)?parseIdentifierName(e,t,e.token):r})}function parseExportDefault(e,t,n){let r;switch(expect(e,t|exports.Context.DisallowEscapedKeyword,12368),e.token){case 33566808:r=parseFunctionDeclaration(e,t|exports.Context.RequireIdentifier);break;case 120:case 33566797:r=parseClassDeclaration(e,t&~exports.Context.AllowIn|exports.Context.RequireIdentifier);break;case 594028:r=parseAsyncFunctionOrAssignmentExpression(e,t|exports.Context.RequireIdentifier);break;default:r=parseAssignmentExpression(e,t|exports.Context.AllowIn),consumeSemicolon(e,t)}return finishNode(t,e,n,{type:"ExportDefaultDeclaration",declaration:r})}function parseImportDeclaration(e,t){const n=getLocation(e);let r;expect(e,t,33566810);let o=[];return 33554435===e.token?r=parseLiteral(e,t):(o=parseImportClause(e,t|exports.Context.DisallowEscapedKeyword),r=parseModuleSpecifier(e,t)),consumeSemicolon(e,t),finishNode(t,e,n,{type:"ImportDeclaration",specifiers:o,source:r})}function parseImportClause(e,t){const n=[];switch(e.token){case 33685505:if(n.push(parseImportDefaultSpecifier(e,t)),consume(e,t,16777234))switch(e.token){case 167774771:parseNameSpaceImport(e,t,n);break;case 41943052:parseNamedImports(e,t,n);break;default:tolerant(e,t,1,tokenDesc(e.token))}break;case 41943052:parseNamedImports(e,t,n);break;case 167774771:parseNameSpaceImport(e,t,n);break;default:report(e,1,tokenDesc(e.token))}return n}function parseNamedImports(e,t,n){for(expect(e,t,41943052);17825807!==e.token;)n.push(parseImportSpecifier(e,t)),17825807!==e.token&&expect(e,t,16777234);expect(e,t,17825807)}function parseImportSpecifier(e,t){const n=getLocation(e),{token:r}=e,o=parseIdentifierName(e,t|exports.Context.DisallowEscapedKeyword,r);let s;return consume(e,t,167843947)?s=parseBindingIdentifier(e,t):(hasBit(r,12288)&&tolerant(e,t,46),hasBit(r,4194304)&&tolerant(e,t,47),s=o),finishNode(t,e,n,{type:"ImportSpecifier",local:s,imported:o})}function parseNameSpaceImport(e,t,n){const r=getLocation(e);expect(e,t,167774771),expect(e,t,167843947,82);const o=parseBindingIdentifier(e,t);n.push(finishNode(t,e,r,{type:"ImportNamespaceSpecifier",local:o}))}function parseModuleSpecifier(e,t){return expect(e,t,69745),33554435!==e.token&&report(e,1,tokenDesc(e.token)),parseLiteral(e,t)}function parseImportDefaultSpecifier(e,t){return finishNode(t,e,getLocation(e),{type:"ImportDefaultSpecifier",local:parseIdentifier(e,t)})}function parseAsyncFunctionOrAssignmentExpression(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t|exports.Context.RequireIdentifier):parseAssignmentExpression(e,t|exports.Context.AllowIn)}function createParser(e,t){return{source:e,length:e.length,index:0,line:1,column:0,startIndex:0,startColumn:0,startLine:1,lastIndex:0,lastColumn:0,lastLine:0,pendingExpressionError:void 0,flags:exports.Flags.AllowDestructuring,token:1048576,tokenRaw:"",lastValue:0,comments:[],sourceFile:t,tokenRegExp:void 0,tokenValue:void 0,labelSet:void 0,errorLocation:void 0,errors:[]}}function parseSource(e,t,n){let r="";t&&(t.module&&(n|=exports.Context.Module),t.next&&(n|=exports.Context.OptionsNext),t.jsx&&(n|=exports.Context.OptionsJSX),t.ranges&&(n|=exports.Context.OptionsRanges),t.loc&&(n|=exports.Context.OptionsLoc),t.raw&&(n|=exports.Context.OptionsRaw),t.rawIdentifier&&(n|=exports.Context.OptionsRawidentifiers),t.globalReturn&&(n|=exports.Context.OptionsGlobalReturn),t.skipShebang&&(n|=exports.Context.OptionsShebang),t.tolerant&&(n|=exports.Context.OptionsTolerant),t.source&&(r=t.source),t.comments&&(n|=exports.Context.OptionsComments),t.impliedStrict&&(n|=exports.Context.Strict),t.experimental&&(n|=exports.Context.OptionsExperimental),t.node&&(n|=exports.Context.OptionsNode));const o=createParser(e,r),s=n&exports.Context.Module?parseModuleItemList(o,n):parseStatementList(o,n),a={type:"Program",sourceType:n&exports.Context.Module?"module":"script",body:s};return n&exports.Context.LocationTracker&&(n&exports.Context.OptionsRanges&&(a.start=0,a.end=e.length),n&exports.Context.OptionsLoc&&(a.loc={start:{line:1,column:0},end:{line:o.line,column:o.column}},r&&(a.loc.source=r))),n&exports.Context.OptionsComments&&(a.comments=o.comments),n&exports.Context.OptionsTolerant&&(a.errors=o.errors),a}function parseStatementList(e,t){const n=[];let r=!0;for(nextToken(e,t|exports.Context.DisallowEscapedKeyword);1048576!==e.token;)r&&33554435!==e.token&&(r=!1),r?(t&exports.Context.Strict||12!==e.tokenRaw.length||"use strict"!==e.tokenValue||(t|=exports.Context.Strict),n.push(parseDirective(e,t))):n.push(parseStatementListItem(e,t));return n}function parse(e,t){return t&&t.module?parseModule(e,t):parseScript(e,t)}function parseScript(e,t){return parseSource(e,t,exports.Context.Empty)}function parseModule(e,t){return parseSource(e,t,exports.Context.Strict|exports.Context.Module)}var estree=Object.freeze({}),index=Object.freeze({scanIdentifier:scanIdentifier,scanMaybeIdentifier:scanMaybeIdentifier,scanHexIntegerLiteral:scanHexIntegerLiteral,scanOctalOrBinary:scanOctalOrBinary,scanImplicitOctalDigits:scanImplicitOctalDigits,scanSignedInteger:scanSignedInteger,scanNumericLiteral:scanNumericLiteral,scanNumericSeparator:scanNumericSeparator,scanDecimalDigitsOrSeparator:scanDecimalDigitsOrSeparator,scanDecimalAsSmi:scanDecimalAsSmi,scanRegularExpression:scanRegularExpression,scan:scan,scanEscapeSequence:scanEscapeSequence,throwStringError:throwStringError,scanString:scanString,consumeTemplateBrace:consumeTemplateBrace,scanTemplate:scanTemplate,skipSingleHTMLComment:skipSingleHTMLComment,skipSingleLineComment:skipSingleLineComment,skipMultiLineComment:skipMultiLineComment,addComment:addComment,nextUnicodeChar:nextUnicodeChar,isIdentifierPart:isIdentifierPart,escapeInvalidCharacters:escapeInvalidCharacters,consumeOpt:consumeOpt,consumeLineFeed:consumeLineFeed,scanPrivateName:scanPrivateName,advanceNewline:advanceNewline,fromCodePoint:fromCodePoint,readNext:readNext,toHex:toHex,advanceOnMaybeAstral:advanceOnMaybeAstral}),parser=Object.freeze({parseClassDeclaration:parseClassDeclaration,parseFunctionDeclaration:parseFunctionDeclaration,parseAsyncFunctionOrAsyncGeneratorDeclaration:parseAsyncFunctionOrAsyncGeneratorDeclaration,parseVariableDeclarationList:parseVariableDeclarationList,parseExpression:parseExpression,parseSequenceExpression:parseSequenceExpression,parseAssignmentExpression:parseAssignmentExpression,parseRestElement:parseRestElement,parseLeftHandSideExpression:parseLeftHandSideExpression,parsePrimaryExpression:parsePrimaryExpression,parseIdentifier:parseIdentifier,parseLiteral:parseLiteral,parseBigIntLiteral:parseBigIntLiteral,parseIdentifierName:parseIdentifierName,parseFunctionExpression:parseFunctionExpression,parseAsyncFunctionOrAsyncGeneratorExpression:parseAsyncFunctionOrAsyncGeneratorExpression,parsePropertyName:parsePropertyName,parseObjectLiteral:parseObjectLiteral,parseFormalListAndBody:parseFormalListAndBody,parseFunctionBody:parseFunctionBody,parseFormalParameters:parseFormalParameters,parseFormalParameterList:parseFormalParameterList,parseClassBodyAndElementList:parseClassBodyAndElementList,parseClassElement:parseClassElement,parseDecorators:parseDecorators,parseModuleItemList:parseModuleItemList,parseModuleItem:parseModuleItem,parseExportDeclaration:parseExportDeclaration,parseImportDeclaration:parseImportDeclaration,createParser:createParser,parseSource:parseSource,parseStatementList:parseStatementList,parse:parse,parseScript:parseScript,parseModule:parseModule,parseBindingIdentifierOrPattern:parseBindingIdentifierOrPattern,parseBindingIdentifier:parseBindingIdentifier,parseAssignmentRestElement:parseAssignmentRestElement,parseAssignmentPattern:parseAssignmentPattern,parseBindingInitializer:parseBindingInitializer,parseStatementListItem:parseStatementListItem,parseStatement:parseStatement,parseEmptyStatement:parseEmptyStatement,parseContinueStatement:parseContinueStatement,parseBreakStatement:parseBreakStatement,parseIfStatement:parseIfStatement,parseDebuggerStatement:parseDebuggerStatement,parseTryStatement:parseTryStatement,parseCatchBlock:parseCatchBlock,parseThrowStatement:parseThrowStatement,parseExpressionStatement:parseExpressionStatement,parseDirective:parseDirective,parseExpressionOrLabelledStatement:parseExpressionOrLabelledStatement,parseDoWhileStatement:parseDoWhileStatement,parseWhileStatement:parseWhileStatement,parseBlockStatement:parseBlockStatement,parseReturnStatement:parseReturnStatement,parseIterationStatement:parseIterationStatement,parseWithStatement:parseWithStatement,parseSwitchStatement:parseSwitchStatement,parseCaseOrDefaultClauses:parseCaseOrDefaultClauses,parseVariableStatement:parseVariableStatement,parseJSXRootElement:parseJSXRootElement,parseJSXOpeningElement:parseJSXOpeningElement,nextJSXToken:nextJSXToken,scanJSXToken:scanJSXToken,parseJSXText:parseJSXText,parseJSXAttributes:parseJSXAttributes,parseJSXSpreadAttribute:parseJSXSpreadAttribute,parseJSXNamespacedName:parseJSXNamespacedName,parseJSXAttributeName:parseJSXAttributeName,parseJSXAttribute:parseJSXAttribute,parseJSXEmptyExpression:parseJSXEmptyExpression,parseJSXSpreadChild:parseJSXSpreadChild,parseJSXExpressionContainer:parseJSXExpressionContainer,parseJSXExpression:parseJSXExpression,parseJSXClosingFragment:parseJSXClosingFragment,parseJSXClosingElement:parseJSXClosingElement,parseJSXIdentifier:parseJSXIdentifier,parseJSXMemberExpression:parseJSXMemberExpression,parseJSXElementName:parseJSXElementName,scanJSXIdentifier:scanJSXIdentifier});const Parser=parser,version="1.6.9";exports.version="1.6.9",exports.ESTree=estree,exports.Scanner=index,exports.parse=parse,exports.parseSource=parseSource,exports.parseModule=parseModule,exports.parseScript=parseScript,exports.characterType=characterType,exports.errorMessages=errorMessages,exports.constructError=constructError,exports.report=report,exports.tolerant=tolerant,exports.tokenDesc=tokenDesc,exports.descKeyword=descKeyword,exports.Parser=Parser,exports.isValidIdentifierPart=isValidIdentifierPart,exports.isValidIdentifierStart=isValidIdentifierStart,exports.mustEscape=mustEscape,exports.validateBreakOrContinueLabel=validateBreakOrContinueLabel,exports.addLabel=addLabel,exports.popLabel=popLabel,exports.hasLabel=hasLabel,exports.finishNode=finishNode,exports.expect=expect,exports.consume=consume,exports.nextToken=nextToken,exports.hasBit=hasBit,exports.consumeSemicolon=consumeSemicolon,exports.parseExpressionCoverGrammar=parseExpressionCoverGrammar,exports.restoreExpressionCoverGrammar=restoreExpressionCoverGrammar,exports.swapContext=swapContext,exports.validateParams=validateParams,exports.reinterpret=reinterpret,exports.lookahead=lookahead,exports.isValidSimpleAssignmentTarget=isValidSimpleAssignmentTarget,exports.getLocation=getLocation,exports.isValidIdentifier=isValidIdentifier,exports.isLexical=isLexical,exports.isEndOfCaseOrDefaultClauses=isEndOfCaseOrDefaultClauses,exports.nextTokenIsLeftParenOrPeriod=nextTokenIsLeftParenOrPeriod,exports.nextTokenisIdentifierOrParen=nextTokenisIdentifierOrParen,exports.nextTokenIsLeftParen=nextTokenIsLeftParen,exports.nextTokenIsFuncKeywordOnSameLine=nextTokenIsFuncKeywordOnSameLine,exports.isPropertyWithPrivateFieldKey=isPropertyWithPrivateFieldKey,exports.parseAndClassifyIdentifier=parseAndClassifyIdentifier,exports.nameIsArgumentsOrEval=nameIsArgumentsOrEval,exports.setPendingError=setPendingError,exports.isEqualTagNames=isEqualTagNames,exports.isInstanceField=isInstanceField,exports.validateUpdateExpression=validateUpdateExpression,exports.setPendingExpressionError=setPendingExpressionError,exports.validateCoverParenthesizedExpression=validateCoverParenthesizedExpression,exports.validateAsyncArgumentList=validateAsyncArgumentList,exports.isInOrOf=isInOrOf; diff --git a/node_modules/cherow/dist/es2015/cherow.js b/node_modules/cherow/dist/es2015/cherow.js new file mode 100644 index 0000000..aad8f46 --- /dev/null +++ b/node_modules/cherow/dist/es2015/cherow.js @@ -0,0 +1,7276 @@ +// Note: this *must* be kept in sync with the enum's order.
+//
+// It exploits the enum value ordering, and it's necessarily a complete and
+// utter hack.
+//
+// All to lower it to a single monomorphic array access.
+const keywordDescTable = [
+ 'end of source',
+ /* Constants/Bindings */
+ 'identifier', 'number', 'string', 'regular expression',
+ 'false', 'true', 'null',
+ /* Template nodes */
+ 'template continuation', 'template end',
+ /* Punctuators */
+ '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '</', '/>',
+ /* Update operators */
+ '++', '--',
+ /* Assign operators */
+ '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
+ '&=',
+ /* Unary/binary operators */
+ 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
+ '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
+ /* Variable declaration kinds */
+ 'var', 'let', 'const',
+ /* Other reserved words */
+ 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
+ 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
+ 'this', 'throw', 'try', 'while', 'with',
+ /* Strict mode reserved words */
+ 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
+ /* Contextual keywords */
+ 'as', 'async', 'await', 'constructor', 'get', 'set', 'from', 'of',
+ '#',
+ 'eval', 'arguments', 'enum', 'BigInt', '@', 'JSXText',
+ /** TS */
+ 'KeyOf', 'ReadOnly', 'is', 'unique', 'declare', 'type', 'namespace', 'abstract', 'module',
+ 'global', 'require', 'target'
+];
+/**
+ * The conversion function between token and its string description/representation.
+ */
+function tokenDesc(token) {
+ return keywordDescTable[token & 255 /* Type */];
+}
+// Used `Object.create(null)` to avoid potential `Object.prototype`
+// interference.
+const descKeywordTable = Object.create(null, {
+ this: { value: 33566815 /* ThisKeyword */ },
+ function: { value: 33566808 /* FunctionKeyword */ },
+ if: { value: 12377 /* IfKeyword */ },
+ return: { value: 12380 /* ReturnKeyword */ },
+ var: { value: 33566791 /* VarKeyword */ },
+ else: { value: 12370 /* ElseKeyword */ },
+ for: { value: 12374 /* ForKeyword */ },
+ new: { value: 33566811 /* NewKeyword */ },
+ in: { value: 167786289 /* InKeyword */ },
+ typeof: { value: 302002218 /* TypeofKeyword */ },
+ while: { value: 12386 /* WhileKeyword */ },
+ case: { value: 12363 /* CaseKeyword */ },
+ break: { value: 12362 /* BreakKeyword */ },
+ try: { value: 12385 /* TryKeyword */ },
+ catch: { value: 12364 /* CatchKeyword */ },
+ delete: { value: 302002219 /* DeleteKeyword */ },
+ throw: { value: 302002272 /* ThrowKeyword */ },
+ switch: { value: 33566814 /* SwitchKeyword */ },
+ continue: { value: 12366 /* ContinueKeyword */ },
+ default: { value: 12368 /* DefaultKeyword */ },
+ instanceof: { value: 167786290 /* InstanceofKeyword */ },
+ do: { value: 12369 /* DoKeyword */ },
+ void: { value: 302002220 /* VoidKeyword */ },
+ finally: { value: 12373 /* FinallyKeyword */ },
+ arguments: { value: 37879925 /* Arguments */ },
+ keyof: { value: 131194 /* KeyOfKeyword */ },
+ readonly: { value: 131195 /* ReadOnlyKeyword */ },
+ unique: { value: 131197 /* UniqueKeyword */ },
+ declare: { value: 131198 /* DeclareKeyword */ },
+ async: { value: 594028 /* AsyncKeyword */ },
+ await: { value: 34017389 /* AwaitKeyword */ },
+ class: { value: 33566797 /* ClassKeyword */ },
+ const: { value: 33566793 /* ConstKeyword */ },
+ constructor: { value: 69742 /* ConstructorKeyword */ },
+ debugger: { value: 12367 /* DebuggerKeyword */ },
+ enum: { value: 12406 /* EnumKeyword */ },
+ eval: { value: 37879924 /* Eval */ },
+ export: { value: 12371 /* ExportKeyword */ },
+ extends: { value: 12372 /* ExtendsKeyword */ },
+ false: { value: 33566725 /* FalseKeyword */ },
+ from: { value: 69745 /* FromKeyword */ },
+ get: { value: 69743 /* GetKeyword */ },
+ implements: { value: 20579 /* ImplementsKeyword */ },
+ import: { value: 33566810 /* ImportKeyword */ },
+ interface: { value: 20580 /* InterfaceKeyword */ },
+ let: { value: 33574984 /* LetKeyword */ },
+ null: { value: 33566727 /* NullKeyword */ },
+ of: { value: 69746 /* OfKeyword */ },
+ package: { value: 20581 /* PackageKeyword */ },
+ private: { value: 20582 /* PrivateKeyword */ },
+ protected: { value: 20583 /* ProtectedKeyword */ },
+ public: { value: 20584 /* PublicKeyword */ },
+ set: { value: 69744 /* SetKeyword */ },
+ static: { value: 20585 /* StaticKeyword */ },
+ super: { value: 33566813 /* SuperKeyword */ },
+ true: { value: 33566726 /* TrueKeyword */ },
+ with: { value: 12387 /* WithKeyword */ },
+ yield: { value: 1107316842 /* YieldKeyword */ },
+ is: { value: 131196 /* IsKeyword */ },
+ type: { value: 131199 /* TypeKeyword */ },
+ namespace: { value: 131200 /* NameSpaceKeyword */ },
+ abstract: { value: 131201 /* AbstractKeyword */ },
+ as: { value: 167843947 /* AsKeyword */ },
+ module: { value: 131202 /* ModuleKeyword */ },
+ global: { value: 131203 /* GlobalKeyword */ },
+ require: { value: 131204 /* RequireKeyword */ },
+ target: { value: 131205 /* TargetKeyword */ },
+});
+function descKeyword(value) {
+ return (descKeywordTable[value] | 0);
+} + +/*@internal*/
+const characterType = [
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 16 /* Space */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+]; + +// Unicode v. 11 support
+// tslint:disable
+function isValidIdentifierPart(code) {
+ return (convert[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
+}
+function isValidIdentifierStart(code) {
+ return (convert[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
+}
+function mustEscape(code) {
+ return (convert[(code >>> 5) + 69632] >>> code & 31 & 1) !== 0;
+}
+const convert = ((compressed, lookup) => {
+ const result = new Uint32Array(104448);
+ let index = 0;
+ let subIndex = 0;
+ while (index < 3392) {
+ const inst = compressed[index++];
+ if (inst < 0) {
+ subIndex -= inst;
+ }
+ else {
+ let code = compressed[index++];
+ if (inst & 2)
+ code = lookup[code];
+ if (inst & 1) {
+ result.fill(code, subIndex, subIndex += compressed[index++]);
+ }
+ else {
+ result[subIndex++] = code;
+ }
+ }
+ }
+ return result;
+})([-1, 2, 28, 2, 29, 2, 5, -1, 0, 77595648, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 15, 2, 60, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 61, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 20, 2, 0, 0, 608174079, 2, 0, 2, 127, 2, 6, 2, 62, -1, 2, 64, 2, 26, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2965387679, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 2, 171, 0, 4294828031, 0, 3825204735, 0, 123747807, 0, 65487, 2, 3, 0, 4092591615, 0, 1080049119, 0, 458703, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247020, 2, 68, 0, 4284449919, 0, 851904, 2, 4, 2, 16, 0, 67076095, -1, 2, 69, 0, 1006628014, 0, 4093591391, -1, 0, 50331649, 0, 3265266687, 2, 34, 0, 4294844415, 0, 4278190047, 2, 23, 2, 125, -1, 3, 0, 2, 2, 33, 2, 0, 2, 9, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 10, 0, 261632, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 2088959, 2, 31, 2, 8, 0, 909311, 3, 0, 2, 0, 814743551, 2, 42, 0, 67057664, 3, 0, 2, 2, 45, 2, 0, 2, 32, 2, 0, 2, 18, 2, 7, 0, 268374015, 2, 30, 2, 51, 2, 0, 2, 78, 0, 134153215, -1, 2, 6, 2, 0, 2, 7, 0, 2684354559, 0, 67044351, 0, 1073676416, -2, 3, 0, 2, 2, 43, 0, 1046528, 3, 0, 3, 2, 8, 2, 0, 2, 41, 0, 4294960127, 2, 9, 2, 39, 2, 10, 0, 4294377472, 2, 21, 3, 0, 7, 0, 4227858431, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -1, 2, 122, 0, 1048577, 2, 84, 2, 12, -1, 2, 12, 0, 131042, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 1046559, 2, 0, 2, 13, 2, 0, 0, 2147516671, 2, 24, 3, 88, 2, 2, 0, -16, 2, 89, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 2, 119, 2, 0, 0, 3220242431, 3, 0, 3, 2, 20, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 2, 0, 2, 27, 2, 0, 2, 8, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 25, 2, 8, 2, 23, 3, 0, 2, 0, 67076097, 2, 7, 2, 0, 2, 24, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 3774349439, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, 2, 19, 0, 1638399, 2, 169, 2, 104, 3, 0, 3, 2, 23, 2, 28, 2, 29, 2, 5, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -3, 2, 146, -4, 2, 23, 2, 0, 2, 37, 0, 1, 2, 0, 2, 63, 2, 32, 2, 16, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 33, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277137519, 0, 2269118463, -1, 3, 23, 2, -1, 2, 34, 2, 38, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 48, -14, 2, 23, 2, 44, 2, 37, -5, 3, 0, 2, 2, 38, 0, 2147549120, 2, 0, 2, 16, 2, 17, 2, 130, 2, 0, 2, 52, 0, 4294901872, 0, 5242879, 3, 0, 2, 0, 402595359, -1, 2, 118, 0, 1090519039, -2, 2, 120, 2, 39, 2, 0, 2, 55, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, -4, 3, 0, 2, 0, 1140787199, -1, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 41, 2, 42, -1, 2, 10, 2, 43, -6, 2, 0, 2, 16, -3, 3, 0, 2, 0, 2147484671, -8, 2, 0, 2, 7, 2, 44, 2, 0, 0, 603979727, -1, 2, 0, 2, 45, -8, 2, 54, 2, 46, 0, 67043329, 2, 123, 2, 47, 0, 8388351, -2, 2, 124, 0, 3028287487, 2, 48, 2, 126, 0, 33259519, 2, 42, -9, 2, 24, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, 2, 42, -2, 2, 17, 2, 51, 2, 0, 2, 24, 0, 67043343, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 4294901791, 2, 7, 2, 164, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 0, 1677656575, -166, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 90, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -42, 0, 4194303871, 0, 2011, -62, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 55, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -22583, 3, 0, 7, 2, 19, -6130, 3, 5, 2, -1, 0, 69207040, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 15, 2, 60, 2, 0, 2, 35, -1, 2, 17, 2, 61, -1, 2, 0, 2, 62, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 19, 2, 63, 3, 0, 2, 0, 131135, 2, 94, 0, 70256639, 0, 71303167, 0, 272, 2, 45, 2, 62, -1, 2, 64, -2, 2, 96, 0, 603979775, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 65, 2, 66, 0, 33554435, 2, 121, 2, 65, 2, 147, 0, 131075, 0, 3594373096, 0, 67094296, 2, 66, -1, 2, 67, 0, 603979263, 2, 156, 0, 3, 0, 4294828001, 0, 602930687, 2, 180, 0, 393219, 2, 67, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 68, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 69, 0, 537783470, 0, 4026531935, -1, 0, 1, -1, 2, 34, 2, 70, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 16, -1, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 253951, 3, 20, 2, 0, 122879, 2, 0, 2, 8, 0, 276824064, -2, 3, 0, 2, 2, 45, 2, 0, 0, 4294903295, 2, 0, 2, 18, 2, 7, -1, 2, 17, 2, 51, 2, 0, 2, 78, 2, 42, -1, 2, 24, 2, 0, 2, 31, -2, 0, 128, -2, 2, 79, 2, 8, 0, 4064, -1, 2, 117, 0, 4227907585, 2, 0, 2, 116, 2, 0, 2, 50, 2, 196, 2, 9, 2, 39, 2, 10, -1, 0, 6544896, 3, 0, 6, -2, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -3, 2, 84, 2, 12, -3, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 817183, 2, 0, 2, 13, 2, 0, 0, 33023, 2, 24, 3, 88, 2, -17, 2, 89, 0, 524157950, 2, 4, 2, 0, 2, 90, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 19, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 0, 4294965179, 0, 7, 2, 0, 2, 8, 2, 92, 2, 8, -1, 0, 1761345536, 2, 94, 2, 95, 2, 38, 2, 23, 2, 96, 2, 36, 2, 162, 0, 2080440287, 2, 0, 2, 35, 2, 138, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 7, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 2700607615, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, -3, 2, 104, 3, 0, 3, 2, 23, -1, 3, 5, 2, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -8, 2, 23, 2, 0, 2, 37, -1, 2, 0, 2, 63, 2, 32, 2, 18, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 17, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277075969, 2, 18, -1, 3, 23, 2, -1, 2, 34, 2, 139, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 50, -14, 2, 23, 2, 44, 2, 116, -5, 2, 117, 2, 41, -2, 2, 117, 2, 19, 2, 17, 2, 35, 2, 117, 2, 38, 0, 4294901776, 0, 4718591, 2, 117, 2, 36, 0, 335544350, -1, 2, 118, 2, 119, -2, 2, 120, 2, 39, 2, 7, -1, 2, 121, 2, 65, 0, 3758161920, 0, 3, -4, 2, 0, 2, 31, 2, 174, -1, 2, 0, 2, 19, 0, 176, -5, 2, 0, 2, 49, 2, 182, -1, 2, 0, 2, 19, 2, 194, -1, 2, 0, 2, 62, -2, 2, 16, -7, 2, 0, 2, 119, -3, 3, 0, 2, 2, 122, -8, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871887, -1, 2, 0, 2, 45, -8, 2, 54, 2, 49, 0, 1, 2, 123, 2, 19, -3, 2, 124, 2, 37, 2, 125, 2, 126, 0, 16778239, -10, 2, 36, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, -3, 2, 17, 2, 127, 2, 0, 2, 19, 2, 50, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 65567, -1, 2, 26, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 2, 130, -187, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 2, 138, -129, 3, 0, 6, 2, 139, -1, 3, 0, 2, 2, 50, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -28719, 2, 0, 0, 1, -1, 2, 122, 2, 0, 0, 8193, -21, 0, 50331648, 0, 10255, 0, 4, -11, 2, 66, 2, 168, -1, 0, 71680, -1, 2, 157, 0, 4292900864, 0, 805306431, -5, 2, 146, -1, 2, 176, -1, 0, 6144, -2, 2, 123, -1, 2, 150, -1, 2, 153, 2, 147, 2, 161, 2, 0, 0, 3223322624, 2, 36, 0, 4, -4, 2, 188, 0, 205128192, 0, 1333757536, 0, 2147483696, 0, 423953, 0, 747766272, 0, 2717763192, 0, 4286578751, 0, 278545, 2, 148, 0, 4294886464, 0, 33292336, 0, 417809, 2, 148, 0, 1329579616, 0, 4278190128, 0, 700594195, 0, 1006647527, 0, 4286497336, 0, 4160749631, 2, 149, 0, 469762560, 0, 4171219488, 0, 16711728, 2, 149, 0, 202375680, 0, 3214918176, 0, 4294508592, 0, 139280, -1, 0, 983584, 2, 190, 0, 58720275, 0, 3489923072, 0, 10517376, 0, 4293066815, 0, 1, 0, 2013265920, 2, 175, 2, 0, 0, 17816169, 0, 3288339281, 0, 201375904, 2, 0, -2, 0, 256, 0, 122880, 0, 16777216, 2, 146, 0, 4160757760, 2, 0, -6, 2, 163, -11, 0, 3263218176, -1, 0, 49664, 0, 2160197632, 0, 8388802, -1, 0, 12713984, -1, 2, 150, 2, 155, 2, 158, -2, 2, 159, -20, 0, 3758096385, -2, 2, 151, 0, 4292878336, 2, 22, 2, 166, 0, 4294057984, -2, 2, 160, 2, 152, 2, 172, -2, 2, 151, -1, 2, 179, -1, 2, 167, 2, 122, 0, 4026593280, 0, 14, 0, 4292919296, -1, 2, 154, 0, 939588608, -1, 0, 805306368, -1, 2, 122, 0, 1610612736, 2, 152, 2, 153, 3, 0, 2, -2, 2, 154, 2, 155, -3, 0, 267386880, -1, 2, 156, 0, 7168, -1, 0, 65024, 2, 150, 2, 157, 2, 158, -7, 2, 165, -8, 2, 159, -1, 0, 1426112704, 2, 160, -1, 2, 185, 0, 271581216, 0, 2149777408, 2, 19, 2, 157, 2, 122, 0, 851967, 0, 3758129152, -1, 2, 19, 2, 178, -4, 2, 154, -20, 2, 192, 2, 161, -56, 0, 3145728, 2, 184, -1, 2, 191, 2, 122, -1, 2, 162, 2, 122, -4, 0, 32505856, -1, 2, 163, -1, 0, 2147385088, 2, 22, 1, 2155905152, 2, -3, 2, 164, 2, 0, 2, 165, -2, 2, 166, -6, 2, 167, 0, 4026597375, 0, 1, -1, 0, 1, -1, 2, 168, -3, 2, 139, 2, 66, -2, 2, 162, 2, 177, -1, 2, 173, 2, 122, -6, 2, 122, -213, 2, 167, -657, 2, 17, -36, 2, 169, -1, 2, 186, -10, 0, 4294963200, -5, 2, 170, -5, 2, 158, 2, 0, 2, 24, -1, 0, 4227919872, -1, 2, 170, -2, 0, 4227874752, -3, 0, 2146435072, 2, 155, -2, 0, 1006649344, 2, 122, -1, 2, 22, 0, 201375744, -3, 0, 134217720, 2, 22, 0, 4286677377, 0, 32896, -1, 2, 171, -3, 2, 172, -349, 2, 173, 2, 174, 2, 175, 3, 0, 264, -11, 2, 176, -2, 2, 158, 2, 0, 0, 520617856, 0, 2692743168, 0, 36, -3, 0, 524284, -11, 2, 19, -1, 2, 183, -1, 2, 181, 0, 3221291007, 2, 158, -1, 0, 524288, 0, 2158720, -3, 2, 155, 0, 1, -4, 2, 122, 0, 3808625411, 0, 3489628288, 0, 4096, 0, 1207959680, 0, 3221274624, 2, 0, -3, 2, 177, 0, 120, 0, 7340032, -2, 0, 4026564608, 2, 4, 2, 19, 2, 160, 3, 0, 4, 2, 155, -1, 2, 178, 2, 175, -1, 0, 8176, 2, 179, 2, 177, 2, 180, -1, 0, 4290773232, 2, 0, -4, 2, 160, 2, 187, 0, 15728640, 2, 175, -1, 2, 157, -1, 0, 4294934512, 3, 0, 4, -9, 2, 22, 2, 167, 2, 181, 3, 0, 4, 0, 704, 0, 1849688064, 0, 4194304, -1, 2, 122, 0, 4294901887, 2, 0, 0, 130547712, 0, 1879048192, 0, 2080374784, 3, 0, 2, -1, 2, 182, 2, 183, -1, 0, 17829776, 0, 2025848832, 0, 4261477888, -2, 2, 0, -1, 0, 4286580608, -1, 0, 29360128, 2, 184, 0, 16252928, 0, 3791388672, 2, 39, 3, 0, 2, -2, 2, 193, 2, 0, -1, 2, 26, -1, 0, 66584576, -1, 2, 189, 3, 0, 9, 2, 122, 3, 0, 4, -1, 2, 157, 2, 158, 3, 0, 5, -2, 0, 245760, 0, 2147418112, -1, 2, 146, 2, 199, 0, 4227923456, -1, 2, 185, 2, 186, 2, 22, -2, 2, 176, 0, 4292870145, 0, 262144, 2, 122, 3, 0, 2, 0, 1073758848, 2, 187, -1, 0, 4227921920, 2, 188, 0, 68289024, 0, 528402016, 0, 4292927536, 3, 0, 4, -2, 0, 2483027968, 2, 0, -2, 2, 189, 3, 0, 5, -1, 2, 184, 2, 160, 2, 0, -2, 0, 4227923936, 2, 63, -1, 2, 170, 2, 94, 2, 0, 2, 150, 2, 154, 3, 0, 6, -1, 2, 175, 3, 0, 3, -2, 0, 2146959360, 3, 0, 8, -2, 2, 157, -1, 2, 190, 2, 117, -1, 2, 151, 3, 0, 8, 2, 191, 0, 8388608, 2, 171, 2, 169, 2, 183, 0, 4286578944, 3, 0, 2, 0, 1152, 0, 1266679808, 2, 189, 0, 576, 0, 4261707776, 2, 94, 3, 0, 9, 2, 151, 3, 0, 8, -28, 2, 158, 3, 0, 3, -3, 0, 4292902912, -6, 2, 96, 3, 0, 85, -33, 2, 164, 3, 0, 126, -18, 2, 192, 3, 0, 269, -17, 2, 151, 2, 122, 0, 4294917120, 3, 0, 2, 2, 19, 0, 4290822144, -2, 0, 67174336, 0, 520093700, 2, 17, 3, 0, 21, -2, 2, 177, 3, 0, 3, -2, 0, 65504, 2, 122, 2, 49, 3, 0, 2, 2, 92, -191, 2, 123, -23, 2, 26, 3, 0, 296, -8, 2, 122, 3, 0, 2, 2, 19, -11, 2, 175, 3, 0, 72, -3, 0, 3758159872, 0, 201391616, 3, 0, 155, -7, 2, 167, -1, 0, 384, -1, 0, 133693440, -3, 2, 193, -2, 2, 30, 3, 0, 4, 2, 166, -2, 2, 22, 2, 151, 3, 0, 4, -2, 2, 185, -1, 2, 146, 0, 335552923, 2, 194, -1, 0, 538974272, 0, 2214592512, 0, 132000, -10, 0, 192, -8, 0, 12288, -21, 0, 134213632, 0, 4294901761, 3, 0, 42, 0, 100663424, 0, 4294965284, 3, 0, 62, -6, 0, 4286578784, 2, 0, -2, 0, 1006696448, 3, 0, 24, 2, 37, -1, 2, 195, 3, 0, 10, 2, 194, 0, 4110942569, 0, 1432950139, 0, 2701658217, 0, 4026532864, 0, 4026532881, 2, 0, 2, 47, 3, 0, 8, -1, 2, 154, -2, 2, 166, 0, 98304, 0, 65537, 2, 167, 2, 169, -2, 2, 154, -1, 2, 63, 2, 0, 2, 116, 2, 197, 2, 175, 0, 4294770176, 2, 30, 3, 0, 4, -30, 2, 195, 2, 196, -3, 2, 166, -2, 2, 151, 2, 0, 2, 154, -1, 2, 189, -1, 2, 157, 2, 198, 3, 0, 2, 2, 154, 2, 122, -1, 0, 193331200, -1, 0, 4227923960, 2, 197, -1, 3, 0, 3, 2, 198, 3, 0, 44, -1334, 2, 22, 2, 0, -129, 2, 195, -6, 2, 160, -180, 2, 199, -233, 2, 4, 3, 0, 96, -16, 2, 160, 3, 0, 22583, -7, 2, 17, 3, 0, 6128], [4294967295, 4294967291, 4092460543, 4294828015, 4294967294, 134217726, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 1061158911, 536805376, 4294910143, 4160749567, 4294901759, 134217727, 4294901760, 4194303, 65535, 262143, 67108863, 4286578688, 536870911, 8388607, 4294918143, 4294443008, 255, 67043328, 2281701374, 4294967232, 2097151, 4294903807, 4294902783, 4294967039, 511, 524287, 131071, 127, 4294902271, 4294549487, 16777215, 1023, 67047423, 4294901888, 33554431, 4286578687, 4294770687, 67043583, 32767, 15, 2047999, 4292870143, 4294934527, 4294966783, 67045375, 4294967279, 262083, 20511, 4290772991, 41943039, 493567, 2047, 4294959104, 1071644671, 602799615, 65536, 4294828000, 805044223, 4277151126, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 4294967264, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4294967292, 4294965759, 4294966272, 4294901823, 4294967280, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 268369920, 4292804608, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4294966591, 2445279231, 3670015, 3238002687, 63, 4294967288, 4294705151, 4095, 3221208447, 4294549472, 2147483648, 4294705152, 4294966143, 64, 4294966719, 16383, 3774873592, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4087, 31, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 536870912, 2952790016, 202506752, 139264, 402653184, 4261412864, 4227922944, 2147532800, 61440, 3758096384, 117440512, 65280, 4227858432, 3233808384, 3221225472, 4294965248, 32768, 57152, 4294934528, 67108864, 4293918720, 4290772992, 25165824, 57344, 4278190080, 65472, 4227907584, 65520, 1920, 4026531840, 49152, 4160749568, 4294836224, 63488, 1073741824, 4294967040, 251658240, 196608, 12582912, 2097152, 65408, 64512, 417808, 4227923712, 48, 512, 4294967168, 4294966784, 16, 4292870144, 4227915776, 65528, 4294950912, 65532]); + +/**
+ * Return the next unicodechar in the stream
+ *
+ * @param parser Parser object
+ */
+function nextUnicodeChar(parser) {
+ const { index } = parser;
+ const hi = parser.source.charCodeAt(index);
+ if (hi < 55296 /* LeadSurrogateMin */ || hi > 56319 /* LeadSurrogateMax */)
+ return hi;
+ const lo = parser.source.charCodeAt(index + 1);
+ if (lo < 56320 /* TrailSurrogateMin */ || lo > 57343 /* TrailSurrogateMax */)
+ return hi;
+ return 65536 /* NonBMPMin */ + ((hi & 0x3FF) << 10) | lo & 0x3FF;
+}
+/**
+ * Returns true if this is a valid identifier part
+ *
+ * @param code Codepoint
+ */
+const isIdentifierPart = (code) => (characterType[code] & 1 /* IdentifierStart */) !== 0 || isValidIdentifierPart(code);
+function escapeInvalidCharacters(code) {
+ switch (code) {
+ case 0 /* Null */:
+ return '\\0';
+ case 8 /* Backspace */:
+ return '\\b';
+ case 9 /* Tab */:
+ return '\\t';
+ case 10 /* LineFeed */:
+ return '\\n';
+ case 11 /* VerticalTab */:
+ return '\\v';
+ case 12 /* FormFeed */:
+ return '\\f';
+ case 13 /* CarriageReturn */:
+ return '\\r';
+ default:
+ if (!mustEscape(code))
+ return fromCodePoint(code);
+ if (code < 0x10)
+ return `\\x0${code.toString(16)}`;
+ if (code < 0x100)
+ return `\\x${code.toString(16)}`;
+ if (code < 0x1000)
+ return `\\u0${code.toString(16)}`;
+ if (code < 0x10000)
+ return `\\u${code.toString(16)}`;
+ return `\\u{${code.toString(16)}}`;
+ }
+}
+/**
+ * Consume an token in the scanner on match. This is an equalent to
+ * 'consume' used in the parser code itself.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeOpt(parser, code) {
+ if (parser.source.charCodeAt(parser.index) !== code)
+ return false;
+ parser.index++;
+ parser.column++;
+ return true;
+}
+/**
+ * Consumes line feed
+ *
+ * @param parser Parser object
+ * @param state Scanner state
+ */
+function consumeLineFeed(parser, state) {
+ parser.flags |= Flags.NewLine;
+ parser.index++;
+ if ((state & ScannerState.LastIsCR) === 0) {
+ parser.column = 0;
+ parser.line++;
+ }
+}
+/**
+ * Scans private name. Stage 3 proposal related
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanPrivateName(parser, context) {
+ if (!(context & Context.InClass) || !isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return 115 /* Hash */;
+}
+/**
+ * Advance to new line
+ *
+ * @param parser Parser object
+ */
+function advanceNewline(parser) {
+ parser.flags |= Flags.NewLine;
+ parser.index++;
+ parser.column = 0;
+ parser.line++;
+}
+const fromCodePoint = (code) => {
+ return code <= 0xFFFF ?
+ String.fromCharCode(code) :
+ String.fromCharCode(((code - 65536 /* NonBMPMin */) >> 10) + 55296 /* LeadSurrogateMin */, ((code - 65536 /* NonBMPMin */) & (1024 - 1)) + 56320 /* TrailSurrogateMin */);
+};
+function readNext(parser) {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.source.length)
+ report(parser, 14 /* UnicodeOutOfRange */);
+ return nextUnicodeChar(parser);
+}
+function toHex(code) {
+ if (code < 48 /* Zero */)
+ return -1;
+ if (code <= 57 /* Nine */)
+ return code - 48 /* Zero */;
+ if (code < 65 /* UpperA */)
+ return -1;
+ if (code <= 70 /* UpperF */)
+ return code - 65 /* UpperA */ + 10;
+ if (code < 97 /* LowerA */)
+ return -1;
+ if (code <= 102 /* LowerF */)
+ return code - 97 /* LowerA */ + 10;
+ return -1;
+}
+function advanceOnMaybeAstral(parser, ch) {
+ parser.index++;
+ parser.column++;
+ if (ch > 0xFFFF)
+ parser.index++;
+} + +/**
+ * Scan escape sequence
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanEscapeSequence(parser, context, first) {
+ switch (first) {
+ case 98 /* LowerB */:
+ return 8 /* Backspace */;
+ case 102 /* LowerF */:
+ return 12 /* FormFeed */;
+ case 114 /* LowerR */:
+ return 13 /* CarriageReturn */;
+ case 110 /* LowerN */:
+ return 10 /* LineFeed */;
+ case 116 /* LowerT */:
+ return 9 /* Tab */;
+ case 118 /* LowerV */:
+ return 11 /* VerticalTab */;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ return Escape.Empty;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ {
+ // 1 to 3 octal digits
+ let code = first - 48 /* Zero */;
+ let index = parser.index + 1;
+ let column = parser.column + 1;
+ let next = parser.source.charCodeAt(index);
+ if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ // Strict mode code allows only \0, then a non-digit.
+ if (code !== 0 || next === 56 /* Eight */ || next === 57 /* Nine */) {
+ if (context & Context.Strict)
+ return Escape.StrictOctal;
+ parser.flags |= Flags.HasOctal;
+ }
+ }
+ else if (context & Context.Strict) {
+ return Escape.StrictOctal;
+ }
+ else {
+ parser.flags |= Flags.HasOctal;
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ parser.index = index - 1;
+ parser.column = column - 1;
+ }
+ return code;
+ }
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ // 1 to 2 octal digits
+ if (context & Context.Strict)
+ return Escape.StrictOctal;
+ let code = first - 48 /* Zero */;
+ const index = parser.index + 1;
+ const column = parser.column + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ code = code * 8 + (next - 48 /* Zero */);
+ parser.lastValue = next;
+ parser.index = index;
+ parser.column = column;
+ }
+ return code;
+ }
+ // `8`, `9` (invalid escapes)
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return Escape.EightOrNine;
+ // ASCII escapes
+ case 120 /* LowerX */:
+ {
+ const ch1 = parser.lastValue = readNext(parser);
+ const hi = toHex(ch1);
+ if (hi < 0)
+ return Escape.InvalidHex;
+ const ch2 = parser.lastValue = readNext(parser);
+ const lo = toHex(ch2);
+ if (lo < 0)
+ return Escape.InvalidHex;
+ return hi << 4 | lo;
+ }
+ // UCS-2/Unicode escapes
+ case 117 /* LowerU */:
+ {
+ let ch = parser.lastValue = readNext(parser);
+ if (ch === 123 /* LeftBrace */) {
+ ch = parser.lastValue = readNext(parser);
+ let code = toHex(ch);
+ if (code < 0)
+ return Escape.InvalidHex;
+ ch = parser.lastValue = readNext(parser);
+ while (ch !== 125 /* RightBrace */) {
+ const digit = toHex(ch);
+ if (digit < 0)
+ return Escape.InvalidHex;
+ code = code * 16 + digit;
+ // Code point out of bounds
+ if (code > 1114111 /* NonBMPMax */)
+ return Escape.OutOfRange;
+ ch = parser.lastValue = readNext(parser);
+ }
+ return code;
+ }
+ else {
+ // \uNNNN
+ let codePoint = toHex(ch);
+ if (codePoint < 0)
+ return Escape.InvalidHex;
+ for (let i = 0; i < 3; i++) {
+ ch = parser.lastValue = readNext(parser);
+ const digit = toHex(ch);
+ if (digit < 0)
+ return Escape.InvalidHex;
+ codePoint = codePoint * 16 + digit;
+ }
+ return codePoint;
+ }
+ }
+ default:
+ return parser.source.charCodeAt(parser.index);
+ }
+}
+/**
+ * Throws a string error for either string or template literal
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function throwStringError(parser, context, code) {
+ switch (code) {
+ case Escape.Empty:
+ return;
+ case Escape.StrictOctal:
+ report(parser, context & Context.TaggedTemplate ?
+ 76 /* TemplateOctalLiteral */ :
+ 11 /* StrictOctalEscape */);
+ case Escape.EightOrNine:
+ report(parser, 13 /* InvalidEightAndNine */);
+ case Escape.InvalidHex:
+ report(parser, 75 /* MalformedEscape */, 'hexadecimal');
+ case Escape.OutOfRange:
+ report(parser, 14 /* UnicodeOutOfRange */);
+ /* istanbul ignore next */
+ default:
+ // ignore
+ }
+}
+/**
+ * Scan a string literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote codepoint
+ */
+function scanString(parser, context, quote) {
+ const { index: start, lastValue } = parser;
+ let ret = '';
+ parser.index++;
+ parser.column++; // consume quote
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ switch (ch) {
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ report(parser, 6 /* UnterminatedString */);
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch > 128 /* MaxAsciiCharacter */) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ const code = scanEscapeSequence(parser, context, ch);
+ if (code >= 0)
+ ret += fromCodePoint(code);
+ else
+ throwStringError(parser, context, code);
+ ch = parser.lastValue;
+ }
+ break;
+ default:
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++; // consume quote
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ return 33554435 /* StringLiteral */;
+} + +/**
+ * Consumes template brace
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeTemplateBrace(parser, context) {
+ if (parser.index >= parser.length)
+ report(parser, 9 /* UnterminatedTemplate */);
+ // Upon reaching a '}', consume it and rewind the scanner state
+ parser.index--;
+ parser.column--;
+ return scanTemplate(parser, context);
+}
+/**
+ * Scan template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param first Codepoint
+ */
+function scanTemplate(parser, context) {
+ const { index: start, lastValue } = parser;
+ let tail = true;
+ let ret = '';
+ let ch = readNext(parser);
+ loop: while (ch !== 96 /* Backtick */) {
+ switch (ch) {
+ // Break after a literal `${` (thus the dedicated code path).
+ case 36 /* Dollar */:
+ {
+ const index = parser.index + 1;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 123 /* LeftBrace */) {
+ parser.index = index;
+ parser.column++;
+ tail = false;
+ break loop;
+ }
+ ret += '$';
+ break;
+ }
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch >= 128) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ // Because octals are forbidden in escaped template sequences and the fact that
+ // both string and template scanning uses the same method - 'scanEscapeSequence',
+ // we set the strict context mask.
+ const code = scanEscapeSequence(parser, context | Context.Strict, ch);
+ if (code >= 0) {
+ ret += fromCodePoint(code);
+ }
+ else if (code !== Escape.Empty && context & Context.TaggedTemplate) {
+ ret = undefined;
+ ch = scanLooserTemplateSegment(parser, parser.lastValue);
+ if (ch < 0) {
+ tail = false;
+ }
+ break loop;
+ }
+ else {
+ throwStringError(parser, context | Context.TaggedTemplate, code);
+ }
+ ch = parser.lastValue;
+ }
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ // falls through
+ default:
+ if (ret != null)
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++;
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ if (tail) {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 1);
+ return 33554441 /* TemplateTail */;
+ }
+ else {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 2);
+ return 33554440 /* TemplateCont */;
+ }
+}
+/**
+ * Scan looser template segment
+ *
+ * @param parser Parser object
+ * @param ch codepoint
+ */
+function scanLooserTemplateSegment(parser, ch) {
+ while (ch !== 96 /* Backtick */) {
+ if (ch === 36 /* Dollar */ && parser.source.charCodeAt(parser.index + 1) === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return -ch;
+ }
+ // Skip '\' and continue to scan the template token to search
+ // for the end, without validating any escape sequences
+ ch = readNext(parser);
+ }
+ return ch;
+} + +// 11.8.3 Numeric Literals
+/**
+ * Scans hex integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HexIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanHexIntegerLiteral(parser, context) {
+ parser.index++;
+ parser.column++;
+ let state = NumericState.None;
+ let value = toHex(parser.source.charCodeAt(parser.index));
+ if (value < 0)
+ report(parser, 0 /* Unexpected */);
+ parser.index++;
+ parser.column++;
+ while (parser.index < parser.length) {
+ const next = parser.source.charCodeAt(parser.index);
+ if (context & Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ const digit = toHex(next);
+ if (digit < 0)
+ break;
+ value = value * 16 + digit;
+ parser.index++;
+ parser.column++;
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+}
+/**
+ * Scans binary and octal integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalIntegerLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BinaryIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanOctalOrBinary(parser, context, base) {
+ parser.index++;
+ parser.column++;
+ let digits = 0;
+ let ch;
+ let value = 0;
+ let state = NumericState.None;
+ while (parser.index < parser.length) {
+ ch = parser.source.charCodeAt(parser.index);
+ if (context & Context.OptionsNext && ch === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ const converted = ch - 48 /* Zero */;
+ if (!(ch >= 48 /* Zero */ && ch <= 57 /* Nine */) || converted >= base)
+ break;
+ value = value * base + converted;
+ parser.index++;
+ parser.column++;
+ digits++;
+ }
+ if (digits === 0)
+ report(parser, 0 /* Unexpected */);
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+}
+/**
+ * Scans implicit octal digits
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalDigits)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanImplicitOctalDigits(parser, context) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ if (context & Context.Strict)
+ report(parser, 0 /* Unexpected */);
+ let index = parser.index;
+ let column = parser.column;
+ let code = 0;
+ parser.flags |= Flags.HasOctal;
+ // Implicit octal, unless there is a non-octal digit.
+ // (Annex B.1.1 on Numeric Literals)
+ while (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ else if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ return scanNumericLiteral(parser, context);
+ }
+ else {
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ }
+ parser.index = index;
+ parser.column = column;
+ return assembleNumericLiteral(parser, context, code, consumeOpt(parser, 110 /* LowerN */));
+ }
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ parser.flags |= Flags.HasOctal;
+ default:
+ if (context & Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ return scanNumericLiteral(parser, context);
+ }
+}
+/**
+ * Scans signed integer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SignedInteger)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanSignedInteger(parser, end) {
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */ || next === 45 /* Hyphen */) {
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (!(next >= 48 /* Zero */ && next <= 57 /* Nine */)) {
+ report(parser, 0 /* Unexpected */);
+ }
+ const preNumericPart = parser.index;
+ const finalFragment = scanDecimalDigitsOrSeparator(parser);
+ return parser.source.substring(end, preNumericPart) + finalFragment;
+}
+/**
+ * Scans numeric literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanNumericLiteral(parser, context, state = NumericState.None) {
+ let value = state & NumericState.Float ?
+ 0 :
+ scanDecimalAsSmi(parser, context);
+ const next = parser.source.charCodeAt(parser.index);
+ // I know I'm causing a bug here. The question is - will anyone figure this out?
+ if (next !== 46 /* Period */ && next !== 95 /* Underscore */ && !isValidIdentifierStart(next)) {
+ return assembleNumericLiteral(parser, context, value);
+ }
+ if (consumeOpt(parser, 46 /* Period */)) {
+ if (context & Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ state |= NumericState.Float;
+ value = `${value}.${scanDecimalDigitsOrSeparator(parser)}`;
+ }
+ const end = parser.index;
+ if (consumeOpt(parser, 110 /* LowerN */)) {
+ if (state & NumericState.Float)
+ report(parser, 0 /* Unexpected */);
+ state |= NumericState.BigInt;
+ }
+ if (consumeOpt(parser, 101 /* LowerE */) || consumeOpt(parser, 69 /* UpperE */)) {
+ state |= NumericState.Float;
+ value += scanSignedInteger(parser, end);
+ }
+ if (isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 0 /* Unexpected */);
+ }
+ return assembleNumericLiteral(parser, context, state & NumericState.Float ? parseFloat(value) : parseInt(value, 10), !!(state & NumericState.BigInt));
+}
+/**
+ * Internal helper function for scanning numeric separators.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state NumericState state
+ */
+function scanNumericSeparator(parser, state) {
+ parser.index++;
+ parser.column++;
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ state |= NumericState.SeenSeparator;
+ return state;
+}
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanDecimalDigitsOrSeparator(parser) {
+ let start = parser.index;
+ let state = NumericState.None;
+ let ret = '';
+ loop: while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 95 /* Underscore */:
+ const preUnderscoreIndex = parser.index;
+ state = scanNumericSeparator(parser, state);
+ ret += parser.source.substring(start, preUnderscoreIndex);
+ start = parser.index;
+ continue;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ state = state & ~NumericState.SeenSeparator;
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ break loop;
+ }
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return ret + parser.source.substring(start, parser.index);
+}
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanDecimalAsSmi(parser, context) {
+ let state = NumericState.None;
+ let value = 0;
+ let next = parser.source.charCodeAt(parser.index);
+ while (next >= 48 /* Zero */ && next <= 57 /* Nine */ || next === 95 /* Underscore */) {
+ if (context & Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ next = parser.source.charCodeAt(parser.index);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ value = value * 10 + (next - 48 /* Zero */);
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return value;
+}
+/**
+ * Internal helper function that assamble the number scanning parts and return
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param value The numeric value
+ */
+function assembleNumericLiteral(parser, context, value, isBigInt = false) {
+ parser.tokenValue = value;
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ return isBigInt ? 33554551 /* BigIntLiteral */ : 33554434 /* NumericLiteral */;
+} + +/**
+ * Scan identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanIdentifier(parser, context, first) {
+ let start = parser.index;
+ let ret = '';
+ let isEscaped = false;
+ if (first)
+ advanceOnMaybeAstral(parser, first);
+ loop: while (parser.index < parser.length) {
+ const index = parser.index;
+ let ch = parser.source.charCodeAt(index);
+ switch (ch) {
+ case 92 /* Backslash */:
+ ret += parser.source.slice(start, index);
+ ret += scanUnicodeCodePointEscape(parser);
+ start = parser.index;
+ isEscaped = true;
+ break;
+ default:
+ if (ch >= 0xD800 && ch <= 0xDBFF) {
+ const lo = parser.source.charCodeAt(index + 1);
+ ch = (ch & 0x3FF) << 10 | lo & 0x3FF | 0x10000;
+ }
+ if (!isIdentifierPart(ch))
+ break loop;
+ advanceOnMaybeAstral(parser, ch);
+ }
+ }
+ if (start < parser.index)
+ ret += parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ const len = ret.length;
+ // Keywords are between 2 and 11 characters long and start with a lowercase letter
+ // https://tc39.github.io/ecma262/#sec-keywords
+ if (len >= 2 && len <= 11) {
+ const token = descKeyword(ret);
+ if (token > 0) {
+ if (isEscaped) {
+ if (context & Context.DisallowEscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ // Here we fall back to a mutual parser flag if the escaped keyword isn't disallowed through
+ // context masks. This is similiar to how V8 does it - they are using an
+ // 'escaped_keyword' token.
+ // - J.K. Thomas
+ parser.flags |= Flags.EscapedKeyword;
+ }
+ return token;
+ }
+ }
+ if (context & Context.OptionsRawidentifiers)
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ return 33685505 /* Identifier */;
+}
+/**
+ * Scanning chars in the range 0...127, and treat them as an possible
+ * identifier. This allows subsequent checking to be faster.
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param first Code point
+ */
+function scanMaybeIdentifier(parser, context, first) {
+ first = nextUnicodeChar(parser);
+ if (!isValidIdentifierStart(first)) {
+ report(parser, 10 /* UnexpectedChar */, escapeInvalidCharacters(first));
+ }
+ return scanIdentifier(parser, context, first);
+}
+/**
+ * Scan unicode codepoint escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanUnicodeCodePointEscape(parser) {
+ const { index } = parser;
+ if (index + 5 < parser.length) {
+ if (parser.source.charCodeAt(index + 1) !== 117 /* LowerU */) {
+ report(parser, 0 /* Unexpected */);
+ }
+ parser.index += 2;
+ parser.column += 2;
+ const code = scanIdentifierUnicodeEscape(parser);
+ if (code >= 55296 /* LeadSurrogateMin */ && code <= 56319 /* LeadSurrogateMax */) {
+ report(parser, 74 /* UnexpectedSurrogate */);
+ }
+ if (!isIdentifierPart(code)) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ return fromCodePoint(code);
+ }
+ report(parser, 0 /* Unexpected */);
+}
+/**
+ * Scan identifier unicode escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanIdentifierUnicodeEscape(parser) {
+ // Accept both \uxxxx and \u{xxxxxx}. In the latter case, the number of
+ // hex digits between { } is arbitrary. \ and u have already been read.
+ let ch = parser.source.charCodeAt(parser.index);
+ let codePoint = 0;
+ // '\u{DDDDDDDD}'
+ if (ch === 123 /* LeftBrace */) { // {
+ ch = readNext(parser);
+ let digit = toHex(ch);
+ while (digit >= 0) {
+ codePoint = (codePoint << 4) | digit;
+ if (codePoint > 1114111 /* NonBMPMax */) {
+ report(parser, 89 /* UndefinedUnicodeCodePoint */);
+ }
+ parser.index++;
+ parser.column++;
+ digit = toHex(parser.source.charCodeAt(parser.index));
+ }
+ if (parser.source.charCodeAt(parser.index) !== 125 /* RightBrace */) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ consumeOpt(parser, 125 /* RightBrace */);
+ // '\uDDDD'
+ }
+ else {
+ for (let i = 0; i < 4; i++) {
+ ch = parser.source.charCodeAt(parser.index);
+ const digit = toHex(ch);
+ if (digit < 0)
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ codePoint = (codePoint << 4) | digit;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ return codePoint;
+} + +// 11.4 Comments
+/**
+ * Skips single HTML comments. Same behavior as in V8.
+ *
+ * @param parser Parser Object
+ * @param context Context masks.
+ * @param state Scanner state
+ * @param type Comment type
+ */
+function skipSingleHTMLComment(parser, context, state, type) {
+ if (context & Context.Module)
+ report(parser, 90 /* HtmlCommentInModule */);
+ return skipSingleLineComment(parser, context, state, type);
+}
+/**
+ * Skips SingleLineComment, SingleLineHTMLCloseComment and SingleLineHTMLOpenComment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SingleLineComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLOpenComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLCloseComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ * @param type Comment type
+ */
+function skipSingleLineComment(parser, context, state, type) {
+ const start = parser.index;
+ const collectable = !!(context & Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 13 /* CarriageReturn */:
+ advanceNewline(parser);
+ if ((parser.index < parser.length) && parser.source.charCodeAt(parser.index) === 10 /* LineFeed */)
+ parser.index++;
+ return state | ScannerState.NewLine;
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ advanceNewline(parser);
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state | ScannerState.NewLine;
+ default:
+ parser.index++;
+ parser.column++;
+ }
+ }
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state;
+}
+/**
+ * Skips multiline comment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-MultiLineComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ */
+function skipMultiLineComment(parser, context, state) {
+ const start = parser.index;
+ const collectable = !!(context & Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 42 /* Asterisk */:
+ parser.index++;
+ parser.column++;
+ state &= ~ScannerState.LastIsCR;
+ if (consumeOpt(parser, 47 /* Slash */)) {
+ if (collectable)
+ addComment(parser, context, 'MultiLine', start);
+ return state;
+ }
+ break;
+ // Mark multiline comments containing linebreaks as new lines
+ // so we can perfectly handle edge cases like: '1/*\n*/--> a comment'
+ case 13 /* CarriageReturn */:
+ state |= ScannerState.NewLine | ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ break;
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ default:
+ state &= ~ScannerState.LastIsCR;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ // Unterminated multi-line comment.
+ tolerant(parser, context, 8 /* UnterminatedComment */);
+}
+/**
+ * Add comments
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param type Comment type
+ * @param commentStart Start position of comment
+ */
+function addComment(parser, context, type, commentStart) {
+ const { index, startIndex: start, startLine, startColumn, lastLine, lastColumn } = parser;
+ const comment = {
+ type,
+ value: parser.source.slice(commentStart, type === 'MultiLine' ? index - 2 : index),
+ start,
+ end: index,
+ };
+ if (context & Context.OptionsLoc) {
+ comment.loc = {
+ start: { line: startLine, column: startColumn },
+ end: { line: lastLine, column: lastColumn },
+ };
+ }
+ parser.comments.push(comment);
+} + +/**
+ * Scan
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-punctuatorss)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scan(parser, context) {
+ parser.flags &= ~Flags.NewLine | Flags.EscapedKeyword;
+ const lineStart = parser.index === 0;
+ let state = ScannerState.None;
+ while (parser.index < parser.length) {
+ if (!lineStart) {
+ parser.startIndex = parser.index;
+ parser.startColumn = parser.column;
+ parser.startLine = parser.line;
+ }
+ const first = parser.source.charCodeAt(parser.index);
+ if (first > 128 /* MaxAsciiCharacter */) {
+ switch (first) {
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ case 65519 /* ByteOrderMark */:
+ case 160 /* NonBreakingSpace */:
+ case 5760 /* Ogham */:
+ case 8192 /* EnQuad */:
+ case 8193 /* EmQuad */:
+ case 8194 /* EnSpace */:
+ case 8195 /* EmSpace */:
+ case 8196 /* ThreePerEmSpace */:
+ case 8197 /* FourPerEmSpace */:
+ case 8198 /* SixPerEmSpace */:
+ case 8199 /* FigureSpace */:
+ case 8200 /* PunctuationSpace */:
+ case 8201 /* ThinSpace */:
+ case 8202 /* HairSpace */:
+ case 8239 /* NarrowNoBreakSpace */:
+ case 8287 /* MathematicalSpace */:
+ case 12288 /* IdeographicSpace */:
+ case 65279 /* Zwnbs */:
+ case 8205 /* Zwj */:
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ return scanMaybeIdentifier(parser, context, first);
+ }
+ }
+ else {
+ // Note: Here we first get rid of LT and WS, then we make sure that the lookup time
+ // for the single punctuator char is short as possible. A single punctuator
+ // char is a valid token that cannot also be a prefix of a combination
+ // of long tokens - e.g. '(', ')' and '=' is valid. '==' is not.
+ switch (first) {
+ case 13 /* CarriageReturn */:
+ state |= ScannerState.NewLine | ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ break;
+ case 9 /* Tab */:
+ case 11 /* VerticalTab */:
+ case 12 /* FormFeed */:
+ case 32 /* Space */:
+ parser.index++;
+ parser.column++;
+ break;
+ // `(`
+ case 40 /* LeftParen */:
+ parser.index++;
+ parser.column++;
+ return 50331659 /* LeftParen */;
+ // `)`
+ case 41 /* RightParen */:
+ parser.index++;
+ parser.column++;
+ return 16 /* RightParen */;
+ // `,`
+ case 44 /* Comma */:
+ parser.index++;
+ parser.column++;
+ return 16777234 /* Comma */;
+ // `:`
+ case 58 /* Colon */:
+ parser.index++;
+ parser.column++;
+ return 16777237 /* Colon */;
+ // `;`
+ case 59 /* Semicolon */:
+ parser.index++;
+ parser.column++;
+ return 17825809 /* Semicolon */;
+ // `?`
+ case 63 /* QuestionMark */:
+ parser.index++;
+ parser.column++;
+ return 22 /* QuestionMark */;
+ // `]`
+ case 93 /* RightBracket */:
+ parser.index++;
+ parser.column++;
+ return 20 /* RightBracket */;
+ // `{`
+ case 123 /* LeftBrace */:
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ // `}`
+ case 125 /* RightBrace */:
+ parser.index++;
+ parser.column++;
+ return 17825807 /* RightBrace */;
+ // `~`
+ case 126 /* Tilde */:
+ parser.index++;
+ parser.column++;
+ return 301989934 /* Complement */;
+ // `[`
+ case 91 /* LeftBracket */:
+ parser.index++;
+ parser.column++;
+ return 41943059 /* LeftBracket */;
+ // `@`
+ case 64 /* At */:
+ parser.index++;
+ parser.column++;
+ return 120 /* At */;
+ // `/`, `/=`, `/>`
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774773 /* Divide */;
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipSingleLineComment(parser, context, state, 'SingleLine');
+ continue;
+ }
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipMultiLineComment(parser, context, state);
+ continue;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 100663333 /* DivideAssign */;
+ }
+ default:
+ return 167774773 /* Divide */;
+ }
+ }
+ // `-`, `--`, `-=`
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++; // skip `-`
+ const next = parser.source.charCodeAt(parser.index);
+ switch (next) {
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++;
+ if ((state & ScannerState.NewLine || lineStart) &&
+ consumeOpt(parser, 62 /* GreaterThan */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLClose');
+ continue;
+ }
+ return 570425372 /* Decrement */;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 67108899 /* SubtractAssign */;
+ }
+ default:
+ return 436209968 /* Subtract */;
+ }
+ }
+ // `<`, `<=`, `<<`, `<<=`, `</`, <!--
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++; // skip `<`
+ if (consumeOpt(parser, 33 /* Exclamation */) &&
+ consumeOpt(parser, 45 /* Hyphen */) &&
+ consumeOpt(parser, 45 /* Hyphen */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLOpen');
+ continue;
+ }
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 61 /* EqualSign */) ?
+ 67108894 /* ShiftLeftAssign */ :
+ 167774273 /* ShiftLeft */;
+ case 61 /* EqualSign */:
+ parser.index++;
+ parser.column++;
+ return 167774013 /* LessThanOrEqual */;
+ case 47 /* Slash */:
+ {
+ if (!(context & Context.OptionsJSX))
+ break;
+ const index = parser.index + 1;
+ // Check that it's not a comment start.
+ if (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 42 /* Asterisk */ || next === 47 /* Slash */)
+ break;
+ }
+ parser.index++;
+ parser.column++;
+ return 25 /* JSXClose */;
+ }
+ default: // ignore
+ return 167774015 /* LessThan */;
+ }
+ // `!`, `!=`, `!==`
+ case 33 /* Exclamation */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 301989933 /* Negate */;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773756 /* LooseNotEqual */;
+ return 167773754 /* StrictNotEqual */;
+ // `'string'`, `"string"`
+ case 39 /* SingleQuote */:
+ case 34 /* DoubleQuote */:
+ return scanString(parser, context, first);
+ // `%`, `%=`
+ case 37 /* Percent */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167774772 /* Modulo */;
+ return 67108902 /* ModuloAssign */;
+ // `&`, `&&`, `&=`
+ case 38 /* Ampersand */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 38 /* Ampersand */) {
+ parser.index++;
+ parser.column++;
+ return 169869879 /* LogicalAnd */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108905 /* BitwiseAndAssign */;
+ }
+ return 167773508 /* BitwiseAnd */;
+ }
+ // `*`, `**`, `*=`, `**=`
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774771 /* Multiply */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108900 /* MultiplyAssign */;
+ }
+ if (next !== 42 /* Asterisk */)
+ return 167774771 /* Multiply */;
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167775030 /* Exponentiate */;
+ return 67108897 /* ExponentiateAssign */;
+ }
+ // `+`, `++`, `+=`
+ case 43 /* Plus */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 436209967 /* Add */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */) {
+ parser.index++;
+ parser.column++;
+ return 570425371 /* Increment */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108898 /* AddAssign */;
+ }
+ return 436209967 /* Add */;
+ }
+ // `\\u{N}var`
+ case 92 /* Backslash */:
+ return scanIdentifier(parser, context);
+ // `=`, `==`, `===`, `=>`
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 167773753 /* StrictEqual */;
+ }
+ else {
+ return 167773755 /* LooseEqual */;
+ }
+ }
+ else if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ return 10 /* Arrow */;
+ }
+ return 83886109 /* Assign */;
+ }
+ // `>`, `>=`, `>>`, `>>>`, `>>=`, `>>>=`
+ case 62 /* GreaterThan */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774016 /* GreaterThan */;
+ if (context & Context.InJSXChild)
+ return 167774016 /* GreaterThan */;
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 167774014 /* GreaterThanOrEqual */;
+ }
+ if (next !== 62 /* GreaterThan */)
+ return 167774016 /* GreaterThan */;
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 67108896 /* LogicalShiftRightAssign */;
+ }
+ else {
+ return 167774275 /* LogicalShiftRight */;
+ }
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108895 /* ShiftRightAssign */;
+ }
+ return 167774274 /* ShiftRight */;
+ }
+ // `^`, `^=`
+ case 94 /* Caret */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773254 /* BitwiseXor */;
+ return 67108903 /* BitwiseXorAssign */;
+ // ``string``
+ case 96 /* Backtick */:
+ return scanTemplate(parser, context);
+ // `|`, `||`, `|=`
+ case 124 /* VerticalBar */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 124 /* VerticalBar */) {
+ parser.index++;
+ parser.column++;
+ return 169869624 /* LogicalOr */;
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108904 /* BitwiseOrAssign */;
+ }
+ return 167772997 /* BitwiseOr */;
+ }
+ // `.`, `...`, `.123` (numeric literal)
+ case 46 /* Period */:
+ {
+ let index = parser.index + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 57 /* Nine */) {
+ scanNumericLiteral(parser, context, NumericState.Float);
+ return 33554434 /* NumericLiteral */;
+ }
+ else if (next === 46 /* Period */) {
+ index++;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 46 /* Period */) {
+ parser.index = index + 1;
+ parser.column += 3;
+ return 14 /* Ellipsis */;
+ }
+ }
+ parser.index++;
+ parser.column++;
+ return 16777229 /* Period */;
+ }
+ // `#`
+ case 35 /* Hash */:
+ {
+ parser.index++;
+ parser.column++;
+ const index = parser.index;
+ const next = parser.source.charCodeAt(index);
+ if (context & Context.OptionsShebang &&
+ lineStart &&
+ next === 33 /* Exclamation */) {
+ parser.index = index + 1;
+ skipSingleLineComment(parser, context, ScannerState.None, 'SheBang');
+ continue;
+ }
+ return scanPrivateName(parser, context);
+ }
+ // `0`...`9`
+ case 48 /* Zero */:
+ {
+ parser.index++;
+ parser.column++;
+ switch (parser.source.charCodeAt(parser.index)) {
+ // Hex number - '0x', '0X'
+ case 88 /* UpperX */:
+ case 120 /* LowerX */:
+ return scanHexIntegerLiteral(parser, context);
+ // Binary number - '0b', '0B'
+ case 66 /* UpperB */:
+ case 98 /* LowerB */:
+ return scanOctalOrBinary(parser, context, 2);
+ // Octal number - '0o', '0O'
+ case 79 /* UpperO */:
+ case 111 /* LowerO */:
+ return scanOctalOrBinary(parser, context, 8);
+ default:
+ // Implicit octal digits startign with '0'
+ return scanImplicitOctalDigits(parser, context);
+ }
+ }
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return scanNumericLiteral(parser, context);
+ // `a`...`z`, `A`...`Z`, `_var`, `$var`
+ case 65 /* UpperA */:
+ case 66 /* UpperB */:
+ case 67 /* UpperC */:
+ case 68 /* UpperD */:
+ case 69 /* UpperE */:
+ case 70 /* UpperF */:
+ case 71 /* UpperG */:
+ case 72 /* UpperH */:
+ case 73 /* UpperI */:
+ case 74 /* UpperJ */:
+ case 75 /* UpperK */:
+ case 76 /* UpperL */:
+ case 77 /* UpperM */:
+ case 78 /* UpperN */:
+ case 79 /* UpperO */:
+ case 80 /* UpperP */:
+ case 81 /* UpperQ */:
+ case 82 /* UpperR */:
+ case 83 /* UpperS */:
+ case 84 /* UpperT */:
+ case 85 /* UpperU */:
+ case 86 /* UpperV */:
+ case 87 /* UpperW */:
+ case 88 /* UpperX */:
+ case 89 /* UpperY */:
+ case 90 /* UpperZ */:
+ case 36 /* Dollar */:
+ case 95 /* Underscore */:
+ case 97 /* LowerA */:
+ case 98 /* LowerB */:
+ case 99 /* LowerC */:
+ case 100 /* LowerD */:
+ case 101 /* LowerE */:
+ case 102 /* LowerF */:
+ case 103 /* LowerG */:
+ case 104 /* LowerH */:
+ case 105 /* LowerI */:
+ case 106 /* LowerJ */:
+ case 107 /* LowerK */:
+ case 108 /* LowerL */:
+ case 109 /* LowerM */:
+ case 110 /* LowerN */:
+ case 111 /* LowerO */:
+ case 112 /* LowerP */:
+ case 113 /* LowerQ */:
+ case 114 /* LowerR */:
+ case 115 /* LowerS */:
+ case 116 /* LowerT */:
+ case 117 /* LowerU */:
+ case 118 /* LowerV */:
+ case 119 /* LowerW */:
+ case 120 /* LowerX */:
+ case 121 /* LowerY */:
+ case 122 /* LowerZ */:
+ default:
+ return scanIdentifier(parser, context, first);
+ }
+ }
+ }
+ return 1048576 /* EndOfSource */;
+} + +/**
+ * Scans regular expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanRegularExpression(parser, context) {
+ const bodyStart = parser.index;
+ let preparseState = RegexState.Empty;
+ loop: while (true) {
+ const ch = parser.source.charCodeAt(parser.index);
+ parser.index++;
+ parser.column++;
+ if (preparseState & RegexState.Escape) {
+ preparseState &= ~RegexState.Escape;
+ }
+ else {
+ switch (ch) {
+ case 47 /* Slash */:
+ if (!preparseState)
+ break loop;
+ else
+ break;
+ case 92 /* Backslash */:
+ preparseState |= RegexState.Escape;
+ break;
+ case 91 /* LeftBracket */:
+ preparseState |= RegexState.Class;
+ break;
+ case 93 /* RightBracket */:
+ preparseState &= RegexState.Escape;
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ report(parser, 7 /* UnterminatedRegExp */);
+ default: // ignore
+ }
+ }
+ if (parser.index >= parser.source.length) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ const bodyEnd = parser.index - 1;
+ let mask = RegexFlags.Empty;
+ const { index: flagStart } = parser;
+ loop: while (parser.index < parser.source.length) {
+ const code = parser.source.charCodeAt(parser.index);
+ switch (code) {
+ case 103 /* LowerG */:
+ if (mask & RegexFlags.Global)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'g');
+ mask |= RegexFlags.Global;
+ break;
+ case 105 /* LowerI */:
+ if (mask & RegexFlags.IgnoreCase)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'i');
+ mask |= RegexFlags.IgnoreCase;
+ break;
+ case 109 /* LowerM */:
+ if (mask & RegexFlags.Multiline)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'm');
+ mask |= RegexFlags.Multiline;
+ break;
+ case 117 /* LowerU */:
+ if (mask & RegexFlags.Unicode)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'u');
+ mask |= RegexFlags.Unicode;
+ break;
+ case 121 /* LowerY */:
+ if (mask & RegexFlags.Sticky)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'y');
+ mask |= RegexFlags.Sticky;
+ break;
+ case 115 /* LowerS */:
+ if (mask & RegexFlags.DotAll)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 's');
+ mask |= RegexFlags.DotAll;
+ break;
+ default:
+ if (!isIdentifierPart(code))
+ break loop;
+ report(parser, 16 /* UnexpectedTokenRegExpFlag */, fromCodePoint(code));
+ }
+ parser.index++;
+ parser.column++;
+ }
+ const flags = parser.source.slice(flagStart, parser.index);
+ const pattern = parser.source.slice(bodyStart, bodyEnd);
+ parser.tokenRegExp = { pattern, flags };
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ parser.tokenValue = validate(parser, context, pattern, flags);
+ return 33554436 /* RegularExpression */;
+}
+/**
+ * Validates regular expressions
+ *
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param pattern Regexp body
+ * @param flags Regexp flags
+ */
+function validate(parser, context, pattern, flags) {
+ if (!(context & Context.OptionsNode)) {
+ try {
+ }
+ catch (e) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ try {
+ return new RegExp(pattern, flags);
+ }
+ catch (e) {
+ return null;
+ }
+} + +// 12.15.5 Destructuring Assignment
+/**
+ * Parses either a binding identifier or binding pattern
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingIdentifierOrPattern(parser, context, args = []) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ return token === 41943052 /* LeftBrace */ ?
+ parserObjectAssignmentPattern(parser, context) :
+ parseArrayAssignmentPattern(parser, context, args);
+ }
+ else if (token & (262144 /* IsAwait */ | 1073741824 /* IsYield */)) {
+ if (token & 262144 /* IsAwait */ && (context & (Context.Async | Context.Module))) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ else if (token & 1073741824 /* IsYield */ && (context & (Context.Yield | Context.Strict))) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ }
+ args.push(parser.tokenValue);
+ return parseBindingIdentifier(parser, context);
+}
+/**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BindingIdentifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingIdentifier(parser, context) {
+ const { token } = parser;
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (context & Context.BlockScope && token === 33574984 /* LetKeyword */) {
+ // let is disallowed as a lexically bound name
+ tolerant(parser, context, 27 /* LetInLexicalBinding */);
+ }
+ else if (hasBit(token, 20480 /* FutureReserved */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ else if (!isValidIdentifier(context, token)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+}
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentRestElement(parser, context, args) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * Parse rest property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+// tslint:disable-next-line:function-name
+function AssignmentRestProperty(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const { token } = parser;
+ const argument = parseBindingIdentifierOrPattern(parser, context);
+ if (hasBit(token, 8388608 /* IsBindingPattern */))
+ tolerant(parser, context, 94 /* InvalidRestBindingPattern */);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * ArrayAssignmentPattern[Yield] :
+ * [ Elisionopt AssignmentRestElement[?Yield]opt ]
+ * [ AssignmentElementList[?Yield] ]
+ * [ AssignmentElementList[?Yield] , Elisionopt AssignmentRestElement[?Yield]opt ]
+ *
+ * AssignmentRestElement[Yield] :
+ * ... DestructuringAssignmentTarget[?Yield]
+ *
+ * AssignmentElementList[Yield] :
+ * AssignmentElisionElement[?Yield]
+ * AssignmentElementList[?Yield] , AssignmentElisionElement[?Yield]
+ *
+ * AssignmentElisionElement[Yield] :
+ * Elisionopt AssignmentElement[?Yield]
+ *
+ * AssignmentElement[Yield] :
+ * DestructuringAssignmentTarget[?Yield] Initializer[In,?Yield]opt
+ *
+ * DestructuringAssignmentTarget[Yield] :
+ * LeftHandSideExpression[?Yield]
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param Parser object
+ * @param Context masks
+ */
+function parseArrayAssignmentPattern(parser, context, args) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else {
+ if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseAssignmentRestElement(parser, context, args));
+ break;
+ }
+ else {
+ elements.push(parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseBindingInitializer));
+ }
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ // tslint:disable-next-line:no-object-literal-type-assertion
+ return finishNode(context, parser, pos, {
+ type: 'ArrayPattern',
+ elements,
+ });
+}
+/**
+ * Parse object assignment pattern
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parserObjectAssignmentPattern(parser, context) {
+ const pos = getLocation(parser);
+ const properties = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ properties.push(AssignmentRestProperty(parser, context));
+ break;
+ }
+ properties.push(parseAssignmentProperty(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ObjectPattern',
+ properties,
+ });
+}
+/** Parse assignment pattern
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param left LHS of assignment pattern
+ * @param pos Location
+ */
+function parseAssignmentPattern(parser, context, left, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse binding initializer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingInitializer(parser, context) {
+ const pos = getLocation(parser);
+ const left = parseBindingIdentifierOrPattern(parser, context);
+ return !consume(parser, context, 83886109 /* Assign */) ?
+ left :
+ finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseAssignmentExpression(parser, context | Context.AllowIn),
+ });
+}
+/**
+ * Parse assignment property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentProperty(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ let key;
+ let value;
+ let computed = false;
+ let shorthand = false;
+ // single name binding
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ key = parseIdentifier(parser, context);
+ shorthand = !consume(parser, context, 16777237 /* Colon */);
+ if (shorthand) {
+ const hasInitializer = consume(parser, context, 83886109 /* Assign */);
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (!isValidIdentifier(context, token))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ value = hasInitializer ? parseAssignmentPattern(parser, context, key, pos) : key;
+ }
+ else
+ value = parseBindingInitializer(parser, context);
+ }
+ else {
+ computed = token === 41943059 /* LeftBracket */;
+ key = parsePropertyName(parser, context);
+ expect(parser, context, 16777237 /* Colon */);
+ value = parseExpressionCoverGrammar(parser, context, parseBindingInitializer);
+ }
+ // Note! The specs specifically state that this is "assignment property", but
+ // nothing in ESTree specs explains the difference between this "property" and the "property" for object literals.
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ kind: 'init',
+ key,
+ computed,
+ value,
+ method: false,
+ shorthand,
+ });
+} + +// JSX Specification
+// https://facebook.github.io/jsx/
+/**
+ * Parses JSX element or JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXRootElement(parser, context) {
+ const pos = getLocation(parser);
+ let children = [];
+ let closingElement = null;
+ let selfClosing = false;
+ let openingElement;
+ expect(parser, context, 167774015 /* LessThan */);
+ const isFragment = parser.token === 167774016 /* GreaterThan */;
+ if (isFragment) {
+ openingElement = parseJSXOpeningFragment(parser, context, pos);
+ }
+ else {
+ const name = parseJSXElementName(parser, context);
+ const attributes = parseJSXAttributes(parser, context);
+ selfClosing = consume(parser, context, 167774773 /* Divide */);
+ openingElement = parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos);
+ }
+ if (isFragment)
+ return parseJSXFragment(parser, context, openingElement, pos);
+ if (!selfClosing) {
+ children = parseJSXChildren(parser, context);
+ closingElement = parseJSXClosingElement(parser, context);
+ const open = isEqualTagNames(openingElement.name);
+ const close = isEqualTagNames(closingElement.name);
+ if (open !== close)
+ report(parser, 85 /* ExpectedJSXClosingTag */, close);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'JSXElement',
+ children,
+ openingElement,
+ closingElement,
+ });
+}
+/**
+ * Parses JSX opening element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param name Element name
+ * @param attributes Element attributes
+ * @param selfClosing True if this is a selfclosing JSX Element
+ * @param pos Line / Column tracking
+ */
+function parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos) {
+ if (context & Context.InJSXChild && selfClosing)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningElement',
+ name,
+ attributes,
+ selfClosing,
+ });
+}
+/**
+ * Parse JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param openingElement Opening fragment
+ * @param pos Line / Column location
+ */
+function parseJSXFragment(parser, context, openingElement, pos) {
+ const children = parseJSXChildren(parser, context);
+ const closingFragment = parseJSXClosingFragment(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXFragment',
+ children,
+ openingElement,
+ closingFragment,
+ });
+}
+/**
+ * Parse JSX opening fragmentD
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXOpeningFragment(parser, context, pos) {
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningFragment',
+ });
+}
+/**
+ * Prime the scanner and advance to the next JSX token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextJSXToken(parser) {
+ return parser.token = scanJSXToken(parser);
+}
+/**
+ * Mini scanner
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXToken(parser) {
+ if (parser.index >= parser.source.length)
+ return 1048576 /* EndOfSource */;
+ parser.lastIndex = parser.startIndex = parser.index;
+ const char = parser.source.charCodeAt(parser.index);
+ if (char === 60 /* LessThan */) {
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 47 /* Slash */) ? 25 /* JSXClose */ : 167774015 /* LessThan */;
+ }
+ else if (char === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ }
+ while (parser.index < parser.source.length) {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 123 /* LeftBrace */ || next === 60 /* LessThan */)
+ break;
+ }
+ return 121 /* JSXText */;
+}
+/**
+ * Parses JSX children
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXChildren(parser, context) {
+ const children = [];
+ while (parser.token !== 25 /* JSXClose */) {
+ children.push(parseJSXChild(parser, context));
+ }
+ return children;
+}
+/**
+ * Parses JSX Text
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXText(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.source.slice(parser.startIndex, parser.index);
+ parser.token = scanJSXToken(parser);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXText',
+ value,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = value;
+ return node;
+}
+/**
+ * Parses JSX Child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXChild(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ case 121 /* JSXText */:
+ return parseJSXText(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpression(parser, context & ~Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context & ~Context.InJSXChild);
+ default:
+ report(parser, 0 /* Unexpected */);
+ }
+ return undefined; // note: get rid of this
+}
+/**
+ * Parses JSX attributes
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributes(parser, context) {
+ const attributes = [];
+ while (parser.index < parser.source.length) {
+ if (parser.token === 167774773 /* Divide */ || parser.token === 167774016 /* GreaterThan */)
+ break;
+ attributes.push(parseJSXAttribute(parser, context));
+ }
+ return attributes;
+}
+/**
+ * Parses JSX spread attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXSpreadAttribute(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadAttribute',
+ argument: expression,
+ });
+}
+/**
+ * Parses JSX namespace name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param namespace Identifier
+ * @param pos Line / Column location
+ */
+function parseJSXNamespacedName(parser, context, namespace, pos) {
+ expect(parser, context, 16777237 /* Colon */);
+ const name = parseJSXIdentifier(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXNamespacedName',
+ namespace,
+ name,
+ });
+}
+/**
+ * Parses JSX attribute name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributeName(parser, context) {
+ const pos = getLocation(parser);
+ const identifier = parseJSXIdentifier(parser, context);
+ return parser.token === 16777237 /* Colon */ ?
+ parseJSXNamespacedName(parser, context, identifier, pos) :
+ identifier;
+}
+/**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributeValue(parser, context) {
+ switch (scanJSXAttributeValue(parser, context)) {
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpressionContainer(parser, context | Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context | Context.InJSXChild);
+ default:
+ tolerant(parser, context, 87 /* InvalidJSXAttributeValue */);
+ return undefined; // note: get rid of this
+ }
+}
+/**
+ * Parses JSX Attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttribute(parser, context) {
+ const pos = getLocation(parser);
+ if (parser.token === 41943052 /* LeftBrace */)
+ return parseJSXSpreadAttribute(parser, context);
+ scanJSXIdentifier(parser);
+ const attrName = parseJSXAttributeName(parser, context);
+ const value = parser.token === 83886109 /* Assign */ ? parseJSXAttributeValue(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'JSXAttribute',
+ value: value,
+ name: attrName,
+ });
+}
+/**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXAttributeValue(parser, context) {
+ parser.lastIndex = parser.index;
+ const ch = parser.source.charCodeAt(parser.index);
+ switch (ch) {
+ case 34 /* DoubleQuote */:
+ case 39 /* SingleQuote */:
+ return scanJSXString(parser, context, ch);
+ default:
+ return nextToken(parser, context);
+ }
+}
+/**
+ * Parses JSX String
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote Code point
+ */
+function scanJSXString(parser, context, quote) {
+ const rawStart = parser.index;
+ parser.index++;
+ parser.column++;
+ let ret = '';
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ ret += fromCodePoint(ch);
+ parser.index++;
+ parser.column++;
+ ch = parser.source.charCodeAt(parser.index);
+ if (parser.index >= parser.source.length)
+ report(parser, 6 /* UnterminatedString */);
+ }
+ parser.index++;
+ parser.column++; // skip the quote
+ // raw
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(rawStart, parser.index);
+ parser.tokenValue = ret;
+ return 33554435 /* StringLiteral */;
+}
+/**
+ * Parses JJSX Empty Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXEmptyExpression(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXEmptyExpression',
+ });
+}
+/**
+ * Parses JSX Spread child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXSpreadChild(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpression(parser, context);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadChild',
+ expression,
+ });
+}
+/**
+ * Parses JSX Expression container
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXExpressionContainer(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ // Note: JSX Expressions can't be empty
+ if (parser.token === 17825807 /* RightBrace */)
+ tolerant(parser, context, 84 /* NonEmptyJSXExpression */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+}
+/**
+ * Parses JSX Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ if (parser.token === 14 /* Ellipsis */)
+ return parseJSXSpreadChild(parser, context);
+ const expression = parser.token === 17825807 /* RightBrace */ ?
+ parseJSXEmptyExpression(parser, context) :
+ parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+}
+/**
+ * Parses JSX Closing fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXClosingFragment(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ expect(parser, context, 167774016 /* GreaterThan */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingFragment',
+ });
+}
+/**
+ * Parses JSX Closing Element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXClosingElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ const name = parseJSXElementName(parser, context);
+ if (context & Context.InJSXChild)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingElement',
+ name,
+ });
+}
+/**
+ * Parses JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXIdentifier(parser, context) {
+ const { token, tokenValue: name, tokenRaw: raw } = parser;
+ if (!(token & (131072 /* IsIdentifier */ | 4096 /* Keyword */))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXIdentifier',
+ name,
+ });
+ if (context & Context.OptionsRawidentifiers)
+ node.raw = raw;
+ return node;
+}
+/**
+ * Parses JSX Member expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXMemberExpression(parser, context, expr, pos) {
+ // Note: In order to be able to parse cases like ''<A.B.C.D.E.foo-bar />', where the dash is located at the
+ // end, we must rescan for the JSX Identifier now. This because JSX identifiers differ from normal identifiers
+ scanJSXIdentifier(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXMemberExpression',
+ object: expr,
+ property: parseJSXIdentifier(parser, context),
+ });
+}
+/**
+ * Parses JSX Element name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXElementName(parser, context) {
+ const pos = getLocation(parser);
+ scanJSXIdentifier(parser);
+ let elementName = parseJSXIdentifier(parser, context);
+ if (parser.token === 16777237 /* Colon */)
+ return parseJSXNamespacedName(parser, context, elementName, pos);
+ while (consume(parser, context, 16777229 /* Period */)) {
+ elementName = parseJSXMemberExpression(parser, context, elementName, pos);
+ }
+ return elementName;
+}
+/**
+ * Scans JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXIdentifier(parser) {
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const firstCharPosition = parser.index;
+ let ch = parser.source.charCodeAt(parser.index);
+ while ((parser.index < parser.source.length) && (ch === 45 /* Hyphen */ || (isValidIdentifierPart(ch)))) {
+ ch = readNext(parser);
+ }
+ parser.tokenValue += parser.source.substr(firstCharPosition, parser.index - firstCharPosition);
+ }
+ return parser.token;
+} + +/**
+ * Expression :
+ * AssignmentExpression
+ * Expression , AssignmentExpression
+ *
+ * ExpressionNoIn :
+ * AssignmentExpressionNoIn
+ * ExpressionNoIn , AssignmentExpressionNoIn
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Expression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpression(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ return parser.token === 16777234 /* Comma */ ?
+ parseSequenceExpression(parser, context, expr, pos) :
+ expr;
+}
+/**
+ * Parse secuence expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSequenceExpression(parser, context, left, pos) {
+ const expressions = [left];
+ while (consume(parser, context, 16777234 /* Comma */)) {
+ expressions.push(parseExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+}
+/**
+ * Parse yield expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-YieldExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseYieldExpression(parser, context, pos) {
+ // YieldExpression[In] :
+ // yield
+ // yield [no LineTerminator here] AssignmentExpression[?In, Yield]
+ // yield [no LineTerminator here] * AssignmentExpression[?In, Yield]
+ // https://tc39.github.io/ecma262/#sec-generator-function-definitions-static-semantics-early-errors
+ if (context & Context.InParameter)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ expect(parser, context, 1107316842 /* YieldKeyword */);
+ let argument = null;
+ let delegate = false;
+ if (!(parser.flags & Flags.NewLine)) {
+ delegate = consume(parser, context, 167774771 /* Multiply */);
+ // 'Token.IsExpressionStart' bitmask contains the complete set of
+ // tokens that can appear after an AssignmentExpression, and none of them
+ // can start an AssignmentExpression.
+ if (delegate || parser.token & 33554432 /* IsExpressionStart */) {
+ argument = parseAssignmentExpression(parser, context);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'YieldExpression',
+ argument,
+ delegate,
+ });
+}
+/**
+ * AssignmentExpression :
+ * ConditionalExpression
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpression
+ * LeftHandSideExpression AssignmentOperator AssignmentExpression
+ *
+ * AssignmentExpressionNoIn :
+ * ConditionalExpressionNoIn
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpressionNoIn
+ * LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentExpression(parser, context) {
+ const pos = getLocation(parser);
+ let { token } = parser;
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ return parseYieldExpression(parser, context, pos);
+ let expr = token & 524288 /* IsAsync */ && lookahead(parser, context, nextTokenisIdentifierOrParen)
+ ? parserCoverCallExpressionAndAsyncArrowHead(parser, context)
+ : parseConditionalExpression(parser, context, pos);
+ if (parser.token === 10 /* Arrow */) {
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & (20480 /* FutureReserved */ | 4194304 /* IsEvalOrArguments */)) {
+ // Invalid: ' yield => { 'use strict'; 0 };'
+ if (token & 20480 /* FutureReserved */) {
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ }
+ expr = [expr];
+ }
+ return parseArrowFunction(parser, context &= ~Context.Async, pos, expr);
+ }
+ if (hasBit(parser.token, 67108864 /* IsAssignOp */)) {
+ token = parser.token;
+ if (context & Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ }
+ else if (consume(parser, context, 83886109 /* Assign */)) {
+ if (!(parser.flags & Flags.AllowDestructuring)) {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ // Only re-interpret if not inside a formal parameter list
+ if (!(context & Context.InParameter))
+ reinterpret(parser, context, expr);
+ if (context & Context.InParen)
+ parser.flags |= Flags.SimpleParameterList;
+ if (parser.token & 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ else if (context & Context.InParen &&
+ context & (Context.Strict | Context.Yield) &&
+ parser.token & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasYield;
+ }
+ }
+ else {
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ nextToken(parser, context);
+ }
+ const right = parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ parser.pendingExpressionError = null;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentExpression',
+ left: expr,
+ operator: tokenDesc(token),
+ right,
+ });
+ }
+ return expr;
+}
+/**
+ * Parse conditional expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ConditionalExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseConditionalExpression(parser, context, pos) {
+ const test = parseBinaryExpression(parser, context, 0, pos);
+ if (!consume(parser, context, 22 /* QuestionMark */))
+ return test;
+ const consequent = parseExpressionCoverGrammar(parser, context & ~Context.AllowDecorator | Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16777237 /* Colon */);
+ return finishNode(context, parser, pos, {
+ type: 'ConditionalExpression',
+ test,
+ consequent,
+ alternate: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse binary expression.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-exp-operator)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-additive-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-bitwise-shift-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-equality-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-relational-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-multiplicative-operators)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param minPrec Minimum precedence value
+ * @param pos Line / Column info
+ * @param Left Left hand side of the binary expression
+ */
+function parseBinaryExpression(parser, context, minPrec, pos, left = parseUnaryExpression(parser, context)) {
+ // Shift-reduce parser for the binary operator part of the JS expression
+ // syntax.
+ const bit = context & Context.AllowIn ^ Context.AllowIn;
+ while (hasBit(parser.token, 167772160 /* IsBinaryOp */)) {
+ const t = parser.token;
+ const prec = t & 3840 /* Precedence */;
+ const delta = (t === 167775030 /* Exponentiate */) << 8 /* PrecStart */;
+ if (bit && t === 167786289 /* InKeyword */)
+ break;
+ // When the next token is no longer a binary operator, it's potentially the
+ // start of an expression, so we break the loop
+ if (prec + delta <= minPrec)
+ break;
+ nextToken(parser, context);
+ left = finishNode(context, parser, pos, {
+ type: t & 2097152 /* IsLogical */ ? 'LogicalExpression' : 'BinaryExpression',
+ left,
+ right: parseBinaryExpression(parser, context & ~Context.AllowIn, prec, getLocation(parser)),
+ operator: tokenDesc(t),
+ });
+ }
+ return left;
+}
+/**
+ * Parse await expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AwaitExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ */
+function parseAwaitExpression(parser, context, pos) {
+ if (context & Context.InParameter)
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ expect(parser, context, 34017389 /* AwaitKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'AwaitExpression',
+ argument: parseUnaryExpression(parser, context),
+ });
+}
+/**
+ * Parses unary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UnaryExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseUnaryExpression(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ if (hasBit(token, 301989888 /* IsUnaryOp */)) {
+ nextToken(parser, context);
+ if (parser.flags & Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ const argument = parseExpressionCoverGrammar(parser, context, parseUnaryExpression);
+ if (parser.token === 167775030 /* Exponentiate */) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & Context.Strict && token === 302002219 /* DeleteKeyword */) {
+ if (argument.type === 'Identifier') {
+ tolerant(parser, context, 43 /* StrictDelete */);
+ }
+ else if (isPropertyWithPrivateFieldKey(argument)) {
+ tolerant(parser, context, 44 /* DeletePrivateField */);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'UnaryExpression',
+ operator: tokenDesc(token),
+ argument,
+ prefix: true,
+ });
+ }
+ return context & Context.Async && token & 262144 /* IsAwait */
+ ? parseAwaitExpression(parser, context, pos)
+ : parseUpdateExpression(parser, context, pos);
+}
+/**
+ * Parses update expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UpdateExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseUpdateExpression(parser, context, pos) {
+ const { token } = parser;
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */)) {
+ nextToken(parser, context);
+ const expr = parseLeftHandSideExpression(parser, context, pos);
+ validateUpdateExpression(parser, context, expr, 'Prefix');
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expr,
+ operator: tokenDesc(token),
+ prefix: true,
+ });
+ }
+ else if (context & Context.OptionsJSX && token === 167774015 /* LessThan */) {
+ return parseJSXRootElement(parser, context | Context.InJSXChild);
+ }
+ const expression = parseLeftHandSideExpression(parser, context, pos);
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */) && !(parser.flags & Flags.NewLine)) {
+ validateUpdateExpression(parser, context, expression, 'Postfix');
+ const operator = parser.token;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expression,
+ operator: tokenDesc(operator),
+ prefix: false,
+ });
+ }
+ return expression;
+}
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseRestElement(parser, context, args = []) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (context & Context.InParen && parser.token & 262144 /* IsAwait */)
+ parser.flags |= Flags.HasAwait;
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * Parse spread element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SpreadElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSpreadElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+}
+/**
+ * Parse left hand side expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LeftHandSideExpression)
+ *
+ * @param Parser Parer instance
+ * @param Context Contextmasks
+ * @param pos Location info
+ */
+function parseLeftHandSideExpression(parser, context, pos) {
+ const expr = context & Context.OptionsNext && parser.token === 33566810 /* ImportKeyword */
+ ? parseCallImportOrMetaProperty(parser, context | Context.AllowIn)
+ : parseMemberExpression(parser, context | Context.AllowIn, pos);
+ return parseCallExpression(parser, context | Context.AllowIn, pos, expr);
+}
+/**
+ * Parse member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ * @param expr Expression
+ */
+function parseMemberExpression(parser, context, pos, expr = parsePrimaryExpression(parser, context)) {
+ while (true) {
+ switch (parser.token) {
+ case 16777229 /* Period */: {
+ consume(parser, context, 16777229 /* Period */);
+ parser.flags = parser.flags & ~Flags.AllowBinding | Flags.AllowDestructuring;
+ const property = parseIdentifierNameOrPrivateName(parser, context);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: false,
+ property,
+ });
+ continue;
+ }
+ case 41943059 /* LeftBracket */: {
+ consume(parser, context, 41943059 /* LeftBracket */);
+ parser.flags = parser.flags & ~Flags.AllowBinding | Flags.AllowDestructuring;
+ const property = parseExpression(parser, context);
+ expect(parser, context, 20 /* RightBracket */);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: true,
+ property,
+ });
+ continue;
+ }
+ case 33554441 /* TemplateTail */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplateLiteral(parser, context),
+ });
+ continue;
+ }
+ case 33554440 /* TemplateCont */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplate(parser, context | Context.TaggedTemplate),
+ });
+ continue;
+ }
+ default:
+ return expr;
+ }
+ }
+}
+/**
+ * Parse call expression
+ *
+ * @param parser Parer instance
+ * @param context Context masks
+ * @param pos Line / Colum info
+ * @param expr Expression
+ */
+function parseCallExpression(parser, context, pos, expr) {
+ while (true) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ if (parser.token !== 50331659 /* LeftParen */)
+ return expr;
+ const args = parseArgumentList(parser, context & ~Context.AllowDecorator);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+}
+/**
+ * Parse cover call expression and async arrow head
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CoverCallExpressionAndAsyncArrowHead)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parserCoverCallExpressionAndAsyncArrowHead(parser, context) {
+ const pos = getLocation(parser);
+ let expr = parseMemberExpression(parser, context | Context.AllowIn, pos);
+ // Here we jump right into it and parse a simple, faster sub-grammar for
+ // async arrow / async identifier + call expression. This could have been done different
+ // but ESTree sucks!
+ //
+ // - J.K. Thomas
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (parser.token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */);
+ return parseAsyncArrowFunction(parser, context, ModifierState.Await, pos, [parseAndClassifyIdentifier(parser, context)]);
+ }
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ while (parser.token === 50331659 /* LeftParen */) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ const args = parseAsyncArgumentList(parser, context);
+ if (parser.token === 10 /* Arrow */) {
+ expr = parseAsyncArrowFunction(parser, context, ModifierState.Await, pos, args);
+ break;
+ }
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ return expr;
+}
+/**
+ * Parse argument list
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parseArgumentList(parser, context) {
+ // ArgumentList :
+ // AssignmentOrSpreadExpression
+ // ArgumentList , AssignmentOrSpreadExpression
+ //
+ // AssignmentOrSpreadExpression :
+ // ... AssignmentExpression
+ // AssignmentExpression
+ expect(parser, context, 50331659 /* LeftParen */);
+ const expressions = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ expressions.push(parseSpreadElement(parser, context));
+ }
+ else {
+ if (context & Context.Yield && hasBit(parser.token, 1073741824 /* IsYield */)) {
+ parser.flags |= Flags.HasYield;
+ setPendingError(parser);
+ }
+ expressions.push(parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ }
+ if (parser.token !== 16 /* RightParen */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return expressions;
+}
+/**
+ * Parse argument list for async arrow / async call expression
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parseAsyncArgumentList(parser, context) {
+ // Here we are parsing an "extended" argument list tweaked to handle async arrows. This is
+ // done here to avoid overhead and possible performance loss if we only
+ // parse out a simple call expression - E.g 'async(foo, bar)' or 'async(foo, bar)()';
+ //
+ // - J.K. Thomas
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = [];
+ let { token } = parser;
+ let state = CoverCallState.Empty;
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ parser.flags |= Flags.SimpleParameterList;
+ args.push(parseSpreadElement(parser, context));
+ state = CoverCallState.HasSpread;
+ }
+ else {
+ token = parser.token;
+ state = validateAsyncArgumentList(parser, context, state);
+ args.push(restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ }
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ parser.flags &= ~Flags.AllowDestructuring;
+ if (state & CoverCallState.HasSpread)
+ state = CoverCallState.SeenSpread;
+ }
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & CoverCallState.SeenSpread) {
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ }
+ else if (state & CoverCallState.EvalOrArguments) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (state & CoverCallState.Yield) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ else if (parser.flags & Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (state & CoverCallState.Await || parser.flags & Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ }
+ return args;
+}
+/**
+ * Parse primary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PrimaryExpression)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parsePrimaryExpression(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ return parseIdentifier(parser, context);
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionOrIdentifier(parser, context);
+ case 50331659 /* LeftParen */:
+ return parseParenthesizedExpression(parser, context | Context.InParen);
+ case 41943059 /* LeftBracket */:
+ return restoreExpressionCoverGrammar(parser, context, parseArrayLiteral);
+ case 41943052 /* LeftBrace */:
+ return restoreExpressionCoverGrammar(parser, context, parseObjectLiteral);
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionExpression(parser, context);
+ case 33566727 /* NullKeyword */:
+ case 33566726 /* TrueKeyword */:
+ case 33566725 /* FalseKeyword */:
+ return parseNullOrTrueOrFalseLiteral(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassExpression(parser, context);
+ case 33566811 /* NewKeyword */:
+ return parseNewExpressionOrMetaProperty(parser, context);
+ case 33566813 /* SuperKeyword */:
+ return parseSuperProperty(parser, context);
+ case 33554551 /* BigIntLiteral */:
+ return parseBigIntLiteral(parser, context);
+ case 33566815 /* ThisKeyword */:
+ return parseThisExpression(parser, context);
+ case 115 /* Hash */:
+ return parseIdentifierNameOrPrivateName(parser, context);
+ case 167774773 /* Divide */:
+ case 100663333 /* DivideAssign */:
+ scanRegularExpression(parser, context);
+ return parseRegularExpressionLiteral(parser, context);
+ case 33554441 /* TemplateTail */:
+ return parseTemplateLiteral(parser, context);
+ case 33554440 /* TemplateCont */:
+ return parseTemplate(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetAsIdentifier(parser, context);
+ case 12369 /* DoKeyword */:
+ if (context & Context.OptionsExperimental)
+ return parseDoExpression(parser, context);
+ default:
+ return parseAndClassifyIdentifier(parser, context);
+ }
+}
+/**
+ * Parse do expression (*experimental*)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDoExpression(parser, context) {
+ // AssignmentExpression ::
+ // do '{' StatementList '}'
+ const pos = getLocation(parser);
+ expect(parser, context, 12369 /* DoKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'DoExpression',
+ body: parseBlockStatement(parser, context)
+ });
+}
+/**
+ * Parse 'let' as identifier in 'sloppy mode', and throws
+ * in 'strict mode' / 'module code'. We also avoid a lookahead on the
+ * ASI restictions while checking this after parsing out the 'let' keyword
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+function parseLetAsIdentifier(parser, context) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ if (parser.flags & Flags.NewLine) {
+ if (parser.token === 41943059 /* LeftBracket */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, 'let');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+}
+/**
+ * Parse either async function expression or identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+function parseAsyncFunctionOrIdentifier(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) :
+ parseIdentifier(parser, context);
+}
+/**
+ * Parses identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIdentifier(parser, context) {
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context | Context.TaggedTemplate);
+ const node = finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ if (context & Context.OptionsRawidentifiers)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parse regular expression literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseRegularExpressionLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenRegExp, tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ regex: tokenRegExp,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = tokenRaw;
+ return node;
+}
+/**
+ * Parses string and number literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StringLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.tokenValue;
+ if (context & Context.Strict && parser.flags & Flags.HasOctal) {
+ tolerant(parser, context, 61 /* StrictOctalLiteral */);
+ }
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parses BigInt literal (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/proposal-bigint/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBigIntLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ bigint: tokenRaw,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parses either null or boolean literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BooleanLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNullOrTrueOrFalseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const raw = tokenDesc(token);
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: token === 33566727 /* NullKeyword */ ? null : raw === 'true',
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = raw;
+ return node;
+}
+/**
+ * Parse this expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseThisExpression(parser, context) {
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ const pos = getLocation(parser);
+ nextToken(parser, context | Context.DisallowEscapedKeyword);
+ return finishNode(context, parser, pos, {
+ type: 'ThisExpression',
+ });
+}
+/**
+ * Parse identifier name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-IdentifierName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t token
+ */
+function parseIdentifierName(parser, context, t) {
+ if (!(t & (131072 /* IsIdentifier */ | 4096 /* Keyword */)))
+ tolerant(parser, context, 4 /* UnexpectedKeyword */, tokenDesc(t));
+ return parseIdentifier(parser, context);
+}
+/**
+ * Parse identifier name or private name (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIdentifierNameOrPrivateName(parser, context) {
+ if (!consume(parser, context, 115 /* Hash */))
+ return parseIdentifierName(parser, context, parser.token);
+ const { tokenValue } = parser;
+ const pos = getLocation(parser);
+ const name = tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+}
+/**
+ * Parse array literal
+ *
+ * ArrayLiteral :
+ * [ Elisionopt ]
+ * [ ElementList ]
+ * [ ElementList , Elisionopt ]
+ *
+ * ElementList :
+ * Elisionopt AssignmentExpression
+ * Elisionopt ... AssignmentExpression
+ * ElementList , Elisionopt AssignmentExpression
+ * ElementList , Elisionopt SpreadElement
+ *
+ * Elision :
+ * ,
+ * Elision ,
+ *
+ * SpreadElement :
+ * ... AssignmentExpression
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseArrayLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseSpreadElement(parser, context));
+ if (parser.token !== 20 /* RightBracket */) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ else {
+ elements.push(restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ return finishNode(context, parser, pos, {
+ type: 'ArrayExpression',
+ elements,
+ });
+}
+/**
+ * Parses cover parenthesized expression and arrow parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-parseCoverParenthesizedExpressionAndArrowParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseParenthesizedExpression(parser, context) {
+ expect(parser, context, 50331659 /* LeftParen */);
+ if (consume(parser, context, 16 /* RightParen */)) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.token === 10 /* Arrow */)
+ return [];
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ const restExpr = [parseRestElement(parser, context)];
+ expect(parser, context, 16 /* RightParen */);
+ parser.flags = parser.flags & ~(Flags.AllowDestructuring | Flags.AllowBinding) | Flags.SimpleParameterList;
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return restExpr;
+ }
+ // Record the sequence position
+ const sequencepos = getLocation(parser);
+ let state = validateCoverParenthesizedExpression(parser, CoverParenthesizedState.None);
+ let expr = restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ // Sequence expression
+ if (parser.token === 16777234 /* Comma */) {
+ state |= CoverParenthesizedState.SequenceExpression;
+ const expressions = [expr];
+ while (consume(parser, context | Context.DisallowEscapedKeyword, 16777234 /* Comma */)) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (!(parser.flags & Flags.AllowBinding))
+ tolerant(parser, context, 77 /* NotBindable */);
+ parser.flags |= Flags.SimpleParameterList;
+ const restElement = parseRestElement(parser, context);
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ expressions.push(restElement);
+ return expressions;
+ }
+ else if (consume(parser, context, 16 /* RightParen */)) {
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return expressions;
+ }
+ else {
+ state = validateCoverParenthesizedExpression(parser, state);
+ expressions.push(restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ }
+ expr = finishNode(context, parser, sequencepos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & CoverParenthesizedState.HasEvalOrArguments) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (state & CoverParenthesizedState.HasReservedWords) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ else if (!(parser.flags & Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (parser.flags & Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (context & Context.Async && parser.flags & Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ parser.flags &= ~(Flags.AllowBinding | Flags.HasAwait | Flags.HasYield);
+ return (state & CoverParenthesizedState.SequenceExpression ? expr.expressions : [expr]);
+ }
+ parser.flags &= ~(Flags.HasAwait | Flags.HasYield | Flags.AllowBinding);
+ if (!isValidSimpleAssignmentTarget(expr))
+ parser.flags &= ~Flags.AllowDestructuring;
+ return expr;
+}
+/**
+ * Parses function expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & ModifierState.Generator) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty), isGenerator, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: false,
+ generator: !!(isGenerator & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parses async function or async generator expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ const isAwait = ModifierState.Await;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict || isAwait & ModifierState.Await)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ if (token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & ModifierState.Generator)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty), isGenerator | isAwait, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: true,
+ generator: !!(isGenerator & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parse computed property names
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ComputedPropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseComputedPropertyName(parser, context) {
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const key = parseAssignmentExpression(parser, context | Context.AllowIn);
+ expect(parser, context, 20 /* RightBracket */);
+ return key;
+}
+/**
+ * Parse property name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePropertyName(parser, context) {
+ switch (parser.token) {
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943059 /* LeftBracket */:
+ return parseComputedPropertyName(parser, context);
+ default:
+ return parseIdentifier(parser, context);
+ }
+}
+/**
+ * Parse object spread properties
+ *
+ * @see [Link](https://tc39.github.io/proposal-object-rest-spread/#Spread)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSpreadProperties(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (parser.token & 8388608 /* IsBindingPattern */)
+ parser.flags &= ~Flags.AllowDestructuring;
+ const argument = parseAssignmentExpression(parser, context | Context.AllowIn);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+}
+/**
+ * Parses object literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ObjectLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseObjectLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const properties = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ properties.push(parser.token === 14 /* Ellipsis */ ?
+ parseSpreadProperties(parser, context) :
+ parsePropertyDefinition(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ parser.flags &= ~Flags.HasProtoField;
+ return finishNode(context, parser, pos, {
+ type: 'ObjectExpression',
+ properties,
+ });
+}
+/**
+ * Parse property definition
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyDefinition)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePropertyDefinition(parser, context) {
+ const pos = getLocation(parser);
+ const flags = parser.flags;
+ let value;
+ let state = consume(parser, context, 167774771 /* Multiply */) ? ObjectState.Generator | ObjectState.Method : ObjectState.Method;
+ const t = parser.token;
+ let key = parsePropertyName(parser, context);
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ else if (!(state & ObjectState.Generator) && t & 524288 /* IsAsync */ && !(parser.flags & Flags.NewLine)) {
+ state |= consume(parser, context, 167774771 /* Multiply */) ? ObjectState.Generator | ObjectState.Async : ObjectState.Async;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69743 /* GetKeyword */) {
+ state = state & ~ObjectState.Method | ObjectState.Getter;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69744 /* SetKeyword */) {
+ state = state & ~ObjectState.Method | ObjectState.Setter;
+ key = parsePropertyName(parser, context);
+ }
+ if (state & (ObjectState.Getter | ObjectState.Setter)) {
+ if (state & ObjectState.Generator)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ state &= ~ObjectState.Method;
+ if (parser.token === 16777237 /* Colon */) {
+ if ((state & (ObjectState.Async | ObjectState.Generator))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ else if (t !== 41943059 /* LeftBracket */ && parser.tokenValue === '__proto__') {
+ if (parser.flags & Flags.HasProtoField) {
+ // Record the error and put it on hold until we've determined
+ // whether or not we're destructuring
+ setPendingExpressionError(parser, 63 /* DuplicateProto */);
+ }
+ else
+ parser.flags |= Flags.HasProtoField;
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ // Invalid: 'async ({a: await}) => 1'
+ if (parser.token & 262144 /* IsAwait */)
+ parser.flags |= Flags.HasAwait;
+ value = restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ }
+ else {
+ if ((state & (ObjectState.Generator | ObjectState.Async)) || !isValidIdentifier(context, t)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(t));
+ }
+ else if (context & (Context.Strict | Context.Yield) && t & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasYield;
+ }
+ state |= ObjectState.Shorthand;
+ if (parser.token === 83886109 /* Assign */) {
+ if (context & Context.Strict && t & 4194304 /* IsEvalOrArguments */) {
+ report(parser, 47 /* StrictEvalArguments */);
+ }
+ else
+ setPendingExpressionError(parser, 91 /* InvalidCoverInitializedName */);
+ expect(parser, context, 83886109 /* Assign */);
+ if (context & (Context.Strict | Context.Yield | Context.Async) && parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */)) {
+ setPendingError(parser);
+ parser.flags |= parser.token & 1073741824 /* IsYield */ ? Flags.HasYield : Flags.HasAwait;
+ }
+ value = parseAssignmentPattern(parser, context, key, pos);
+ }
+ else {
+ if (t & 262144 /* IsAwait */) {
+ if (context & Context.Async)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ value = key;
+ }
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ key,
+ value,
+ kind: !(state & ObjectState.Getter | state & ObjectState.Setter) ? 'init' : (state & ObjectState.Setter) ? 'set' : 'get',
+ computed: t === 41943059 /* LeftBracket */,
+ method: !!(state & ObjectState.Method),
+ shorthand: !!(state & ObjectState.Shorthand),
+ });
+}
+/**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseMethodDeclaration(parser, context, state) {
+ const pos = getLocation(parser);
+ const isGenerator = state & ObjectState.Generator ? ModifierState.Generator : ModifierState.None;
+ const isAsync = state & ObjectState.Async ? ModifierState.Await : ModifierState.None;
+ const { params, body } = swapContext(parser, context | Context.Method, isGenerator | isAsync, parseFormalListAndBody, state);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: !!(state & ObjectState.Async),
+ generator: !!(state & ObjectState.Generator),
+ expression: false,
+ id: null,
+ });
+}
+/**
+ * Parse arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseArrowFunction(parser, context, pos, params) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, '=>');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context & ~Context.Async, params, pos, ModifierState.None);
+}
+/**
+ * Parse async arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncArrowFunction(parser, context, state, pos, params) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context | Context.Async, params, pos, state);
+}
+/**
+ * Shared helper function for both async arrow and arrows
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+// https://tc39.github.io/ecma262/#prod-AsyncArrowFunction
+function parseArrowBody(parser, context, params, pos, state) {
+ parser.pendingExpressionError = null;
+ for (const i in params)
+ reinterpret(parser, context | Context.InParameter, params[i]);
+ const expression = parser.token !== 41943052 /* LeftBrace */;
+ const body = expression ? parseExpressionCoverGrammar(parser, context & ~(Context.Yield | Context.InParameter), parseAssignmentExpression) :
+ swapContext(parser, context & ~(Context.Yield | Context.AllowDecorator) | Context.InFunctionBody, state, parseFunctionBody);
+ return finishNode(context, parser, pos, {
+ type: 'ArrowFunctionExpression',
+ body,
+ params,
+ id: null,
+ async: !!(state & ModifierState.Await),
+ generator: false,
+ expression,
+ });
+}
+/**
+ * Parses formal parameters and function body.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFormalListAndBody(parser, context, state) {
+ const paramList = parseFormalParameters(parser, context | Context.InParameter, state);
+ const args = paramList.args;
+ const params = paramList.params;
+ const body = parseFunctionBody(parser, context & ~Context.AllowDecorator | Context.InFunctionBody, args);
+ return { params, body };
+}
+/**
+ * Parse funciton body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionBody(parser, context, params) {
+ // Note! The 'params' has an 'any' type now because it's really shouldn't be there. This should have been
+ // on the parser object instead. So for now the 'params' arg are only used within the
+ // 'parseFormalListAndBody' method, and not within the arrow function body.
+ const pos = getLocation(parser);
+ expect(parser, context | Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const body = [];
+ while (parser.token === 33554435 /* StringLiteral */) {
+ const { tokenRaw, tokenValue } = parser;
+ body.push(parseDirective(parser, context));
+ if (tokenRaw.length === /* length of prologue*/ 12 && tokenValue === 'use strict') {
+ if (parser.flags & Flags.SimpleParameterList) {
+ tolerant(parser, context, 64 /* IllegalUseStrict */);
+ }
+ else if (parser.flags & (Flags.HasStrictReserved | Flags.StrictFunctionName)) {
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ }
+ else if (parser.flags & Flags.StrictEvalArguments) {
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ }
+ context |= Context.Strict;
+ }
+ }
+ if (context & Context.Strict) {
+ validateParams(parser, context, params);
+ }
+ const { labelSet } = parser;
+ parser.labelSet = {};
+ const savedFlags = parser.flags;
+ parser.flags = parser.flags & ~(Flags.StrictFunctionName | Flags.StrictEvalArguments | Flags.InSwitchStatement | Flags.InIterationStatement) | Flags.AllowDestructuring;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ if (savedFlags & Flags.InIterationStatement)
+ parser.flags |= Flags.InIterationStatement;
+ if (savedFlags & Flags.InSwitchStatement)
+ parser.flags |= Flags.InSwitchStatement;
+ parser.labelSet = labelSet;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body,
+ });
+}
+/**
+ * Parse formal parameters
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param Parser object
+ * @param Context masks
+ * @param Optional objectstate. Default to none
+ */
+function parseFormalParameters(parser, context, state) {
+ // FormalParameterList :
+ // [empty]
+ // FunctionRestParameter
+ // FormalsList
+ // FormalsList , FunctionRestParameter
+ //
+ // FunctionRestParameter :
+ // ... BindingIdentifier
+ //
+ // FormalsList :
+ // FormalParameter
+ // FormalsList , FormalParameter
+ //
+ // FormalParameter :
+ // BindingElement
+ //
+ // BindingElement :
+ // SingleNameBinding
+ // BindingPattern Initializeropt
+ expect(parser, context, 50331659 /* LeftParen */);
+ parser.flags &= ~(Flags.SimpleParameterList | Flags.HasStrictReserved);
+ const args = [];
+ const params = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (state & ObjectState.Setter)
+ tolerant(parser, context, 67 /* BadSetterRestParameter */);
+ parser.flags |= Flags.SimpleParameterList;
+ params.push(parseRestElement(parser, context, args));
+ break;
+ }
+ params.push(parseFormalParameterList(parser, context, args));
+ if (!consume(parser, context, 16777234 /* Comma */))
+ break;
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ if (state & ObjectState.Setter && params.length !== 1) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Setter', 'one', '');
+ }
+ if (state & ObjectState.Getter && params.length > 0) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Getter', 'no', 's');
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return { params, args };
+}
+/**
+ * Parse formal parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFormalParameterList(parser, context, args) {
+ const pos = getLocation(parser);
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (hasBit(parser.token, 20480 /* FutureReserved */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ if (hasBit(parser.token, 4194304 /* IsEvalOrArguments */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ }
+ else {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ const left = parseBindingIdentifierOrPattern(parser, context, args);
+ if (!consume(parser, context, 83886109 /* Assign */))
+ return left;
+ if (parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */) && context & (Context.Yield | Context.Async)) {
+ tolerant(parser, context, parser.token & 262144 /* IsAwait */ ? 52 /* AwaitInParameter */ : 51 /* YieldInParameter */);
+ }
+ parser.flags |= Flags.SimpleParameterList;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse class expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassExpression(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const { token } = parser;
+ let state = ObjectState.None;
+ let id = null;
+ let superClass = null;
+ if ((token !== 41943052 /* LeftBrace */ && token !== 12372 /* ExtendsKeyword */)) {
+ if (context & Context.Async && token & 262144 /* IsAwait */) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context | Context.Strict);
+ }
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | Context.Strict, pos);
+ state |= ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context | Context.Strict, state);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ });
+}
+/**
+ * Parse class body and element list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElementList)
+ *
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassBodyAndElementList(parser, context, state) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const body = [];
+ let decorators = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (!consume(parser, context, 17825809 /* Semicolon */)) {
+ if (context & Context.OptionsExperimental) {
+ decorators = parseDecorators(parser, context);
+ if (parser.token === 17825807 /* RightBrace */)
+ report(parser, 92 /* TrailingDecorators */);
+ if (decorators.length !== 0 && parser.tokenValue === 'constructor') {
+ report(parser, 93 /* GeneratorConstructor */);
+ }
+ }
+ body.push(context & Context.OptionsNext && parser.token === 115 /* Hash */
+ ? parsePrivateFields(parser, context, decorators)
+ : parseClassElement(parser, context, state, decorators));
+ }
+ }
+ parser.flags &= ~Flags.HasConstructor;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ClassBody',
+ body,
+ });
+}
+/**
+ * Parse class element and class public instance fields & private instance fields
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElement)
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassElement(parser, context, state, decorators) {
+ const pos = getLocation(parser);
+ let { tokenValue, token } = parser;
+ const flags = parser.flags;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ state |= ObjectState.Generator;
+ }
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ if (parser.tokenValue === 'constructor') {
+ if (state & ObjectState.Generator)
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'generator');
+ else if (state & ObjectState.Heritage)
+ context |= Context.AllowSuperProperty;
+ state |= ObjectState.Constructor;
+ }
+ let key = parsePropertyName(parser, context);
+ let value;
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ if (token === 20585 /* StaticKeyword */) {
+ token = parser.token;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= ObjectState.Generator;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ if (parser.tokenValue === 'prototype')
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ state |= ObjectState.Static;
+ key = parsePropertyName(parser, context);
+ if (context & Context.OptionsNext && isInstanceField(parser)) {
+ if (tokenValue === 'constructor')
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ }
+ }
+ if (parser.token !== 50331659 /* LeftParen */) {
+ if (token & 524288 /* IsAsync */ && !(state & ObjectState.Generator) && !(parser.flags & Flags.NewLine)) {
+ token = parser.token;
+ tokenValue = parser.tokenValue;
+ state |= ObjectState.Async;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= ObjectState.Generator;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ key = parsePropertyName(parser, context);
+ }
+ else if ((token === 69743 /* GetKeyword */ || token === 69744 /* SetKeyword */)) {
+ state |= token === 69743 /* GetKeyword */ ? ObjectState.Getter : ObjectState.Setter;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ key = parsePropertyName(parser, context & ~Context.Strict);
+ }
+ if (tokenValue === 'prototype') {
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ }
+ else if (!(state & ObjectState.Static) && tokenValue === 'constructor') {
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'accessor');
+ }
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ if (!(state & ObjectState.Computed) && state & ObjectState.Constructor) {
+ if (parser.flags & Flags.HasConstructor)
+ report(parser, 12 /* DuplicateConstructor */);
+ else
+ parser.flags |= Flags.HasConstructor;
+ }
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ if (context & Context.OptionsNext)
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const kind = (state & ObjectState.Constructor) ? 'constructor' : (state & ObjectState.Getter) ? 'get' :
+ (state & ObjectState.Setter) ? 'set' : 'method';
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & ObjectState.Static),
+ computed: !!(state & ObjectState.Computed),
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & ObjectState.Static),
+ computed: !!(state & ObjectState.Computed),
+ key,
+ value,
+ });
+}
+/**
+ * Parses field definition.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFieldDefinition(parser, context, key, state, pos, decorators) {
+ if (state & ObjectState.Constructor)
+ tolerant(parser, context, 0 /* Unexpected */);
+ let value = null;
+ if (state & (ObjectState.Async | ObjectState.Generator))
+ tolerant(parser, context, 0 /* Unexpected */);
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & ObjectState.Computed),
+ static: !!(state & ObjectState.Static),
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & ObjectState.Computed),
+ static: !!(state & ObjectState.Static),
+ });
+}
+/**
+ * Parse private name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePrivateName(parser, context, pos) {
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+}
+/**
+ * Parses private instance fields
+ *
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePrivateFields(parser, context, decorators) {
+ const pos = getLocation(parser);
+ expect(parser, context | Context.InClass, 115 /* Hash */);
+ if (parser.tokenValue === 'constructor')
+ tolerant(parser, context, 41 /* PrivateFieldConstructor */);
+ const key = parsePrivateName(parser, context, pos);
+ if (parser.token === 50331659 /* LeftParen */)
+ return parsePrivateMethod(parser, context, key, pos, decorators);
+ let value = null;
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ });
+}
+function parsePrivateMethod(parser, context, key, pos, decorators) {
+ const value = parseMethodDeclaration(parser, context | Context.Strict, ObjectState.None);
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ });
+}
+/**
+ * Parse either call expression or import expressions
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCallImportOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ // Import.meta - Stage 3 proposal
+ if (consume(parser, context, 16777229 /* Period */)) {
+ if (context & Context.Module && parser.tokenValue === 'meta')
+ return parseMetaProperty(parser, context, id, pos);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ let expr = parseImportExpression(parser, context, pos);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16 /* RightParen */);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: [args],
+ });
+ return expr;
+}
+/**
+ * Parse Import() expression. (Stage 3 proposal)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+function parseImportExpression(parser, context, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'Import',
+ });
+}
+/**
+ * Parse meta property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Identifier
+ * @param pos Location
+ */
+function parseMetaProperty(parser, context, meta, pos) {
+ return finishNode(context, parser, pos, {
+ meta,
+ type: 'MetaProperty',
+ property: parseIdentifier(parser, context),
+ });
+}
+/**
+ * Parse new expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NewExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNewExpressionOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ if (consume(parser, context | Context.DisallowEscapedKeyword, 16777229 /* Period */)) {
+ if (parser.tokenValue !== 'target' ||
+ !(context & (Context.InParameter | Context.InFunctionBody)))
+ tolerant(parser, context, 53 /* MetaNotInFunctionBody */);
+ return parseMetaProperty(parser, context, id, pos);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'NewExpression',
+ callee: parseImportOrMemberExpression(parser, context, pos),
+ arguments: parser.token === 50331659 /* LeftParen */ ? parseArgumentList(parser, context) : [],
+ });
+}
+/**
+ * Parse either import or member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportOrMemberExpression(parser, context, pos) {
+ const { token } = parser;
+ if (context & Context.OptionsNext && token === 33566810 /* ImportKeyword */) {
+ // Invalid: '"new import(x)"'
+ if (lookahead(parser, context, nextTokenIsLeftParen))
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ // Fixes cases like ''new import.meta','
+ return parseCallImportOrMetaProperty(parser, context);
+ }
+ return parseMemberExpression(parser, context, pos);
+}
+/**
+ * Parse super property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SuperProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSuperProperty(parser, context) {
+ // SuperProperty[Yield, Await]:
+ // super[Expression[+In, ?Yield, ?Await]]
+ // super.IdentifierName
+ const pos = getLocation(parser);
+ expect(parser, context, 33566813 /* SuperKeyword */);
+ switch (parser.token) {
+ case 50331659 /* LeftParen */:
+ // The super property has to be within a class constructor
+ if (!(context & Context.AllowSuperProperty))
+ tolerant(parser, context, 54 /* BadSuperCall */);
+ break;
+ case 41943059 /* LeftBracket */:
+ case 16777229 /* Period */:
+ if (!(context & Context.Method))
+ tolerant(parser, context, 55 /* UnexpectedSuper */);
+ break;
+ default:
+ tolerant(parser, context, 56 /* LoneSuper */);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Super',
+ });
+}
+/**
+ * Parse template literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseTemplateLiteral(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions: [],
+ quasis: [parseTemplateSpans(parser, context)],
+ });
+}
+/**
+ * Parse template head
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param cooked Cooked template value
+ * @param raw Raw template value
+ * @param pos Current location
+ */
+function parseTemplateHead(parser, context, cooked = null, raw, pos) {
+ parser.token = consumeTemplateBrace(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked,
+ raw,
+ },
+ tail: false,
+ });
+}
+/**
+ * Parse template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expression Expression AST node
+ * @param quasis Array of Template elements
+ */
+function parseTemplate(parser, context, expressions = [], quasis = []) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554440 /* TemplateCont */);
+ expressions.push(parseExpression(parser, context));
+ const t = getLocation(parser);
+ quasis.push(parseTemplateHead(parser, context, tokenValue, tokenRaw, pos));
+ if (parser.token === 33554441 /* TemplateTail */) {
+ quasis.push(parseTemplateSpans(parser, context, t));
+ }
+ else {
+ parseTemplate(parser, context, expressions, quasis);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions,
+ quasis,
+ });
+}
+/**
+ * Parse template spans
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateSpans)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param loc Current AST node location
+ */
+function parseTemplateSpans(parser, context, pos = getLocation(parser)) {
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554441 /* TemplateTail */);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked: tokenValue,
+ raw: tokenRaw,
+ },
+ tail: true,
+ });
+}
+/**
+ * Parses decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDecoratorList(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'Decorator',
+ expression: parseLeftHandSideExpression(parser, context, pos)
+ });
+}
+/**
+ * Parses a list of decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDecorators(parser, context) {
+ const decoratorList = [];
+ while (consume(parser, context, 120 /* At */)) {
+ decoratorList.push(parseDecoratorList(parser, context | Context.AllowDecorator));
+ }
+ return decoratorList;
+} + +// Context masks
+var Context;
+(function (Context) {
+ Context[Context["Empty"] = 0] = "Empty";
+ Context[Context["OptionsNext"] = 1] = "OptionsNext";
+ Context[Context["OptionsRanges"] = 2] = "OptionsRanges";
+ Context[Context["OptionsJSX"] = 4] = "OptionsJSX";
+ Context[Context["OptionsRaw"] = 8] = "OptionsRaw";
+ Context[Context["OptionsLoc"] = 16] = "OptionsLoc";
+ Context[Context["OptionsGlobalReturn"] = 32] = "OptionsGlobalReturn";
+ Context[Context["OptionsComments"] = 64] = "OptionsComments";
+ Context[Context["OptionsShebang"] = 128] = "OptionsShebang";
+ Context[Context["OptionsRawidentifiers"] = 256] = "OptionsRawidentifiers";
+ Context[Context["OptionsTolerant"] = 512] = "OptionsTolerant";
+ Context[Context["OptionsNode"] = 1024] = "OptionsNode";
+ Context[Context["OptionsExperimental"] = 2048] = "OptionsExperimental";
+ Context[Context["Strict"] = 4096] = "Strict";
+ Context[Context["Module"] = 8192] = "Module";
+ Context[Context["TaggedTemplate"] = 16384] = "TaggedTemplate";
+ Context[Context["InClass"] = 32768] = "InClass";
+ Context[Context["AllowIn"] = 65536] = "AllowIn";
+ Context[Context["Async"] = 131072] = "Async";
+ Context[Context["Yield"] = 262144] = "Yield";
+ Context[Context["InParameter"] = 524288] = "InParameter";
+ Context[Context["InFunctionBody"] = 1048576] = "InFunctionBody";
+ Context[Context["AllowSingleStatement"] = 2097152] = "AllowSingleStatement";
+ Context[Context["BlockScope"] = 4194304] = "BlockScope";
+ Context[Context["ForStatement"] = 8388608] = "ForStatement";
+ Context[Context["RequireIdentifier"] = 16777216] = "RequireIdentifier";
+ Context[Context["Method"] = 33554432] = "Method";
+ Context[Context["AllowSuperProperty"] = 67108864] = "AllowSuperProperty";
+ Context[Context["InParen"] = 134217728] = "InParen";
+ Context[Context["InJSXChild"] = 268435456] = "InJSXChild";
+ Context[Context["DisallowEscapedKeyword"] = 536870912] = "DisallowEscapedKeyword";
+ Context[Context["AllowDecorator"] = 1073741824] = "AllowDecorator";
+ Context[Context["LocationTracker"] = 18] = "LocationTracker";
+})(Context || (Context = {}));
+// Mutual parser flags
+var Flags;
+(function (Flags) {
+ Flags[Flags["None"] = 0] = "None";
+ Flags[Flags["NewLine"] = 1] = "NewLine";
+ Flags[Flags["AllowBinding"] = 2] = "AllowBinding";
+ Flags[Flags["AllowDestructuring"] = 4] = "AllowDestructuring";
+ Flags[Flags["SimpleParameterList"] = 8] = "SimpleParameterList";
+ Flags[Flags["InSwitchStatement"] = 16] = "InSwitchStatement";
+ Flags[Flags["InIterationStatement"] = 32] = "InIterationStatement";
+ Flags[Flags["HasStrictReserved"] = 64] = "HasStrictReserved";
+ Flags[Flags["HasOctal"] = 128] = "HasOctal";
+ Flags[Flags["SimpleAssignmentTarget"] = 256] = "SimpleAssignmentTarget";
+ Flags[Flags["HasProtoField"] = 512] = "HasProtoField";
+ Flags[Flags["StrictFunctionName"] = 1024] = "StrictFunctionName";
+ Flags[Flags["StrictEvalArguments"] = 2048] = "StrictEvalArguments";
+ Flags[Flags["InFunctionBody"] = 4096] = "InFunctionBody";
+ Flags[Flags["HasAwait"] = 8192] = "HasAwait";
+ Flags[Flags["HasYield"] = 16384] = "HasYield";
+ Flags[Flags["EscapedKeyword"] = 32768] = "EscapedKeyword";
+ Flags[Flags["HasConstructor"] = 65536] = "HasConstructor";
+})(Flags || (Flags = {}));
+// Label tracking state
+var Labels;
+(function (Labels) {
+ Labels[Labels["None"] = 0] = "None";
+ Labels[Labels["NotNested"] = 1] = "NotNested";
+ Labels[Labels["Nested"] = 2] = "Nested";
+})(Labels || (Labels = {}));
+var NumericState;
+(function (NumericState) {
+ NumericState[NumericState["None"] = 0] = "None";
+ NumericState[NumericState["SeenSeparator"] = 1] = "SeenSeparator";
+ NumericState[NumericState["EigthOrNine"] = 2] = "EigthOrNine";
+ NumericState[NumericState["Float"] = 4] = "Float";
+ NumericState[NumericState["BigInt"] = 8] = "BigInt";
+})(NumericState || (NumericState = {}));
+var ScannerState;
+(function (ScannerState) {
+ ScannerState[ScannerState["None"] = 0] = "None";
+ ScannerState[ScannerState["NewLine"] = 1] = "NewLine";
+ ScannerState[ScannerState["LastIsCR"] = 2] = "LastIsCR";
+})(ScannerState || (ScannerState = {}));
+var ModifierState;
+(function (ModifierState) {
+ ModifierState[ModifierState["None"] = 0] = "None";
+ ModifierState[ModifierState["Generator"] = 1] = "Generator";
+ ModifierState[ModifierState["Await"] = 2] = "Await";
+})(ModifierState || (ModifierState = {}));
+var CoverParenthesizedState;
+(function (CoverParenthesizedState) {
+ CoverParenthesizedState[CoverParenthesizedState["None"] = 0] = "None";
+ CoverParenthesizedState[CoverParenthesizedState["SequenceExpression"] = 1] = "SequenceExpression";
+ CoverParenthesizedState[CoverParenthesizedState["HasEvalOrArguments"] = 2] = "HasEvalOrArguments";
+ CoverParenthesizedState[CoverParenthesizedState["HasReservedWords"] = 4] = "HasReservedWords";
+ CoverParenthesizedState[CoverParenthesizedState["HasYield"] = 8] = "HasYield";
+ CoverParenthesizedState[CoverParenthesizedState["HasBinding"] = 16] = "HasBinding";
+})(CoverParenthesizedState || (CoverParenthesizedState = {}));
+var Escape;
+(function (Escape) {
+ Escape[Escape["Empty"] = -1] = "Empty";
+ Escape[Escape["StrictOctal"] = -2] = "StrictOctal";
+ Escape[Escape["EightOrNine"] = -3] = "EightOrNine";
+ Escape[Escape["InvalidHex"] = -4] = "InvalidHex";
+ Escape[Escape["OutOfRange"] = -5] = "OutOfRange";
+})(Escape || (Escape = {}));
+var RegexFlags;
+(function (RegexFlags) {
+ RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
+ RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
+ RegexFlags[RegexFlags["Global"] = 2] = "Global";
+ RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
+ RegexFlags[RegexFlags["Unicode"] = 8] = "Unicode";
+ RegexFlags[RegexFlags["Sticky"] = 16] = "Sticky";
+ RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
+})(RegexFlags || (RegexFlags = {}));
+var CoverCallState;
+(function (CoverCallState) {
+ CoverCallState[CoverCallState["Empty"] = 0] = "Empty";
+ CoverCallState[CoverCallState["SeenSpread"] = 1] = "SeenSpread";
+ CoverCallState[CoverCallState["HasSpread"] = 2] = "HasSpread";
+ CoverCallState[CoverCallState["SimpleParameter"] = 4] = "SimpleParameter";
+ CoverCallState[CoverCallState["EvalOrArguments"] = 8] = "EvalOrArguments";
+ CoverCallState[CoverCallState["Yield"] = 16] = "Yield";
+ CoverCallState[CoverCallState["Await"] = 32] = "Await";
+})(CoverCallState || (CoverCallState = {}));
+var RegexState;
+(function (RegexState) {
+ RegexState[RegexState["Empty"] = 0] = "Empty";
+ RegexState[RegexState["Escape"] = 1] = "Escape";
+ RegexState[RegexState["Class"] = 2] = "Class";
+})(RegexState || (RegexState = {}));
+// Shared between class expr / decl & object literal
+var ObjectState;
+(function (ObjectState) {
+ ObjectState[ObjectState["None"] = 0] = "None";
+ ObjectState[ObjectState["Async"] = 1] = "Async";
+ ObjectState[ObjectState["Generator"] = 2] = "Generator";
+ ObjectState[ObjectState["Getter"] = 4] = "Getter";
+ ObjectState[ObjectState["Setter"] = 8] = "Setter";
+ ObjectState[ObjectState["Computed"] = 16] = "Computed";
+ ObjectState[ObjectState["Method"] = 32] = "Method";
+ ObjectState[ObjectState["Shorthand"] = 64] = "Shorthand";
+ ObjectState[ObjectState["Static"] = 128] = "Static";
+ ObjectState[ObjectState["Constructor"] = 256] = "Constructor";
+ ObjectState[ObjectState["Heritage"] = 512] = "Heritage";
+})(ObjectState || (ObjectState = {}));
+/**
+ * Validate break and continue statement
+ *
+ * @param parser Parser object
+ * @param label label
+ * @param isContinue true if validation continue statement
+ */
+function validateBreakOrContinueLabel(parser, context, label, isContinue) {
+ const state = hasLabel(parser, label);
+ if (!state)
+ tolerant(parser, context, 32 /* UnknownLabel */, label);
+ if (isContinue && !(state & Labels.Nested))
+ tolerant(parser, context, 31 /* IllegalContinue */, label);
+}
+/**
+ * Add label to the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+function addLabel(parser, label) {
+ if (parser.labelSet === undefined)
+ parser.labelSet = {};
+ parser.labelSet[`$${label}`] = isIterationStatement(parser.token) ? Labels.Nested : Labels.NotNested;
+}
+/**
+ * Remove label from the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+function popLabel(parser, label) {
+ parser.labelSet[`$${label}`] = Labels.None;
+}
+/**
+ * Returns either true or false. Depends if the label exist.
+ *
+ * @param parser Parser object
+ * @param label Label
+ */
+function hasLabel(parser, label) {
+ return !parser.labelSet ? Labels.None : parser.labelSet[`$${label}`];
+}
+/**
+ * Finish each the node for each parse. Set line / and column on the node if the
+ * options are set for it
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Line / column
+ * @param node AST node
+ */
+function finishNode(context, parser, meta, node) {
+ const { lastIndex, lastLine, lastColumn, sourceFile, index } = parser;
+ if (context & Context.LocationTracker) {
+ if (context & Context.OptionsRanges) {
+ node.start = meta.index;
+ node.end = lastIndex;
+ }
+ if (context & Context.OptionsLoc) {
+ node.loc = {
+ start: { line: meta.line, column: meta.column },
+ end: { line: lastLine, column: lastColumn }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ return node;
+}
+/**
+ * Consumes the next token. If the consumed token is not of the expected type
+ * then report an error and return null. Otherwise return true.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ * @param Err Optionally error message to be thrown
+ */
+function expect(parser, context, token, err = 1 /* UnexpectedToken */) {
+ if (parser.token !== token)
+ report(parser, err, tokenDesc(parser.token));
+ nextToken(parser, context);
+ return true;
+}
+/**
+ * If the next token matches the given token, this consumes the token
+ * and returns true. Otherwise return false.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ */
+function consume(parser, context, token) {
+ if (parser.token !== token)
+ return false;
+ nextToken(parser, context);
+ return true;
+}
+/**
+ * Advance and return the next token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextToken(parser, context) {
+ parser.lastIndex = parser.index;
+ parser.lastLine = parser.line;
+ parser.lastColumn = parser.column;
+ return (parser.token = scan(parser, context));
+}
+const hasBit = (mask, flags) => (mask & flags) === flags;
+/**
+ * Automatic Semicolon Insertion
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeSemicolon(parser, context) {
+ return parser.token & 1048576 /* ASI */ || parser.flags & Flags.NewLine
+ ? consume(parser, context, 17825809 /* Semicolon */)
+ : report(parser, !(context & Context.Async) && parser.token & 262144 /* IsAwait */ ? 38 /* AwaitOutsideAsync */ : 1 /* UnexpectedToken */, tokenDesc(parser.token));
+}
+/**
+ * Bit fiddle current grammar state and keep track of the state during the parse and restore
+ * it back to original state after finish parsing or throw.
+ *
+ * Ideas for this is basicly from V8 and SM, but also the Esprima parser does this in a similar way.
+ *
+ * However this implementation is an major improvement over similiar implementations, and
+ * does not require additonal bitmasks to be set / unset during the parsing outside this function.
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ * @param errMsg Optional error message
+ */
+function parseExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= Flags.AllowBinding | Flags.AllowDestructuring;
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // If there exist an pending expression error, we throw an error at
+ // the same location it was recorded
+ if (!!parser.pendingExpressionError) {
+ const { error, line, column, index } = parser.pendingExpressionError;
+ constructError(parser, context, index, line, column, error);
+ }
+ // Here we - just in case - disallow both binding and destructuring
+ // and only set the bitmaks if the previous flags (before the callback)
+ // is positive.
+ // Note that this bitmasks may have been turned off during parsing
+ // the callback
+ parser.flags &= ~(Flags.AllowBinding | Flags.AllowDestructuring);
+ if (flags & Flags.AllowBinding)
+ parser.flags |= Flags.AllowBinding;
+ if (flags & Flags.AllowDestructuring)
+ parser.flags |= Flags.AllowDestructuring;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+}
+/**
+ * Restor current grammar to previous state, or unset necessary bitmasks
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ */
+function restoreExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= Flags.AllowBinding | Flags.AllowDestructuring;
+ // Clear pending expression error
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // Both the previous bitmasks and bitmasks set during parsing the callback
+ // has to be positive for us to allow further binding or destructuring.
+ // Note that we allow both before the callback, so this is the only thing
+ // we need to check for.
+ if (!(parser.flags & Flags.AllowBinding) || !(flags & Flags.AllowBinding)) {
+ parser.flags &= ~Flags.AllowBinding;
+ }
+ if (!(parser.flags & Flags.AllowDestructuring) || !(flags & Flags.AllowDestructuring)) {
+ parser.flags &= ~Flags.AllowDestructuring;
+ }
+ // Here we either
+ // 1) restore to previous pending expression error
+ // or
+ // 2) if a pending expression error have been set during the parse (*only in object literal*)
+ // we overwrite previous error, and keep the new one
+ parser.pendingExpressionError = pendingExpressionError || parser.pendingExpressionError;
+ return res;
+}
+/**
+ * Set / unset yield / await context masks based on the
+ * ModifierState masks before invoking the callback and
+ * returning it's content
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Modifier state
+ * @param callback Callback function to be invoked
+ * @param methodState Optional Objectstate.
+ */
+function swapContext(parser, context, state, callback, methodState = ObjectState.None) {
+ context &= ~(Context.Async | Context.Yield | Context.InParameter);
+ if (state & ModifierState.Generator)
+ context |= Context.Yield;
+ if (state & ModifierState.Await)
+ context |= Context.Async;
+ return callback(parser, context, methodState);
+}
+/**
+ * Validates function params
+ *
+ * Note! In case anyone want to enable full scoping, replace 'paramSet' with an similiar
+ * object on the parser object itself. Then push / set the tokenValue to
+ * it an use an bitmask to mark it as an 'variable' not 'blockscope'. Then when
+ * implementing lexical scoping, you can use that for validation.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param params Array of token values
+ */
+function validateParams(parser, context, params) {
+ const paramSet = new Map();
+ for (let i = 0; i < params.length; i++) {
+ const key = `@${params[i]}`;
+ if (paramSet.get(key)) {
+ tolerant(parser, context, 81 /* ParamDupe */);
+ }
+ else
+ paramSet.set(key, true);
+ }
+}
+/**
+ * Reinterpret various expressions as pattern
+ * This is only used for assignment and arrow parameter list
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param node AST node
+ */
+const reinterpret = (parser, context, node) => {
+ switch (node.type) {
+ case 'Identifier':
+ if (context & Context.Strict && nameIsArgumentsOrEval(node.name))
+ report(parser, 3 /* InvalidEscapedReservedWord */);
+ case 'ArrayPattern':
+ case 'AssignmentPattern':
+ case 'ObjectPattern':
+ case 'RestElement':
+ case 'MetaProperty':
+ return;
+ case 'ArrayExpression':
+ node.type = 'ArrayPattern';
+ for (let i = 0; i < node.elements.length; ++i) {
+ // skip holes in pattern
+ if (node.elements[i] !== null) {
+ reinterpret(parser, context, node.elements[i]);
+ }
+ }
+ return;
+ case 'ObjectExpression':
+ node.type = 'ObjectPattern';
+ for (let i = 0; i < node.properties.length; i++) {
+ reinterpret(parser, context, node.properties[i]);
+ }
+ return;
+ case 'Property':
+ reinterpret(parser, context, node.value);
+ return;
+ case 'SpreadElement':
+ node.type = 'RestElement';
+ if (node.argument.type !== 'ArrayExpression' &&
+ node.argument.type !== 'ObjectExpression' &&
+ !isValidSimpleAssignmentTarget(node.argument)) {
+ tolerant(parser, context, 71 /* RestDefaultInitializer */);
+ }
+ reinterpret(parser, context, node.argument);
+ break;
+ case 'AssignmentExpression':
+ node.type = 'AssignmentPattern';
+ delete node.operator; // operator is not relevant for assignment pattern
+ reinterpret(parser, context, node.left); // recursive descent
+ return;
+ case 'MemberExpression':
+ if (!(context & Context.InParameter))
+ return;
+ // Fall through
+ default:
+ tolerant(parser, context, context & Context.InParameter ? 77 /* NotBindable */ : 73 /* InvalidDestructuringTarget */, node.type);
+ }
+};
+/**
+ * Does a lookahead.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param callback Callback function to be invoked
+ */
+function lookahead(parser, context, callback) {
+ const { tokenValue, flags, line, column, startColumn, index, lastColumn, startLine, lastLine, lastIndex, startIndex, tokenRaw, token, lastValue, tokenRegExp, labelSet, errors, errorLocation, pendingExpressionError } = parser;
+ const res = callback(parser, context);
+ parser.index = index;
+ parser.token = token;
+ parser.tokenValue = tokenValue;
+ parser.tokenValue = tokenValue;
+ parser.flags = flags;
+ parser.line = line;
+ parser.column = column;
+ parser.tokenRaw = tokenRaw;
+ parser.lastValue = lastValue;
+ parser.startColumn = startColumn;
+ parser.lastColumn = lastColumn;
+ parser.startLine = startLine;
+ parser.lastLine = lastLine;
+ parser.lastIndex = lastIndex;
+ parser.startIndex = startIndex;
+ parser.tokenRegExp = tokenRegExp;
+ parser.labelSet = labelSet;
+ parser.errors = errors;
+ parser.errorLocation = errorLocation;
+ parser.tokenRegExp = tokenRegExp;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+}
+/**
+ * Returns true if this an valid simple assignment target
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isValidSimpleAssignmentTarget(node) {
+ return node.type === 'Identifier' || node.type === 'MemberExpression' ? true : false;
+}
+/**
+ * Get current node location
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function getLocation(parser) {
+ return {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+}
+/**
+ * Returns true if this is an valid identifier
+ *
+ * @param context Context masks
+ * @param t Token
+ */
+function isValidIdentifier(context, t) {
+ if (context & Context.Strict) {
+ if (context & Context.Module && t & 262144 /* IsAwait */)
+ return false;
+ if (t & 1073741824 /* IsYield */)
+ return false;
+ return (t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (t & 69632 /* Contextual */) === 69632 /* Contextual */;
+ }
+ return ((t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (t & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (t & 20480 /* FutureReserved */) === 20480 /* FutureReserved */);
+}
+/**
+ * Returns true if this an valid lexical binding and not an identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isLexical(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return !!(token & (131072 /* IsIdentifier */ | 8388608 /* IsBindingPattern */ | 1073741824 /* IsYield */ | 262144 /* IsAwait */) ||
+ token === 33574984 /* LetKeyword */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */);
+}
+/**
+ * Returns true if this is end of case or default clauses
+ *
+ * @param parser Parser object
+ */
+function isEndOfCaseOrDefaultClauses(parser) {
+ return (parser.token === 12368 /* DefaultKeyword */ || parser.token === 17825807 /* RightBrace */ || parser.token === 12363 /* CaseKeyword */);
+}
+/**
+ * Validates if the next token in the stream is a left paren or a period
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsLeftParenOrPeriod(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */ || parser.token === 16777229 /* Period */;
+}
+/**
+ * Validates if the next token in the stream is a identifier or left paren
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenisIdentifierOrParen(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return token & (131072 /* IsIdentifier */ | 1073741824 /* IsYield */) || token === 50331659 /* LeftParen */;
+}
+/**
+ * Validates if the next token in the stream is left parenthesis.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsLeftParen(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */;
+}
+/**
+ * Validates if the next token in the stream is a function keyword on the same line.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsFuncKeywordOnSameLine(parser, context) {
+ nextToken(parser, context);
+ return !(parser.flags & Flags.NewLine) && parser.token === 33566808 /* FunctionKeyword */;
+}
+/**
+ * Checks if the property has any private field key
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isPropertyWithPrivateFieldKey(expr) {
+ return !expr.property ? false : expr.property.type === 'PrivateName';
+}
+/**
+ * Parse and classify itendifier - similar method as in V8
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAndClassifyIdentifier(parser, context) {
+ const { token, tokenValue: name } = parser;
+ if (context & Context.Strict) {
+ if (context & Context.Module && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (token & 69632 /* Contextual */) === 69632 /* Contextual */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (context & Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+}
+function nameIsArgumentsOrEval(value) {
+ return value === 'eval' || value === 'arguments';
+}
+/**
+ * Records an error from current position. If we report an error later, we'll do it from
+ * this position.
+ *
+ * @param parser Parser object
+ */
+function setPendingError(parser) {
+ parser.errorLocation = {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+}
+/**
+ * Returns tagName for JSX element
+ *
+ * @param elementName JSX Element name
+ */
+function isEqualTagNames(elementName) {
+ // tslint:disable-next-line:switch-default | this switch is exhaustive
+ switch (elementName.type) {
+ case 'JSXIdentifier':
+ return elementName.name;
+ case 'JSXNamespacedName':
+ return `${isEqualTagNames(elementName.namespace)}:${isEqualTagNames(elementName.name)}`;
+ case 'JSXMemberExpression':
+ return `${isEqualTagNames(elementName.object)}.${isEqualTagNames(elementName.property)}`;
+ }
+}
+/**
+ * Returns true if this is an instance field ( stage 3 proposal)
+ *
+ * @param parser Parser object
+ */
+function isInstanceField(parser) {
+ const { token } = parser;
+ return token === 17825807 /* RightBrace */ || token === 17825809 /* Semicolon */ || token === 83886109 /* Assign */;
+}
+/**
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expr AST expressions
+ * @param prefix prefix
+ */
+function validateUpdateExpression(parser, context, expr, prefix) {
+ if (context & Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 68 /* StrictLHSPrefixPostFix */, prefix);
+ }
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+}
+/**
+ * Record expression error
+ *
+ * @param parser Parser object
+ * @param error Error message
+ */
+function setPendingExpressionError(parser, type) {
+ parser.pendingExpressionError = {
+ error: errorMessages[type],
+ line: parser.line,
+ column: parser.column,
+ index: parser.index
+ };
+}
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+function validateCoverParenthesizedExpression(parser, state) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= CoverParenthesizedState.HasEvalOrArguments;
+ }
+ else if ((token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ setPendingError(parser);
+ state |= CoverParenthesizedState.HasReservedWords;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ }
+ return state;
+}
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+function validateAsyncArgumentList(parser, context, state) {
+ const { token } = parser;
+ if (!(parser.flags & Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= CoverCallState.EvalOrArguments;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ state |= CoverCallState.Await;
+ }
+ else if ((token & 1073741824 /* IsYield */) === 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ state |= CoverCallState.Yield;
+ }
+ }
+ return state;
+}
+/**
+ * Returns true if iteration statement. Otherwise return false,
+ *
+ * @param t Token
+ */
+function isIterationStatement(t) {
+ return t === 12369 /* DoKeyword */ || t === 12386 /* WhileKeyword */ || t === 12374 /* ForKeyword */;
+}
+/**
+ * Returns true if in or of token. Otherwise return false,
+ *
+ * @param t Token
+ */
+function isInOrOf(t) {
+ return t === 69746 /* OfKeyword */ || t === 167786289 /* InKeyword */;
+} + +/*@internal*/
+const errorMessages = {
+ [0 /* Unexpected */]: 'Unexpected token',
+ [1 /* UnexpectedToken */]: 'Unexpected token \'%0\'',
+ [2 /* ExpectedToken */]: 'Expected token \'%0\'',
+ [3 /* InvalidEscapedReservedWord */]: 'Keyword must not contain escaped characters',
+ [4 /* UnexpectedKeyword */]: 'Keyword \'%0\' is reserved',
+ [5 /* InvalidLHSInAssignment */]: 'Invalid left-hand side in assignment',
+ [6 /* UnterminatedString */]: 'Unterminated string literal',
+ [7 /* UnterminatedRegExp */]: 'Unterminated regular expression literal',
+ [8 /* UnterminatedComment */]: 'Unterminated MultiLineComment',
+ [9 /* UnterminatedTemplate */]: 'Unterminated template literal',
+ [10 /* UnexpectedChar */]: 'Invalid character \'%0\'',
+ [11 /* StrictOctalEscape */]: 'Octal escapes are not allowed in strict mode',
+ [13 /* InvalidEightAndNine */]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
+ [14 /* UnicodeOutOfRange */]: 'Unicode escape code point out of range',
+ [15 /* DuplicateRegExpFlag */]: 'Duplicate regular expression flag \'%0\'',
+ [16 /* UnexpectedTokenRegExpFlag */]: 'Unexpected regular expression flag \'%0\'',
+ [17 /* StrictLHSAssignment */]: 'Eval or arguments can\'t be assigned to in strict mode code',
+ [18 /* IllegalReturn */]: 'Illegal return statement',
+ [19 /* StrictFunction */]: 'In strict mode code, functions can only be declared at top level or inside a block',
+ [20 /* SloppyFunction */]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
+ [21 /* ForbiddenAsStatement */]: '%0 can\'t appear in single-statement context',
+ [22 /* GeneratorInSingleStatementContext */]: 'Generators can only be declared at the top level or inside a block',
+ [23 /* ForAwaitNotOf */]: '\'for await\' loop should be used with \'of\'',
+ [24 /* DeclarationMissingInitializer */]: 'Missing initializer in %0 declaration',
+ [25 /* ForInOfLoopInitializer */]: '\'for-%0\' loop variable declaration may not have an initializer',
+ [26 /* ForInOfLoopMultiBindings */]: 'Invalid left-hand side in for-%0 loop: Must have a single binding.',
+ [27 /* LetInLexicalBinding */]: 'let is disallowed as a lexically bound name',
+ [28 /* UnexpectedLexicalDeclaration */]: 'Lexical declaration cannot appear in a single-statement context',
+ [29 /* LabelRedeclaration */]: 'Label \'%0\' has already been declared',
+ [30 /* InvalidNestedStatement */]: '%0 statement must be nested within an iteration statement',
+ [31 /* IllegalContinue */]: 'Illegal continue statement: \'%0\' does not denote an iteration statement',
+ [32 /* UnknownLabel */]: 'Undefined label \'%0\'',
+ [33 /* MultipleDefaultsInSwitch */]: 'More than one default clause in switch statement',
+ [34 /* ImportExportDeclAtTopLevel */]: '%0 declarations may only appear at top level of a module',
+ [35 /* AsyncFunctionInSingleStatementContext */]: 'Async functions can only be declared at the top level or inside a block',
+ [36 /* InvalidLineBreak */]: 'No line break is allowed after \'%0\'',
+ [37 /* StrictModeWith */]: 'Strict mode code may not include a with statement',
+ [38 /* AwaitOutsideAsync */]: 'Await is only valid in async functions',
+ [39 /* UnNamedFunctionDecl */]: 'Function declaration must have a name in this context',
+ [12 /* DuplicateConstructor */]: 'Duplicate constructor method in class',
+ [40 /* DisallowedInContext */]: '\'%0\' may not be used as an identifier in this context',
+ [43 /* StrictDelete */]: 'Delete of an unqualified identifier in strict mode',
+ [44 /* DeletePrivateField */]: 'Private fields can not be deleted',
+ [41 /* PrivateFieldConstructor */]: 'Classes may not have a private field named \'#constructor\'',
+ [42 /* PublicFieldConstructor */]: 'Classes may not have a field named \'constructor\'',
+ [45 /* InvalidConstructor */]: 'Class constructor may not be a \'%0\'',
+ [46 /* UnexpectedReserved */]: 'Unexpected reserved word',
+ [47 /* StrictEvalArguments */]: 'Unexpected eval or arguments in strict mode',
+ [48 /* AwaitBindingIdentifier */]: '\'await\' is not a valid identifier inside an async function',
+ [49 /* YieldBindingIdentifier */]: '\'yield\' is not a valid identifier inside an generator function',
+ [50 /* UnexpectedStrictReserved */]: 'Unexpected strict mode reserved word',
+ [52 /* AwaitInParameter */]: 'Await expression not allowed in formal parameter',
+ [51 /* YieldInParameter */]: 'Yield expression not allowed in formal parameter',
+ [53 /* MetaNotInFunctionBody */]: 'new.target only allowed within functions',
+ [54 /* BadSuperCall */]: 'super() is not allowed in this context',
+ [55 /* UnexpectedSuper */]: 'Member access from super not allowed in this context',
+ [56 /* LoneSuper */]: 'Only "(" or "." or "[" are allowed after \'super\'',
+ [57 /* YieldReservedKeyword */]: '\'yield\' is a reserved keyword within generator function bodies',
+ [58 /* ContinuousNumericSeparator */]: 'Only one underscore is allowed as numeric separator',
+ [59 /* TrailingNumericSeparator */]: 'Numeric separators are not allowed at the end of numeric literals',
+ [60 /* ZeroDigitNumericSeparator */]: 'Numeric separator can not be used after leading 0.',
+ [61 /* StrictOctalLiteral */]: 'Legacy octal literals are not allowed in strict mode',
+ [62 /* InvalidLhsInAssignment */]: 'Invalid left-hand side in assignment',
+ [63 /* DuplicateProto */]: 'Property name __proto__ appears more than once in object literal',
+ [64 /* IllegalUseStrict */]: 'Illegal \'use strict\' directive in function with non-simple parameter list',
+ [65 /* StaticPrototype */]: 'Classes may not have a static property named \'prototype\'',
+ [66 /* AccessorWrongArgs */]: '%0 functions must have %1 argument%2',
+ [67 /* BadSetterRestParameter */]: 'Setter function argument must not be a rest parameter',
+ [68 /* StrictLHSPrefixPostFix */]: '%0 increment/decrement may not have eval or arguments operand in strict mode',
+ [69 /* InvalidElisonInObjPropList */]: 'Elision not allowed in object property list',
+ [70 /* ElementAfterRest */]: 'Rest element must be last element',
+ [72 /* ElementAfterSpread */]: 'Spread element must be last element',
+ [71 /* RestDefaultInitializer */]: 'Rest parameter may not have a default initializer',
+ [73 /* InvalidDestructuringTarget */]: 'Invalid destructuring assignment target',
+ [74 /* UnexpectedSurrogate */]: 'Unexpected surrogate pair',
+ [75 /* MalformedEscape */]: 'Malformed %0 character escape sequence',
+ [76 /* TemplateOctalLiteral */]: 'Template literals may not contain octal escape sequences',
+ [77 /* NotBindable */]: 'Invalid binding pattern',
+ [78 /* ParamAfterRest */]: 'Rest parameter must be last formal parameter',
+ [79 /* NoCatchOrFinally */]: 'Missing catch or finally after try',
+ [80 /* NewlineAfterThrow */]: 'Illegal newline after throw',
+ [81 /* ParamDupe */]: 'Duplicate parameter name not allowed in this context',
+ [82 /* AsAfterImportStart */]: 'Missing keyword \'as\' after import *',
+ [83 /* LabelNoColon */]: 'Labels must be followed by a \':\'',
+ [84 /* NonEmptyJSXExpression */]: 'JSX attributes must only be assigned a non-empty \'expression\'',
+ [85 /* ExpectedJSXClosingTag */]: 'Expected corresponding JSX closing tag for %0',
+ [86 /* AdjacentJSXElements */]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
+ [87 /* InvalidJSXAttributeValue */]: 'Invalid JSX attribute value',
+ [88 /* RestWithComma */]: 'Rest element may not have a trailing comma',
+ [89 /* UndefinedUnicodeCodePoint */]: 'Undefined Unicode code-point',
+ [90 /* HtmlCommentInModule */]: 'HTML comments are not allowed in modules',
+ [91 /* InvalidCoverInitializedName */]: 'Invalid shorthand property initializer',
+ [92 /* TrailingDecorators */]: 'Trailing decorator may be followed by method',
+ [93 /* GeneratorConstructor */]: 'Decorators can\'t be used with a constructor',
+ [94 /* InvalidRestBindingPattern */]: '`...` must be followed by an identifier in declaration contexts',
+};
+/**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param index The 0-based end index of the error.
+ * @param line The 0-based line position of the error.
+ * @param column The 0-based column position of the error.
+ * @param parser The 0-based end index of the current node.
+ * @param description Error description
+ */
+/*@internal*/
+function constructError(parser, context, index, line, column, description) {
+ const error = new SyntaxError(`Line ${line}, column ${column}: ${description}`);
+ error.index = index;
+ error.line = line;
+ error.column = column;
+ error.description = description;
+ if (context & Context.OptionsTolerant) {
+ parser.errors.push(error);
+ }
+ else
+ throw error;
+}
+/**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ */
+function getErrorLocation(parser) {
+ let { index, startLine: line, startColumn: column } = parser;
+ const errorLoc = parser.errorLocation;
+ if (!!errorLoc) {
+ index = errorLoc.index;
+ line = errorLoc.line;
+ column = errorLoc.column;
+ }
+ return { index, line, column };
+}
+/**
+ * Throws an error
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+/*@internal*/
+function report(parser, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, Context.Empty, index, line, column, errorMessage);
+}
+/**
+ * If in tolerant mode, all errors are pushed to a top-level error array containing
+ * otherwise throws
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+/*@internal*/
+function tolerant(parser, context, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, context, index, line, column, errorMessage);
+} + +// Declarations
+/**
+ * Parses class declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const id = (context & Context.RequireIdentifier && (parser.token !== 33685505 /* Identifier */))
+ ? null :
+ parseBindingIdentifier(parser, context | Context.Strict | Context.DisallowEscapedKeyword);
+ let state = ObjectState.None;
+ let superClass = null;
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | Context.Strict, pos);
+ state |= ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context & ~Context.RequireIdentifier | Context.Strict | Context.InClass, state);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body
+ });
+}
+/**
+ * Parses function declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ let isGenerator = ModifierState.None;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ if (context & Context.AllowSingleStatement && !(context & Context.InFunctionBody)) {
+ tolerant(parser, context, 22 /* GeneratorInSingleStatementContext */);
+ }
+ isGenerator = ModifierState.Generator;
+ }
+ return parseFunctionDeclarationBody(parser, context, isGenerator, pos);
+}
+/**
+ * Parses out a function declartion body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context mask
+ * @param state Modifier state
+ * @param pos Current location
+ */
+function parseFunctionDeclarationBody(parser, context, state, pos) {
+ const { token } = parser;
+ let id = null;
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (context & Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (token !== 50331659 /* LeftParen */) {
+ id = parseBindingIdentifier(parser, context);
+ // Unnamed functions are forbidden in statement context.
+ }
+ else if (!(context & Context.RequireIdentifier))
+ tolerant(parser, context, 39 /* UnNamedFunctionDecl */);
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty | Context.RequireIdentifier), state, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionDeclaration',
+ params,
+ body,
+ async: !!(state & ModifierState.Await),
+ generator: !!(state & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parses async function or async generator declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isAwait = ModifierState.Await;
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ return parseFunctionDeclarationBody(parser, context, isGenerator | isAwait, pos);
+}
+/**
+ * VariableDeclaration :
+ * BindingIdentifier Initializeropt
+ * BindingPattern Initializer
+ *
+ * VariableDeclarationNoIn :
+ * BindingIdentifier InitializerNoInopt
+ * BindingPattern InitializerNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableDeclaration(parser, context, isConst) {
+ const pos = getLocation(parser);
+ const isBindingPattern = (parser.token & 8388608 /* IsBindingPattern */) !== 0;
+ const id = parseBindingIdentifierOrPattern(parser, context);
+ let init = null;
+ if (consume(parser, context | Context.DisallowEscapedKeyword, 83886109 /* Assign */)) {
+ init = parseExpressionCoverGrammar(parser, context & ~(Context.BlockScope | Context.ForStatement), parseAssignmentExpression);
+ if (isInOrOf(parser.token) && (context & Context.ForStatement || isBindingPattern)) {
+ if (parser.token === 167786289 /* InKeyword */) {
+ // https://github.com/tc39/test262/blob/master/test/annexB/language/statements/for-in/strict-initializer.js
+ if (context & (Context.BlockScope | Context.Strict | Context.Async) || isBindingPattern) {
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ }
+ else
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ // Note: Initializers are required for 'const' and binding patterns
+ }
+ else if (!isInOrOf(parser.token) && (isConst || isBindingPattern)) {
+ tolerant(parser, context, 24 /* DeclarationMissingInitializer */, isConst ? 'const' : 'destructuring');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclarator',
+ init,
+ id,
+ });
+}
+/**
+ * Parses variable declaration list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclarationList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableDeclarationList(parser, context, isConst) {
+ const list = [parseVariableDeclaration(parser, context, isConst)];
+ while (consume(parser, context, 16777234 /* Comma */))
+ list.push(parseVariableDeclaration(parser, context, isConst));
+ if (context & Context.ForStatement && isInOrOf(parser.token) && list.length !== 1) {
+ tolerant(parser, context, 26 /* ForInOfLoopMultiBindings */, tokenDesc(parser.token));
+ }
+ return list;
+} + +// Statements
+/**
+ * Parses statement list items
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementListItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseStatementListItem(parser, context) {
+ switch (parser.token) {
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionDeclaration(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassDeclaration(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetOrExpressionStatement(parser, context | Context.AllowIn);
+ case 33566793 /* ConstKeyword */:
+ return parseVariableStatement(parser, context | Context.BlockScope | Context.AllowIn);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionDeclarationOrStatement(parser, context);
+ case 33566810 /* ImportKeyword */: {
+ if (context & Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod)) {
+ return parseExpressionStatement(parser, context | Context.AllowIn);
+ }
+ }
+ case 12371 /* ExportKeyword */:
+ if (context & Context.Module) {
+ tolerant(parser, context, 34 /* ImportExportDeclAtTopLevel */, tokenDesc(parser.token));
+ }
+ default:
+ return parseStatement(parser, context | Context.AllowSingleStatement);
+ }
+}
+/**
+ * Parses statements
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseStatement(parser, context) {
+ switch (parser.token) {
+ case 33566791 /* VarKeyword */:
+ return parseVariableStatement(parser, context | Context.AllowIn);
+ case 17825809 /* Semicolon */:
+ return parseEmptyStatement(parser, context);
+ case 33566814 /* SwitchKeyword */:
+ return parseSwitchStatement(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseBlockStatement(parser, context);
+ case 12380 /* ReturnKeyword */:
+ return parseReturnStatement(parser, context);
+ case 12377 /* IfKeyword */:
+ return parseIfStatement(parser, context);
+ case 12369 /* DoKeyword */:
+ return parseDoWhileStatement(parser, context);
+ case 12386 /* WhileKeyword */:
+ return parseWhileStatement(parser, context);
+ case 12387 /* WithKeyword */:
+ return parseWithStatement(parser, context);
+ case 12362 /* BreakKeyword */:
+ return parseBreakStatement(parser, context);
+ case 12366 /* ContinueKeyword */:
+ return parseContinueStatement(parser, context);
+ case 12367 /* DebuggerKeyword */:
+ return parseDebuggerStatement(parser, context);
+ case 302002272 /* ThrowKeyword */:
+ return parseThrowStatement(parser, context);
+ case 12385 /* TryKeyword */:
+ return parseTryStatement(parser, context | Context.DisallowEscapedKeyword);
+ case 12374 /* ForKeyword */:
+ return parseForStatement(parser, context | Context.ForStatement);
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ tolerant(parser, context, 35 /* AsyncFunctionInSingleStatementContext */);
+ }
+ return parseExpressionOrLabelledStatement(parser, context | Context.AllowSingleStatement);
+ case 33566808 /* FunctionKeyword */:
+ // V8
+ tolerant(parser, context, context & Context.Strict ? 19 /* StrictFunction */ : 20 /* SloppyFunction */);
+ case 33566797 /* ClassKeyword */:
+ tolerant(parser, context, 21 /* ForbiddenAsStatement */, tokenDesc(parser.token));
+ default:
+ return parseExpressionOrLabelledStatement(parser, context);
+ }
+}
+/**
+ * Parses empty statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-EmptyStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseEmptyStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'EmptyStatement'
+ });
+}
+/**
+ * Parses the continue statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ContinueStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseContinueStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ // Appearing of continue without an IterationStatement leads to syntax error
+ if (!(parser.flags & (Flags.InSwitchStatement | Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, tokenDesc(parser.token));
+ }
+ let label = null;
+ if (!(parser.flags & Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, true);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ContinueStatement',
+ label
+ });
+}
+/**
+ * Parses the break statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BreakStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBreakStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let label = null;
+ if (!(parser.flags & Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, false);
+ }
+ else if (!(parser.flags & (Flags.InSwitchStatement | Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, 'break');
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'BreakStatement',
+ label
+ });
+}
+/**
+ * Parses the if statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-if-statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIfStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const consequent = parseConsequentOrAlternate(parser, context | Context.DisallowEscapedKeyword);
+ const alternate = consume(parser, context, 12370 /* ElseKeyword */) ? parseConsequentOrAlternate(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'IfStatement',
+ test,
+ consequent,
+ alternate
+ });
+}
+/**
+ * Parse either consequent or alternate. Supports AnnexB.
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseConsequentOrAlternate(parser, context) {
+ return context & Context.Strict || parser.token !== 33566808 /* FunctionKeyword */
+ ? parseStatement(parser, context & ~Context.AllowSingleStatement)
+ : parseFunctionDeclaration(parser, context);
+}
+/**
+ * Parses the debugger statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DebuggerStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDebuggerStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'DebuggerStatement'
+ });
+}
+/**
+ * Parses try statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TryStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseTryStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const block = parseBlockStatement(parser, context);
+ const handler = parser.token === 12364 /* CatchKeyword */ ? parseCatchBlock(parser, context) : null;
+ const finalizer = consume(parser, context, 12373 /* FinallyKeyword */) ? parseBlockStatement(parser, context) : null;
+ if (!handler && !finalizer)
+ tolerant(parser, context, 79 /* NoCatchOrFinally */);
+ return finishNode(context, parser, pos, {
+ type: 'TryStatement',
+ block,
+ handler,
+ finalizer
+ });
+}
+/**
+ * Parses catch block
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Catch)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCatchBlock(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let param = null;
+ if (consume(parser, context, 50331659 /* LeftParen */)) {
+ const params = [];
+ param = parseBindingIdentifierOrPattern(parser, context, params);
+ validateParams(parser, context, params);
+ expect(parser, context, 16 /* RightParen */);
+ }
+ const body = parseBlockStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'CatchClause',
+ param,
+ body
+ });
+}
+/**
+ * Parses throw statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ThrowStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseThrowStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 80 /* NewlineAfterThrow */);
+ const argument = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ThrowStatement',
+ argument
+ });
+}
+/**
+ * Parses expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpressionStatement(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+}
+/**
+ * Parse directive node
+ *
+ * * @see [Link](https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDirective(parser, context) {
+ const pos = getLocation(parser);
+ const directive = parser.tokenRaw.slice(1, -1);
+ const expr = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr,
+ directive
+ });
+}
+/**
+ * Parses either expression or labelled statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LabelledStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpressionOrLabelledStatement(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, token } = parser;
+ const expr = parseExpression(parser, (context & ~(Context.AllowSingleStatement | Context.AllowDecorator)) | Context.AllowIn);
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */) && parser.token === 16777237 /* Colon */) {
+ // If within generator function bodies, we do it like this so we can throw an nice error message
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 57 /* YieldReservedKeyword */);
+ expect(parser, context, 16777237 /* Colon */, 83 /* LabelNoColon */);
+ if (hasLabel(parser, tokenValue))
+ tolerant(parser, context, 29 /* LabelRedeclaration */, tokenValue);
+ addLabel(parser, tokenValue);
+ const body = !(context & Context.Strict) &&
+ context & Context.AllowSingleStatement &&
+ parser.token === 33566808 /* FunctionKeyword */
+ ? parseFunctionDeclaration(parser, context)
+ : parseStatement(parser, context);
+ popLabel(parser, tokenValue);
+ return finishNode(context, parser, pos, {
+ type: 'LabeledStatement',
+ label: expr,
+ body
+ });
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+}
+/**
+ * Parses do while statement
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDoWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const body = parseIterationStatement(parser, context);
+ expect(parser, context, 12386 /* WhileKeyword */);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ consume(parser, context, 17825809 /* Semicolon */);
+ return finishNode(context, parser, pos, {
+ type: 'DoWhileStatement',
+ body,
+ test
+ });
+}
+/**
+ * Parses while statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-WhileStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'WhileStatement',
+ test,
+ body
+ });
+}
+/**
+ * Parses block statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BlockStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Block)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBlockStatement(parser, context) {
+ const pos = getLocation(parser);
+ const body = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body
+ });
+}
+/**
+ * Parses return statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ReturnStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseReturnStatement(parser, context) {
+ const pos = getLocation(parser);
+ if (!(context & (Context.OptionsGlobalReturn | Context.InFunctionBody))) {
+ tolerant(parser, context, 18 /* IllegalReturn */);
+ }
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const argument = !(parser.token & 1048576 /* ASI */) && !(parser.flags & Flags.NewLine)
+ ? parseExpression(parser, (context & ~(Context.InFunctionBody | Context.AllowDecorator)) | Context.AllowIn)
+ : null;
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ReturnStatement',
+ argument
+ });
+}
+/**
+ * Sets the necessary mutable parser flags. The parser flags will
+ * be unset after done parsing out the statements.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-IterationStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIterationStatement(parser, context) {
+ // Note: We are deviating from the original grammar here beauce the original grammar says that the
+ // 'iterationStatement' should return either'for', 'do' or 'while' statements. We are doing some
+ // bitfiddling before and after to modify the parser state before we let the 'parseStatement'
+ // return the mentioned statements (to match the original grammar).
+ const savedFlags = parser.flags;
+ parser.flags |= Flags.InIterationStatement | Flags.AllowDestructuring;
+ const body = parseStatement(parser, (context & ~Context.AllowSingleStatement) | Context.DisallowEscapedKeyword);
+ parser.flags = savedFlags;
+ return body;
+}
+/**
+ * Parses with statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-WithStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseWithStatement(parser, context) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 37 /* StrictModeWith */);
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const object = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseStatement(parser, context & ~Context.AllowSingleStatement);
+ return finishNode(context, parser, pos, {
+ type: 'WithStatement',
+ object,
+ body
+ });
+}
+/**
+ * Parses switch statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SwitchStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSwitchStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const discriminant = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ expect(parser, context | Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const cases = [];
+ const savedFlags = parser.flags;
+ parser.flags |= Flags.InSwitchStatement;
+ let seenDefault = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ const clause = parseCaseOrDefaultClauses(parser, context);
+ cases.push(clause);
+ if (clause.test === null) {
+ if (seenDefault)
+ tolerant(parser, context, 33 /* MultipleDefaultsInSwitch */);
+ seenDefault = true;
+ }
+ }
+ parser.flags = savedFlags;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'SwitchStatement',
+ discriminant,
+ cases
+ });
+}
+/**
+ * Parses either default clause or case clauses
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CaseClauses)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DefaultClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCaseOrDefaultClauses(parser, context) {
+ const pos = getLocation(parser);
+ let test = null;
+ if (consume(parser, context, 12363 /* CaseKeyword */)) {
+ test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ }
+ else {
+ expect(parser, context, 12368 /* DefaultKeyword */);
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ const consequent = [];
+ while (!isEndOfCaseOrDefaultClauses(parser)) {
+ consequent.push(parseStatementListItem(parser, context | Context.AllowIn));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SwitchCase',
+ test,
+ consequent
+ });
+}
+/**
+ * Parses variable statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableStatement(parser, context, shouldConsume = true) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const isConst = token === 33566793 /* ConstKeyword */;
+ nextToken(parser, context);
+ const declarations = parseVariableDeclarationList(parser, context, isConst);
+ // Only consume semicolons if not inside the 'ForStatement' production
+ if (shouldConsume)
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclaration',
+ kind: tokenDesc(token),
+ declarations
+ });
+}
+/**
+ * Parses either an lexical declaration (let) or an expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-let-and-const-declarations)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseLetOrExpressionStatement(parser, context, shouldConsume = true) {
+ return lookahead(parser, context, isLexical)
+ ? parseVariableStatement(parser, context | Context.BlockScope, shouldConsume)
+ : parseExpressionOrLabelledStatement(parser, context);
+}
+/**
+ * Parses either async function declaration or statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionDeclarationOrStatement(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)
+ ? parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context)
+ : parseStatement(parser, context);
+}
+/**
+ * Parses either For, ForIn or ForOf statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-statement)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseForStatement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 12374 /* ForKeyword */);
+ const awaitToken = !!(context & Context.Async && consume(parser, context, 34017389 /* AwaitKeyword */));
+ expect(parser, context | Context.DisallowEscapedKeyword, 50331659 /* LeftParen */);
+ const { token } = parser;
+ let init = null;
+ let sequencePos = null;
+ let variableStatement = null;
+ let type = 'ForStatement';
+ let test = null;
+ let update = null;
+ let right;
+ if (token === 33566793 /* ConstKeyword */ || (token === 33574984 /* LetKeyword */ && lookahead(parser, context, isLexical))) {
+ variableStatement = parseVariableStatement(parser, (context & ~Context.AllowIn) | Context.BlockScope, false);
+ }
+ else if (token === 33566791 /* VarKeyword */) {
+ variableStatement = parseVariableStatement(parser, context & ~Context.AllowIn, false);
+ }
+ else if (token !== 17825809 /* Semicolon */) {
+ sequencePos = getLocation(parser);
+ init = restoreExpressionCoverGrammar(parser, (context & ~Context.AllowIn) | Context.DisallowEscapedKeyword, parseAssignmentExpression);
+ }
+ if (consume(parser, context, 69746 /* OfKeyword */)) {
+ type = 'ForOfStatement';
+ if (init) {
+ if (!(parser.flags & Flags.AllowDestructuring) || init.type === 'AssignmentExpression') {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ right = parseAssignmentExpression(parser, context | Context.AllowIn);
+ }
+ else if (consume(parser, context, 167786289 /* InKeyword */)) {
+ if (init) {
+ if (!(parser.flags & Flags.AllowDestructuring))
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ type = 'ForInStatement';
+ right = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ }
+ else {
+ if (parser.token === 16777234 /* Comma */)
+ init = parseSequenceExpression(parser, context, init, sequencePos);
+ if (variableStatement)
+ init = variableStatement;
+ expect(parser, context, 17825809 /* Semicolon */);
+ test = parser.token !== 17825809 /* Semicolon */
+ ? parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn)
+ : null;
+ expect(parser, context, 17825809 /* Semicolon */);
+ update = parser.token !== 16 /* RightParen */
+ ? parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn)
+ : null;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, type === 'ForOfStatement'
+ ? {
+ type,
+ body,
+ left: init,
+ right,
+ await: awaitToken
+ }
+ : right
+ ? {
+ type: type,
+ body,
+ left: init,
+ right
+ }
+ : {
+ type: type,
+ body,
+ init,
+ test,
+ update
+ });
+} + +// 15.2 Modules
+/**
+ * Parse module item list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItemList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleItemList(parser, context) {
+ // Prime the scanner
+ nextToken(parser, context);
+ const statements = [];
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ statements.push(parser.token === 33554435 /* StringLiteral */ ?
+ parseDirective(parser, context) :
+ parseModuleItem(parser, context | Context.AllowIn));
+ }
+ return statements;
+}
+/**
+ * Parse module item
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleItem(parser, context) {
+ switch (parser.token) {
+ // @decorator
+ case 120 /* At */:
+ return parseDecorators(parser, context);
+ // ExportDeclaration
+ case 12371 /* ExportKeyword */:
+ return parseExportDeclaration(parser, context);
+ // ImportDeclaration
+ case 33566810 /* ImportKeyword */:
+ // 'Dynamic Import' or meta property disallowed here
+ if (!(context & Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod))) {
+ return parseImportDeclaration(parser, context);
+ }
+ // falls through
+ default:
+ return parseStatementListItem(parser, context);
+ }
+}
+/**
+ * Parse export declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ const specifiers = [];
+ let source = null;
+ let declaration = null;
+ expect(parser, context | Context.DisallowEscapedKeyword, 12371 /* ExportKeyword */);
+ switch (parser.token) {
+ // export * FromClause ;
+ case 167774771 /* Multiply */:
+ return parseExportAllDeclaration(parser, context, pos);
+ case 12368 /* DefaultKeyword */:
+ return parseExportDefault(parser, context, pos);
+ case 41943052 /* LeftBrace */:
+ {
+ // export ExportClause FromClause ;
+ // export ExportClause ;
+ expect(parser, context, 41943052 /* LeftBrace */);
+ let hasReservedWord = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token !== 69743 /* GetKeyword */ && parser.token & 12288 /* Reserved */) {
+ hasReservedWord = true;
+ setPendingError(parser);
+ }
+ specifiers.push(parseNamedExportDeclaration(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context | Context.DisallowEscapedKeyword, 17825807 /* RightBrace */);
+ if (parser.token === 69745 /* FromKeyword */) {
+ source = parseModuleSpecifier(parser, context);
+ // The left hand side can't be a keyword where there is no
+ // 'from' keyword since it references a local binding.
+ }
+ else if (hasReservedWord)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ consumeSemicolon(parser, context);
+ break;
+ }
+ // export ClassDeclaration
+ case 33566797 /* ClassKeyword */:
+ declaration = (parseClassDeclaration(parser, context));
+ break;
+ // export LexicalDeclaration
+ case 33574984 /* LetKeyword */:
+ case 33566793 /* ConstKeyword */:
+ declaration = parseVariableStatement(parser, context | Context.BlockScope);
+ break;
+ // export VariableDeclaration
+ case 33566791 /* VarKeyword */:
+ declaration = parseVariableStatement(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ declaration = parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context);
+ break;
+ }
+ // Falls through
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportNamedDeclaration',
+ source,
+ specifiers,
+ declaration,
+ });
+}
+/**
+ * Parse export all declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExportAllDeclaration(parser, context, pos) {
+ expect(parser, context, 167774771 /* Multiply */);
+ const source = parseModuleSpecifier(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExportAllDeclaration',
+ source,
+ });
+}
+/**
+ * Parse named export declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNamedExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ // ExportSpecifier :
+ // IdentifierName
+ // IdentifierName as IdentifierName
+ const local = parseIdentifierName(parser, context | Context.DisallowEscapedKeyword, parser.token);
+ const exported = consume(parser, context, 167843947 /* AsKeyword */)
+ ? parseIdentifierName(parser, context, parser.token)
+ : local;
+ return finishNode(context, parser, pos, {
+ type: 'ExportSpecifier',
+ local,
+ exported,
+ });
+}
+/**
+ * Parse export default
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+function parseExportDefault(parser, context, pos) {
+ expect(parser, context | Context.DisallowEscapedKeyword, 12368 /* DefaultKeyword */);
+ let declaration;
+ switch (parser.token) {
+ // export default HoistableDeclaration[Default]
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context | Context.RequireIdentifier);
+ break;
+ // export default ClassDeclaration[Default]
+ // export default @decl ClassDeclaration[Default]
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ declaration = parseClassDeclaration(parser, context & ~Context.AllowIn | Context.RequireIdentifier);
+ break;
+ // export default HoistableDeclaration[Default]
+ case 594028 /* AsyncKeyword */:
+ declaration = parseAsyncFunctionOrAssignmentExpression(parser, context | Context.RequireIdentifier);
+ break;
+ default:
+ // export default [lookahead ∉ {function, class}] AssignmentExpression[In] ;
+ declaration = parseAssignmentExpression(parser, context | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportDefaultDeclaration',
+ declaration,
+ });
+}
+/**
+ * Parse import declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566810 /* ImportKeyword */);
+ let source;
+ let specifiers = [];
+ // 'import' ModuleSpecifier ';'
+ if (parser.token === 33554435 /* StringLiteral */) {
+ source = parseLiteral(parser, context);
+ }
+ else {
+ specifiers = parseImportClause(parser, context | Context.DisallowEscapedKeyword);
+ source = parseModuleSpecifier(parser, context);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ImportDeclaration',
+ specifiers,
+ source,
+ });
+}
+/**
+ * Parse import clause
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportClause(parser, context) {
+ const specifiers = [];
+ switch (parser.token) {
+ // 'import' ModuleSpecifier ';'
+ case 33685505 /* Identifier */:
+ {
+ specifiers.push(parseImportDefaultSpecifier(parser, context));
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ switch (parser.token) {
+ // import a, * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ // import a, {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ default:
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ break;
+ }
+ // import {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ // import * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return specifiers;
+}
+/**
+ * Parse named imports
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NamedImports)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNamedImports(parser, context, specifiers) {
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ specifiers.push(parseImportSpecifier(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+}
+/**
+ * Parse import specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportSpecifier(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const imported = parseIdentifierName(parser, context | Context.DisallowEscapedKeyword, token);
+ let local;
+ if (consume(parser, context, 167843947 /* AsKeyword */)) {
+ local = parseBindingIdentifier(parser, context);
+ }
+ else {
+ // An import name that is a keyword is a syntax error if it is not followed
+ // by the keyword 'as'.
+ if (hasBit(token, 12288 /* Reserved */))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ if (hasBit(token, 4194304 /* IsEvalOrArguments */))
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ local = imported;
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ImportSpecifier',
+ local,
+ imported,
+ });
+}
+/**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NameSpaceImport)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNameSpaceImport(parser, context, specifiers) {
+ // NameSpaceImport:
+ // * as ImportedBinding
+ const pos = getLocation(parser);
+ expect(parser, context, 167774771 /* Multiply */);
+ expect(parser, context, 167843947 /* AsKeyword */, 82 /* AsAfterImportStart */);
+ const local = parseBindingIdentifier(parser, context);
+ specifiers.push(finishNode(context, parser, pos, {
+ type: 'ImportNamespaceSpecifier',
+ local,
+ }));
+}
+/**
+ * Parse module specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleSpecifier(parser, context) {
+ // ModuleSpecifier :
+ // StringLiteral
+ expect(parser, context, 69745 /* FromKeyword */);
+ if (parser.token !== 33554435 /* StringLiteral */)
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseLiteral(parser, context);
+}
+/**
+ * Parse import default specifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportDefaultSpecifier(parser, context) {
+ return finishNode(context, parser, getLocation(parser), {
+ type: 'ImportDefaultSpecifier',
+ local: parseIdentifier(parser, context),
+ });
+}
+/**
+ * Parses either async function or assignment expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAssignmentExpression(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context | Context.RequireIdentifier) :
+ parseAssignmentExpression(parser, context | Context.AllowIn);
+} + +/**
+ * Creates the parser object
+ *
+ * @param source The source coode to parser
+ * @param sourceFile Optional source file info to be attached in every node
+ */
+function createParser(source, sourceFile) {
+ return {
+ // The source code to parse
+ source,
+ // Source length
+ length: source.length,
+ // Current position
+ index: 0,
+ // Current line
+ line: 1,
+ // Current column
+ column: 0,
+ // Start position before current token
+ startIndex: 0,
+ // Start position column before current token
+ startColumn: 0,
+ // Start position line before current token
+ startLine: 1,
+ // End position after parsing after current token
+ lastIndex: 0,
+ // End column position after current token
+ lastColumn: 0,
+ // End line position after current token
+ lastLine: 0,
+ // Pending cover grammar errors
+ pendingExpressionError: undefined,
+ // Mutable parser flags. Allows destructuring by default.
+ flags: Flags.AllowDestructuring,
+ // The tokens
+ token: 1048576 /* EndOfSource */,
+ // Misc
+ tokenRaw: '',
+ lastValue: 0,
+ comments: [],
+ sourceFile,
+ tokenRegExp: undefined,
+ tokenValue: undefined,
+ labelSet: undefined,
+ errorLocation: undefined,
+ errors: [],
+ };
+}
+/**
+ * Creating the parser
+ *
+ * @param source The source coode to parser
+ * @param options The parser options
+ * @param context Context masks
+ */
+function parseSource(source, options, /*@internal*/ context) {
+ let sourceFile = '';
+ if (!!options) {
+ // The flag to enable module syntax support
+ if (options.module)
+ context |= Context.Module;
+ // The flag to enable stage 3 support (ESNext)
+ if (options.next)
+ context |= Context.OptionsNext;
+ // The flag to enable React JSX parsing
+ if (options.jsx)
+ context |= Context.OptionsJSX;
+ // The flag to enable start and end offsets to each node
+ if (options.ranges)
+ context |= Context.OptionsRanges;
+ // The flag to enable line/column location information to each node
+ if (options.loc)
+ context |= Context.OptionsLoc;
+ // The flag to attach raw property to each literal node
+ if (options.raw)
+ context |= Context.OptionsRaw;
+ // Attach raw property to each identifier node
+ if (options.rawIdentifier)
+ context |= Context.OptionsRawidentifiers;
+ // The flag to allow return in the global scope
+ if (options.globalReturn)
+ context |= Context.OptionsGlobalReturn;
+ // The flag to allow to skip shebang - '#'
+ if (options.skipShebang)
+ context |= Context.OptionsShebang;
+ // Enable tolerant mode
+ if (options.tolerant)
+ context |= Context.OptionsTolerant;
+ // Set to true to record the source file in every node's loc object when the loc option is set.
+ if (!!options.source)
+ sourceFile = options.source;
+ // Create a top-level comments array containing all comments
+ if (!!options.comments)
+ context |= Context.OptionsComments;
+ // The flag to enable implied strict mode
+ if (options.impliedStrict)
+ context |= Context.Strict;
+ // The flag to enable experimental features
+ if (options.experimental)
+ context |= Context.OptionsExperimental;
+ // The flag to set to bypass methods in Node
+ if (options.node)
+ context |= Context.OptionsNode;
+ // Accepts a callback function to be invoked for each syntax node (as the node is constructed)
+ }
+ const parser = createParser(source, sourceFile);
+ const body = context & Context.Module ?
+ parseModuleItemList(parser, context) :
+ parseStatementList(parser, context);
+ const node = {
+ type: 'Program',
+ sourceType: context & Context.Module ? 'module' : 'script',
+ body: body,
+ };
+ if (context & Context.LocationTracker) {
+ if (context & Context.OptionsRanges) {
+ node.start = 0;
+ node.end = source.length;
+ }
+ if (context & Context.OptionsLoc) {
+ node.loc = {
+ start: { line: 1, column: 0 },
+ end: { line: parser.line, column: parser.column
+ }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ if (context & Context.OptionsComments)
+ node.comments = parser.comments;
+ if (context & Context.OptionsTolerant)
+ node.errors = parser.errors;
+ return node;
+}
+/**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function parseStatementList(parser, context) {
+ const statements = [];
+ let hasProlog = true; // Parsing directive prologue.
+ // prime the scanner
+ nextToken(parser, context | Context.DisallowEscapedKeyword);
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ if (hasProlog && parser.token !== 33554435 /* StringLiteral */)
+ hasProlog = false;
+ if (hasProlog) {
+ if (!(context & Context.Strict) && parser.tokenRaw.length === 12 && parser.tokenValue === 'use strict') {
+ context |= Context.Strict;
+ }
+ statements.push(parseDirective(parser, context));
+ }
+ else {
+ statements.push(parseStatementListItem(parser, context));
+ }
+ }
+ return statements;
+}
+/**
+ * Parse either script code or module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parse(source, options) {
+ return options && options.module
+ ? parseModule(source, options)
+ : parseScript(source, options);
+}
+/**
+ * Parse script code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parseScript(source, options) {
+ return parseSource(source, options, Context.Empty);
+}
+/**
+ * Parse module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parseModule(source, options) {
+ return parseSource(source, options, Context.Strict | Context.Module);
+} + + + +var estree = /*#__PURE__*/Object.freeze({ + +}); + + + +var index = /*#__PURE__*/Object.freeze({ + scanIdentifier: scanIdentifier, + scanMaybeIdentifier: scanMaybeIdentifier, + scanHexIntegerLiteral: scanHexIntegerLiteral, + scanOctalOrBinary: scanOctalOrBinary, + scanImplicitOctalDigits: scanImplicitOctalDigits, + scanSignedInteger: scanSignedInteger, + scanNumericLiteral: scanNumericLiteral, + scanNumericSeparator: scanNumericSeparator, + scanDecimalDigitsOrSeparator: scanDecimalDigitsOrSeparator, + scanDecimalAsSmi: scanDecimalAsSmi, + scanRegularExpression: scanRegularExpression, + scan: scan, + scanEscapeSequence: scanEscapeSequence, + throwStringError: throwStringError, + scanString: scanString, + consumeTemplateBrace: consumeTemplateBrace, + scanTemplate: scanTemplate, + skipSingleHTMLComment: skipSingleHTMLComment, + skipSingleLineComment: skipSingleLineComment, + skipMultiLineComment: skipMultiLineComment, + addComment: addComment, + nextUnicodeChar: nextUnicodeChar, + isIdentifierPart: isIdentifierPart, + escapeInvalidCharacters: escapeInvalidCharacters, + consumeOpt: consumeOpt, + consumeLineFeed: consumeLineFeed, + scanPrivateName: scanPrivateName, + advanceNewline: advanceNewline, + fromCodePoint: fromCodePoint, + readNext: readNext, + toHex: toHex, + advanceOnMaybeAstral: advanceOnMaybeAstral +}); + + + +var parser = /*#__PURE__*/Object.freeze({ + parseClassDeclaration: parseClassDeclaration, + parseFunctionDeclaration: parseFunctionDeclaration, + parseAsyncFunctionOrAsyncGeneratorDeclaration: parseAsyncFunctionOrAsyncGeneratorDeclaration, + parseVariableDeclarationList: parseVariableDeclarationList, + parseExpression: parseExpression, + parseSequenceExpression: parseSequenceExpression, + parseAssignmentExpression: parseAssignmentExpression, + parseRestElement: parseRestElement, + parseLeftHandSideExpression: parseLeftHandSideExpression, + parsePrimaryExpression: parsePrimaryExpression, + parseIdentifier: parseIdentifier, + parseLiteral: parseLiteral, + parseBigIntLiteral: parseBigIntLiteral, + parseIdentifierName: parseIdentifierName, + parseFunctionExpression: parseFunctionExpression, + parseAsyncFunctionOrAsyncGeneratorExpression: parseAsyncFunctionOrAsyncGeneratorExpression, + parsePropertyName: parsePropertyName, + parseObjectLiteral: parseObjectLiteral, + parseFormalListAndBody: parseFormalListAndBody, + parseFunctionBody: parseFunctionBody, + parseFormalParameters: parseFormalParameters, + parseFormalParameterList: parseFormalParameterList, + parseClassBodyAndElementList: parseClassBodyAndElementList, + parseClassElement: parseClassElement, + parseDecorators: parseDecorators, + parseModuleItemList: parseModuleItemList, + parseModuleItem: parseModuleItem, + parseExportDeclaration: parseExportDeclaration, + parseImportDeclaration: parseImportDeclaration, + createParser: createParser, + parseSource: parseSource, + parseStatementList: parseStatementList, + parse: parse, + parseScript: parseScript, + parseModule: parseModule, + parseBindingIdentifierOrPattern: parseBindingIdentifierOrPattern, + parseBindingIdentifier: parseBindingIdentifier, + parseAssignmentRestElement: parseAssignmentRestElement, + parseAssignmentPattern: parseAssignmentPattern, + parseBindingInitializer: parseBindingInitializer, + parseStatementListItem: parseStatementListItem, + parseStatement: parseStatement, + parseEmptyStatement: parseEmptyStatement, + parseContinueStatement: parseContinueStatement, + parseBreakStatement: parseBreakStatement, + parseIfStatement: parseIfStatement, + parseDebuggerStatement: parseDebuggerStatement, + parseTryStatement: parseTryStatement, + parseCatchBlock: parseCatchBlock, + parseThrowStatement: parseThrowStatement, + parseExpressionStatement: parseExpressionStatement, + parseDirective: parseDirective, + parseExpressionOrLabelledStatement: parseExpressionOrLabelledStatement, + parseDoWhileStatement: parseDoWhileStatement, + parseWhileStatement: parseWhileStatement, + parseBlockStatement: parseBlockStatement, + parseReturnStatement: parseReturnStatement, + parseIterationStatement: parseIterationStatement, + parseWithStatement: parseWithStatement, + parseSwitchStatement: parseSwitchStatement, + parseCaseOrDefaultClauses: parseCaseOrDefaultClauses, + parseVariableStatement: parseVariableStatement, + parseJSXRootElement: parseJSXRootElement, + parseJSXOpeningElement: parseJSXOpeningElement, + nextJSXToken: nextJSXToken, + scanJSXToken: scanJSXToken, + parseJSXText: parseJSXText, + parseJSXAttributes: parseJSXAttributes, + parseJSXSpreadAttribute: parseJSXSpreadAttribute, + parseJSXNamespacedName: parseJSXNamespacedName, + parseJSXAttributeName: parseJSXAttributeName, + parseJSXAttribute: parseJSXAttribute, + parseJSXEmptyExpression: parseJSXEmptyExpression, + parseJSXSpreadChild: parseJSXSpreadChild, + parseJSXExpressionContainer: parseJSXExpressionContainer, + parseJSXExpression: parseJSXExpression, + parseJSXClosingFragment: parseJSXClosingFragment, + parseJSXClosingElement: parseJSXClosingElement, + parseJSXIdentifier: parseJSXIdentifier, + parseJSXMemberExpression: parseJSXMemberExpression, + parseJSXElementName: parseJSXElementName, + scanJSXIdentifier: scanJSXIdentifier +}); + +// tslint:disable-next-line:variable-name
+const Parser = parser; + +const version = '1.6.9'; + +export { version, estree as ESTree, index as Scanner, parse, parseSource, parseModule, parseScript, characterType, errorMessages, constructError, report, tolerant, tokenDesc, descKeyword, Parser, isValidIdentifierPart, isValidIdentifierStart, mustEscape, Context, Flags, Labels, NumericState, ScannerState, ModifierState, CoverParenthesizedState, Escape, RegexFlags, CoverCallState, RegexState, ObjectState, validateBreakOrContinueLabel, addLabel, popLabel, hasLabel, finishNode, expect, consume, nextToken, hasBit, consumeSemicolon, parseExpressionCoverGrammar, restoreExpressionCoverGrammar, swapContext, validateParams, reinterpret, lookahead, isValidSimpleAssignmentTarget, getLocation, isValidIdentifier, isLexical, isEndOfCaseOrDefaultClauses, nextTokenIsLeftParenOrPeriod, nextTokenisIdentifierOrParen, nextTokenIsLeftParen, nextTokenIsFuncKeywordOnSameLine, isPropertyWithPrivateFieldKey, parseAndClassifyIdentifier, nameIsArgumentsOrEval, setPendingError, isEqualTagNames, isInstanceField, validateUpdateExpression, setPendingExpressionError, validateCoverParenthesizedExpression, validateAsyncArgumentList, isInOrOf }; diff --git a/node_modules/cherow/dist/es2015/cherow.min.js b/node_modules/cherow/dist/es2015/cherow.min.js new file mode 100644 index 0000000..2cb3f74 --- /dev/null +++ b/node_modules/cherow/dist/es2015/cherow.min.js @@ -0,0 +1 @@ +const keywordDescTable=["end of source","identifier","number","string","regular expression","false","true","null","template continuation","template end","=>","(","{",".","...","}",")",";",",","[","]",":","?","'",'"',"</","/>","++","--","=","<<=",">>=",">>>=","**=","+=","-=","*=","/=","%=","^=","|=","&=","typeof","delete","void","!","~","+","-","in","instanceof","*","%","/","**","&&","||","===","!==","==","!=","<=",">=","<",">","<<",">>",">>>","&","|","^","var","let","const","break","case","catch","class","continue","debugger","default","do","else","export","extends","finally","for","function","if","import","new","return","super","switch","this","throw","try","while","with","implements","interface","package","private","protected","public","static","yield","as","async","await","constructor","get","set","from","of","#","eval","arguments","enum","BigInt","@","JSXText","KeyOf","ReadOnly","is","unique","declare","type","namespace","abstract","module","global","require","target"];function tokenDesc(e){return keywordDescTable[255&e]}const descKeywordTable=Object.create(null,{this:{value:33566815},function:{value:33566808},if:{value:12377},return:{value:12380},var:{value:33566791},else:{value:12370},for:{value:12374},new:{value:33566811},in:{value:167786289},typeof:{value:302002218},while:{value:12386},case:{value:12363},break:{value:12362},try:{value:12385},catch:{value:12364},delete:{value:302002219},throw:{value:302002272},switch:{value:33566814},continue:{value:12366},default:{value:12368},instanceof:{value:167786290},do:{value:12369},void:{value:302002220},finally:{value:12373},arguments:{value:37879925},keyof:{value:131194},readonly:{value:131195},unique:{value:131197},declare:{value:131198},async:{value:594028},await:{value:34017389},class:{value:33566797},const:{value:33566793},constructor:{value:69742},debugger:{value:12367},enum:{value:12406},eval:{value:37879924},export:{value:12371},extends:{value:12372},false:{value:33566725},from:{value:69745},get:{value:69743},implements:{value:20579},import:{value:33566810},interface:{value:20580},let:{value:33574984},null:{value:33566727},of:{value:69746},package:{value:20581},private:{value:20582},protected:{value:20583},public:{value:20584},set:{value:69744},static:{value:20585},super:{value:33566813},true:{value:33566726},with:{value:12387},yield:{value:1107316842},is:{value:131196},type:{value:131199},namespace:{value:131200},abstract:{value:131201},as:{value:167843947},module:{value:131202},global:{value:131203},require:{value:131204},target:{value:131205}});function descKeyword(e){return 0|descKeywordTable[e]}const characterType=[0,0,0,0,0,0,0,0,0,16,48,16,16,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0];function isValidIdentifierPart(e){return 0!=(1&convert[0+(e>>>5)]>>>e)}function isValidIdentifierStart(e){return 0!=(1&convert[34816+(e>>>5)]>>>e)}function mustEscape(e){return 0!=(1&convert[69632+(e>>>5)]>>>e)}const convert=((e,t)=>{const n=new Uint32Array(104448);let r=0,a=0;for(;r<3392;){const o=e[r++];if(o<0)a-=o;else{let s=e[r++];2&o&&(s=t[s]),1&o?n.fill(s,a,a+=e[r++]):n[a++]=s}}return n})([-1,2,28,2,29,2,5,-1,0,77595648,3,46,2,3,0,14,2,57,2,58,3,0,3,0,3168796671,0,4294956992,2,1,2,0,2,59,3,0,4,0,4294966523,3,0,4,2,15,2,60,2,0,0,4294836735,0,3221225471,0,4294901942,2,61,0,134152192,3,0,2,0,4294951935,3,0,2,0,2683305983,0,2684354047,2,17,2,0,0,4294961151,3,0,2,2,20,2,0,0,608174079,2,0,2,127,2,6,2,62,-1,2,64,2,26,2,1,3,0,3,0,4294901711,2,40,0,4089839103,0,2961209759,0,1342439375,0,4294543342,0,3547201023,0,1577204103,0,4194240,0,4294688750,2,2,0,80831,0,4261478351,0,4294549486,2,2,0,2965387679,0,196559,0,3594373100,0,3288319768,0,8469959,2,171,0,4294828031,0,3825204735,0,123747807,0,65487,2,3,0,4092591615,0,1080049119,0,458703,2,3,2,0,0,2163244511,0,4227923919,0,4236247020,2,68,0,4284449919,0,851904,2,4,2,16,0,67076095,-1,2,69,0,1006628014,0,4093591391,-1,0,50331649,0,3265266687,2,34,0,4294844415,0,4278190047,2,23,2,125,-1,3,0,2,2,33,2,0,2,9,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,10,0,261632,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,2088959,2,31,2,8,0,909311,3,0,2,0,814743551,2,42,0,67057664,3,0,2,2,45,2,0,2,32,2,0,2,18,2,7,0,268374015,2,30,2,51,2,0,2,78,0,134153215,-1,2,6,2,0,2,7,0,2684354559,0,67044351,0,1073676416,-2,3,0,2,2,43,0,1046528,3,0,3,2,8,2,0,2,41,0,4294960127,2,9,2,39,2,10,0,4294377472,2,21,3,0,7,0,4227858431,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-1,2,122,0,1048577,2,84,2,12,-1,2,12,0,131042,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,1046559,2,0,2,13,2,0,0,2147516671,2,24,3,88,2,2,0,-16,2,89,0,524222462,2,4,2,0,0,4269801471,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,2,119,2,0,0,3220242431,3,0,3,2,20,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,2,0,2,27,2,0,2,8,3,0,2,0,67043391,0,3909091327,2,0,2,25,2,8,2,23,3,0,2,0,67076097,2,7,2,0,2,24,0,67059711,0,4236247039,3,0,2,0,939524103,0,8191999,2,97,2,98,2,14,2,95,3,0,3,0,67057663,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,3774349439,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,2,19,0,1638399,2,169,2,104,3,0,3,2,23,2,28,2,29,2,5,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-3,2,146,-4,2,23,2,0,2,37,0,1,2,0,2,63,2,32,2,16,2,9,2,0,2,109,-1,3,0,4,2,9,2,33,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277137519,0,2269118463,-1,3,23,2,-1,2,34,2,38,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,48,-14,2,23,2,44,2,37,-5,3,0,2,2,38,0,2147549120,2,0,2,16,2,17,2,130,2,0,2,52,0,4294901872,0,5242879,3,0,2,0,402595359,-1,2,118,0,1090519039,-2,2,120,2,39,2,0,2,55,2,40,0,4226678271,0,3766565279,0,2039759,-4,3,0,2,0,1140787199,-1,3,0,2,0,67043519,-5,2,0,0,4282384383,0,1056964609,-1,3,0,2,0,67043345,-1,2,0,2,41,2,42,-1,2,10,2,43,-6,2,0,2,16,-3,3,0,2,0,2147484671,-8,2,0,2,7,2,44,2,0,0,603979727,-1,2,0,2,45,-8,2,54,2,46,0,67043329,2,123,2,47,0,8388351,-2,2,124,0,3028287487,2,48,2,126,0,33259519,2,42,-9,2,24,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,2,42,-2,2,17,2,51,2,0,2,24,0,67043343,2,128,2,19,-21,3,0,2,-4,3,0,2,0,4294901791,2,7,2,164,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,0,1677656575,-166,0,4161266656,0,4071,0,15360,-4,0,28,-13,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,0,4294954999,2,0,-16,2,0,2,90,2,0,0,2105343,0,4160749584,0,65534,-42,0,4194303871,0,2011,-62,3,0,6,0,8323103,-1,3,0,2,2,55,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-22583,3,0,7,2,19,-6130,3,5,2,-1,0,69207040,3,46,2,3,0,14,2,57,2,58,-3,0,3168731136,0,4294956864,2,1,2,0,2,59,3,0,4,0,4294966275,3,0,4,2,15,2,60,2,0,2,35,-1,2,17,2,61,-1,2,0,2,62,0,4294885376,3,0,2,0,3145727,0,2617294944,0,4294770688,2,19,2,63,3,0,2,0,131135,2,94,0,70256639,0,71303167,0,272,2,45,2,62,-1,2,64,-2,2,96,0,603979775,0,4278255616,0,4294836227,0,4294549473,0,600178175,0,2952806400,0,268632067,0,4294543328,0,57540095,0,1577058304,0,1835008,0,4294688736,2,65,2,66,0,33554435,2,121,2,65,2,147,0,131075,0,3594373096,0,67094296,2,66,-1,2,67,0,603979263,2,156,0,3,0,4294828001,0,602930687,2,180,0,393219,2,67,0,671088639,0,2154840064,0,4227858435,0,4236247008,2,68,2,38,-1,2,4,0,917503,2,38,-1,2,69,0,537783470,0,4026531935,-1,0,1,-1,2,34,2,70,0,7936,-3,2,0,0,2147485695,0,1010761728,0,4292984930,0,16387,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,16,-1,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,253951,3,20,2,0,122879,2,0,2,8,0,276824064,-2,3,0,2,2,45,2,0,0,4294903295,2,0,2,18,2,7,-1,2,17,2,51,2,0,2,78,2,42,-1,2,24,2,0,2,31,-2,0,128,-2,2,79,2,8,0,4064,-1,2,117,0,4227907585,2,0,2,116,2,0,2,50,2,196,2,9,2,39,2,10,-1,0,6544896,3,0,6,-2,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-3,2,84,2,12,-3,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,817183,2,0,2,13,2,0,0,33023,2,24,3,88,2,-17,2,89,0,524157950,2,4,2,0,2,90,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,0,3072,2,0,0,2147516415,2,9,3,0,2,2,19,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,0,4294965179,0,7,2,0,2,8,2,92,2,8,-1,0,1761345536,2,94,2,95,2,38,2,23,2,96,2,36,2,162,0,2080440287,2,0,2,35,2,138,0,3296722943,2,0,0,1046675455,0,939524101,0,1837055,2,97,2,98,2,14,2,95,3,0,3,0,7,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,2700607615,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,-3,2,104,3,0,3,2,23,-1,3,5,2,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-8,2,23,2,0,2,37,-1,2,0,2,63,2,32,2,18,2,9,2,0,2,109,-1,3,0,4,2,9,2,17,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277075969,2,18,-1,3,23,2,-1,2,34,2,139,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,50,-14,2,23,2,44,2,116,-5,2,117,2,41,-2,2,117,2,19,2,17,2,35,2,117,2,38,0,4294901776,0,4718591,2,117,2,36,0,335544350,-1,2,118,2,119,-2,2,120,2,39,2,7,-1,2,121,2,65,0,3758161920,0,3,-4,2,0,2,31,2,174,-1,2,0,2,19,0,176,-5,2,0,2,49,2,182,-1,2,0,2,19,2,194,-1,2,0,2,62,-2,2,16,-7,2,0,2,119,-3,3,0,2,2,122,-8,0,4294965249,0,67633151,0,4026597376,2,0,0,536871887,-1,2,0,2,45,-8,2,54,2,49,0,1,2,123,2,19,-3,2,124,2,37,2,125,2,126,0,16778239,-10,2,36,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,-3,2,17,2,127,2,0,2,19,2,50,2,128,2,19,-21,3,0,2,-4,3,0,2,0,65567,-1,2,26,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,2,130,-187,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,2,138,-129,3,0,6,2,139,-1,3,0,2,2,50,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-28719,2,0,0,1,-1,2,122,2,0,0,8193,-21,0,50331648,0,10255,0,4,-11,2,66,2,168,-1,0,71680,-1,2,157,0,4292900864,0,805306431,-5,2,146,-1,2,176,-1,0,6144,-2,2,123,-1,2,150,-1,2,153,2,147,2,161,2,0,0,3223322624,2,36,0,4,-4,2,188,0,205128192,0,1333757536,0,2147483696,0,423953,0,747766272,0,2717763192,0,4286578751,0,278545,2,148,0,4294886464,0,33292336,0,417809,2,148,0,1329579616,0,4278190128,0,700594195,0,1006647527,0,4286497336,0,4160749631,2,149,0,469762560,0,4171219488,0,16711728,2,149,0,202375680,0,3214918176,0,4294508592,0,139280,-1,0,983584,2,190,0,58720275,0,3489923072,0,10517376,0,4293066815,0,1,0,2013265920,2,175,2,0,0,17816169,0,3288339281,0,201375904,2,0,-2,0,256,0,122880,0,16777216,2,146,0,4160757760,2,0,-6,2,163,-11,0,3263218176,-1,0,49664,0,2160197632,0,8388802,-1,0,12713984,-1,2,150,2,155,2,158,-2,2,159,-20,0,3758096385,-2,2,151,0,4292878336,2,22,2,166,0,4294057984,-2,2,160,2,152,2,172,-2,2,151,-1,2,179,-1,2,167,2,122,0,4026593280,0,14,0,4292919296,-1,2,154,0,939588608,-1,0,805306368,-1,2,122,0,1610612736,2,152,2,153,3,0,2,-2,2,154,2,155,-3,0,267386880,-1,2,156,0,7168,-1,0,65024,2,150,2,157,2,158,-7,2,165,-8,2,159,-1,0,1426112704,2,160,-1,2,185,0,271581216,0,2149777408,2,19,2,157,2,122,0,851967,0,3758129152,-1,2,19,2,178,-4,2,154,-20,2,192,2,161,-56,0,3145728,2,184,-1,2,191,2,122,-1,2,162,2,122,-4,0,32505856,-1,2,163,-1,0,2147385088,2,22,1,2155905152,2,-3,2,164,2,0,2,165,-2,2,166,-6,2,167,0,4026597375,0,1,-1,0,1,-1,2,168,-3,2,139,2,66,-2,2,162,2,177,-1,2,173,2,122,-6,2,122,-213,2,167,-657,2,17,-36,2,169,-1,2,186,-10,0,4294963200,-5,2,170,-5,2,158,2,0,2,24,-1,0,4227919872,-1,2,170,-2,0,4227874752,-3,0,2146435072,2,155,-2,0,1006649344,2,122,-1,2,22,0,201375744,-3,0,134217720,2,22,0,4286677377,0,32896,-1,2,171,-3,2,172,-349,2,173,2,174,2,175,3,0,264,-11,2,176,-2,2,158,2,0,0,520617856,0,2692743168,0,36,-3,0,524284,-11,2,19,-1,2,183,-1,2,181,0,3221291007,2,158,-1,0,524288,0,2158720,-3,2,155,0,1,-4,2,122,0,3808625411,0,3489628288,0,4096,0,1207959680,0,3221274624,2,0,-3,2,177,0,120,0,7340032,-2,0,4026564608,2,4,2,19,2,160,3,0,4,2,155,-1,2,178,2,175,-1,0,8176,2,179,2,177,2,180,-1,0,4290773232,2,0,-4,2,160,2,187,0,15728640,2,175,-1,2,157,-1,0,4294934512,3,0,4,-9,2,22,2,167,2,181,3,0,4,0,704,0,1849688064,0,4194304,-1,2,122,0,4294901887,2,0,0,130547712,0,1879048192,0,2080374784,3,0,2,-1,2,182,2,183,-1,0,17829776,0,2025848832,0,4261477888,-2,2,0,-1,0,4286580608,-1,0,29360128,2,184,0,16252928,0,3791388672,2,39,3,0,2,-2,2,193,2,0,-1,2,26,-1,0,66584576,-1,2,189,3,0,9,2,122,3,0,4,-1,2,157,2,158,3,0,5,-2,0,245760,0,2147418112,-1,2,146,2,199,0,4227923456,-1,2,185,2,186,2,22,-2,2,176,0,4292870145,0,262144,2,122,3,0,2,0,1073758848,2,187,-1,0,4227921920,2,188,0,68289024,0,528402016,0,4292927536,3,0,4,-2,0,2483027968,2,0,-2,2,189,3,0,5,-1,2,184,2,160,2,0,-2,0,4227923936,2,63,-1,2,170,2,94,2,0,2,150,2,154,3,0,6,-1,2,175,3,0,3,-2,0,2146959360,3,0,8,-2,2,157,-1,2,190,2,117,-1,2,151,3,0,8,2,191,0,8388608,2,171,2,169,2,183,0,4286578944,3,0,2,0,1152,0,1266679808,2,189,0,576,0,4261707776,2,94,3,0,9,2,151,3,0,8,-28,2,158,3,0,3,-3,0,4292902912,-6,2,96,3,0,85,-33,2,164,3,0,126,-18,2,192,3,0,269,-17,2,151,2,122,0,4294917120,3,0,2,2,19,0,4290822144,-2,0,67174336,0,520093700,2,17,3,0,21,-2,2,177,3,0,3,-2,0,65504,2,122,2,49,3,0,2,2,92,-191,2,123,-23,2,26,3,0,296,-8,2,122,3,0,2,2,19,-11,2,175,3,0,72,-3,0,3758159872,0,201391616,3,0,155,-7,2,167,-1,0,384,-1,0,133693440,-3,2,193,-2,2,30,3,0,4,2,166,-2,2,22,2,151,3,0,4,-2,2,185,-1,2,146,0,335552923,2,194,-1,0,538974272,0,2214592512,0,132e3,-10,0,192,-8,0,12288,-21,0,134213632,0,4294901761,3,0,42,0,100663424,0,4294965284,3,0,62,-6,0,4286578784,2,0,-2,0,1006696448,3,0,24,2,37,-1,2,195,3,0,10,2,194,0,4110942569,0,1432950139,0,2701658217,0,4026532864,0,4026532881,2,0,2,47,3,0,8,-1,2,154,-2,2,166,0,98304,0,65537,2,167,2,169,-2,2,154,-1,2,63,2,0,2,116,2,197,2,175,0,4294770176,2,30,3,0,4,-30,2,195,2,196,-3,2,166,-2,2,151,2,0,2,154,-1,2,189,-1,2,157,2,198,3,0,2,2,154,2,122,-1,0,193331200,-1,0,4227923960,2,197,-1,3,0,3,2,198,3,0,44,-1334,2,22,2,0,-129,2,195,-6,2,160,-180,2,199,-233,2,4,3,0,96,-16,2,160,3,0,22583,-7,2,17,3,0,6128],[4294967295,4294967291,4092460543,4294828015,4294967294,134217726,268435455,2147483647,1048575,1073741823,3892314111,1061158911,536805376,4294910143,4160749567,4294901759,134217727,4294901760,4194303,65535,262143,67108863,4286578688,536870911,8388607,4294918143,4294443008,255,67043328,2281701374,4294967232,2097151,4294903807,4294902783,4294967039,511,524287,131071,127,4294902271,4294549487,16777215,1023,67047423,4294901888,33554431,4286578687,4294770687,67043583,32767,15,2047999,4292870143,4294934527,4294966783,67045375,4294967279,262083,20511,4290772991,41943039,493567,2047,4294959104,1071644671,602799615,65536,4294828e3,805044223,4277151126,8191,1031749119,4294917631,2134769663,4286578493,4282253311,4294942719,33540095,4294905855,4294967264,2868854591,1608515583,265232348,534519807,2147614720,1060109444,4093640016,17376,2139062143,224,4169138175,4294909951,4294967292,4294965759,4294966272,4294901823,4294967280,8289918,4294934399,4294901775,4294965375,1602223615,4294967259,268369920,4292804608,486341884,4294963199,3087007615,1073692671,4128527,4279238655,4294902015,4294966591,2445279231,3670015,3238002687,63,4294967288,4294705151,4095,3221208447,4294549472,2147483648,4294705152,4294966143,64,4294966719,16383,3774873592,536807423,67043839,3758096383,3959414372,3755993023,2080374783,4294835295,4294967103,4160749565,4087,31,184024726,2862017156,1593309078,268434431,268434414,4294901763,536870912,2952790016,202506752,139264,402653184,4261412864,4227922944,2147532800,61440,3758096384,117440512,65280,4227858432,3233808384,3221225472,4294965248,32768,57152,4294934528,67108864,4293918720,4290772992,25165824,57344,4278190080,65472,4227907584,65520,1920,4026531840,49152,4160749568,4294836224,63488,1073741824,4294967040,251658240,196608,12582912,2097152,65408,64512,417808,4227923712,48,512,4294967168,4294966784,16,4292870144,4227915776,65528,4294950912,65532]);function nextUnicodeChar(e){const{index:t}=e,n=e.source.charCodeAt(t);if(n<55296||n>56319)return n;const r=e.source.charCodeAt(t+1);return r<56320||r>57343?n:65536+((1023&n)<<10)|1023&r}const isIdentifierPart=e=>0!=(1&characterType[e])||isValidIdentifierPart(e);function escapeInvalidCharacters(e){switch(e){case 0:return"\\0";case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:return mustEscape(e)?e<16?`\\x0${e.toString(16)}`:e<256?`\\x${e.toString(16)}`:e<4096?`\\u0${e.toString(16)}`:e<65536?`\\u${e.toString(16)}`:`\\u{${e.toString(16)}}`:fromCodePoint(e)}}function consumeOpt(e,t){return e.source.charCodeAt(e.index)===t&&(e.index++,e.column++,!0)}function consumeLineFeed(e,t){e.flags|=Flags.NewLine,e.index++,0==(t&ScannerState.LastIsCR)&&(e.column=0,e.line++)}function scanPrivateName(e,t){return t&Context.InClass&&isValidIdentifierStart(e.source.charCodeAt(e.index))||report(e,1,tokenDesc(e.token)),115}function advanceNewline(e){e.flags|=Flags.NewLine,e.index++,e.column=0,e.line++}const fromCodePoint=e=>e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023));function readNext(e){return e.index++,e.column++,e.index>=e.source.length&&report(e,14),nextUnicodeChar(e)}function toHex(e){return e<48?-1:e<=57?e-48:e<65?-1:e<=70?e-65+10:e<97?-1:e<=102?e-97+10:-1}function advanceOnMaybeAstral(e,t){e.index++,e.column++,t>65535&&e.index++}function scanEscapeSequence(e,t,n){switch(n){case 98:return 8;case 102:return 12;case 114:return 13;case 110:return 10;case 116:return 9;case 118:return 11;case 13:case 10:case 8232:case 8233:return e.column=-1,e.line++,Escape.Empty;case 48:case 49:case 50:case 51:{let r=n-48,a=e.index+1,o=e.column+1,s=e.source.charCodeAt(a);if(s<48||s>55){if(0!==r||56===s||57===s){if(t&Context.Strict)return Escape.StrictOctal;e.flags|=Flags.HasOctal}}else{if(t&Context.Strict)return Escape.StrictOctal;e.flags|=Flags.HasOctal,e.lastValue=s,r=8*r+(s-48),a++,o++,(s=e.source.charCodeAt(a))>=48&&s<=55&&(e.lastValue=s,r=8*r+(s-48),a++,o++),e.index=a-1,e.column=o-1}return r}case 52:case 53:case 54:case 55:{if(t&Context.Strict)return Escape.StrictOctal;let r=n-48;const a=e.index+1,o=e.column+1,s=e.source.charCodeAt(a);return s>=48&&s<=55&&(r=8*r+(s-48),e.lastValue=s,e.index=a,e.column=o),r}case 56:case 57:return Escape.EightOrNine;case 120:{const t=toHex(e.lastValue=readNext(e));if(t<0)return Escape.InvalidHex;const n=toHex(e.lastValue=readNext(e));return n<0?Escape.InvalidHex:t<<4|n}case 117:{let t=e.lastValue=readNext(e);if(123===t){let n=toHex(t=e.lastValue=readNext(e));if(n<0)return Escape.InvalidHex;for(t=e.lastValue=readNext(e);125!==t;){const r=toHex(t);if(r<0)return Escape.InvalidHex;if((n=16*n+r)>1114111)return Escape.OutOfRange;t=e.lastValue=readNext(e)}return n}{let n=toHex(t);if(n<0)return Escape.InvalidHex;for(let r=0;r<3;r++){const r=toHex(t=e.lastValue=readNext(e));if(r<0)return Escape.InvalidHex;n=16*n+r}return n}}default:return e.source.charCodeAt(e.index)}}function throwStringError(e,t,n){switch(n){case Escape.Empty:return;case Escape.StrictOctal:report(e,t&Context.TaggedTemplate?76:11);case Escape.EightOrNine:report(e,13);case Escape.InvalidHex:report(e,75,"hexadecimal");case Escape.OutOfRange:report(e,14)}}function scanString(e,t,n){const{index:r,lastValue:a}=e;let o="";e.index++,e.column++;let s=e.source.charCodeAt(e.index);for(;s!==n;){switch(s){case 13:case 10:report(e,6);case 92:if((s=readNext(e))>128)o+=fromCodePoint(s);else{e.lastValue=s;const n=scanEscapeSequence(e,t,s);n>=0?o+=fromCodePoint(n):throwStringError(e,t,n),s=e.lastValue}break;default:o+=fromCodePoint(s)}s=readNext(e)}return e.index++,e.column++,e.tokenRaw=e.source.slice(r,e.index),e.tokenValue=o,e.lastValue=a,33554435}function consumeTemplateBrace(e,t){return e.index>=e.length&&report(e,9),e.index--,e.column--,scanTemplate(e,t)}function scanTemplate(e,t){const{index:n,lastValue:r}=e;let a=!0,o="",s=readNext(e);e:for(;96!==s;){switch(s){case 36:{const t=e.index+1;if(t<e.length&&123===e.source.charCodeAt(t)){e.index=t,e.column++,a=!1;break e}o+="$";break}case 92:if((s=readNext(e))>=128)o+=fromCodePoint(s);else{e.lastValue=s;const n=scanEscapeSequence(e,t|Context.Strict,s);if(n>=0)o+=fromCodePoint(n);else{if(n!==Escape.Empty&&t&Context.TaggedTemplate){o=void 0,(s=scanLooserTemplateSegment(e,e.lastValue))<0&&(a=!1);break e}throwStringError(e,t|Context.TaggedTemplate,n)}s=e.lastValue}break;case 13:case 10:case 8232:case 8233:e.column=-1,e.line++;default:null!=o&&(o+=fromCodePoint(s))}s=readNext(e)}return e.index++,e.column++,e.tokenValue=o,e.lastValue=r,a?(e.tokenRaw=e.source.slice(n+1,e.index-1),33554441):(e.tokenRaw=e.source.slice(n+1,e.index-2),33554440)}function scanLooserTemplateSegment(e,t){for(;96!==t;){if(36===t&&123===e.source.charCodeAt(e.index+1))return e.index++,e.column++,-t;t=readNext(e)}return t}function scanHexIntegerLiteral(e,t){e.index++,e.column++;let n=NumericState.None,r=toHex(e.source.charCodeAt(e.index));for(r<0&&report(e,0),e.index++,e.column++;e.index<e.length;){const a=e.source.charCodeAt(e.index);if(t&Context.OptionsNext&&95===a){n=scanNumericSeparator(e,n);continue}n&=~NumericState.SeenSeparator;const o=toHex(a);if(o<0)break;r=16*r+o,e.index++,e.column++}return n&NumericState.SeenSeparator&&report(e,59),assembleNumericLiteral(e,t,r,consumeOpt(e,110))}function scanOctalOrBinary(e,t,n){e.index++,e.column++;let r,a=0,o=0,s=NumericState.None;for(;e.index<e.length;){if(r=e.source.charCodeAt(e.index),t&Context.OptionsNext&&95===r){s=scanNumericSeparator(e,s);continue}s&=~NumericState.SeenSeparator;const i=r-48;if(!(r>=48&&r<=57)||i>=n)break;o=o*n+i,e.index++,e.column++,a++}return 0===a&&report(e,0),s&NumericState.SeenSeparator&&report(e,59),assembleNumericLiteral(e,t,o,consumeOpt(e,110))}function scanImplicitOctalDigits(e,t){switch(e.source.charCodeAt(e.index)){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:{t&Context.Strict&&report(e,0);let n=e.index,r=e.column,a=0;for(e.flags|=Flags.HasOctal;n<e.length;){const o=e.source.charCodeAt(n);if(95===o)report(e,60);else{if(o<48||o>55)return scanNumericLiteral(e,t);a=8*a+(o-48),n++,r++}}return e.index=n,e.column=r,assembleNumericLiteral(e,t,a,consumeOpt(e,110))}case 56:case 57:e.flags|=Flags.HasOctal;default:return t&Context.OptionsNext&&95===e.source.charCodeAt(e.index)&&report(e,60),scanNumericLiteral(e,t)}}function scanSignedInteger(e,t){let n=e.source.charCodeAt(e.index);43!==n&&45!==n||(e.index++,e.column++,n=e.source.charCodeAt(e.index)),n>=48&&n<=57||report(e,0);const r=e.index,a=scanDecimalDigitsOrSeparator(e);return e.source.substring(t,r)+a}function scanNumericLiteral(e,t,n=NumericState.None){let r=n&NumericState.Float?0:scanDecimalAsSmi(e,t);const a=e.source.charCodeAt(e.index);if(46!==a&&95!==a&&!isValidIdentifierStart(a))return assembleNumericLiteral(e,t,r);consumeOpt(e,46)&&(t&Context.OptionsNext&&95===e.source.charCodeAt(e.index)&&report(e,60),n|=NumericState.Float,r=`${r}.${scanDecimalDigitsOrSeparator(e)}`);const o=e.index;return consumeOpt(e,110)&&(n&NumericState.Float&&report(e,0),n|=NumericState.BigInt),(consumeOpt(e,101)||consumeOpt(e,69))&&(n|=NumericState.Float,r+=scanSignedInteger(e,o)),isValidIdentifierStart(e.source.charCodeAt(e.index))&&report(e,0),assembleNumericLiteral(e,t,n&NumericState.Float?parseFloat(r):parseInt(r,10),!!(n&NumericState.BigInt))}function scanNumericSeparator(e,t){return e.index++,e.column++,t&NumericState.SeenSeparator&&report(e,59),t|=NumericState.SeenSeparator}function scanDecimalDigitsOrSeparator(e){let t=e.index,n=NumericState.None,r="";e:for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 95:const a=e.index;n=scanNumericSeparator(e,n),r+=e.source.substring(t,a),t=e.index;continue;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:n&=~NumericState.SeenSeparator,e.index++,e.column++;break;default:break e}return n&NumericState.SeenSeparator&&report(e,59),r+e.source.substring(t,e.index)}function scanDecimalAsSmi(e,t){let n=NumericState.None,r=0,a=e.source.charCodeAt(e.index);for(;a>=48&&a<=57||95===a;)t&Context.OptionsNext&&95===a?(n=scanNumericSeparator(e,n),a=e.source.charCodeAt(e.index)):(n&=~NumericState.SeenSeparator,r=10*r+(a-48),e.index++,e.column++,a=e.source.charCodeAt(e.index));return n&NumericState.SeenSeparator&&report(e,59),r}function assembleNumericLiteral(e,t,n,r=!1){return e.tokenValue=n,t&Context.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),r?33554551:33554434}function scanIdentifier(e,t,n){let r=e.index,a="",o=!1;n&&advanceOnMaybeAstral(e,n);e:for(;e.index<e.length;){const t=e.index;let n=e.source.charCodeAt(t);switch(n){case 92:a+=e.source.slice(r,t),a+=scanUnicodeCodePointEscape(e),r=e.index,o=!0;break;default:if(n>=55296&&n<=56319){n=(1023&n)<<10|1023&e.source.charCodeAt(t+1)|65536}if(!isIdentifierPart(n))break e;advanceOnMaybeAstral(e,n)}}r<e.index&&(a+=e.source.slice(r,e.index)),e.tokenValue=a;const s=a.length;if(s>=2&&s<=11){const n=descKeyword(a);if(n>0)return o&&(t&Context.DisallowEscapedKeyword&&tolerant(e,t,3),e.flags|=Flags.EscapedKeyword),n}return t&Context.OptionsRawidentifiers&&(e.tokenRaw=e.source.slice(r,e.index)),33685505}function scanMaybeIdentifier(e,t,n){return isValidIdentifierStart(n=nextUnicodeChar(e))||report(e,10,escapeInvalidCharacters(n)),scanIdentifier(e,t,n)}function scanUnicodeCodePointEscape(e){const{index:t}=e;if(t+5<e.length){117!==e.source.charCodeAt(t+1)&&report(e,0),e.index+=2,e.column+=2;const n=scanIdentifierUnicodeEscape(e);return n>=55296&&n<=56319&&report(e,74),isIdentifierPart(n)||report(e,75,"unicode"),fromCodePoint(n)}report(e,0)}function scanIdentifierUnicodeEscape(e){let t=e.source.charCodeAt(e.index),n=0;if(123===t){let r=toHex(t=readNext(e));for(;r>=0;)(n=n<<4|r)>1114111&&report(e,89),e.index++,e.column++,r=toHex(e.source.charCodeAt(e.index));125!==e.source.charCodeAt(e.index)&&report(e,75,"unicode"),consumeOpt(e,125)}else for(let r=0;r<4;r++){const r=toHex(t=e.source.charCodeAt(e.index));r<0&&report(e,75,"unicode"),n=n<<4|r,e.index++,e.column++}return n}function skipSingleHTMLComment(e,t,n,r){return t&Context.Module&&report(e,90),skipSingleLineComment(e,t,n,r)}function skipSingleLineComment(e,t,n,r){const a=e.index,o=!!(t&Context.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 13:return advanceNewline(e),e.index<e.length&&10===e.source.charCodeAt(e.index)&&e.index++,n|ScannerState.NewLine;case 10:case 8232:case 8233:return advanceNewline(e),o&&addComment(e,t,r,a),n|ScannerState.NewLine;default:e.index++,e.column++}return o&&addComment(e,t,r,a),n}function skipMultiLineComment(e,t,n){const r=e.index,a=!!(t&Context.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 42:if(e.index++,e.column++,n&=~ScannerState.LastIsCR,consumeOpt(e,47))return a&&addComment(e,t,"MultiLine",r),n;break;case 13:n|=ScannerState.NewLine|ScannerState.LastIsCR,advanceNewline(e);break;case 10:consumeLineFeed(e,n),n=n&~ScannerState.LastIsCR|ScannerState.NewLine;break;case 8232:case 8233:n=n&~ScannerState.LastIsCR|ScannerState.NewLine,advanceNewline(e);break;default:n&=~ScannerState.LastIsCR,e.index++,e.column++}tolerant(e,t,8)}function addComment(e,t,n,r){const{index:a,startIndex:o,startLine:s,startColumn:i,lastLine:c,lastColumn:l}=e,p={type:n,value:e.source.slice(r,"MultiLine"===n?a-2:a),start:o,end:a};t&Context.OptionsLoc&&(p.loc={start:{line:s,column:i},end:{line:c,column:l}}),e.comments.push(p)}function scan(e,t){e.flags&=~Flags.NewLine|Flags.EscapedKeyword;const n=0===e.index;let r=ScannerState.None;for(;e.index<e.length;){n||(e.startIndex=e.index,e.startColumn=e.column,e.startLine=e.line);const a=e.source.charCodeAt(e.index);if(a>128)switch(a){case 8232:case 8233:r=r&~ScannerState.LastIsCR|ScannerState.NewLine,advanceNewline(e);break;case 65519:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:case 8205:e.index++,e.column++;break;default:return scanMaybeIdentifier(e,t,a)}else switch(a){case 13:r|=ScannerState.NewLine|ScannerState.LastIsCR,advanceNewline(e);break;case 10:consumeLineFeed(e,r),r=r&~ScannerState.LastIsCR|ScannerState.NewLine;break;case 9:case 11:case 12:case 32:e.index++,e.column++;break;case 40:return e.index++,e.column++,50331659;case 41:return e.index++,e.column++,16;case 44:return e.index++,e.column++,16777234;case 58:return e.index++,e.column++,16777237;case 59:return e.index++,e.column++,17825809;case 63:return e.index++,e.column++,22;case 93:return e.index++,e.column++,20;case 123:return e.index++,e.column++,41943052;case 125:return e.index++,e.column++,17825807;case 126:return e.index++,e.column++,301989934;case 91:return e.index++,e.column++,41943059;case 64:return e.index++,e.column++,120;case 47:if(e.index++,e.column++,e.index>=e.length)return 167774773;switch(e.source.charCodeAt(e.index)){case 47:e.index++,e.column++,r=skipSingleLineComment(e,t,r,"SingleLine");continue;case 42:e.index++,e.column++,r=skipMultiLineComment(e,t,r);continue;case 61:return e.index++,e.column++,100663333;default:return 167774773}case 45:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 45:if(e.index++,e.column++,(r&ScannerState.NewLine||n)&&consumeOpt(e,62)){r=skipSingleHTMLComment(e,t,r,"HTMLClose");continue}return 570425372;case 61:return e.index++,e.column++,67108899;default:return 436209968}case 60:if(e.index++,e.column++,consumeOpt(e,33)&&consumeOpt(e,45)&&consumeOpt(e,45)){r=skipSingleHTMLComment(e,t,r,"HTMLOpen");continue}switch(e.source.charCodeAt(e.index)){case 60:return e.index++,e.column++,consumeOpt(e,61)?67108894:167774273;case 61:return e.index++,e.column++,167774013;case 47:{if(!(t&Context.OptionsJSX))break;const n=e.index+1;if(n<e.length){const t=e.source.charCodeAt(n);if(42===t||47===t)break}return e.index++,e.column++,25}default:return 167774015}case 33:return e.index++,e.column++,consumeOpt(e,61)?consumeOpt(e,61)?167773754:167773756:301989933;case 39:case 34:return scanString(e,t,a);case 37:return e.index++,e.column++,consumeOpt(e,61)?67108902:167774772;case 38:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 38===t?(e.index++,e.column++,169869879):61===t?(e.index++,e.column++,67108905):167773508}case 42:{if(e.index++,e.column++,e.index>=e.length)return 167774771;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,67108900):42!==t?167774771:(e.index++,e.column++,consumeOpt(e,61)?67108897:167775030)}case 43:{if(e.index++,e.column++,e.index>=e.length)return 436209967;const t=e.source.charCodeAt(e.index);return 43===t?(e.index++,e.column++,570425371):61===t?(e.index++,e.column++,67108898):436209967}case 92:return scanIdentifier(e,t);case 61:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,consumeOpt(e,61)?167773753:167773755):62===t?(e.index++,e.column++,10):83886109}case 62:{if(e.index++,e.column++,e.index>=e.length)return 167774016;if(t&Context.InJSXChild)return 167774016;let n=e.source.charCodeAt(e.index);return 61===n?(e.index++,e.column++,167774014):62!==n?167774016:(e.index++,e.column++,62===(n=e.source.charCodeAt(e.index))?(e.index++,e.column++,consumeOpt(e,61)?67108896:167774275):61===n?(e.index++,e.column++,67108895):167774274)}case 94:return e.index++,e.column++,consumeOpt(e,61)?67108903:167773254;case 96:return scanTemplate(e,t);case 124:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 124===t?(e.index++,e.column++,169869624):61===t?(e.index++,e.column++,67108904):167772997}case 46:{let n=e.index+1;const r=e.source.charCodeAt(n);return r>=48&&r<=57?(scanNumericLiteral(e,t,NumericState.Float),33554434):46===r&&++n<e.length&&46===e.source.charCodeAt(n)?(e.index=n+1,e.column+=3,14):(e.index++,e.column++,16777229)}case 35:{e.index++,e.column++;const r=e.index,a=e.source.charCodeAt(r);if(t&Context.OptionsShebang&&n&&33===a){e.index=r+1,skipSingleLineComment(e,t,ScannerState.None,"SheBang");continue}return scanPrivateName(e,t)}case 48:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 88:case 120:return scanHexIntegerLiteral(e,t);case 66:case 98:return scanOctalOrBinary(e,t,2);case 79:case 111:return scanOctalOrBinary(e,t,8);default:return scanImplicitOctalDigits(e,t)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return scanNumericLiteral(e,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 36:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:default:return scanIdentifier(e,t,a)}}return 1048576}function scanRegularExpression(e,t){const n=e.index;let r=RegexState.Empty;e:for(;;){const t=e.source.charCodeAt(e.index);if(e.index++,e.column++,r&RegexState.Escape)r&=~RegexState.Escape;else switch(t){case 47:if(r)break;break e;case 92:r|=RegexState.Escape;break;case 91:r|=RegexState.Class;break;case 93:r&=RegexState.Escape;break;case 13:case 10:case 8232:case 8233:report(e,7)}e.index>=e.source.length&&report(e,7)}const a=e.index-1;let o=RegexFlags.Empty;const{index:s}=e;e:for(;e.index<e.source.length;){const n=e.source.charCodeAt(e.index);switch(n){case 103:o&RegexFlags.Global&&tolerant(e,t,15,"g"),o|=RegexFlags.Global;break;case 105:o&RegexFlags.IgnoreCase&&tolerant(e,t,15,"i"),o|=RegexFlags.IgnoreCase;break;case 109:o&RegexFlags.Multiline&&tolerant(e,t,15,"m"),o|=RegexFlags.Multiline;break;case 117:o&RegexFlags.Unicode&&tolerant(e,t,15,"u"),o|=RegexFlags.Unicode;break;case 121:o&RegexFlags.Sticky&&tolerant(e,t,15,"y"),o|=RegexFlags.Sticky;break;case 115:o&RegexFlags.DotAll&&tolerant(e,t,15,"s"),o|=RegexFlags.DotAll;break;default:if(!isIdentifierPart(n))break e;report(e,16,fromCodePoint(n))}e.index++,e.column++}const i=e.source.slice(s,e.index),c=e.source.slice(n,a);return e.tokenRegExp={pattern:c,flags:i},t&Context.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),e.tokenValue=validate(e,t,c,i),33554436}function validate(e,t,n,r){Context.OptionsNode;try{return new RegExp(n,r)}catch(e){return null}}function parseBindingIdentifierOrPattern(e,t,n=[]){const{token:r}=e;return 8388608&r?41943052===r?parserObjectAssignmentPattern(e,t):parseArrayAssignmentPattern(e,t,n):(1074003968&r&&(262144&r&&t&(Context.Async|Context.Module)?tolerant(e,t,48):1073741824&r&&t&(Context.Yield|Context.Strict)&&tolerant(e,t,49)),n.push(e.tokenValue),parseBindingIdentifier(e,t))}function parseBindingIdentifier(e,t){const{token:n}=e;4194304&n?(t&Context.Strict&&tolerant(e,t,17),e.flags|=Flags.StrictEvalArguments):t&Context.BlockScope&&33574984===n?tolerant(e,t,27):hasBit(n,20480)?(t&Context.Strict&&tolerant(e,t,1,tokenDesc(n)),e.flags|=Flags.StrictFunctionName):isValidIdentifier(t,n)||tolerant(e,t,1,tokenDesc(n));const r=getLocation(e),a=e.tokenValue;return nextToken(e,t),finishNode(t,e,r,{type:"Identifier",name:a})}function parseAssignmentRestElement(e,t,n){const r=getLocation(e);expect(e,t,14);const a=parseBindingIdentifierOrPattern(e,t,n);return 16777234===e.token&&tolerant(e,t,88),finishNode(t,e,r,{type:"RestElement",argument:a})}function AssignmentRestProperty(e,t){const n=getLocation(e);expect(e,t,14);const{token:r}=e,a=parseBindingIdentifierOrPattern(e,t);return hasBit(r,8388608)&&tolerant(e,t,94),16777234===e.token&&tolerant(e,t,88),finishNode(t,e,n,{type:"RestElement",argument:a})}function parseArrayAssignmentPattern(e,t,n){const r=getLocation(e);nextToken(e,t);const a=[];for(;20!==e.token;)if(consume(e,t,16777234))a.push(null);else{if(14===e.token){a.push(parseAssignmentRestElement(e,t,n));break}a.push(parseExpressionCoverGrammar(e,t|Context.AllowIn,parseBindingInitializer)),20!==e.token&&expect(e,t,16777234)}return expect(e,t,20),finishNode(t,e,r,{type:"ArrayPattern",elements:a})}function parserObjectAssignmentPattern(e,t){const n=getLocation(e),r=[];for(expect(e,t,41943052);17825807!==e.token;){if(14===e.token){r.push(AssignmentRestProperty(e,t));break}r.push(parseAssignmentProperty(e,t)),17825807!==e.token&&expect(e,t,16777234)}return expect(e,t,17825807),finishNode(t,e,n,{type:"ObjectPattern",properties:r})}function parseAssignmentPattern(e,t,n,r){return finishNode(t,e,r,{type:"AssignmentPattern",left:n,right:parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression)})}function parseBindingInitializer(e,t){const n=getLocation(e),r=parseBindingIdentifierOrPattern(e,t);return consume(e,t,83886109)?finishNode(t,e,n,{type:"AssignmentPattern",left:r,right:parseAssignmentExpression(e,t|Context.AllowIn)}):r}function parseAssignmentProperty(e,t){const n=getLocation(e),{token:r}=e;let a,o,s=!1,i=!1;if(135168&r)if(a=parseIdentifier(e,t),i=!consume(e,t,16777237)){const s=consume(e,t,83886109);t&Context.Yield&&1073741824&r&&tolerant(e,t,49),isValidIdentifier(t,r)||tolerant(e,t,46),o=s?parseAssignmentPattern(e,t,a,n):a}else o=parseBindingInitializer(e,t);else s=41943059===r,a=parsePropertyName(e,t),expect(e,t,16777237),o=parseExpressionCoverGrammar(e,t,parseBindingInitializer);return finishNode(t,e,n,{type:"Property",kind:"init",key:a,computed:s,value:o,method:!1,shorthand:i})}function parseJSXRootElement(e,t){const n=getLocation(e);let r,a=[],o=null,s=!1;expect(e,t,167774015);const i=167774016===e.token;if(i)r=parseJSXOpeningFragment(e,t,n);else{r=parseJSXOpeningElement(e,t,parseJSXElementName(e,t),parseJSXAttributes(e,t),s=consume(e,t,167774773),n)}if(i)return parseJSXFragment(e,t,r,n);if(!s){a=parseJSXChildren(e,t),o=parseJSXClosingElement(e,t);const n=isEqualTagNames(r.name),s=isEqualTagNames(o.name);n!==s&&report(e,85,s)}return finishNode(t,e,n,{type:"JSXElement",children:a,openingElement:r,closingElement:o})}function parseJSXOpeningElement(e,t,n,r,a,o){return t&Context.InJSXChild&&a?expect(e,t,167774016):nextJSXToken(e),finishNode(t,e,o,{type:"JSXOpeningElement",name:n,attributes:r,selfClosing:a})}function parseJSXFragment(e,t,n,r){return finishNode(t,e,r,{type:"JSXFragment",children:parseJSXChildren(e,t),openingElement:n,closingFragment:parseJSXClosingFragment(e,t)})}function parseJSXOpeningFragment(e,t,n){return nextJSXToken(e),finishNode(t,e,n,{type:"JSXOpeningFragment"})}function nextJSXToken(e){return e.token=scanJSXToken(e)}function scanJSXToken(e){if(e.index>=e.source.length)return 1048576;e.lastIndex=e.startIndex=e.index;const t=e.source.charCodeAt(e.index);if(60===t)return e.index++,e.column++,consumeOpt(e,47)?25:167774015;if(123===t)return e.index++,e.column++,41943052;for(;e.index<e.source.length;){e.index++,e.column++;const t=e.source.charCodeAt(e.index);if(123===t||60===t)break}return 121}function parseJSXChildren(e,t){const n=[];for(;25!==e.token;)n.push(parseJSXChild(e,t));return n}function parseJSXText(e,t){const n=getLocation(e),r=e.source.slice(e.startIndex,e.index);e.token=scanJSXToken(e);const a=finishNode(t,e,n,{type:"JSXText",value:r});return t&Context.OptionsRaw&&(a.raw=r),a}function parseJSXChild(e,t){switch(e.token){case 33685505:case 121:return parseJSXText(e,t);case 41943052:return parseJSXExpression(e,t&~Context.InJSXChild);case 167774015:return parseJSXRootElement(e,t&~Context.InJSXChild);default:report(e,0)}}function parseJSXAttributes(e,t){const n=[];for(;e.index<e.source.length&&167774773!==e.token&&167774016!==e.token;)n.push(parseJSXAttribute(e,t));return n}function parseJSXSpreadAttribute(e,t){const n=getLocation(e);expect(e,t,41943052),expect(e,t,14);const r=parseExpressionCoverGrammar(e,t&~Context.InJSXChild,parseAssignmentExpression);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXSpreadAttribute",argument:r})}function parseJSXNamespacedName(e,t,n,r){return expect(e,t,16777237),finishNode(t,e,r,{type:"JSXNamespacedName",namespace:n,name:parseJSXIdentifier(e,t)})}function parseJSXAttributeName(e,t){const n=getLocation(e),r=parseJSXIdentifier(e,t);return 16777237===e.token?parseJSXNamespacedName(e,t,r,n):r}function parseJSXAttributeValue(e,t){switch(scanJSXAttributeValue(e,t)){case 33554435:return parseLiteral(e,t);case 41943052:return parseJSXExpressionContainer(e,t|Context.InJSXChild);case 167774015:return parseJSXRootElement(e,t|Context.InJSXChild);default:return void tolerant(e,t,87)}}function parseJSXAttribute(e,t){const n=getLocation(e);if(41943052===e.token)return parseJSXSpreadAttribute(e,t);scanJSXIdentifier(e);const r=parseJSXAttributeName(e,t);return finishNode(t,e,n,{type:"JSXAttribute",value:83886109===e.token?parseJSXAttributeValue(e,t):null,name:r})}function scanJSXAttributeValue(e,t){e.lastIndex=e.index;const n=e.source.charCodeAt(e.index);switch(n){case 34:case 39:return scanJSXString(e,t,n);default:return nextToken(e,t)}}function scanJSXString(e,t,n){const r=e.index;e.index++,e.column++;let a="",o=e.source.charCodeAt(e.index);for(;o!==n;)a+=fromCodePoint(o),e.index++,e.column++,o=e.source.charCodeAt(e.index),e.index>=e.source.length&&report(e,6);return e.index++,e.column++,t&Context.OptionsRaw&&(e.tokenRaw=e.source.slice(r,e.index)),e.tokenValue=a,33554435}function parseJSXEmptyExpression(e,t){return finishNode(t,e,getLocation(e),{type:"JSXEmptyExpression"})}function parseJSXSpreadChild(e,t){const n=getLocation(e);expect(e,t,14);const r=parseExpression(e,t);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXSpreadChild",expression:r})}function parseJSXExpressionContainer(e,t){const n=getLocation(e);expect(e,t,41943052),17825807===e.token&&tolerant(e,t,84);const r=parseExpressionCoverGrammar(e,t&~Context.InJSXChild,parseAssignmentExpression);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXExpressionContainer",expression:r})}function parseJSXExpression(e,t){const n=getLocation(e);if(expect(e,t,41943052),14===e.token)return parseJSXSpreadChild(e,t);const r=17825807===e.token?parseJSXEmptyExpression(e,t):parseExpressionCoverGrammar(e,t,parseAssignmentExpression);return nextJSXToken(e),finishNode(t,e,n,{type:"JSXExpressionContainer",expression:r})}function parseJSXClosingFragment(e,t){const n=getLocation(e);return expect(e,t,25),expect(e,t,167774016),finishNode(t,e,n,{type:"JSXClosingFragment"})}function parseJSXClosingElement(e,t){const n=getLocation(e);expect(e,t,25);const r=parseJSXElementName(e,t);return t&Context.InJSXChild?expect(e,t,167774016):nextJSXToken(e),finishNode(t,e,n,{type:"JSXClosingElement",name:r})}function parseJSXIdentifier(e,t){const{token:n,tokenValue:r,tokenRaw:a}=e;135168&n||tolerant(e,t,1,tokenDesc(e.token));const o=getLocation(e);nextToken(e,t);const s=finishNode(t,e,o,{type:"JSXIdentifier",name:r});return t&Context.OptionsRawidentifiers&&(s.raw=a),s}function parseJSXMemberExpression(e,t,n,r){return scanJSXIdentifier(e),finishNode(t,e,r,{type:"JSXMemberExpression",object:n,property:parseJSXIdentifier(e,t)})}function parseJSXElementName(e,t){const n=getLocation(e);scanJSXIdentifier(e);let r=parseJSXIdentifier(e,t);if(16777237===e.token)return parseJSXNamespacedName(e,t,r,n);for(;consume(e,t,16777229);)r=parseJSXMemberExpression(e,t,r,n);return r}function scanJSXIdentifier(e){const{token:t}=e;if(135168&t){const t=e.index;let n=e.source.charCodeAt(e.index);for(;e.index<e.source.length&&(45===n||isValidIdentifierPart(n));)n=readNext(e);e.tokenValue+=e.source.substr(t,e.index-t)}return e.token}function parseExpression(e,t){const n=getLocation(e),r=parseExpressionCoverGrammar(e,t,parseAssignmentExpression);return 16777234===e.token?parseSequenceExpression(e,t,r,n):r}function parseSequenceExpression(e,t,n,r){const a=[n];for(;consume(e,t,16777234);)a.push(parseExpressionCoverGrammar(e,t,parseAssignmentExpression));return finishNode(t,e,r,{type:"SequenceExpression",expressions:a})}function parseYieldExpression(e,t,n){t&Context.InParameter&&tolerant(e,t,51),expect(e,t,1107316842);let r=null,a=!1;return e.flags&Flags.NewLine||((a=consume(e,t,167774771))||33554432&e.token)&&(r=parseAssignmentExpression(e,t)),finishNode(t,e,n,{type:"YieldExpression",argument:r,delegate:a})}function parseAssignmentExpression(e,t){const n=getLocation(e);let{token:r}=e;if(t&Context.Yield&&1073741824&r)return parseYieldExpression(e,t,n);let a=524288&r&&lookahead(e,t,nextTokenisIdentifierOrParen)?parserCoverCallExpressionAndAsyncArrowHead(e,t):parseConditionalExpression(e,t,n);if(10===e.token)return 135168&r&&(4214784&r&&(20480&r&&(e.flags|=Flags.HasStrictReserved),4194304&r&&(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments)),a=[a]),parseArrowFunction(e,t&=~Context.Async,n,a);if(hasBit(e.token,67108864)){r=e.token,t&Context.Strict&&nameIsArgumentsOrEval(a.name)?tolerant(e,t,17):consume(e,t,83886109)?(e.flags&Flags.AllowDestructuring||tolerant(e,t,73),t&Context.InParameter||reinterpret(e,t,a),t&Context.InParen&&(e.flags|=Flags.SimpleParameterList),262144&e.token?(setPendingError(e),e.flags|=Flags.HasAwait):t&Context.InParen&&t&(Context.Strict|Context.Yield)&&1073741824&e.token&&(setPendingError(e),e.flags|=Flags.HasYield)):(isValidSimpleAssignmentTarget(a)||tolerant(e,t,5),e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),nextToken(e,t));const o=parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression);return e.pendingExpressionError=null,finishNode(t,e,n,{type:"AssignmentExpression",left:a,operator:tokenDesc(r),right:o})}return a}function parseConditionalExpression(e,t,n){const r=parseBinaryExpression(e,t,0,n);if(!consume(e,t,22))return r;const a=parseExpressionCoverGrammar(e,t&~Context.AllowDecorator|Context.AllowIn,parseAssignmentExpression);return expect(e,t,16777237),finishNode(t,e,n,{type:"ConditionalExpression",test:r,consequent:a,alternate:parseExpressionCoverGrammar(e,t,parseAssignmentExpression)})}function parseBinaryExpression(e,t,n,r,a=parseUnaryExpression(e,t)){const o=t&Context.AllowIn^Context.AllowIn;for(;hasBit(e.token,167772160);){const s=e.token,i=3840&s;if(o&&167786289===s)break;if(i+((167775030===s)<<8)<=n)break;nextToken(e,t),a=finishNode(t,e,r,{type:2097152&s?"LogicalExpression":"BinaryExpression",left:a,right:parseBinaryExpression(e,t&~Context.AllowIn,i,getLocation(e)),operator:tokenDesc(s)})}return a}function parseAwaitExpression(e,t,n){return t&Context.InParameter&&tolerant(e,t,52),expect(e,t,34017389),finishNode(t,e,n,{type:"AwaitExpression",argument:parseUnaryExpression(e,t)})}function parseUnaryExpression(e,t){const n=getLocation(e),{token:r}=e;if(hasBit(r,301989888)){nextToken(e,t),e.flags&Flags.EscapedKeyword&&tolerant(e,t,3);const a=parseExpressionCoverGrammar(e,t,parseUnaryExpression);return 167775030===e.token&&tolerant(e,t,1,tokenDesc(e.token)),t&Context.Strict&&302002219===r&&("Identifier"===a.type?tolerant(e,t,43):isPropertyWithPrivateFieldKey(a)&&tolerant(e,t,44)),finishNode(t,e,n,{type:"UnaryExpression",operator:tokenDesc(r),argument:a,prefix:!0})}return t&Context.Async&&262144&r?parseAwaitExpression(e,t,n):parseUpdateExpression(e,t,n)}function parseUpdateExpression(e,t,n){const{token:r}=e;if(hasBit(e.token,570425344)){nextToken(e,t);const a=parseLeftHandSideExpression(e,t,n);return validateUpdateExpression(e,t,a,"Prefix"),finishNode(t,e,n,{type:"UpdateExpression",argument:a,operator:tokenDesc(r),prefix:!0})}if(t&Context.OptionsJSX&&167774015===r)return parseJSXRootElement(e,t|Context.InJSXChild);const a=parseLeftHandSideExpression(e,t,n);if(hasBit(e.token,570425344)&&!(e.flags&Flags.NewLine)){validateUpdateExpression(e,t,a,"Postfix");const r=e.token;return nextToken(e,t),finishNode(t,e,n,{type:"UpdateExpression",argument:a,operator:tokenDesc(r),prefix:!1})}return a}function parseRestElement(e,t,n=[]){const r=getLocation(e);return expect(e,t,14),t&Context.InParen&&262144&e.token&&(e.flags|=Flags.HasAwait),finishNode(t,e,r,{type:"RestElement",argument:parseBindingIdentifierOrPattern(e,t,n)})}function parseSpreadElement(e,t){const n=getLocation(e);return expect(e,t,14),finishNode(t,e,n,{type:"SpreadElement",argument:restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression)})}function parseLeftHandSideExpression(e,t,n){const r=t&Context.OptionsNext&&33566810===e.token?parseCallImportOrMetaProperty(e,t|Context.AllowIn):parseMemberExpression(e,t|Context.AllowIn,n);return parseCallExpression(e,t|Context.AllowIn,n,r)}function parseMemberExpression(e,t,n,r=parsePrimaryExpression(e,t)){for(;;)switch(e.token){case 16777229:consume(e,t,16777229),e.flags=e.flags&~Flags.AllowBinding|Flags.AllowDestructuring,r=finishNode(t,e,n,{type:"MemberExpression",object:r,computed:!1,property:parseIdentifierNameOrPrivateName(e,t)});continue;case 41943059:{consume(e,t,41943059),e.flags=e.flags&~Flags.AllowBinding|Flags.AllowDestructuring;const a=parseExpression(e,t);expect(e,t,20),r=finishNode(t,e,n,{type:"MemberExpression",object:r,computed:!0,property:a});continue}case 33554441:r=finishNode(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:parseTemplateLiteral(e,t)});continue;case 33554440:r=finishNode(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:parseTemplate(e,t|Context.TaggedTemplate)});continue;default:return r}}function parseCallExpression(e,t,n,r){for(;;){if(r=parseMemberExpression(e,t,n,r),50331659!==e.token)return r;r=finishNode(t,e,n,{type:"CallExpression",callee:r,arguments:parseArgumentList(e,t&~Context.AllowDecorator)})}}function parserCoverCallExpressionAndAsyncArrowHead(e,t){const n=getLocation(e);let r=parseMemberExpression(e,t|Context.AllowIn,n);if(135168&e.token)return 262144&e.token&&tolerant(e,t,40),parseAsyncArrowFunction(e,t,ModifierState.Await,n,[parseAndClassifyIdentifier(e,t)]);for(e.flags&Flags.NewLine&&tolerant(e,t,36,"async");50331659===e.token;){r=parseMemberExpression(e,t,n,r);const a=parseAsyncArgumentList(e,t);if(10===e.token){r=parseAsyncArrowFunction(e,t,ModifierState.Await,n,a);break}r=finishNode(t,e,n,{type:"CallExpression",callee:r,arguments:a})}return r}function parseArgumentList(e,t){expect(e,t,50331659);const n=[];for(;16!==e.token;)14===e.token?n.push(parseSpreadElement(e,t)):(t&Context.Yield&&hasBit(e.token,1073741824)&&(e.flags|=Flags.HasYield,setPendingError(e)),n.push(parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression))),16!==e.token&&expect(e,t,16777234);return expect(e,t,16),n}function parseAsyncArgumentList(e,t){expect(e,t,50331659);const n=[];let{token:r}=e,a=CoverCallState.Empty;for(;16!==e.token&&(14===e.token?(e.flags|=Flags.SimpleParameterList,n.push(parseSpreadElement(e,t)),a=CoverCallState.HasSpread):(r=e.token,a=validateAsyncArgumentList(e,t,a),n.push(restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression))),consume(e,t,16777234)&&(e.flags&=~Flags.AllowDestructuring,a&CoverCallState.HasSpread&&(a=CoverCallState.SeenSpread)),16!==e.token););return expect(e,t,16),10===e.token&&(a&CoverCallState.SeenSpread?tolerant(e,t,78):a&CoverCallState.EvalOrArguments?(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments):a&CoverCallState.Yield?(t&Context.Strict&&tolerant(e,t,51),e.flags|=Flags.HasStrictReserved):e.flags&Flags.HasYield?tolerant(e,t,51):(a&CoverCallState.Await||e.flags&Flags.HasAwait)&&tolerant(e,t,52)),n}function parsePrimaryExpression(e,t){switch(e.token){case 33685505:return parseIdentifier(e,t);case 33554434:case 33554435:return parseLiteral(e,t);case 594028:return parseAsyncFunctionOrIdentifier(e,t);case 50331659:return parseParenthesizedExpression(e,t|Context.InParen);case 41943059:return restoreExpressionCoverGrammar(e,t,parseArrayLiteral);case 41943052:return restoreExpressionCoverGrammar(e,t,parseObjectLiteral);case 33566808:return parseFunctionExpression(e,t);case 33566727:case 33566726:case 33566725:return parseNullOrTrueOrFalseLiteral(e,t);case 120:case 33566797:return parseClassExpression(e,t);case 33566811:return parseNewExpressionOrMetaProperty(e,t);case 33566813:return parseSuperProperty(e,t);case 33554551:return parseBigIntLiteral(e,t);case 33566815:return parseThisExpression(e,t);case 115:return parseIdentifierNameOrPrivateName(e,t);case 167774773:case 100663333:return scanRegularExpression(e,t),parseRegularExpressionLiteral(e,t);case 33554441:return parseTemplateLiteral(e,t);case 33554440:return parseTemplate(e,t);case 33574984:return parseLetAsIdentifier(e,t);case 12369:if(t&Context.OptionsExperimental)return parseDoExpression(e,t);default:return parseAndClassifyIdentifier(e,t)}}function parseDoExpression(e,t){const n=getLocation(e);return expect(e,t,12369),finishNode(t,e,n,{type:"DoExpression",body:parseBlockStatement(e,t)})}function parseLetAsIdentifier(e,t){t&Context.Strict&&tolerant(e,t,50);const n=getLocation(e),r=e.tokenValue;return nextToken(e,t),e.flags&Flags.NewLine&&41943059===e.token&&tolerant(e,t,1,"let"),finishNode(t,e,n,{type:"Identifier",name:r})}function parseAsyncFunctionOrIdentifier(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorExpression(e,t):parseIdentifier(e,t)}function parseIdentifier(e,t){const n=getLocation(e),r=e.tokenValue;nextToken(e,t|Context.TaggedTemplate);const a=finishNode(t,e,n,{type:"Identifier",name:r});return t&Context.OptionsRawidentifiers&&(a.raw=e.tokenRaw),a}function parseRegularExpressionLiteral(e,t){const n=getLocation(e),{tokenRegExp:r,tokenValue:a,tokenRaw:o}=e;nextToken(e,t);const s=finishNode(t,e,n,{type:"Literal",value:a,regex:r});return t&Context.OptionsRaw&&(s.raw=o),s}function parseLiteral(e,t){const n=getLocation(e),r=e.tokenValue;t&Context.Strict&&e.flags&Flags.HasOctal&&tolerant(e,t,61),nextToken(e,t);const a=finishNode(t,e,n,{type:"Literal",value:r});return t&Context.OptionsRaw&&(a.raw=e.tokenRaw),a}function parseBigIntLiteral(e,t){const n=getLocation(e),{tokenValue:r,tokenRaw:a}=e;nextToken(e,t);const o=finishNode(t,e,n,{type:"Literal",value:r,bigint:a});return t&Context.OptionsRaw&&(o.raw=e.tokenRaw),o}function parseNullOrTrueOrFalseLiteral(e,t){const n=getLocation(e),{token:r}=e,a=tokenDesc(r);e.flags&Flags.EscapedKeyword&&tolerant(e,t,3),nextToken(e,t);const o=finishNode(t,e,n,{type:"Literal",value:33566727===r?null:"true"===a});return t&Context.OptionsRaw&&(o.raw=a),o}function parseThisExpression(e,t){e.flags&Flags.EscapedKeyword&&tolerant(e,t,3);const n=getLocation(e);return nextToken(e,t|Context.DisallowEscapedKeyword),finishNode(t,e,n,{type:"ThisExpression"})}function parseIdentifierName(e,t,n){return 135168&n||tolerant(e,t,4,tokenDesc(n)),parseIdentifier(e,t)}function parseIdentifierNameOrPrivateName(e,t){if(!consume(e,t,115))return parseIdentifierName(e,t,e.token);const{tokenValue:n}=e,r=getLocation(e),a=n;return nextToken(e,t),finishNode(t,e,r,{type:"PrivateName",name:a})}function parseArrayLiteral(e,t){const n=getLocation(e);expect(e,t,41943059);const r=[];for(;20!==e.token;)consume(e,t,16777234)?r.push(null):14===e.token?(r.push(parseSpreadElement(e,t)),20!==e.token&&(e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),expect(e,t,16777234))):(r.push(restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression)),20!==e.token&&expect(e,t,16777234));return expect(e,t,20),finishNode(t,e,n,{type:"ArrayExpression",elements:r})}function parseParenthesizedExpression(e,t){if(expect(e,t,50331659),consume(e,t,16)){if(e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),10===e.token)return[]}else if(14===e.token){const n=[parseRestElement(e,t)];return expect(e,t,16),e.flags=e.flags&~(Flags.AllowDestructuring|Flags.AllowBinding)|Flags.SimpleParameterList,10!==e.token&&tolerant(e,t,1,tokenDesc(e.token)),n}const n=getLocation(e);let r=validateCoverParenthesizedExpression(e,CoverParenthesizedState.None),a=restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression);if(16777234===e.token){r|=CoverParenthesizedState.SequenceExpression;const o=[a];for(;consume(e,t|Context.DisallowEscapedKeyword,16777234);){if(14===e.token){e.flags&Flags.AllowBinding||tolerant(e,t,77),e.flags|=Flags.SimpleParameterList;const n=parseRestElement(e,t);return expect(e,t,16),10!==e.token&&tolerant(e,t,78),o.push(n),o}if(consume(e,t,16))return 10!==e.token&&tolerant(e,t,1,tokenDesc(e.token)),o;r=validateCoverParenthesizedExpression(e,r),o.push(restoreExpressionCoverGrammar(e,t,parseAssignmentExpression))}a=finishNode(t,e,n,{type:"SequenceExpression",expressions:o})}return expect(e,t,16),10===e.token?(r&CoverParenthesizedState.HasEvalOrArguments?(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments):r&CoverParenthesizedState.HasReservedWords?(t&Context.Strict&&tolerant(e,t,50),e.flags|=Flags.HasStrictReserved):e.flags&Flags.AllowBinding?e.flags&Flags.HasYield?tolerant(e,t,51):t&Context.Async&&e.flags&Flags.HasAwait&&tolerant(e,t,52):tolerant(e,t,77),e.flags&=~(Flags.AllowBinding|Flags.HasAwait|Flags.HasYield),r&CoverParenthesizedState.SequenceExpression?a.expressions:[a]):(e.flags&=~(Flags.HasAwait|Flags.HasYield|Flags.AllowBinding),isValidSimpleAssignmentTarget(a)||(e.flags&=~Flags.AllowDestructuring),a)}function parseFunctionExpression(e,t){const n=getLocation(e);expect(e,t,33566808);const r=consume(e,t,167774771)?ModifierState.Generator:ModifierState.None;let a=null;const{token:o}=e;135168&o&&(4194304&o&&(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments),1073741824&e.token&&r&ModifierState.Generator&&tolerant(e,t,49),a=parseBindingIdentifier(e,t));const{params:s,body:i}=swapContext(e,t&~(Context.Method|Context.AllowSuperProperty),r,parseFormalListAndBody);return finishNode(t,e,n,{type:"FunctionExpression",params:s,body:i,async:!1,generator:!!(r&ModifierState.Generator),expression:!1,id:a})}function parseAsyncFunctionOrAsyncGeneratorExpression(e,t){const n=getLocation(e);expect(e,t,594028),expect(e,t,33566808);const r=consume(e,t,167774771)?ModifierState.Generator:ModifierState.None,a=ModifierState.Await;let o=null;const{token:s}=e;135168&s&&(4194304&s&&((t&Context.Strict||a&ModifierState.Await)&&tolerant(e,t,47),e.flags|=Flags.StrictFunctionName),262144&s&&tolerant(e,t,48),1073741824&e.token&&r&ModifierState.Generator&&tolerant(e,t,49),o=parseBindingIdentifier(e,t));const{params:i,body:c}=swapContext(e,t&~(Context.Method|Context.AllowSuperProperty),r|a,parseFormalListAndBody);return finishNode(t,e,n,{type:"FunctionExpression",params:i,body:c,async:!0,generator:!!(r&ModifierState.Generator),expression:!1,id:o})}function parseComputedPropertyName(e,t){expect(e,t,41943059);const n=parseAssignmentExpression(e,t|Context.AllowIn);return expect(e,t,20),n}function parsePropertyName(e,t){switch(e.token){case 33554434:case 33554435:return parseLiteral(e,t);case 41943059:return parseComputedPropertyName(e,t);default:return parseIdentifier(e,t)}}function parseSpreadProperties(e,t){const n=getLocation(e);return expect(e,t,14),8388608&e.token&&(e.flags&=~Flags.AllowDestructuring),finishNode(t,e,n,{type:"SpreadElement",argument:parseAssignmentExpression(e,t|Context.AllowIn)})}function parseObjectLiteral(e,t){const n=getLocation(e);expect(e,t,41943052);const r=[];for(;17825807!==e.token;)r.push(14===e.token?parseSpreadProperties(e,t):parsePropertyDefinition(e,t)),17825807!==e.token&&expect(e,t,16777234);return expect(e,t,17825807),e.flags&=~Flags.HasProtoField,finishNode(t,e,n,{type:"ObjectExpression",properties:r})}function parsePropertyDefinition(e,t){const n=getLocation(e),r=e.flags;let a,o=consume(e,t,167774771)?ObjectState.Generator|ObjectState.Method:ObjectState.Method;const s=e.token;let i=parsePropertyName(e,t);return 16777216&e.token||(r&Flags.EscapedKeyword?tolerant(e,t,3):o&ObjectState.Generator||!(524288&s)||e.flags&Flags.NewLine?69743===s?(o=o&~ObjectState.Method|ObjectState.Getter,i=parsePropertyName(e,t)):69744===s&&(o=o&~ObjectState.Method|ObjectState.Setter,i=parsePropertyName(e,t)):(o|=consume(e,t,167774771)?ObjectState.Generator|ObjectState.Async:ObjectState.Async,i=parsePropertyName(e,t)),o&(ObjectState.Getter|ObjectState.Setter)&&o&ObjectState.Generator&&tolerant(e,t,1,tokenDesc(e.token))),50331659===e.token?a=parseMethodDeclaration(e,t,o):(o&=~ObjectState.Method,16777237===e.token?(o&(ObjectState.Async|ObjectState.Generator)?tolerant(e,t,1,tokenDesc(e.token)):41943059!==s&&"__proto__"===e.tokenValue&&(e.flags&Flags.HasProtoField?setPendingExpressionError(e,63):e.flags|=Flags.HasProtoField),expect(e,t,16777237),262144&e.token&&(e.flags|=Flags.HasAwait),a=restoreExpressionCoverGrammar(e,t,parseAssignmentExpression)):(o&(ObjectState.Generator|ObjectState.Async)||!isValidIdentifier(t,s)?tolerant(e,t,1,tokenDesc(s)):t&(Context.Strict|Context.Yield)&&1073741824&s&&(setPendingError(e),e.flags|=Flags.HasYield),o|=ObjectState.Shorthand,83886109===e.token?(t&Context.Strict&&4194304&s?report(e,47):setPendingExpressionError(e,91),expect(e,t,83886109),t&(Context.Strict|Context.Yield|Context.Async)&&1074003968&e.token&&(setPendingError(e),e.flags|=1073741824&e.token?Flags.HasYield:Flags.HasAwait),a=parseAssignmentPattern(e,t,i,n)):(262144&s&&(t&Context.Async&&tolerant(e,t,46),setPendingError(e),e.flags|=Flags.HasAwait),a=i))),finishNode(t,e,n,{type:"Property",key:i,value:a,kind:o&ObjectState.Getter|o&ObjectState.Setter?o&ObjectState.Setter?"set":"get":"init",computed:41943059===s,method:!!(o&ObjectState.Method),shorthand:!!(o&ObjectState.Shorthand)})}function parseMethodDeclaration(e,t,n){const r=getLocation(e),a=n&ObjectState.Generator?ModifierState.Generator:ModifierState.None,o=n&ObjectState.Async?ModifierState.Await:ModifierState.None,{params:s,body:i}=swapContext(e,t|Context.Method,a|o,parseFormalListAndBody,n);return finishNode(t,e,r,{type:"FunctionExpression",params:s,body:i,async:!!(n&ObjectState.Async),generator:!!(n&ObjectState.Generator),expression:!1,id:null})}function parseArrowFunction(e,t,n,r){return e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),e.flags&Flags.NewLine&&tolerant(e,t,36,"=>"),expect(e,t,10),parseArrowBody(e,t&~Context.Async,r,n,ModifierState.None)}function parseAsyncArrowFunction(e,t,n,r,a){return e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),e.flags&Flags.NewLine&&tolerant(e,t,36,"async"),expect(e,t,10),parseArrowBody(e,t|Context.Async,a,r,n)}function parseArrowBody(e,t,n,r,a){e.pendingExpressionError=null;for(const r in n)reinterpret(e,t|Context.InParameter,n[r]);const o=41943052!==e.token;return finishNode(t,e,r,{type:"ArrowFunctionExpression",body:o?parseExpressionCoverGrammar(e,t&~(Context.Yield|Context.InParameter),parseAssignmentExpression):swapContext(e,t&~(Context.Yield|Context.AllowDecorator)|Context.InFunctionBody,a,parseFunctionBody),params:n,id:null,async:!!(a&ModifierState.Await),generator:!1,expression:o})}function parseFormalListAndBody(e,t,n){const r=parseFormalParameters(e,t|Context.InParameter,n),a=r.args;return{params:r.params,body:parseFunctionBody(e,t&~Context.AllowDecorator|Context.InFunctionBody,a)}}function parseFunctionBody(e,t,n){const r=getLocation(e);expect(e,t|Context.DisallowEscapedKeyword,41943052);const a=[];for(;33554435===e.token;){const{tokenRaw:n,tokenValue:r}=e;a.push(parseDirective(e,t)),12===n.length&&"use strict"===r&&(e.flags&Flags.SimpleParameterList?tolerant(e,t,64):e.flags&(Flags.HasStrictReserved|Flags.StrictFunctionName)?tolerant(e,t,50):e.flags&Flags.StrictEvalArguments&&tolerant(e,t,47),t|=Context.Strict)}t&Context.Strict&&validateParams(e,t,n);const{labelSet:o}=e;e.labelSet={};const s=e.flags;for(e.flags=e.flags&~(Flags.StrictFunctionName|Flags.StrictEvalArguments|Flags.InSwitchStatement|Flags.InIterationStatement)|Flags.AllowDestructuring;17825807!==e.token;)a.push(parseStatementListItem(e,t));return s&Flags.InIterationStatement&&(e.flags|=Flags.InIterationStatement),s&Flags.InSwitchStatement&&(e.flags|=Flags.InSwitchStatement),e.labelSet=o,expect(e,t,17825807),finishNode(t,e,r,{type:"BlockStatement",body:a})}function parseFormalParameters(e,t,n){expect(e,t,50331659),e.flags&=~(Flags.SimpleParameterList|Flags.HasStrictReserved);const r=[],a=[];for(;16!==e.token;){if(14===e.token){n&ObjectState.Setter&&tolerant(e,t,67),e.flags|=Flags.SimpleParameterList,a.push(parseRestElement(e,t,r));break}if(a.push(parseFormalParameterList(e,t,r)),!consume(e,t,16777234))break;if(16===e.token)break}return n&ObjectState.Setter&&1!==a.length&&tolerant(e,t,66,"Setter","one",""),n&ObjectState.Getter&&a.length>0&&tolerant(e,t,66,"Getter","no","s"),expect(e,t,16),{params:a,args:r}}function parseFormalParameterList(e,t,n){const r=getLocation(e);135168&e.token?(hasBit(e.token,20480)&&(t&Context.Strict&&tolerant(e,t,50),e.flags|=Flags.StrictFunctionName),hasBit(e.token,4194304)&&(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments)):e.flags|=Flags.SimpleParameterList;const a=parseBindingIdentifierOrPattern(e,t,n);return consume(e,t,83886109)?(1074003968&e.token&&t&(Context.Yield|Context.Async)&&tolerant(e,t,262144&e.token?52:51),e.flags|=Flags.SimpleParameterList,finishNode(t,e,r,{type:"AssignmentPattern",left:a,right:parseExpressionCoverGrammar(e,t,parseAssignmentExpression)})):a}function parseClassExpression(e,t){const n=getLocation(e);let r=[];t&Context.OptionsExperimental&&(r=parseDecorators(e,t)),expect(e,t|Context.DisallowEscapedKeyword,33566797);const{token:a}=e;let o=ObjectState.None,s=null,i=null;41943052!==a&&12372!==a&&(t&Context.Async&&262144&a&&tolerant(e,t,48),s=parseBindingIdentifier(e,t|Context.Strict)),consume(e,t,12372)&&(i=parseLeftHandSideExpression(e,t|Context.Strict,n),o|=ObjectState.Heritage);const c=parseClassBodyAndElementList(e,t|Context.Strict,o);return finishNode(t,e,n,t&Context.OptionsExperimental?{type:"ClassExpression",id:s,superClass:i,body:c,decorators:r}:{type:"ClassExpression",id:s,superClass:i,body:c})}function parseClassBodyAndElementList(e,t,n){const r=getLocation(e);expect(e,t,41943052);const a=[];let o=[];for(;17825807!==e.token;)consume(e,t,17825809)||(t&Context.OptionsExperimental&&(o=parseDecorators(e,t),17825807===e.token&&report(e,92),0!==o.length&&"constructor"===e.tokenValue&&report(e,93)),a.push(t&Context.OptionsNext&&115===e.token?parsePrivateFields(e,t,o):parseClassElement(e,t,n,o)));return e.flags&=~Flags.HasConstructor,expect(e,t,17825807),finishNode(t,e,r,{type:"ClassBody",body:a})}function parseClassElement(e,t,n,r){const a=getLocation(e);let{tokenValue:o,token:s}=e;const i=e.flags;consume(e,t,167774771)&&(n|=ObjectState.Generator),41943059===e.token&&(n|=ObjectState.Computed),"constructor"===e.tokenValue&&(n&ObjectState.Generator?tolerant(e,t,45,"generator"):n&ObjectState.Heritage&&(t|=Context.AllowSuperProperty),n|=ObjectState.Constructor);let c,l=parsePropertyName(e,t);if(!(16777216&e.token)){if(i&Flags.EscapedKeyword&&tolerant(e,t,3),20585===s&&(s=e.token,consume(e,t,167774771)&&(n|=ObjectState.Generator),o=e.tokenValue,41943059===e.token&&(n|=ObjectState.Computed),"prototype"===e.tokenValue&&tolerant(e,t,65),n|=ObjectState.Static,l=parsePropertyName(e,t),t&Context.OptionsNext&&isInstanceField(e)))return"constructor"===o&&tolerant(e,t,1,tokenDesc(e.token)),parseFieldDefinition(e,t,l,n,a,r);50331659!==e.token&&(!(524288&s)||n&ObjectState.Generator||e.flags&Flags.NewLine?69743!==s&&69744!==s||(n|=69743===s?ObjectState.Getter:ObjectState.Setter,o=e.tokenValue,41943059===e.token&&(n|=ObjectState.Computed),l=parsePropertyName(e,t&~Context.Strict)):(s=e.token,o=e.tokenValue,n|=ObjectState.Async,consume(e,t,167774771)&&(n|=ObjectState.Generator),41943059===e.token&&(n|=ObjectState.Computed),l=parsePropertyName(e,t)),"prototype"===o?tolerant(e,t,65):n&ObjectState.Static||"constructor"!==o||tolerant(e,t,45,"accessor"))}if(50331659===e.token)!(n&ObjectState.Computed)&&n&ObjectState.Constructor&&(e.flags&Flags.HasConstructor?report(e,12):e.flags|=Flags.HasConstructor),c=parseMethodDeclaration(e,t,n);else{if(t&Context.OptionsNext)return parseFieldDefinition(e,t,l,n,a,r);tolerant(e,t,1,tokenDesc(s))}const p=n&ObjectState.Constructor?"constructor":n&ObjectState.Getter?"get":n&ObjectState.Setter?"set":"method";return finishNode(t,e,a,t&Context.OptionsExperimental?{type:"MethodDefinition",kind:p,static:!!(n&ObjectState.Static),computed:!!(n&ObjectState.Computed),key:l,value:c,decorators:r}:{type:"MethodDefinition",kind:p,static:!!(n&ObjectState.Static),computed:!!(n&ObjectState.Computed),key:l,value:c})}function parseFieldDefinition(e,t,n,r,a,o){r&ObjectState.Constructor&&tolerant(e,t,0);let s=null;return r&(ObjectState.Async|ObjectState.Generator)&&tolerant(e,t,0),consume(e,t,83886109)&&(4194304&e.token&&tolerant(e,t,47),s=parseAssignmentExpression(e,t)),consume(e,t,16777234),finishNode(t,e,a,t&Context.OptionsExperimental?{type:"FieldDefinition",key:n,value:s,computed:!!(r&ObjectState.Computed),static:!!(r&ObjectState.Static),decorators:o}:{type:"FieldDefinition",key:n,value:s,computed:!!(r&ObjectState.Computed),static:!!(r&ObjectState.Static)})}function parsePrivateName(e,t,n){const r=e.tokenValue;return nextToken(e,t),finishNode(t,e,n,{type:"PrivateName",name:r})}function parsePrivateFields(e,t,n){const r=getLocation(e);expect(e,t|Context.InClass,115),"constructor"===e.tokenValue&&tolerant(e,t,41);const a=parsePrivateName(e,t,r);if(50331659===e.token)return parsePrivateMethod(e,t,a,r,n);let o=null;return consume(e,t,83886109)&&(4194304&e.token&&tolerant(e,t,47),o=parseAssignmentExpression(e,t)),consume(e,t,16777234),finishNode(t,e,r,t&Context.OptionsExperimental?{type:"FieldDefinition",key:a,value:o,computed:!1,static:!1,decorators:n}:{type:"FieldDefinition",key:a,value:o,computed:!1,static:!1})}function parsePrivateMethod(e,t,n,r,a){const o=parseMethodDeclaration(e,t|Context.Strict,ObjectState.None);return e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),finishNode(t,e,r,t&Context.OptionsExperimental?{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:o,decorators:a}:{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:o})}function parseCallImportOrMetaProperty(e,t){const n=getLocation(e),r=parseIdentifier(e,t);if(consume(e,t,16777229)){if(t&Context.Module&&"meta"===e.tokenValue)return parseMetaProperty(e,t,r,n);tolerant(e,t,1,tokenDesc(e.token))}let a=parseImportExpression(e,t,n);expect(e,t,50331659);const o=parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression);return expect(e,t,16),a=finishNode(t,e,n,{type:"CallExpression",callee:a,arguments:[o]})}function parseImportExpression(e,t,n){return finishNode(t,e,n,{type:"Import"})}function parseMetaProperty(e,t,n,r){return finishNode(t,e,r,{meta:n,type:"MetaProperty",property:parseIdentifier(e,t)})}function parseNewExpressionOrMetaProperty(e,t){const n=getLocation(e),r=parseIdentifier(e,t);return consume(e,t|Context.DisallowEscapedKeyword,16777229)?("target"===e.tokenValue&&t&(Context.InParameter|Context.InFunctionBody)||tolerant(e,t,53),parseMetaProperty(e,t,r,n)):finishNode(t,e,n,{type:"NewExpression",callee:parseImportOrMemberExpression(e,t,n),arguments:50331659===e.token?parseArgumentList(e,t):[]})}function parseImportOrMemberExpression(e,t,n){const{token:r}=e;return t&Context.OptionsNext&&33566810===r?(lookahead(e,t,nextTokenIsLeftParen)&&tolerant(e,t,1,tokenDesc(r)),parseCallImportOrMetaProperty(e,t)):parseMemberExpression(e,t,n)}function parseSuperProperty(e,t){const n=getLocation(e);switch(expect(e,t,33566813),e.token){case 50331659:t&Context.AllowSuperProperty||tolerant(e,t,54);break;case 41943059:case 16777229:t&Context.Method||tolerant(e,t,55);break;default:tolerant(e,t,56)}return finishNode(t,e,n,{type:"Super"})}function parseTemplateLiteral(e,t){return finishNode(t,e,getLocation(e),{type:"TemplateLiteral",expressions:[],quasis:[parseTemplateSpans(e,t)]})}function parseTemplateHead(e,t,n=null,r,a){return e.token=consumeTemplateBrace(e,t),finishNode(t,e,a,{type:"TemplateElement",value:{cooked:n,raw:r},tail:!1})}function parseTemplate(e,t,n=[],r=[]){const a=getLocation(e),{tokenValue:o,tokenRaw:s}=e;expect(e,t,33554440),n.push(parseExpression(e,t));const i=getLocation(e);return r.push(parseTemplateHead(e,t,o,s,a)),33554441===e.token?r.push(parseTemplateSpans(e,t,i)):parseTemplate(e,t,n,r),finishNode(t,e,a,{type:"TemplateLiteral",expressions:n,quasis:r})}function parseTemplateSpans(e,t,n=getLocation(e)){const{tokenValue:r,tokenRaw:a}=e;return expect(e,t,33554441),finishNode(t,e,n,{type:"TemplateElement",value:{cooked:r,raw:a},tail:!0})}function parseDecoratorList(e,t){const n=getLocation(e);return finishNode(t,e,n,{type:"Decorator",expression:parseLeftHandSideExpression(e,t,n)})}function parseDecorators(e,t){const n=[];for(;consume(e,t,120);)n.push(parseDecoratorList(e,t|Context.AllowDecorator));return n}var Context,Flags,Labels,NumericState,ScannerState,ModifierState,CoverParenthesizedState,Escape,RegexFlags,CoverCallState,RegexState,ObjectState;function validateBreakOrContinueLabel(e,t,n,r){const a=hasLabel(e,n);a||tolerant(e,t,32,n),!r||a&Labels.Nested||tolerant(e,t,31,n)}function addLabel(e,t){void 0===e.labelSet&&(e.labelSet={}),e.labelSet[`$${t}`]=isIterationStatement(e.token)?Labels.Nested:Labels.NotNested}function popLabel(e,t){e.labelSet[`$${t}`]=Labels.None}function hasLabel(e,t){return e.labelSet?e.labelSet[`$${t}`]:Labels.None}function finishNode(e,t,n,r){const{lastIndex:a,lastLine:o,lastColumn:s,sourceFile:i,index:c}=t;return e&Context.LocationTracker&&(e&Context.OptionsRanges&&(r.start=n.index,r.end=a),e&Context.OptionsLoc&&(r.loc={start:{line:n.line,column:n.column},end:{line:o,column:s}},i&&(r.loc.source=i))),r}function expect(e,t,n,r=1){return e.token!==n&&report(e,r,tokenDesc(e.token)),nextToken(e,t),!0}function consume(e,t,n){return e.token===n&&(nextToken(e,t),!0)}function nextToken(e,t){return e.lastIndex=e.index,e.lastLine=e.line,e.lastColumn=e.column,e.token=scan(e,t)}!function(e){e[e.Empty=0]="Empty",e[e.OptionsNext=1]="OptionsNext",e[e.OptionsRanges=2]="OptionsRanges",e[e.OptionsJSX=4]="OptionsJSX",e[e.OptionsRaw=8]="OptionsRaw",e[e.OptionsLoc=16]="OptionsLoc",e[e.OptionsGlobalReturn=32]="OptionsGlobalReturn",e[e.OptionsComments=64]="OptionsComments",e[e.OptionsShebang=128]="OptionsShebang",e[e.OptionsRawidentifiers=256]="OptionsRawidentifiers",e[e.OptionsTolerant=512]="OptionsTolerant",e[e.OptionsNode=1024]="OptionsNode",e[e.OptionsExperimental=2048]="OptionsExperimental",e[e.Strict=4096]="Strict",e[e.Module=8192]="Module",e[e.TaggedTemplate=16384]="TaggedTemplate",e[e.InClass=32768]="InClass",e[e.AllowIn=65536]="AllowIn",e[e.Async=131072]="Async",e[e.Yield=262144]="Yield",e[e.InParameter=524288]="InParameter",e[e.InFunctionBody=1048576]="InFunctionBody",e[e.AllowSingleStatement=2097152]="AllowSingleStatement",e[e.BlockScope=4194304]="BlockScope",e[e.ForStatement=8388608]="ForStatement",e[e.RequireIdentifier=16777216]="RequireIdentifier",e[e.Method=33554432]="Method",e[e.AllowSuperProperty=67108864]="AllowSuperProperty",e[e.InParen=134217728]="InParen",e[e.InJSXChild=268435456]="InJSXChild",e[e.DisallowEscapedKeyword=536870912]="DisallowEscapedKeyword",e[e.AllowDecorator=1073741824]="AllowDecorator",e[e.LocationTracker=18]="LocationTracker"}(Context||(Context={})),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.AllowBinding=2]="AllowBinding",e[e.AllowDestructuring=4]="AllowDestructuring",e[e.SimpleParameterList=8]="SimpleParameterList",e[e.InSwitchStatement=16]="InSwitchStatement",e[e.InIterationStatement=32]="InIterationStatement",e[e.HasStrictReserved=64]="HasStrictReserved",e[e.HasOctal=128]="HasOctal",e[e.SimpleAssignmentTarget=256]="SimpleAssignmentTarget",e[e.HasProtoField=512]="HasProtoField",e[e.StrictFunctionName=1024]="StrictFunctionName",e[e.StrictEvalArguments=2048]="StrictEvalArguments",e[e.InFunctionBody=4096]="InFunctionBody",e[e.HasAwait=8192]="HasAwait",e[e.HasYield=16384]="HasYield",e[e.EscapedKeyword=32768]="EscapedKeyword",e[e.HasConstructor=65536]="HasConstructor"}(Flags||(Flags={})),function(e){e[e.None=0]="None",e[e.NotNested=1]="NotNested",e[e.Nested=2]="Nested"}(Labels||(Labels={})),function(e){e[e.None=0]="None",e[e.SeenSeparator=1]="SeenSeparator",e[e.EigthOrNine=2]="EigthOrNine",e[e.Float=4]="Float",e[e.BigInt=8]="BigInt"}(NumericState||(NumericState={})),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.LastIsCR=2]="LastIsCR"}(ScannerState||(ScannerState={})),function(e){e[e.None=0]="None",e[e.Generator=1]="Generator",e[e.Await=2]="Await"}(ModifierState||(ModifierState={})),function(e){e[e.None=0]="None",e[e.SequenceExpression=1]="SequenceExpression",e[e.HasEvalOrArguments=2]="HasEvalOrArguments",e[e.HasReservedWords=4]="HasReservedWords",e[e.HasYield=8]="HasYield",e[e.HasBinding=16]="HasBinding"}(CoverParenthesizedState||(CoverParenthesizedState={})),function(e){e[e.Empty=-1]="Empty",e[e.StrictOctal=-2]="StrictOctal",e[e.EightOrNine=-3]="EightOrNine",e[e.InvalidHex=-4]="InvalidHex",e[e.OutOfRange=-5]="OutOfRange"}(Escape||(Escape={})),function(e){e[e.Empty=0]="Empty",e[e.IgnoreCase=1]="IgnoreCase",e[e.Global=2]="Global",e[e.Multiline=4]="Multiline",e[e.Unicode=8]="Unicode",e[e.Sticky=16]="Sticky",e[e.DotAll=32]="DotAll"}(RegexFlags||(RegexFlags={})),function(e){e[e.Empty=0]="Empty",e[e.SeenSpread=1]="SeenSpread",e[e.HasSpread=2]="HasSpread",e[e.SimpleParameter=4]="SimpleParameter",e[e.EvalOrArguments=8]="EvalOrArguments",e[e.Yield=16]="Yield",e[e.Await=32]="Await"}(CoverCallState||(CoverCallState={})),function(e){e[e.Empty=0]="Empty",e[e.Escape=1]="Escape",e[e.Class=2]="Class"}(RegexState||(RegexState={})),function(e){e[e.None=0]="None",e[e.Async=1]="Async",e[e.Generator=2]="Generator",e[e.Getter=4]="Getter",e[e.Setter=8]="Setter",e[e.Computed=16]="Computed",e[e.Method=32]="Method",e[e.Shorthand=64]="Shorthand",e[e.Static=128]="Static",e[e.Constructor=256]="Constructor",e[e.Heritage=512]="Heritage"}(ObjectState||(ObjectState={}));const hasBit=(e,t)=>(e&t)===t;function consumeSemicolon(e,t){return 1048576&e.token||e.flags&Flags.NewLine?consume(e,t,17825809):report(e,!(t&Context.Async)&&262144&e.token?38:1,tokenDesc(e.token))}function parseExpressionCoverGrammar(e,t,n){const{flags:r,pendingExpressionError:a}=e;e.flags|=Flags.AllowBinding|Flags.AllowDestructuring,e.pendingExpressionError=void 0;const o=n(e,t);if(e.pendingExpressionError){const{error:n,line:r,column:a,index:o}=e.pendingExpressionError;constructError(e,t,o,r,a,n)}return e.flags&=~(Flags.AllowBinding|Flags.AllowDestructuring),r&Flags.AllowBinding&&(e.flags|=Flags.AllowBinding),r&Flags.AllowDestructuring&&(e.flags|=Flags.AllowDestructuring),e.pendingExpressionError=a,o}function restoreExpressionCoverGrammar(e,t,n){const{flags:r,pendingExpressionError:a}=e;e.flags|=Flags.AllowBinding|Flags.AllowDestructuring,e.pendingExpressionError=void 0;const o=n(e,t);return e.flags&Flags.AllowBinding&&r&Flags.AllowBinding||(e.flags&=~Flags.AllowBinding),e.flags&Flags.AllowDestructuring&&r&Flags.AllowDestructuring||(e.flags&=~Flags.AllowDestructuring),e.pendingExpressionError=a||e.pendingExpressionError,o}function swapContext(e,t,n,r,a=ObjectState.None){return t&=~(Context.Async|Context.Yield|Context.InParameter),n&ModifierState.Generator&&(t|=Context.Yield),n&ModifierState.Await&&(t|=Context.Async),r(e,t,a)}function validateParams(e,t,n){const r=new Map;for(let a=0;a<n.length;a++){const o=`@${n[a]}`;r.get(o)?tolerant(e,t,81):r.set(o,!0)}}const reinterpret=(e,t,n)=>{switch(n.type){case"Identifier":t&Context.Strict&&nameIsArgumentsOrEval(n.name)&&report(e,3);case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":case"RestElement":case"MetaProperty":return;case"ArrayExpression":n.type="ArrayPattern";for(let r=0;r<n.elements.length;++r)null!==n.elements[r]&&reinterpret(e,t,n.elements[r]);return;case"ObjectExpression":n.type="ObjectPattern";for(let r=0;r<n.properties.length;r++)reinterpret(e,t,n.properties[r]);return;case"Property":return void reinterpret(e,t,n.value);case"SpreadElement":n.type="RestElement","ArrayExpression"===n.argument.type||"ObjectExpression"===n.argument.type||isValidSimpleAssignmentTarget(n.argument)||tolerant(e,t,71),reinterpret(e,t,n.argument);break;case"AssignmentExpression":return n.type="AssignmentPattern",delete n.operator,void reinterpret(e,t,n.left);case"MemberExpression":if(!(t&Context.InParameter))return;default:tolerant(e,t,t&Context.InParameter?77:73,n.type)}};function lookahead(e,t,n){const{tokenValue:r,flags:a,line:o,column:s,startColumn:i,index:c,lastColumn:l,startLine:p,lastLine:u,lastIndex:d,startIndex:m,tokenRaw:x,token:f,lastValue:g,tokenRegExp:S,labelSet:C,errors:k,errorLocation:E,pendingExpressionError:h}=e,y=n(e,t);return e.index=c,e.token=f,e.tokenValue=r,e.tokenValue=r,e.flags=a,e.line=o,e.column=s,e.tokenRaw=x,e.lastValue=g,e.startColumn=i,e.lastColumn=l,e.startLine=p,e.lastLine=u,e.lastIndex=d,e.startIndex=m,e.tokenRegExp=S,e.labelSet=C,e.errors=k,e.errorLocation=E,e.tokenRegExp=S,e.pendingExpressionError=h,y}function isValidSimpleAssignmentTarget(e){return"Identifier"===e.type||"MemberExpression"===e.type}function getLocation(e){return{line:e.startLine,column:e.startColumn,index:e.startIndex}}function isValidIdentifier(e,t){return e&Context.Strict?!(e&Context.Module&&262144&t)&&(!(1073741824&t)&&(131072==(131072&t)||69632==(69632&t))):131072==(131072&t)||69632==(69632&t)||20480==(20480&t)}function isLexical(e,t){nextToken(e,t);const{token:n}=e;return!!(1082523648&n||33574984===n||69632==(69632&n))}function isEndOfCaseOrDefaultClauses(e){return 12368===e.token||17825807===e.token||12363===e.token}function nextTokenIsLeftParenOrPeriod(e,t){return nextToken(e,t),50331659===e.token||16777229===e.token}function nextTokenisIdentifierOrParen(e,t){nextToken(e,t);const{token:n}=e;return 1073872896&n||50331659===n}function nextTokenIsLeftParen(e,t){return nextToken(e,t),50331659===e.token}function nextTokenIsFuncKeywordOnSameLine(e,t){return nextToken(e,t),!(e.flags&Flags.NewLine)&&33566808===e.token}function isPropertyWithPrivateFieldKey(e){return!!e.property&&"PrivateName"===e.property.type}function parseAndClassifyIdentifier(e,t){const{token:n,tokenValue:r}=e;if(t&Context.Strict){if(t&Context.Module&&262144&n&&tolerant(e,t,40,tokenDesc(e.token)),1073741824&n&&tolerant(e,t,40,tokenDesc(e.token)),131072==(131072&n)||69632==(69632&n))return parseIdentifier(e,t);report(e,1,tokenDesc(e.token))}if(t&Context.Yield&&1073741824&n&&tolerant(e,t,40,tokenDesc(e.token)),t&Context.Async&&262144&n&&tolerant(e,t,40,tokenDesc(e.token)),131072==(131072&n)||69632==(69632&n)||20480==(20480&n))return parseIdentifier(e,t);report(e,1,tokenDesc(e.token))}function nameIsArgumentsOrEval(e){return"eval"===e||"arguments"===e}function setPendingError(e){e.errorLocation={line:e.startLine,column:e.startColumn,index:e.startIndex}}function isEqualTagNames(e){switch(e.type){case"JSXIdentifier":return e.name;case"JSXNamespacedName":return`${isEqualTagNames(e.namespace)}:${isEqualTagNames(e.name)}`;case"JSXMemberExpression":return`${isEqualTagNames(e.object)}.${isEqualTagNames(e.property)}`}}function isInstanceField(e){const{token:t}=e;return 17825807===t||17825809===t||83886109===t}function validateUpdateExpression(e,t,n,r){t&Context.Strict&&nameIsArgumentsOrEval(n.name)&&tolerant(e,t,68,r),isValidSimpleAssignmentTarget(n)||tolerant(e,t,5)}function setPendingExpressionError(e,t){e.pendingExpressionError={error:errorMessages[t],line:e.line,column:e.column,index:e.index}}function validateCoverParenthesizedExpression(e,t){const{token:n}=e;return 8388608&n?e.flags|=Flags.SimpleParameterList:4194304==(4194304&n)?(setPendingError(e),t|=CoverParenthesizedState.HasEvalOrArguments):20480==(20480&n)?(setPendingError(e),t|=CoverParenthesizedState.HasReservedWords):262144==(262144&n)&&(setPendingError(e),e.flags|=Flags.HasAwait),t}function validateAsyncArgumentList(e,t,n){const{token:r}=e;return e.flags&Flags.AllowBinding?8388608&r?e.flags|=Flags.SimpleParameterList:4194304==(4194304&r)?(setPendingError(e),n|=CoverCallState.EvalOrArguments):262144==(262144&r)?(setPendingError(e),n|=CoverCallState.Await):1073741824==(1073741824&r)&&(setPendingError(e),n|=CoverCallState.Yield):tolerant(e,t,77),n}function isIterationStatement(e){return 12369===e||12386===e||12374===e}function isInOrOf(e){return 69746===e||167786289===e}const errorMessages={0:"Unexpected token",1:"Unexpected token '%0'",2:"Expected token '%0'",3:"Keyword must not contain escaped characters",4:"Keyword '%0' is reserved",5:"Invalid left-hand side in assignment",6:"Unterminated string literal",7:"Unterminated regular expression literal",8:"Unterminated MultiLineComment",9:"Unterminated template literal",10:"Invalid character '%0'",11:"Octal escapes are not allowed in strict mode",13:"Escapes \\8 or \\9 are not syntactically valid escapes",14:"Unicode escape code point out of range",15:"Duplicate regular expression flag '%0'",16:"Unexpected regular expression flag '%0'",17:"Eval or arguments can't be assigned to in strict mode code",18:"Illegal return statement",19:"In strict mode code, functions can only be declared at top level or inside a block",20:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",21:"%0 can't appear in single-statement context",22:"Generators can only be declared at the top level or inside a block",23:"'for await' loop should be used with 'of'",24:"Missing initializer in %0 declaration",25:"'for-%0' loop variable declaration may not have an initializer",26:"Invalid left-hand side in for-%0 loop: Must have a single binding.",27:"let is disallowed as a lexically bound name",28:"Lexical declaration cannot appear in a single-statement context",29:"Label '%0' has already been declared",30:"%0 statement must be nested within an iteration statement",31:"Illegal continue statement: '%0' does not denote an iteration statement",32:"Undefined label '%0'",33:"More than one default clause in switch statement",34:"%0 declarations may only appear at top level of a module",35:"Async functions can only be declared at the top level or inside a block",36:"No line break is allowed after '%0'",37:"Strict mode code may not include a with statement",38:"Await is only valid in async functions",39:"Function declaration must have a name in this context",12:"Duplicate constructor method in class",40:"'%0' may not be used as an identifier in this context",43:"Delete of an unqualified identifier in strict mode",44:"Private fields can not be deleted",41:"Classes may not have a private field named '#constructor'",42:"Classes may not have a field named 'constructor'",45:"Class constructor may not be a '%0'",46:"Unexpected reserved word",47:"Unexpected eval or arguments in strict mode",48:"'await' is not a valid identifier inside an async function",49:"'yield' is not a valid identifier inside an generator function",50:"Unexpected strict mode reserved word",52:"Await expression not allowed in formal parameter",51:"Yield expression not allowed in formal parameter",53:"new.target only allowed within functions",54:"super() is not allowed in this context",55:"Member access from super not allowed in this context",56:'Only "(" or "." or "[" are allowed after \'super\'',57:"'yield' is a reserved keyword within generator function bodies",58:"Only one underscore is allowed as numeric separator",59:"Numeric separators are not allowed at the end of numeric literals",60:"Numeric separator can not be used after leading 0.",61:"Legacy octal literals are not allowed in strict mode",62:"Invalid left-hand side in assignment",63:"Property name __proto__ appears more than once in object literal",64:"Illegal 'use strict' directive in function with non-simple parameter list",65:"Classes may not have a static property named 'prototype'",66:"%0 functions must have %1 argument%2",67:"Setter function argument must not be a rest parameter",68:"%0 increment/decrement may not have eval or arguments operand in strict mode",69:"Elision not allowed in object property list",70:"Rest element must be last element",72:"Spread element must be last element",71:"Rest parameter may not have a default initializer",73:"Invalid destructuring assignment target",74:"Unexpected surrogate pair",75:"Malformed %0 character escape sequence",76:"Template literals may not contain octal escape sequences",77:"Invalid binding pattern",78:"Rest parameter must be last formal parameter",79:"Missing catch or finally after try",80:"Illegal newline after throw",81:"Duplicate parameter name not allowed in this context",82:"Missing keyword 'as' after import *",83:"Labels must be followed by a ':'",84:"JSX attributes must only be assigned a non-empty 'expression'",85:"Expected corresponding JSX closing tag for %0",86:"Adjacent JSX elements must be wrapped in an enclosing tag",87:"Invalid JSX attribute value",88:"Rest element may not have a trailing comma",89:"Undefined Unicode code-point",90:"HTML comments are not allowed in modules",91:"Invalid shorthand property initializer",92:"Trailing decorator may be followed by method",93:"Decorators can't be used with a constructor",94:"`...` must be followed by an identifier in declaration contexts"};function constructError(e,t,n,r,a,o){const s=new SyntaxError(`Line ${r}, column ${a}: ${o}`);if(s.index=n,s.line=r,s.column=a,s.description=o,!(t&Context.OptionsTolerant))throw s;e.errors.push(s)}function getErrorLocation(e){let{index:t,startLine:n,startColumn:r}=e;const a=e.errorLocation;return a&&(t=a.index,n=a.line,r=a.column),{index:t,line:n,column:r}}function report(e,t,...n){const{index:r,line:a,column:o}=getErrorLocation(e),s=errorMessages[t].replace(/%(\d+)/g,(e,t)=>n[t]);constructError(e,Context.Empty,r,a,o,s)}function tolerant(e,t,n,...r){const{index:a,line:o,column:s}=getErrorLocation(e);constructError(e,t,a,o,s,errorMessages[n].replace(/%(\d+)/g,(e,t)=>r[t]))}function parseClassDeclaration(e,t){const n=getLocation(e);let r=[];t&Context.OptionsExperimental&&(r=parseDecorators(e,t)),expect(e,t|Context.DisallowEscapedKeyword,33566797);const a=t&Context.RequireIdentifier&&33685505!==e.token?null:parseBindingIdentifier(e,t|Context.Strict|Context.DisallowEscapedKeyword);let o=ObjectState.None,s=null;consume(e,t,12372)&&(s=parseLeftHandSideExpression(e,t|Context.Strict,n),o|=ObjectState.Heritage);const i=parseClassBodyAndElementList(e,t&~Context.RequireIdentifier|Context.Strict|Context.InClass,o);return finishNode(t,e,n,t&Context.OptionsExperimental?{type:"ClassDeclaration",id:a,superClass:s,body:i,decorators:r}:{type:"ClassDeclaration",id:a,superClass:s,body:i})}function parseFunctionDeclaration(e,t){const n=getLocation(e);expect(e,t,33566808);let r=ModifierState.None;return consume(e,t,167774771)&&(t&Context.AllowSingleStatement&&!(t&Context.InFunctionBody)&&tolerant(e,t,22),r=ModifierState.Generator),parseFunctionDeclarationBody(e,t,r,n)}function parseFunctionDeclarationBody(e,t,n,r){const{token:a}=e;let o=null;t&Context.Yield&&1073741824&a&&tolerant(e,t,49),t&Context.Async&&262144&a&&tolerant(e,t,48),50331659!==a?o=parseBindingIdentifier(e,t):t&Context.RequireIdentifier||tolerant(e,t,39);const{params:s,body:i}=swapContext(e,t&~(Context.Method|Context.AllowSuperProperty|Context.RequireIdentifier),n,parseFormalListAndBody);return finishNode(t,e,r,{type:"FunctionDeclaration",params:s,body:i,async:!!(n&ModifierState.Await),generator:!!(n&ModifierState.Generator),expression:!1,id:o})}function parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t){const n=getLocation(e);expect(e,t,594028),expect(e,t,33566808);const r=ModifierState.Await;return parseFunctionDeclarationBody(e,t,(consume(e,t,167774771)?ModifierState.Generator:ModifierState.None)|r,n)}function parseVariableDeclaration(e,t,n){const r=getLocation(e),a=0!=(8388608&e.token),o=parseBindingIdentifierOrPattern(e,t);let s=null;return consume(e,t|Context.DisallowEscapedKeyword,83886109)?(s=parseExpressionCoverGrammar(e,t&~(Context.BlockScope|Context.ForStatement),parseAssignmentExpression),isInOrOf(e.token)&&(t&Context.ForStatement||a)&&(167786289===e.token?(t&(Context.BlockScope|Context.Strict|Context.Async)||a)&&tolerant(e,t,25,tokenDesc(e.token)):tolerant(e,t,25,tokenDesc(e.token)))):isInOrOf(e.token)||!n&&!a||tolerant(e,t,24,n?"const":"destructuring"),finishNode(t,e,r,{type:"VariableDeclarator",init:s,id:o})}function parseVariableDeclarationList(e,t,n){const r=[parseVariableDeclaration(e,t,n)];for(;consume(e,t,16777234);)r.push(parseVariableDeclaration(e,t,n));return t&Context.ForStatement&&isInOrOf(e.token)&&1!==r.length&&tolerant(e,t,26,tokenDesc(e.token)),r}function parseStatementListItem(e,t){switch(e.token){case 33566808:return parseFunctionDeclaration(e,t);case 120:case 33566797:return parseClassDeclaration(e,t);case 33574984:return parseLetOrExpressionStatement(e,t|Context.AllowIn);case 33566793:return parseVariableStatement(e,t|Context.BlockScope|Context.AllowIn);case 594028:return parseAsyncFunctionDeclarationOrStatement(e,t);case 33566810:if(t&Context.OptionsNext&&lookahead(e,t,nextTokenIsLeftParenOrPeriod))return parseExpressionStatement(e,t|Context.AllowIn);case 12371:t&Context.Module&&tolerant(e,t,34,tokenDesc(e.token));default:return parseStatement(e,t|Context.AllowSingleStatement)}}function parseStatement(e,t){switch(e.token){case 33566791:return parseVariableStatement(e,t|Context.AllowIn);case 17825809:return parseEmptyStatement(e,t);case 33566814:return parseSwitchStatement(e,t);case 41943052:return parseBlockStatement(e,t);case 12380:return parseReturnStatement(e,t);case 12377:return parseIfStatement(e,t);case 12369:return parseDoWhileStatement(e,t);case 12386:return parseWhileStatement(e,t);case 12387:return parseWithStatement(e,t);case 12362:return parseBreakStatement(e,t);case 12366:return parseContinueStatement(e,t);case 12367:return parseDebuggerStatement(e,t);case 302002272:return parseThrowStatement(e,t);case 12385:return parseTryStatement(e,t|Context.DisallowEscapedKeyword);case 12374:return parseForStatement(e,t|Context.ForStatement);case 594028:return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)&&tolerant(e,t,35),parseExpressionOrLabelledStatement(e,t|Context.AllowSingleStatement);case 33566808:tolerant(e,t,t&Context.Strict?19:20);case 33566797:tolerant(e,t,21,tokenDesc(e.token));default:return parseExpressionOrLabelledStatement(e,t)}}function parseEmptyStatement(e,t){const n=getLocation(e);return nextToken(e,t),finishNode(t,e,n,{type:"EmptyStatement"})}function parseContinueStatement(e,t){const n=getLocation(e);nextToken(e,t),e.flags&(Flags.InSwitchStatement|Flags.InIterationStatement)||tolerant(e,t,30,tokenDesc(e.token));let r=null;if(!(e.flags&Flags.NewLine)&&135168&e.token){const{tokenValue:n}=e;r=parseIdentifier(e,t),validateBreakOrContinueLabel(e,t,n,!0)}return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ContinueStatement",label:r})}function parseBreakStatement(e,t){const n=getLocation(e);nextToken(e,t);let r=null;if(!(e.flags&Flags.NewLine)&&135168&e.token){const{tokenValue:n}=e;r=parseIdentifier(e,t),validateBreakOrContinueLabel(e,t,n,!1)}else e.flags&(Flags.InSwitchStatement|Flags.InIterationStatement)||tolerant(e,t,30,"break");return consumeSemicolon(e,t),finishNode(t,e,n,{type:"BreakStatement",label:r})}function parseIfStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"IfStatement",test:r,consequent:parseConsequentOrAlternate(e,t|Context.DisallowEscapedKeyword),alternate:consume(e,t,12370)?parseConsequentOrAlternate(e,t):null})}function parseConsequentOrAlternate(e,t){return t&Context.Strict||33566808!==e.token?parseStatement(e,t&~Context.AllowSingleStatement):parseFunctionDeclaration(e,t)}function parseDebuggerStatement(e,t){const n=getLocation(e);return nextToken(e,t),consumeSemicolon(e,t),finishNode(t,e,n,{type:"DebuggerStatement"})}function parseTryStatement(e,t){const n=getLocation(e);nextToken(e,t);const r=parseBlockStatement(e,t),a=12364===e.token?parseCatchBlock(e,t):null,o=consume(e,t,12373)?parseBlockStatement(e,t):null;return a||o||tolerant(e,t,79),finishNode(t,e,n,{type:"TryStatement",block:r,handler:a,finalizer:o})}function parseCatchBlock(e,t){const n=getLocation(e);nextToken(e,t);let r=null;if(consume(e,t,50331659)){const n=[];r=parseBindingIdentifierOrPattern(e,t,n),validateParams(e,t,n),expect(e,t,16)}return finishNode(t,e,n,{type:"CatchClause",param:r,body:parseBlockStatement(e,t)})}function parseThrowStatement(e,t){const n=getLocation(e);nextToken(e,t),e.flags&Flags.NewLine&&tolerant(e,t,80);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ThrowStatement",argument:r})}function parseExpressionStatement(e,t){const n=getLocation(e),r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:r})}function parseDirective(e,t){const n=getLocation(e),r=e.tokenRaw.slice(1,-1),a=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:a,directive:r})}function parseExpressionOrLabelledStatement(e,t){const n=getLocation(e),{tokenValue:r,token:a}=e,o=parseExpression(e,t&~(Context.AllowSingleStatement|Context.AllowDecorator)|Context.AllowIn);if(135168&a&&16777237===e.token){t&Context.Yield&&1073741824&a&&tolerant(e,t,57),expect(e,t,16777237,83),hasLabel(e,r)&&tolerant(e,t,29,r),addLabel(e,r);const s=!(t&Context.Strict)&&t&Context.AllowSingleStatement&&33566808===e.token?parseFunctionDeclaration(e,t):parseStatement(e,t);return popLabel(e,r),finishNode(t,e,n,{type:"LabeledStatement",label:o,body:s})}return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:o})}function parseDoWhileStatement(e,t){const n=getLocation(e);nextToken(e,t);const r=parseIterationStatement(e,t);expect(e,t,12386),expect(e,t,50331659);const a=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),consume(e,t,17825809),finishNode(t,e,n,{type:"DoWhileStatement",body:r,test:a})}function parseWhileStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"WhileStatement",test:r,body:parseIterationStatement(e,t)})}function parseBlockStatement(e,t){const n=getLocation(e),r=[];for(expect(e,t,41943052);17825807!==e.token;)r.push(parseStatementListItem(e,t));return expect(e,t,17825807),finishNode(t,e,n,{type:"BlockStatement",body:r})}function parseReturnStatement(e,t){const n=getLocation(e);t&(Context.OptionsGlobalReturn|Context.InFunctionBody)||tolerant(e,t,18),e.flags&Flags.EscapedKeyword&&tolerant(e,t,3),nextToken(e,t);const r=1048576&e.token||e.flags&Flags.NewLine?null:parseExpression(e,t&~(Context.InFunctionBody|Context.AllowDecorator)|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ReturnStatement",argument:r})}function parseIterationStatement(e,t){const n=e.flags;e.flags|=Flags.InIterationStatement|Flags.AllowDestructuring;const r=parseStatement(e,t&~Context.AllowSingleStatement|Context.DisallowEscapedKeyword);return e.flags=n,r}function parseWithStatement(e,t){t&Context.Strict&&tolerant(e,t,37);const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"WithStatement",object:r,body:parseStatement(e,t&~Context.AllowSingleStatement)})}function parseSwitchStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);expect(e,t,16),expect(e,t|Context.DisallowEscapedKeyword,41943052);const a=[],o=e.flags;e.flags|=Flags.InSwitchStatement;let s=!1;for(;17825807!==e.token;){const n=parseCaseOrDefaultClauses(e,t);a.push(n),null===n.test&&(s&&tolerant(e,t,33),s=!0)}return e.flags=o,expect(e,t,17825807),finishNode(t,e,n,{type:"SwitchStatement",discriminant:r,cases:a})}function parseCaseOrDefaultClauses(e,t){const n=getLocation(e);let r=null;consume(e,t,12363)?r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn):expect(e,t,12368),expect(e,t,16777237);const a=[];for(;!isEndOfCaseOrDefaultClauses(e);)a.push(parseStatementListItem(e,t|Context.AllowIn));return finishNode(t,e,n,{type:"SwitchCase",test:r,consequent:a})}function parseVariableStatement(e,t,n=!0){const r=getLocation(e),{token:a}=e,o=33566793===a;nextToken(e,t);const s=parseVariableDeclarationList(e,t,o);return n&&consumeSemicolon(e,t),finishNode(t,e,r,{type:"VariableDeclaration",kind:tokenDesc(a),declarations:s})}function parseLetOrExpressionStatement(e,t,n=!0){return lookahead(e,t,isLexical)?parseVariableStatement(e,t|Context.BlockScope,n):parseExpressionOrLabelledStatement(e,t)}function parseAsyncFunctionDeclarationOrStatement(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t):parseStatement(e,t)}function parseForStatement(e,t){const n=getLocation(e);expect(e,t,12374);const r=!!(t&Context.Async&&consume(e,t,34017389));expect(e,t|Context.DisallowEscapedKeyword,50331659);const{token:a}=e;let o,s=null,i=null,c=null,l="ForStatement",p=null,u=null;33566793===a||33574984===a&&lookahead(e,t,isLexical)?c=parseVariableStatement(e,t&~Context.AllowIn|Context.BlockScope,!1):33566791===a?c=parseVariableStatement(e,t&~Context.AllowIn,!1):17825809!==a&&(i=getLocation(e),s=restoreExpressionCoverGrammar(e,t&~Context.AllowIn|Context.DisallowEscapedKeyword,parseAssignmentExpression)),consume(e,t,69746)?(l="ForOfStatement",s?(e.flags&Flags.AllowDestructuring&&"AssignmentExpression"!==s.type||tolerant(e,t,73),reinterpret(e,t,s)):s=c,o=parseAssignmentExpression(e,t|Context.AllowIn)):consume(e,t,167786289)?(s?(e.flags&Flags.AllowDestructuring||tolerant(e,t,73),reinterpret(e,t,s)):s=c,l="ForInStatement",o=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn)):(16777234===e.token&&(s=parseSequenceExpression(e,t,s,i)),c&&(s=c),expect(e,t,17825809),p=17825809!==e.token?parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn):null,expect(e,t,17825809),u=16!==e.token?parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn):null),expect(e,t,16);const d=parseIterationStatement(e,t);return finishNode(t,e,n,"ForOfStatement"===l?{type:l,body:d,left:s,right:o,await:r}:o?{type:l,body:d,left:s,right:o}:{type:l,body:d,init:s,test:p,update:u})}function parseModuleItemList(e,t){nextToken(e,t);const n=[];for(;1048576!==e.token;)n.push(33554435===e.token?parseDirective(e,t):parseModuleItem(e,t|Context.AllowIn));return n}function parseModuleItem(e,t){switch(e.token){case 120:return parseDecorators(e,t);case 12371:return parseExportDeclaration(e,t);case 33566810:if(!(t&Context.OptionsNext&&lookahead(e,t,nextTokenIsLeftParenOrPeriod)))return parseImportDeclaration(e,t);default:return parseStatementListItem(e,t)}}function parseExportDeclaration(e,t){const n=getLocation(e),r=[];let a=null,o=null;switch(expect(e,t|Context.DisallowEscapedKeyword,12371),e.token){case 167774771:return parseExportAllDeclaration(e,t,n);case 12368:return parseExportDefault(e,t,n);case 41943052:{expect(e,t,41943052);let n=!1;for(;17825807!==e.token;)69743!==e.token&&12288&e.token&&(n=!0,setPendingError(e)),r.push(parseNamedExportDeclaration(e,t)),17825807!==e.token&&expect(e,t,16777234);expect(e,t|Context.DisallowEscapedKeyword,17825807),69745===e.token?a=parseModuleSpecifier(e,t):n&&tolerant(e,t,46),consumeSemicolon(e,t);break}case 33566797:o=parseClassDeclaration(e,t);break;case 33574984:case 33566793:o=parseVariableStatement(e,t|Context.BlockScope);break;case 33566791:o=parseVariableStatement(e,t);break;case 33566808:o=parseFunctionDeclaration(e,t);break;case 594028:if(lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)){o=parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t);break}default:report(e,1,tokenDesc(e.token))}return finishNode(t,e,n,{type:"ExportNamedDeclaration",source:a,specifiers:r,declaration:o})}function parseExportAllDeclaration(e,t,n){expect(e,t,167774771);const r=parseModuleSpecifier(e,t);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExportAllDeclaration",source:r})}function parseNamedExportDeclaration(e,t){const n=getLocation(e),r=parseIdentifierName(e,t|Context.DisallowEscapedKeyword,e.token);return finishNode(t,e,n,{type:"ExportSpecifier",local:r,exported:consume(e,t,167843947)?parseIdentifierName(e,t,e.token):r})}function parseExportDefault(e,t,n){let r;switch(expect(e,t|Context.DisallowEscapedKeyword,12368),e.token){case 33566808:r=parseFunctionDeclaration(e,t|Context.RequireIdentifier);break;case 120:case 33566797:r=parseClassDeclaration(e,t&~Context.AllowIn|Context.RequireIdentifier);break;case 594028:r=parseAsyncFunctionOrAssignmentExpression(e,t|Context.RequireIdentifier);break;default:r=parseAssignmentExpression(e,t|Context.AllowIn),consumeSemicolon(e,t)}return finishNode(t,e,n,{type:"ExportDefaultDeclaration",declaration:r})}function parseImportDeclaration(e,t){const n=getLocation(e);let r;expect(e,t,33566810);let a=[];return 33554435===e.token?r=parseLiteral(e,t):(a=parseImportClause(e,t|Context.DisallowEscapedKeyword),r=parseModuleSpecifier(e,t)),consumeSemicolon(e,t),finishNode(t,e,n,{type:"ImportDeclaration",specifiers:a,source:r})}function parseImportClause(e,t){const n=[];switch(e.token){case 33685505:if(n.push(parseImportDefaultSpecifier(e,t)),consume(e,t,16777234))switch(e.token){case 167774771:parseNameSpaceImport(e,t,n);break;case 41943052:parseNamedImports(e,t,n);break;default:tolerant(e,t,1,tokenDesc(e.token))}break;case 41943052:parseNamedImports(e,t,n);break;case 167774771:parseNameSpaceImport(e,t,n);break;default:report(e,1,tokenDesc(e.token))}return n}function parseNamedImports(e,t,n){for(expect(e,t,41943052);17825807!==e.token;)n.push(parseImportSpecifier(e,t)),17825807!==e.token&&expect(e,t,16777234);expect(e,t,17825807)}function parseImportSpecifier(e,t){const n=getLocation(e),{token:r}=e,a=parseIdentifierName(e,t|Context.DisallowEscapedKeyword,r);let o;return consume(e,t,167843947)?o=parseBindingIdentifier(e,t):(hasBit(r,12288)&&tolerant(e,t,46),hasBit(r,4194304)&&tolerant(e,t,47),o=a),finishNode(t,e,n,{type:"ImportSpecifier",local:o,imported:a})}function parseNameSpaceImport(e,t,n){const r=getLocation(e);expect(e,t,167774771),expect(e,t,167843947,82);const a=parseBindingIdentifier(e,t);n.push(finishNode(t,e,r,{type:"ImportNamespaceSpecifier",local:a}))}function parseModuleSpecifier(e,t){return expect(e,t,69745),33554435!==e.token&&report(e,1,tokenDesc(e.token)),parseLiteral(e,t)}function parseImportDefaultSpecifier(e,t){return finishNode(t,e,getLocation(e),{type:"ImportDefaultSpecifier",local:parseIdentifier(e,t)})}function parseAsyncFunctionOrAssignmentExpression(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t|Context.RequireIdentifier):parseAssignmentExpression(e,t|Context.AllowIn)}function createParser(e,t){return{source:e,length:e.length,index:0,line:1,column:0,startIndex:0,startColumn:0,startLine:1,lastIndex:0,lastColumn:0,lastLine:0,pendingExpressionError:void 0,flags:Flags.AllowDestructuring,token:1048576,tokenRaw:"",lastValue:0,comments:[],sourceFile:t,tokenRegExp:void 0,tokenValue:void 0,labelSet:void 0,errorLocation:void 0,errors:[]}}function parseSource(e,t,n){let r="";t&&(t.module&&(n|=Context.Module),t.next&&(n|=Context.OptionsNext),t.jsx&&(n|=Context.OptionsJSX),t.ranges&&(n|=Context.OptionsRanges),t.loc&&(n|=Context.OptionsLoc),t.raw&&(n|=Context.OptionsRaw),t.rawIdentifier&&(n|=Context.OptionsRawidentifiers),t.globalReturn&&(n|=Context.OptionsGlobalReturn),t.skipShebang&&(n|=Context.OptionsShebang),t.tolerant&&(n|=Context.OptionsTolerant),t.source&&(r=t.source),t.comments&&(n|=Context.OptionsComments),t.impliedStrict&&(n|=Context.Strict),t.experimental&&(n|=Context.OptionsExperimental),t.node&&(n|=Context.OptionsNode));const a=createParser(e,r),o=n&Context.Module?parseModuleItemList(a,n):parseStatementList(a,n),s={type:"Program",sourceType:n&Context.Module?"module":"script",body:o};return n&Context.LocationTracker&&(n&Context.OptionsRanges&&(s.start=0,s.end=e.length),n&Context.OptionsLoc&&(s.loc={start:{line:1,column:0},end:{line:a.line,column:a.column}},r&&(s.loc.source=r))),n&Context.OptionsComments&&(s.comments=a.comments),n&Context.OptionsTolerant&&(s.errors=a.errors),s}function parseStatementList(e,t){const n=[];let r=!0;for(nextToken(e,t|Context.DisallowEscapedKeyword);1048576!==e.token;)r&&33554435!==e.token&&(r=!1),r?(t&Context.Strict||12!==e.tokenRaw.length||"use strict"!==e.tokenValue||(t|=Context.Strict),n.push(parseDirective(e,t))):n.push(parseStatementListItem(e,t));return n}function parse(e,t){return t&&t.module?parseModule(e,t):parseScript(e,t)}function parseScript(e,t){return parseSource(e,t,Context.Empty)}function parseModule(e,t){return parseSource(e,t,Context.Strict|Context.Module)}var estree=Object.freeze({}),index=Object.freeze({scanIdentifier:scanIdentifier,scanMaybeIdentifier:scanMaybeIdentifier,scanHexIntegerLiteral:scanHexIntegerLiteral,scanOctalOrBinary:scanOctalOrBinary,scanImplicitOctalDigits:scanImplicitOctalDigits,scanSignedInteger:scanSignedInteger,scanNumericLiteral:scanNumericLiteral,scanNumericSeparator:scanNumericSeparator,scanDecimalDigitsOrSeparator:scanDecimalDigitsOrSeparator,scanDecimalAsSmi:scanDecimalAsSmi,scanRegularExpression:scanRegularExpression,scan:scan,scanEscapeSequence:scanEscapeSequence,throwStringError:throwStringError,scanString:scanString,consumeTemplateBrace:consumeTemplateBrace,scanTemplate:scanTemplate,skipSingleHTMLComment:skipSingleHTMLComment,skipSingleLineComment:skipSingleLineComment,skipMultiLineComment:skipMultiLineComment,addComment:addComment,nextUnicodeChar:nextUnicodeChar,isIdentifierPart:isIdentifierPart,escapeInvalidCharacters:escapeInvalidCharacters,consumeOpt:consumeOpt,consumeLineFeed:consumeLineFeed,scanPrivateName:scanPrivateName,advanceNewline:advanceNewline,fromCodePoint:fromCodePoint,readNext:readNext,toHex:toHex,advanceOnMaybeAstral:advanceOnMaybeAstral}),parser=Object.freeze({parseClassDeclaration:parseClassDeclaration,parseFunctionDeclaration:parseFunctionDeclaration,parseAsyncFunctionOrAsyncGeneratorDeclaration:parseAsyncFunctionOrAsyncGeneratorDeclaration,parseVariableDeclarationList:parseVariableDeclarationList,parseExpression:parseExpression,parseSequenceExpression:parseSequenceExpression,parseAssignmentExpression:parseAssignmentExpression,parseRestElement:parseRestElement,parseLeftHandSideExpression:parseLeftHandSideExpression,parsePrimaryExpression:parsePrimaryExpression,parseIdentifier:parseIdentifier,parseLiteral:parseLiteral,parseBigIntLiteral:parseBigIntLiteral,parseIdentifierName:parseIdentifierName,parseFunctionExpression:parseFunctionExpression,parseAsyncFunctionOrAsyncGeneratorExpression:parseAsyncFunctionOrAsyncGeneratorExpression,parsePropertyName:parsePropertyName,parseObjectLiteral:parseObjectLiteral,parseFormalListAndBody:parseFormalListAndBody,parseFunctionBody:parseFunctionBody,parseFormalParameters:parseFormalParameters,parseFormalParameterList:parseFormalParameterList,parseClassBodyAndElementList:parseClassBodyAndElementList,parseClassElement:parseClassElement,parseDecorators:parseDecorators,parseModuleItemList:parseModuleItemList,parseModuleItem:parseModuleItem,parseExportDeclaration:parseExportDeclaration,parseImportDeclaration:parseImportDeclaration,createParser:createParser,parseSource:parseSource,parseStatementList:parseStatementList,parse:parse,parseScript:parseScript,parseModule:parseModule,parseBindingIdentifierOrPattern:parseBindingIdentifierOrPattern,parseBindingIdentifier:parseBindingIdentifier,parseAssignmentRestElement:parseAssignmentRestElement,parseAssignmentPattern:parseAssignmentPattern,parseBindingInitializer:parseBindingInitializer,parseStatementListItem:parseStatementListItem,parseStatement:parseStatement,parseEmptyStatement:parseEmptyStatement,parseContinueStatement:parseContinueStatement,parseBreakStatement:parseBreakStatement,parseIfStatement:parseIfStatement,parseDebuggerStatement:parseDebuggerStatement,parseTryStatement:parseTryStatement,parseCatchBlock:parseCatchBlock,parseThrowStatement:parseThrowStatement,parseExpressionStatement:parseExpressionStatement,parseDirective:parseDirective,parseExpressionOrLabelledStatement:parseExpressionOrLabelledStatement,parseDoWhileStatement:parseDoWhileStatement,parseWhileStatement:parseWhileStatement,parseBlockStatement:parseBlockStatement,parseReturnStatement:parseReturnStatement,parseIterationStatement:parseIterationStatement,parseWithStatement:parseWithStatement,parseSwitchStatement:parseSwitchStatement,parseCaseOrDefaultClauses:parseCaseOrDefaultClauses,parseVariableStatement:parseVariableStatement,parseJSXRootElement:parseJSXRootElement,parseJSXOpeningElement:parseJSXOpeningElement,nextJSXToken:nextJSXToken,scanJSXToken:scanJSXToken,parseJSXText:parseJSXText,parseJSXAttributes:parseJSXAttributes,parseJSXSpreadAttribute:parseJSXSpreadAttribute,parseJSXNamespacedName:parseJSXNamespacedName,parseJSXAttributeName:parseJSXAttributeName,parseJSXAttribute:parseJSXAttribute,parseJSXEmptyExpression:parseJSXEmptyExpression,parseJSXSpreadChild:parseJSXSpreadChild,parseJSXExpressionContainer:parseJSXExpressionContainer,parseJSXExpression:parseJSXExpression,parseJSXClosingFragment:parseJSXClosingFragment,parseJSXClosingElement:parseJSXClosingElement,parseJSXIdentifier:parseJSXIdentifier,parseJSXMemberExpression:parseJSXMemberExpression,parseJSXElementName:parseJSXElementName,scanJSXIdentifier:scanJSXIdentifier});const Parser=parser,version="1.6.9";export{version,estree as ESTree,index as Scanner,parse,parseSource,parseModule,parseScript,characterType,errorMessages,constructError,report,tolerant,tokenDesc,descKeyword,Parser,isValidIdentifierPart,isValidIdentifierStart,mustEscape,Context,Flags,Labels,NumericState,ScannerState,ModifierState,CoverParenthesizedState,Escape,RegexFlags,CoverCallState,RegexState,ObjectState,validateBreakOrContinueLabel,addLabel,popLabel,hasLabel,finishNode,expect,consume,nextToken,hasBit,consumeSemicolon,parseExpressionCoverGrammar,restoreExpressionCoverGrammar,swapContext,validateParams,reinterpret,lookahead,isValidSimpleAssignmentTarget,getLocation,isValidIdentifier,isLexical,isEndOfCaseOrDefaultClauses,nextTokenIsLeftParenOrPeriod,nextTokenisIdentifierOrParen,nextTokenIsLeftParen,nextTokenIsFuncKeywordOnSameLine,isPropertyWithPrivateFieldKey,parseAndClassifyIdentifier,nameIsArgumentsOrEval,setPendingError,isEqualTagNames,isInstanceField,validateUpdateExpression,setPendingExpressionError,validateCoverParenthesizedExpression,validateAsyncArgumentList,isInOrOf}; diff --git a/node_modules/cherow/dist/es2017/cherow.js b/node_modules/cherow/dist/es2017/cherow.js new file mode 100644 index 0000000..aad8f46 --- /dev/null +++ b/node_modules/cherow/dist/es2017/cherow.js @@ -0,0 +1,7276 @@ +// Note: this *must* be kept in sync with the enum's order.
+//
+// It exploits the enum value ordering, and it's necessarily a complete and
+// utter hack.
+//
+// All to lower it to a single monomorphic array access.
+const keywordDescTable = [
+ 'end of source',
+ /* Constants/Bindings */
+ 'identifier', 'number', 'string', 'regular expression',
+ 'false', 'true', 'null',
+ /* Template nodes */
+ 'template continuation', 'template end',
+ /* Punctuators */
+ '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '</', '/>',
+ /* Update operators */
+ '++', '--',
+ /* Assign operators */
+ '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
+ '&=',
+ /* Unary/binary operators */
+ 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
+ '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
+ /* Variable declaration kinds */
+ 'var', 'let', 'const',
+ /* Other reserved words */
+ 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
+ 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
+ 'this', 'throw', 'try', 'while', 'with',
+ /* Strict mode reserved words */
+ 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
+ /* Contextual keywords */
+ 'as', 'async', 'await', 'constructor', 'get', 'set', 'from', 'of',
+ '#',
+ 'eval', 'arguments', 'enum', 'BigInt', '@', 'JSXText',
+ /** TS */
+ 'KeyOf', 'ReadOnly', 'is', 'unique', 'declare', 'type', 'namespace', 'abstract', 'module',
+ 'global', 'require', 'target'
+];
+/**
+ * The conversion function between token and its string description/representation.
+ */
+function tokenDesc(token) {
+ return keywordDescTable[token & 255 /* Type */];
+}
+// Used `Object.create(null)` to avoid potential `Object.prototype`
+// interference.
+const descKeywordTable = Object.create(null, {
+ this: { value: 33566815 /* ThisKeyword */ },
+ function: { value: 33566808 /* FunctionKeyword */ },
+ if: { value: 12377 /* IfKeyword */ },
+ return: { value: 12380 /* ReturnKeyword */ },
+ var: { value: 33566791 /* VarKeyword */ },
+ else: { value: 12370 /* ElseKeyword */ },
+ for: { value: 12374 /* ForKeyword */ },
+ new: { value: 33566811 /* NewKeyword */ },
+ in: { value: 167786289 /* InKeyword */ },
+ typeof: { value: 302002218 /* TypeofKeyword */ },
+ while: { value: 12386 /* WhileKeyword */ },
+ case: { value: 12363 /* CaseKeyword */ },
+ break: { value: 12362 /* BreakKeyword */ },
+ try: { value: 12385 /* TryKeyword */ },
+ catch: { value: 12364 /* CatchKeyword */ },
+ delete: { value: 302002219 /* DeleteKeyword */ },
+ throw: { value: 302002272 /* ThrowKeyword */ },
+ switch: { value: 33566814 /* SwitchKeyword */ },
+ continue: { value: 12366 /* ContinueKeyword */ },
+ default: { value: 12368 /* DefaultKeyword */ },
+ instanceof: { value: 167786290 /* InstanceofKeyword */ },
+ do: { value: 12369 /* DoKeyword */ },
+ void: { value: 302002220 /* VoidKeyword */ },
+ finally: { value: 12373 /* FinallyKeyword */ },
+ arguments: { value: 37879925 /* Arguments */ },
+ keyof: { value: 131194 /* KeyOfKeyword */ },
+ readonly: { value: 131195 /* ReadOnlyKeyword */ },
+ unique: { value: 131197 /* UniqueKeyword */ },
+ declare: { value: 131198 /* DeclareKeyword */ },
+ async: { value: 594028 /* AsyncKeyword */ },
+ await: { value: 34017389 /* AwaitKeyword */ },
+ class: { value: 33566797 /* ClassKeyword */ },
+ const: { value: 33566793 /* ConstKeyword */ },
+ constructor: { value: 69742 /* ConstructorKeyword */ },
+ debugger: { value: 12367 /* DebuggerKeyword */ },
+ enum: { value: 12406 /* EnumKeyword */ },
+ eval: { value: 37879924 /* Eval */ },
+ export: { value: 12371 /* ExportKeyword */ },
+ extends: { value: 12372 /* ExtendsKeyword */ },
+ false: { value: 33566725 /* FalseKeyword */ },
+ from: { value: 69745 /* FromKeyword */ },
+ get: { value: 69743 /* GetKeyword */ },
+ implements: { value: 20579 /* ImplementsKeyword */ },
+ import: { value: 33566810 /* ImportKeyword */ },
+ interface: { value: 20580 /* InterfaceKeyword */ },
+ let: { value: 33574984 /* LetKeyword */ },
+ null: { value: 33566727 /* NullKeyword */ },
+ of: { value: 69746 /* OfKeyword */ },
+ package: { value: 20581 /* PackageKeyword */ },
+ private: { value: 20582 /* PrivateKeyword */ },
+ protected: { value: 20583 /* ProtectedKeyword */ },
+ public: { value: 20584 /* PublicKeyword */ },
+ set: { value: 69744 /* SetKeyword */ },
+ static: { value: 20585 /* StaticKeyword */ },
+ super: { value: 33566813 /* SuperKeyword */ },
+ true: { value: 33566726 /* TrueKeyword */ },
+ with: { value: 12387 /* WithKeyword */ },
+ yield: { value: 1107316842 /* YieldKeyword */ },
+ is: { value: 131196 /* IsKeyword */ },
+ type: { value: 131199 /* TypeKeyword */ },
+ namespace: { value: 131200 /* NameSpaceKeyword */ },
+ abstract: { value: 131201 /* AbstractKeyword */ },
+ as: { value: 167843947 /* AsKeyword */ },
+ module: { value: 131202 /* ModuleKeyword */ },
+ global: { value: 131203 /* GlobalKeyword */ },
+ require: { value: 131204 /* RequireKeyword */ },
+ target: { value: 131205 /* TargetKeyword */ },
+});
+function descKeyword(value) {
+ return (descKeywordTable[value] | 0);
+} + +/*@internal*/
+const characterType = [
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 16 /* Space */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+]; + +// Unicode v. 11 support
+// tslint:disable
+function isValidIdentifierPart(code) {
+ return (convert[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
+}
+function isValidIdentifierStart(code) {
+ return (convert[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
+}
+function mustEscape(code) {
+ return (convert[(code >>> 5) + 69632] >>> code & 31 & 1) !== 0;
+}
+const convert = ((compressed, lookup) => {
+ const result = new Uint32Array(104448);
+ let index = 0;
+ let subIndex = 0;
+ while (index < 3392) {
+ const inst = compressed[index++];
+ if (inst < 0) {
+ subIndex -= inst;
+ }
+ else {
+ let code = compressed[index++];
+ if (inst & 2)
+ code = lookup[code];
+ if (inst & 1) {
+ result.fill(code, subIndex, subIndex += compressed[index++]);
+ }
+ else {
+ result[subIndex++] = code;
+ }
+ }
+ }
+ return result;
+})([-1, 2, 28, 2, 29, 2, 5, -1, 0, 77595648, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 15, 2, 60, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 61, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 20, 2, 0, 0, 608174079, 2, 0, 2, 127, 2, 6, 2, 62, -1, 2, 64, 2, 26, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2965387679, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 2, 171, 0, 4294828031, 0, 3825204735, 0, 123747807, 0, 65487, 2, 3, 0, 4092591615, 0, 1080049119, 0, 458703, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247020, 2, 68, 0, 4284449919, 0, 851904, 2, 4, 2, 16, 0, 67076095, -1, 2, 69, 0, 1006628014, 0, 4093591391, -1, 0, 50331649, 0, 3265266687, 2, 34, 0, 4294844415, 0, 4278190047, 2, 23, 2, 125, -1, 3, 0, 2, 2, 33, 2, 0, 2, 9, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 10, 0, 261632, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 2088959, 2, 31, 2, 8, 0, 909311, 3, 0, 2, 0, 814743551, 2, 42, 0, 67057664, 3, 0, 2, 2, 45, 2, 0, 2, 32, 2, 0, 2, 18, 2, 7, 0, 268374015, 2, 30, 2, 51, 2, 0, 2, 78, 0, 134153215, -1, 2, 6, 2, 0, 2, 7, 0, 2684354559, 0, 67044351, 0, 1073676416, -2, 3, 0, 2, 2, 43, 0, 1046528, 3, 0, 3, 2, 8, 2, 0, 2, 41, 0, 4294960127, 2, 9, 2, 39, 2, 10, 0, 4294377472, 2, 21, 3, 0, 7, 0, 4227858431, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -1, 2, 122, 0, 1048577, 2, 84, 2, 12, -1, 2, 12, 0, 131042, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 1046559, 2, 0, 2, 13, 2, 0, 0, 2147516671, 2, 24, 3, 88, 2, 2, 0, -16, 2, 89, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 2, 119, 2, 0, 0, 3220242431, 3, 0, 3, 2, 20, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 2, 0, 2, 27, 2, 0, 2, 8, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 25, 2, 8, 2, 23, 3, 0, 2, 0, 67076097, 2, 7, 2, 0, 2, 24, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 3774349439, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, 2, 19, 0, 1638399, 2, 169, 2, 104, 3, 0, 3, 2, 23, 2, 28, 2, 29, 2, 5, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -3, 2, 146, -4, 2, 23, 2, 0, 2, 37, 0, 1, 2, 0, 2, 63, 2, 32, 2, 16, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 33, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277137519, 0, 2269118463, -1, 3, 23, 2, -1, 2, 34, 2, 38, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 48, -14, 2, 23, 2, 44, 2, 37, -5, 3, 0, 2, 2, 38, 0, 2147549120, 2, 0, 2, 16, 2, 17, 2, 130, 2, 0, 2, 52, 0, 4294901872, 0, 5242879, 3, 0, 2, 0, 402595359, -1, 2, 118, 0, 1090519039, -2, 2, 120, 2, 39, 2, 0, 2, 55, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, -4, 3, 0, 2, 0, 1140787199, -1, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 41, 2, 42, -1, 2, 10, 2, 43, -6, 2, 0, 2, 16, -3, 3, 0, 2, 0, 2147484671, -8, 2, 0, 2, 7, 2, 44, 2, 0, 0, 603979727, -1, 2, 0, 2, 45, -8, 2, 54, 2, 46, 0, 67043329, 2, 123, 2, 47, 0, 8388351, -2, 2, 124, 0, 3028287487, 2, 48, 2, 126, 0, 33259519, 2, 42, -9, 2, 24, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, 2, 42, -2, 2, 17, 2, 51, 2, 0, 2, 24, 0, 67043343, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 4294901791, 2, 7, 2, 164, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 0, 1677656575, -166, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 90, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -42, 0, 4194303871, 0, 2011, -62, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 55, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -22583, 3, 0, 7, 2, 19, -6130, 3, 5, 2, -1, 0, 69207040, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 15, 2, 60, 2, 0, 2, 35, -1, 2, 17, 2, 61, -1, 2, 0, 2, 62, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 19, 2, 63, 3, 0, 2, 0, 131135, 2, 94, 0, 70256639, 0, 71303167, 0, 272, 2, 45, 2, 62, -1, 2, 64, -2, 2, 96, 0, 603979775, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 65, 2, 66, 0, 33554435, 2, 121, 2, 65, 2, 147, 0, 131075, 0, 3594373096, 0, 67094296, 2, 66, -1, 2, 67, 0, 603979263, 2, 156, 0, 3, 0, 4294828001, 0, 602930687, 2, 180, 0, 393219, 2, 67, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 68, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 69, 0, 537783470, 0, 4026531935, -1, 0, 1, -1, 2, 34, 2, 70, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 16, -1, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 253951, 3, 20, 2, 0, 122879, 2, 0, 2, 8, 0, 276824064, -2, 3, 0, 2, 2, 45, 2, 0, 0, 4294903295, 2, 0, 2, 18, 2, 7, -1, 2, 17, 2, 51, 2, 0, 2, 78, 2, 42, -1, 2, 24, 2, 0, 2, 31, -2, 0, 128, -2, 2, 79, 2, 8, 0, 4064, -1, 2, 117, 0, 4227907585, 2, 0, 2, 116, 2, 0, 2, 50, 2, 196, 2, 9, 2, 39, 2, 10, -1, 0, 6544896, 3, 0, 6, -2, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -3, 2, 84, 2, 12, -3, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 817183, 2, 0, 2, 13, 2, 0, 0, 33023, 2, 24, 3, 88, 2, -17, 2, 89, 0, 524157950, 2, 4, 2, 0, 2, 90, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 19, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 0, 4294965179, 0, 7, 2, 0, 2, 8, 2, 92, 2, 8, -1, 0, 1761345536, 2, 94, 2, 95, 2, 38, 2, 23, 2, 96, 2, 36, 2, 162, 0, 2080440287, 2, 0, 2, 35, 2, 138, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 7, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 2700607615, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, -3, 2, 104, 3, 0, 3, 2, 23, -1, 3, 5, 2, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -8, 2, 23, 2, 0, 2, 37, -1, 2, 0, 2, 63, 2, 32, 2, 18, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 17, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277075969, 2, 18, -1, 3, 23, 2, -1, 2, 34, 2, 139, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 50, -14, 2, 23, 2, 44, 2, 116, -5, 2, 117, 2, 41, -2, 2, 117, 2, 19, 2, 17, 2, 35, 2, 117, 2, 38, 0, 4294901776, 0, 4718591, 2, 117, 2, 36, 0, 335544350, -1, 2, 118, 2, 119, -2, 2, 120, 2, 39, 2, 7, -1, 2, 121, 2, 65, 0, 3758161920, 0, 3, -4, 2, 0, 2, 31, 2, 174, -1, 2, 0, 2, 19, 0, 176, -5, 2, 0, 2, 49, 2, 182, -1, 2, 0, 2, 19, 2, 194, -1, 2, 0, 2, 62, -2, 2, 16, -7, 2, 0, 2, 119, -3, 3, 0, 2, 2, 122, -8, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871887, -1, 2, 0, 2, 45, -8, 2, 54, 2, 49, 0, 1, 2, 123, 2, 19, -3, 2, 124, 2, 37, 2, 125, 2, 126, 0, 16778239, -10, 2, 36, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, -3, 2, 17, 2, 127, 2, 0, 2, 19, 2, 50, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 65567, -1, 2, 26, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 2, 130, -187, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 2, 138, -129, 3, 0, 6, 2, 139, -1, 3, 0, 2, 2, 50, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -28719, 2, 0, 0, 1, -1, 2, 122, 2, 0, 0, 8193, -21, 0, 50331648, 0, 10255, 0, 4, -11, 2, 66, 2, 168, -1, 0, 71680, -1, 2, 157, 0, 4292900864, 0, 805306431, -5, 2, 146, -1, 2, 176, -1, 0, 6144, -2, 2, 123, -1, 2, 150, -1, 2, 153, 2, 147, 2, 161, 2, 0, 0, 3223322624, 2, 36, 0, 4, -4, 2, 188, 0, 205128192, 0, 1333757536, 0, 2147483696, 0, 423953, 0, 747766272, 0, 2717763192, 0, 4286578751, 0, 278545, 2, 148, 0, 4294886464, 0, 33292336, 0, 417809, 2, 148, 0, 1329579616, 0, 4278190128, 0, 700594195, 0, 1006647527, 0, 4286497336, 0, 4160749631, 2, 149, 0, 469762560, 0, 4171219488, 0, 16711728, 2, 149, 0, 202375680, 0, 3214918176, 0, 4294508592, 0, 139280, -1, 0, 983584, 2, 190, 0, 58720275, 0, 3489923072, 0, 10517376, 0, 4293066815, 0, 1, 0, 2013265920, 2, 175, 2, 0, 0, 17816169, 0, 3288339281, 0, 201375904, 2, 0, -2, 0, 256, 0, 122880, 0, 16777216, 2, 146, 0, 4160757760, 2, 0, -6, 2, 163, -11, 0, 3263218176, -1, 0, 49664, 0, 2160197632, 0, 8388802, -1, 0, 12713984, -1, 2, 150, 2, 155, 2, 158, -2, 2, 159, -20, 0, 3758096385, -2, 2, 151, 0, 4292878336, 2, 22, 2, 166, 0, 4294057984, -2, 2, 160, 2, 152, 2, 172, -2, 2, 151, -1, 2, 179, -1, 2, 167, 2, 122, 0, 4026593280, 0, 14, 0, 4292919296, -1, 2, 154, 0, 939588608, -1, 0, 805306368, -1, 2, 122, 0, 1610612736, 2, 152, 2, 153, 3, 0, 2, -2, 2, 154, 2, 155, -3, 0, 267386880, -1, 2, 156, 0, 7168, -1, 0, 65024, 2, 150, 2, 157, 2, 158, -7, 2, 165, -8, 2, 159, -1, 0, 1426112704, 2, 160, -1, 2, 185, 0, 271581216, 0, 2149777408, 2, 19, 2, 157, 2, 122, 0, 851967, 0, 3758129152, -1, 2, 19, 2, 178, -4, 2, 154, -20, 2, 192, 2, 161, -56, 0, 3145728, 2, 184, -1, 2, 191, 2, 122, -1, 2, 162, 2, 122, -4, 0, 32505856, -1, 2, 163, -1, 0, 2147385088, 2, 22, 1, 2155905152, 2, -3, 2, 164, 2, 0, 2, 165, -2, 2, 166, -6, 2, 167, 0, 4026597375, 0, 1, -1, 0, 1, -1, 2, 168, -3, 2, 139, 2, 66, -2, 2, 162, 2, 177, -1, 2, 173, 2, 122, -6, 2, 122, -213, 2, 167, -657, 2, 17, -36, 2, 169, -1, 2, 186, -10, 0, 4294963200, -5, 2, 170, -5, 2, 158, 2, 0, 2, 24, -1, 0, 4227919872, -1, 2, 170, -2, 0, 4227874752, -3, 0, 2146435072, 2, 155, -2, 0, 1006649344, 2, 122, -1, 2, 22, 0, 201375744, -3, 0, 134217720, 2, 22, 0, 4286677377, 0, 32896, -1, 2, 171, -3, 2, 172, -349, 2, 173, 2, 174, 2, 175, 3, 0, 264, -11, 2, 176, -2, 2, 158, 2, 0, 0, 520617856, 0, 2692743168, 0, 36, -3, 0, 524284, -11, 2, 19, -1, 2, 183, -1, 2, 181, 0, 3221291007, 2, 158, -1, 0, 524288, 0, 2158720, -3, 2, 155, 0, 1, -4, 2, 122, 0, 3808625411, 0, 3489628288, 0, 4096, 0, 1207959680, 0, 3221274624, 2, 0, -3, 2, 177, 0, 120, 0, 7340032, -2, 0, 4026564608, 2, 4, 2, 19, 2, 160, 3, 0, 4, 2, 155, -1, 2, 178, 2, 175, -1, 0, 8176, 2, 179, 2, 177, 2, 180, -1, 0, 4290773232, 2, 0, -4, 2, 160, 2, 187, 0, 15728640, 2, 175, -1, 2, 157, -1, 0, 4294934512, 3, 0, 4, -9, 2, 22, 2, 167, 2, 181, 3, 0, 4, 0, 704, 0, 1849688064, 0, 4194304, -1, 2, 122, 0, 4294901887, 2, 0, 0, 130547712, 0, 1879048192, 0, 2080374784, 3, 0, 2, -1, 2, 182, 2, 183, -1, 0, 17829776, 0, 2025848832, 0, 4261477888, -2, 2, 0, -1, 0, 4286580608, -1, 0, 29360128, 2, 184, 0, 16252928, 0, 3791388672, 2, 39, 3, 0, 2, -2, 2, 193, 2, 0, -1, 2, 26, -1, 0, 66584576, -1, 2, 189, 3, 0, 9, 2, 122, 3, 0, 4, -1, 2, 157, 2, 158, 3, 0, 5, -2, 0, 245760, 0, 2147418112, -1, 2, 146, 2, 199, 0, 4227923456, -1, 2, 185, 2, 186, 2, 22, -2, 2, 176, 0, 4292870145, 0, 262144, 2, 122, 3, 0, 2, 0, 1073758848, 2, 187, -1, 0, 4227921920, 2, 188, 0, 68289024, 0, 528402016, 0, 4292927536, 3, 0, 4, -2, 0, 2483027968, 2, 0, -2, 2, 189, 3, 0, 5, -1, 2, 184, 2, 160, 2, 0, -2, 0, 4227923936, 2, 63, -1, 2, 170, 2, 94, 2, 0, 2, 150, 2, 154, 3, 0, 6, -1, 2, 175, 3, 0, 3, -2, 0, 2146959360, 3, 0, 8, -2, 2, 157, -1, 2, 190, 2, 117, -1, 2, 151, 3, 0, 8, 2, 191, 0, 8388608, 2, 171, 2, 169, 2, 183, 0, 4286578944, 3, 0, 2, 0, 1152, 0, 1266679808, 2, 189, 0, 576, 0, 4261707776, 2, 94, 3, 0, 9, 2, 151, 3, 0, 8, -28, 2, 158, 3, 0, 3, -3, 0, 4292902912, -6, 2, 96, 3, 0, 85, -33, 2, 164, 3, 0, 126, -18, 2, 192, 3, 0, 269, -17, 2, 151, 2, 122, 0, 4294917120, 3, 0, 2, 2, 19, 0, 4290822144, -2, 0, 67174336, 0, 520093700, 2, 17, 3, 0, 21, -2, 2, 177, 3, 0, 3, -2, 0, 65504, 2, 122, 2, 49, 3, 0, 2, 2, 92, -191, 2, 123, -23, 2, 26, 3, 0, 296, -8, 2, 122, 3, 0, 2, 2, 19, -11, 2, 175, 3, 0, 72, -3, 0, 3758159872, 0, 201391616, 3, 0, 155, -7, 2, 167, -1, 0, 384, -1, 0, 133693440, -3, 2, 193, -2, 2, 30, 3, 0, 4, 2, 166, -2, 2, 22, 2, 151, 3, 0, 4, -2, 2, 185, -1, 2, 146, 0, 335552923, 2, 194, -1, 0, 538974272, 0, 2214592512, 0, 132000, -10, 0, 192, -8, 0, 12288, -21, 0, 134213632, 0, 4294901761, 3, 0, 42, 0, 100663424, 0, 4294965284, 3, 0, 62, -6, 0, 4286578784, 2, 0, -2, 0, 1006696448, 3, 0, 24, 2, 37, -1, 2, 195, 3, 0, 10, 2, 194, 0, 4110942569, 0, 1432950139, 0, 2701658217, 0, 4026532864, 0, 4026532881, 2, 0, 2, 47, 3, 0, 8, -1, 2, 154, -2, 2, 166, 0, 98304, 0, 65537, 2, 167, 2, 169, -2, 2, 154, -1, 2, 63, 2, 0, 2, 116, 2, 197, 2, 175, 0, 4294770176, 2, 30, 3, 0, 4, -30, 2, 195, 2, 196, -3, 2, 166, -2, 2, 151, 2, 0, 2, 154, -1, 2, 189, -1, 2, 157, 2, 198, 3, 0, 2, 2, 154, 2, 122, -1, 0, 193331200, -1, 0, 4227923960, 2, 197, -1, 3, 0, 3, 2, 198, 3, 0, 44, -1334, 2, 22, 2, 0, -129, 2, 195, -6, 2, 160, -180, 2, 199, -233, 2, 4, 3, 0, 96, -16, 2, 160, 3, 0, 22583, -7, 2, 17, 3, 0, 6128], [4294967295, 4294967291, 4092460543, 4294828015, 4294967294, 134217726, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 1061158911, 536805376, 4294910143, 4160749567, 4294901759, 134217727, 4294901760, 4194303, 65535, 262143, 67108863, 4286578688, 536870911, 8388607, 4294918143, 4294443008, 255, 67043328, 2281701374, 4294967232, 2097151, 4294903807, 4294902783, 4294967039, 511, 524287, 131071, 127, 4294902271, 4294549487, 16777215, 1023, 67047423, 4294901888, 33554431, 4286578687, 4294770687, 67043583, 32767, 15, 2047999, 4292870143, 4294934527, 4294966783, 67045375, 4294967279, 262083, 20511, 4290772991, 41943039, 493567, 2047, 4294959104, 1071644671, 602799615, 65536, 4294828000, 805044223, 4277151126, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 4294967264, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4294967292, 4294965759, 4294966272, 4294901823, 4294967280, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 268369920, 4292804608, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4294966591, 2445279231, 3670015, 3238002687, 63, 4294967288, 4294705151, 4095, 3221208447, 4294549472, 2147483648, 4294705152, 4294966143, 64, 4294966719, 16383, 3774873592, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4087, 31, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 536870912, 2952790016, 202506752, 139264, 402653184, 4261412864, 4227922944, 2147532800, 61440, 3758096384, 117440512, 65280, 4227858432, 3233808384, 3221225472, 4294965248, 32768, 57152, 4294934528, 67108864, 4293918720, 4290772992, 25165824, 57344, 4278190080, 65472, 4227907584, 65520, 1920, 4026531840, 49152, 4160749568, 4294836224, 63488, 1073741824, 4294967040, 251658240, 196608, 12582912, 2097152, 65408, 64512, 417808, 4227923712, 48, 512, 4294967168, 4294966784, 16, 4292870144, 4227915776, 65528, 4294950912, 65532]); + +/**
+ * Return the next unicodechar in the stream
+ *
+ * @param parser Parser object
+ */
+function nextUnicodeChar(parser) {
+ const { index } = parser;
+ const hi = parser.source.charCodeAt(index);
+ if (hi < 55296 /* LeadSurrogateMin */ || hi > 56319 /* LeadSurrogateMax */)
+ return hi;
+ const lo = parser.source.charCodeAt(index + 1);
+ if (lo < 56320 /* TrailSurrogateMin */ || lo > 57343 /* TrailSurrogateMax */)
+ return hi;
+ return 65536 /* NonBMPMin */ + ((hi & 0x3FF) << 10) | lo & 0x3FF;
+}
+/**
+ * Returns true if this is a valid identifier part
+ *
+ * @param code Codepoint
+ */
+const isIdentifierPart = (code) => (characterType[code] & 1 /* IdentifierStart */) !== 0 || isValidIdentifierPart(code);
+function escapeInvalidCharacters(code) {
+ switch (code) {
+ case 0 /* Null */:
+ return '\\0';
+ case 8 /* Backspace */:
+ return '\\b';
+ case 9 /* Tab */:
+ return '\\t';
+ case 10 /* LineFeed */:
+ return '\\n';
+ case 11 /* VerticalTab */:
+ return '\\v';
+ case 12 /* FormFeed */:
+ return '\\f';
+ case 13 /* CarriageReturn */:
+ return '\\r';
+ default:
+ if (!mustEscape(code))
+ return fromCodePoint(code);
+ if (code < 0x10)
+ return `\\x0${code.toString(16)}`;
+ if (code < 0x100)
+ return `\\x${code.toString(16)}`;
+ if (code < 0x1000)
+ return `\\u0${code.toString(16)}`;
+ if (code < 0x10000)
+ return `\\u${code.toString(16)}`;
+ return `\\u{${code.toString(16)}}`;
+ }
+}
+/**
+ * Consume an token in the scanner on match. This is an equalent to
+ * 'consume' used in the parser code itself.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeOpt(parser, code) {
+ if (parser.source.charCodeAt(parser.index) !== code)
+ return false;
+ parser.index++;
+ parser.column++;
+ return true;
+}
+/**
+ * Consumes line feed
+ *
+ * @param parser Parser object
+ * @param state Scanner state
+ */
+function consumeLineFeed(parser, state) {
+ parser.flags |= Flags.NewLine;
+ parser.index++;
+ if ((state & ScannerState.LastIsCR) === 0) {
+ parser.column = 0;
+ parser.line++;
+ }
+}
+/**
+ * Scans private name. Stage 3 proposal related
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanPrivateName(parser, context) {
+ if (!(context & Context.InClass) || !isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return 115 /* Hash */;
+}
+/**
+ * Advance to new line
+ *
+ * @param parser Parser object
+ */
+function advanceNewline(parser) {
+ parser.flags |= Flags.NewLine;
+ parser.index++;
+ parser.column = 0;
+ parser.line++;
+}
+const fromCodePoint = (code) => {
+ return code <= 0xFFFF ?
+ String.fromCharCode(code) :
+ String.fromCharCode(((code - 65536 /* NonBMPMin */) >> 10) + 55296 /* LeadSurrogateMin */, ((code - 65536 /* NonBMPMin */) & (1024 - 1)) + 56320 /* TrailSurrogateMin */);
+};
+function readNext(parser) {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.source.length)
+ report(parser, 14 /* UnicodeOutOfRange */);
+ return nextUnicodeChar(parser);
+}
+function toHex(code) {
+ if (code < 48 /* Zero */)
+ return -1;
+ if (code <= 57 /* Nine */)
+ return code - 48 /* Zero */;
+ if (code < 65 /* UpperA */)
+ return -1;
+ if (code <= 70 /* UpperF */)
+ return code - 65 /* UpperA */ + 10;
+ if (code < 97 /* LowerA */)
+ return -1;
+ if (code <= 102 /* LowerF */)
+ return code - 97 /* LowerA */ + 10;
+ return -1;
+}
+function advanceOnMaybeAstral(parser, ch) {
+ parser.index++;
+ parser.column++;
+ if (ch > 0xFFFF)
+ parser.index++;
+} + +/**
+ * Scan escape sequence
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanEscapeSequence(parser, context, first) {
+ switch (first) {
+ case 98 /* LowerB */:
+ return 8 /* Backspace */;
+ case 102 /* LowerF */:
+ return 12 /* FormFeed */;
+ case 114 /* LowerR */:
+ return 13 /* CarriageReturn */;
+ case 110 /* LowerN */:
+ return 10 /* LineFeed */;
+ case 116 /* LowerT */:
+ return 9 /* Tab */;
+ case 118 /* LowerV */:
+ return 11 /* VerticalTab */;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ return Escape.Empty;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ {
+ // 1 to 3 octal digits
+ let code = first - 48 /* Zero */;
+ let index = parser.index + 1;
+ let column = parser.column + 1;
+ let next = parser.source.charCodeAt(index);
+ if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ // Strict mode code allows only \0, then a non-digit.
+ if (code !== 0 || next === 56 /* Eight */ || next === 57 /* Nine */) {
+ if (context & Context.Strict)
+ return Escape.StrictOctal;
+ parser.flags |= Flags.HasOctal;
+ }
+ }
+ else if (context & Context.Strict) {
+ return Escape.StrictOctal;
+ }
+ else {
+ parser.flags |= Flags.HasOctal;
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ parser.index = index - 1;
+ parser.column = column - 1;
+ }
+ return code;
+ }
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ // 1 to 2 octal digits
+ if (context & Context.Strict)
+ return Escape.StrictOctal;
+ let code = first - 48 /* Zero */;
+ const index = parser.index + 1;
+ const column = parser.column + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ code = code * 8 + (next - 48 /* Zero */);
+ parser.lastValue = next;
+ parser.index = index;
+ parser.column = column;
+ }
+ return code;
+ }
+ // `8`, `9` (invalid escapes)
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return Escape.EightOrNine;
+ // ASCII escapes
+ case 120 /* LowerX */:
+ {
+ const ch1 = parser.lastValue = readNext(parser);
+ const hi = toHex(ch1);
+ if (hi < 0)
+ return Escape.InvalidHex;
+ const ch2 = parser.lastValue = readNext(parser);
+ const lo = toHex(ch2);
+ if (lo < 0)
+ return Escape.InvalidHex;
+ return hi << 4 | lo;
+ }
+ // UCS-2/Unicode escapes
+ case 117 /* LowerU */:
+ {
+ let ch = parser.lastValue = readNext(parser);
+ if (ch === 123 /* LeftBrace */) {
+ ch = parser.lastValue = readNext(parser);
+ let code = toHex(ch);
+ if (code < 0)
+ return Escape.InvalidHex;
+ ch = parser.lastValue = readNext(parser);
+ while (ch !== 125 /* RightBrace */) {
+ const digit = toHex(ch);
+ if (digit < 0)
+ return Escape.InvalidHex;
+ code = code * 16 + digit;
+ // Code point out of bounds
+ if (code > 1114111 /* NonBMPMax */)
+ return Escape.OutOfRange;
+ ch = parser.lastValue = readNext(parser);
+ }
+ return code;
+ }
+ else {
+ // \uNNNN
+ let codePoint = toHex(ch);
+ if (codePoint < 0)
+ return Escape.InvalidHex;
+ for (let i = 0; i < 3; i++) {
+ ch = parser.lastValue = readNext(parser);
+ const digit = toHex(ch);
+ if (digit < 0)
+ return Escape.InvalidHex;
+ codePoint = codePoint * 16 + digit;
+ }
+ return codePoint;
+ }
+ }
+ default:
+ return parser.source.charCodeAt(parser.index);
+ }
+}
+/**
+ * Throws a string error for either string or template literal
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function throwStringError(parser, context, code) {
+ switch (code) {
+ case Escape.Empty:
+ return;
+ case Escape.StrictOctal:
+ report(parser, context & Context.TaggedTemplate ?
+ 76 /* TemplateOctalLiteral */ :
+ 11 /* StrictOctalEscape */);
+ case Escape.EightOrNine:
+ report(parser, 13 /* InvalidEightAndNine */);
+ case Escape.InvalidHex:
+ report(parser, 75 /* MalformedEscape */, 'hexadecimal');
+ case Escape.OutOfRange:
+ report(parser, 14 /* UnicodeOutOfRange */);
+ /* istanbul ignore next */
+ default:
+ // ignore
+ }
+}
+/**
+ * Scan a string literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote codepoint
+ */
+function scanString(parser, context, quote) {
+ const { index: start, lastValue } = parser;
+ let ret = '';
+ parser.index++;
+ parser.column++; // consume quote
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ switch (ch) {
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ report(parser, 6 /* UnterminatedString */);
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch > 128 /* MaxAsciiCharacter */) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ const code = scanEscapeSequence(parser, context, ch);
+ if (code >= 0)
+ ret += fromCodePoint(code);
+ else
+ throwStringError(parser, context, code);
+ ch = parser.lastValue;
+ }
+ break;
+ default:
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++; // consume quote
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ return 33554435 /* StringLiteral */;
+} + +/**
+ * Consumes template brace
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeTemplateBrace(parser, context) {
+ if (parser.index >= parser.length)
+ report(parser, 9 /* UnterminatedTemplate */);
+ // Upon reaching a '}', consume it and rewind the scanner state
+ parser.index--;
+ parser.column--;
+ return scanTemplate(parser, context);
+}
+/**
+ * Scan template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param first Codepoint
+ */
+function scanTemplate(parser, context) {
+ const { index: start, lastValue } = parser;
+ let tail = true;
+ let ret = '';
+ let ch = readNext(parser);
+ loop: while (ch !== 96 /* Backtick */) {
+ switch (ch) {
+ // Break after a literal `${` (thus the dedicated code path).
+ case 36 /* Dollar */:
+ {
+ const index = parser.index + 1;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 123 /* LeftBrace */) {
+ parser.index = index;
+ parser.column++;
+ tail = false;
+ break loop;
+ }
+ ret += '$';
+ break;
+ }
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch >= 128) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ // Because octals are forbidden in escaped template sequences and the fact that
+ // both string and template scanning uses the same method - 'scanEscapeSequence',
+ // we set the strict context mask.
+ const code = scanEscapeSequence(parser, context | Context.Strict, ch);
+ if (code >= 0) {
+ ret += fromCodePoint(code);
+ }
+ else if (code !== Escape.Empty && context & Context.TaggedTemplate) {
+ ret = undefined;
+ ch = scanLooserTemplateSegment(parser, parser.lastValue);
+ if (ch < 0) {
+ tail = false;
+ }
+ break loop;
+ }
+ else {
+ throwStringError(parser, context | Context.TaggedTemplate, code);
+ }
+ ch = parser.lastValue;
+ }
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ // falls through
+ default:
+ if (ret != null)
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++;
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ if (tail) {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 1);
+ return 33554441 /* TemplateTail */;
+ }
+ else {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 2);
+ return 33554440 /* TemplateCont */;
+ }
+}
+/**
+ * Scan looser template segment
+ *
+ * @param parser Parser object
+ * @param ch codepoint
+ */
+function scanLooserTemplateSegment(parser, ch) {
+ while (ch !== 96 /* Backtick */) {
+ if (ch === 36 /* Dollar */ && parser.source.charCodeAt(parser.index + 1) === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return -ch;
+ }
+ // Skip '\' and continue to scan the template token to search
+ // for the end, without validating any escape sequences
+ ch = readNext(parser);
+ }
+ return ch;
+} + +// 11.8.3 Numeric Literals
+/**
+ * Scans hex integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HexIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanHexIntegerLiteral(parser, context) {
+ parser.index++;
+ parser.column++;
+ let state = NumericState.None;
+ let value = toHex(parser.source.charCodeAt(parser.index));
+ if (value < 0)
+ report(parser, 0 /* Unexpected */);
+ parser.index++;
+ parser.column++;
+ while (parser.index < parser.length) {
+ const next = parser.source.charCodeAt(parser.index);
+ if (context & Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ const digit = toHex(next);
+ if (digit < 0)
+ break;
+ value = value * 16 + digit;
+ parser.index++;
+ parser.column++;
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+}
+/**
+ * Scans binary and octal integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalIntegerLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BinaryIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanOctalOrBinary(parser, context, base) {
+ parser.index++;
+ parser.column++;
+ let digits = 0;
+ let ch;
+ let value = 0;
+ let state = NumericState.None;
+ while (parser.index < parser.length) {
+ ch = parser.source.charCodeAt(parser.index);
+ if (context & Context.OptionsNext && ch === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ const converted = ch - 48 /* Zero */;
+ if (!(ch >= 48 /* Zero */ && ch <= 57 /* Nine */) || converted >= base)
+ break;
+ value = value * base + converted;
+ parser.index++;
+ parser.column++;
+ digits++;
+ }
+ if (digits === 0)
+ report(parser, 0 /* Unexpected */);
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+}
+/**
+ * Scans implicit octal digits
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalDigits)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanImplicitOctalDigits(parser, context) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ if (context & Context.Strict)
+ report(parser, 0 /* Unexpected */);
+ let index = parser.index;
+ let column = parser.column;
+ let code = 0;
+ parser.flags |= Flags.HasOctal;
+ // Implicit octal, unless there is a non-octal digit.
+ // (Annex B.1.1 on Numeric Literals)
+ while (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ else if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ return scanNumericLiteral(parser, context);
+ }
+ else {
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ }
+ parser.index = index;
+ parser.column = column;
+ return assembleNumericLiteral(parser, context, code, consumeOpt(parser, 110 /* LowerN */));
+ }
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ parser.flags |= Flags.HasOctal;
+ default:
+ if (context & Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ return scanNumericLiteral(parser, context);
+ }
+}
+/**
+ * Scans signed integer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SignedInteger)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanSignedInteger(parser, end) {
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */ || next === 45 /* Hyphen */) {
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (!(next >= 48 /* Zero */ && next <= 57 /* Nine */)) {
+ report(parser, 0 /* Unexpected */);
+ }
+ const preNumericPart = parser.index;
+ const finalFragment = scanDecimalDigitsOrSeparator(parser);
+ return parser.source.substring(end, preNumericPart) + finalFragment;
+}
+/**
+ * Scans numeric literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanNumericLiteral(parser, context, state = NumericState.None) {
+ let value = state & NumericState.Float ?
+ 0 :
+ scanDecimalAsSmi(parser, context);
+ const next = parser.source.charCodeAt(parser.index);
+ // I know I'm causing a bug here. The question is - will anyone figure this out?
+ if (next !== 46 /* Period */ && next !== 95 /* Underscore */ && !isValidIdentifierStart(next)) {
+ return assembleNumericLiteral(parser, context, value);
+ }
+ if (consumeOpt(parser, 46 /* Period */)) {
+ if (context & Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ state |= NumericState.Float;
+ value = `${value}.${scanDecimalDigitsOrSeparator(parser)}`;
+ }
+ const end = parser.index;
+ if (consumeOpt(parser, 110 /* LowerN */)) {
+ if (state & NumericState.Float)
+ report(parser, 0 /* Unexpected */);
+ state |= NumericState.BigInt;
+ }
+ if (consumeOpt(parser, 101 /* LowerE */) || consumeOpt(parser, 69 /* UpperE */)) {
+ state |= NumericState.Float;
+ value += scanSignedInteger(parser, end);
+ }
+ if (isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 0 /* Unexpected */);
+ }
+ return assembleNumericLiteral(parser, context, state & NumericState.Float ? parseFloat(value) : parseInt(value, 10), !!(state & NumericState.BigInt));
+}
+/**
+ * Internal helper function for scanning numeric separators.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state NumericState state
+ */
+function scanNumericSeparator(parser, state) {
+ parser.index++;
+ parser.column++;
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ state |= NumericState.SeenSeparator;
+ return state;
+}
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanDecimalDigitsOrSeparator(parser) {
+ let start = parser.index;
+ let state = NumericState.None;
+ let ret = '';
+ loop: while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 95 /* Underscore */:
+ const preUnderscoreIndex = parser.index;
+ state = scanNumericSeparator(parser, state);
+ ret += parser.source.substring(start, preUnderscoreIndex);
+ start = parser.index;
+ continue;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ state = state & ~NumericState.SeenSeparator;
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ break loop;
+ }
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return ret + parser.source.substring(start, parser.index);
+}
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanDecimalAsSmi(parser, context) {
+ let state = NumericState.None;
+ let value = 0;
+ let next = parser.source.charCodeAt(parser.index);
+ while (next >= 48 /* Zero */ && next <= 57 /* Nine */ || next === 95 /* Underscore */) {
+ if (context & Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ next = parser.source.charCodeAt(parser.index);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ value = value * 10 + (next - 48 /* Zero */);
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return value;
+}
+/**
+ * Internal helper function that assamble the number scanning parts and return
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param value The numeric value
+ */
+function assembleNumericLiteral(parser, context, value, isBigInt = false) {
+ parser.tokenValue = value;
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ return isBigInt ? 33554551 /* BigIntLiteral */ : 33554434 /* NumericLiteral */;
+} + +/**
+ * Scan identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanIdentifier(parser, context, first) {
+ let start = parser.index;
+ let ret = '';
+ let isEscaped = false;
+ if (first)
+ advanceOnMaybeAstral(parser, first);
+ loop: while (parser.index < parser.length) {
+ const index = parser.index;
+ let ch = parser.source.charCodeAt(index);
+ switch (ch) {
+ case 92 /* Backslash */:
+ ret += parser.source.slice(start, index);
+ ret += scanUnicodeCodePointEscape(parser);
+ start = parser.index;
+ isEscaped = true;
+ break;
+ default:
+ if (ch >= 0xD800 && ch <= 0xDBFF) {
+ const lo = parser.source.charCodeAt(index + 1);
+ ch = (ch & 0x3FF) << 10 | lo & 0x3FF | 0x10000;
+ }
+ if (!isIdentifierPart(ch))
+ break loop;
+ advanceOnMaybeAstral(parser, ch);
+ }
+ }
+ if (start < parser.index)
+ ret += parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ const len = ret.length;
+ // Keywords are between 2 and 11 characters long and start with a lowercase letter
+ // https://tc39.github.io/ecma262/#sec-keywords
+ if (len >= 2 && len <= 11) {
+ const token = descKeyword(ret);
+ if (token > 0) {
+ if (isEscaped) {
+ if (context & Context.DisallowEscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ // Here we fall back to a mutual parser flag if the escaped keyword isn't disallowed through
+ // context masks. This is similiar to how V8 does it - they are using an
+ // 'escaped_keyword' token.
+ // - J.K. Thomas
+ parser.flags |= Flags.EscapedKeyword;
+ }
+ return token;
+ }
+ }
+ if (context & Context.OptionsRawidentifiers)
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ return 33685505 /* Identifier */;
+}
+/**
+ * Scanning chars in the range 0...127, and treat them as an possible
+ * identifier. This allows subsequent checking to be faster.
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param first Code point
+ */
+function scanMaybeIdentifier(parser, context, first) {
+ first = nextUnicodeChar(parser);
+ if (!isValidIdentifierStart(first)) {
+ report(parser, 10 /* UnexpectedChar */, escapeInvalidCharacters(first));
+ }
+ return scanIdentifier(parser, context, first);
+}
+/**
+ * Scan unicode codepoint escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanUnicodeCodePointEscape(parser) {
+ const { index } = parser;
+ if (index + 5 < parser.length) {
+ if (parser.source.charCodeAt(index + 1) !== 117 /* LowerU */) {
+ report(parser, 0 /* Unexpected */);
+ }
+ parser.index += 2;
+ parser.column += 2;
+ const code = scanIdentifierUnicodeEscape(parser);
+ if (code >= 55296 /* LeadSurrogateMin */ && code <= 56319 /* LeadSurrogateMax */) {
+ report(parser, 74 /* UnexpectedSurrogate */);
+ }
+ if (!isIdentifierPart(code)) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ return fromCodePoint(code);
+ }
+ report(parser, 0 /* Unexpected */);
+}
+/**
+ * Scan identifier unicode escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanIdentifierUnicodeEscape(parser) {
+ // Accept both \uxxxx and \u{xxxxxx}. In the latter case, the number of
+ // hex digits between { } is arbitrary. \ and u have already been read.
+ let ch = parser.source.charCodeAt(parser.index);
+ let codePoint = 0;
+ // '\u{DDDDDDDD}'
+ if (ch === 123 /* LeftBrace */) { // {
+ ch = readNext(parser);
+ let digit = toHex(ch);
+ while (digit >= 0) {
+ codePoint = (codePoint << 4) | digit;
+ if (codePoint > 1114111 /* NonBMPMax */) {
+ report(parser, 89 /* UndefinedUnicodeCodePoint */);
+ }
+ parser.index++;
+ parser.column++;
+ digit = toHex(parser.source.charCodeAt(parser.index));
+ }
+ if (parser.source.charCodeAt(parser.index) !== 125 /* RightBrace */) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ consumeOpt(parser, 125 /* RightBrace */);
+ // '\uDDDD'
+ }
+ else {
+ for (let i = 0; i < 4; i++) {
+ ch = parser.source.charCodeAt(parser.index);
+ const digit = toHex(ch);
+ if (digit < 0)
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ codePoint = (codePoint << 4) | digit;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ return codePoint;
+} + +// 11.4 Comments
+/**
+ * Skips single HTML comments. Same behavior as in V8.
+ *
+ * @param parser Parser Object
+ * @param context Context masks.
+ * @param state Scanner state
+ * @param type Comment type
+ */
+function skipSingleHTMLComment(parser, context, state, type) {
+ if (context & Context.Module)
+ report(parser, 90 /* HtmlCommentInModule */);
+ return skipSingleLineComment(parser, context, state, type);
+}
+/**
+ * Skips SingleLineComment, SingleLineHTMLCloseComment and SingleLineHTMLOpenComment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SingleLineComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLOpenComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLCloseComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ * @param type Comment type
+ */
+function skipSingleLineComment(parser, context, state, type) {
+ const start = parser.index;
+ const collectable = !!(context & Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 13 /* CarriageReturn */:
+ advanceNewline(parser);
+ if ((parser.index < parser.length) && parser.source.charCodeAt(parser.index) === 10 /* LineFeed */)
+ parser.index++;
+ return state | ScannerState.NewLine;
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ advanceNewline(parser);
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state | ScannerState.NewLine;
+ default:
+ parser.index++;
+ parser.column++;
+ }
+ }
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state;
+}
+/**
+ * Skips multiline comment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-MultiLineComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ */
+function skipMultiLineComment(parser, context, state) {
+ const start = parser.index;
+ const collectable = !!(context & Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 42 /* Asterisk */:
+ parser.index++;
+ parser.column++;
+ state &= ~ScannerState.LastIsCR;
+ if (consumeOpt(parser, 47 /* Slash */)) {
+ if (collectable)
+ addComment(parser, context, 'MultiLine', start);
+ return state;
+ }
+ break;
+ // Mark multiline comments containing linebreaks as new lines
+ // so we can perfectly handle edge cases like: '1/*\n*/--> a comment'
+ case 13 /* CarriageReturn */:
+ state |= ScannerState.NewLine | ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ break;
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ default:
+ state &= ~ScannerState.LastIsCR;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ // Unterminated multi-line comment.
+ tolerant(parser, context, 8 /* UnterminatedComment */);
+}
+/**
+ * Add comments
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param type Comment type
+ * @param commentStart Start position of comment
+ */
+function addComment(parser, context, type, commentStart) {
+ const { index, startIndex: start, startLine, startColumn, lastLine, lastColumn } = parser;
+ const comment = {
+ type,
+ value: parser.source.slice(commentStart, type === 'MultiLine' ? index - 2 : index),
+ start,
+ end: index,
+ };
+ if (context & Context.OptionsLoc) {
+ comment.loc = {
+ start: { line: startLine, column: startColumn },
+ end: { line: lastLine, column: lastColumn },
+ };
+ }
+ parser.comments.push(comment);
+} + +/**
+ * Scan
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-punctuatorss)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scan(parser, context) {
+ parser.flags &= ~Flags.NewLine | Flags.EscapedKeyword;
+ const lineStart = parser.index === 0;
+ let state = ScannerState.None;
+ while (parser.index < parser.length) {
+ if (!lineStart) {
+ parser.startIndex = parser.index;
+ parser.startColumn = parser.column;
+ parser.startLine = parser.line;
+ }
+ const first = parser.source.charCodeAt(parser.index);
+ if (first > 128 /* MaxAsciiCharacter */) {
+ switch (first) {
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ case 65519 /* ByteOrderMark */:
+ case 160 /* NonBreakingSpace */:
+ case 5760 /* Ogham */:
+ case 8192 /* EnQuad */:
+ case 8193 /* EmQuad */:
+ case 8194 /* EnSpace */:
+ case 8195 /* EmSpace */:
+ case 8196 /* ThreePerEmSpace */:
+ case 8197 /* FourPerEmSpace */:
+ case 8198 /* SixPerEmSpace */:
+ case 8199 /* FigureSpace */:
+ case 8200 /* PunctuationSpace */:
+ case 8201 /* ThinSpace */:
+ case 8202 /* HairSpace */:
+ case 8239 /* NarrowNoBreakSpace */:
+ case 8287 /* MathematicalSpace */:
+ case 12288 /* IdeographicSpace */:
+ case 65279 /* Zwnbs */:
+ case 8205 /* Zwj */:
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ return scanMaybeIdentifier(parser, context, first);
+ }
+ }
+ else {
+ // Note: Here we first get rid of LT and WS, then we make sure that the lookup time
+ // for the single punctuator char is short as possible. A single punctuator
+ // char is a valid token that cannot also be a prefix of a combination
+ // of long tokens - e.g. '(', ')' and '=' is valid. '==' is not.
+ switch (first) {
+ case 13 /* CarriageReturn */:
+ state |= ScannerState.NewLine | ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ break;
+ case 9 /* Tab */:
+ case 11 /* VerticalTab */:
+ case 12 /* FormFeed */:
+ case 32 /* Space */:
+ parser.index++;
+ parser.column++;
+ break;
+ // `(`
+ case 40 /* LeftParen */:
+ parser.index++;
+ parser.column++;
+ return 50331659 /* LeftParen */;
+ // `)`
+ case 41 /* RightParen */:
+ parser.index++;
+ parser.column++;
+ return 16 /* RightParen */;
+ // `,`
+ case 44 /* Comma */:
+ parser.index++;
+ parser.column++;
+ return 16777234 /* Comma */;
+ // `:`
+ case 58 /* Colon */:
+ parser.index++;
+ parser.column++;
+ return 16777237 /* Colon */;
+ // `;`
+ case 59 /* Semicolon */:
+ parser.index++;
+ parser.column++;
+ return 17825809 /* Semicolon */;
+ // `?`
+ case 63 /* QuestionMark */:
+ parser.index++;
+ parser.column++;
+ return 22 /* QuestionMark */;
+ // `]`
+ case 93 /* RightBracket */:
+ parser.index++;
+ parser.column++;
+ return 20 /* RightBracket */;
+ // `{`
+ case 123 /* LeftBrace */:
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ // `}`
+ case 125 /* RightBrace */:
+ parser.index++;
+ parser.column++;
+ return 17825807 /* RightBrace */;
+ // `~`
+ case 126 /* Tilde */:
+ parser.index++;
+ parser.column++;
+ return 301989934 /* Complement */;
+ // `[`
+ case 91 /* LeftBracket */:
+ parser.index++;
+ parser.column++;
+ return 41943059 /* LeftBracket */;
+ // `@`
+ case 64 /* At */:
+ parser.index++;
+ parser.column++;
+ return 120 /* At */;
+ // `/`, `/=`, `/>`
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774773 /* Divide */;
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipSingleLineComment(parser, context, state, 'SingleLine');
+ continue;
+ }
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipMultiLineComment(parser, context, state);
+ continue;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 100663333 /* DivideAssign */;
+ }
+ default:
+ return 167774773 /* Divide */;
+ }
+ }
+ // `-`, `--`, `-=`
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++; // skip `-`
+ const next = parser.source.charCodeAt(parser.index);
+ switch (next) {
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++;
+ if ((state & ScannerState.NewLine || lineStart) &&
+ consumeOpt(parser, 62 /* GreaterThan */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLClose');
+ continue;
+ }
+ return 570425372 /* Decrement */;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 67108899 /* SubtractAssign */;
+ }
+ default:
+ return 436209968 /* Subtract */;
+ }
+ }
+ // `<`, `<=`, `<<`, `<<=`, `</`, <!--
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++; // skip `<`
+ if (consumeOpt(parser, 33 /* Exclamation */) &&
+ consumeOpt(parser, 45 /* Hyphen */) &&
+ consumeOpt(parser, 45 /* Hyphen */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLOpen');
+ continue;
+ }
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 61 /* EqualSign */) ?
+ 67108894 /* ShiftLeftAssign */ :
+ 167774273 /* ShiftLeft */;
+ case 61 /* EqualSign */:
+ parser.index++;
+ parser.column++;
+ return 167774013 /* LessThanOrEqual */;
+ case 47 /* Slash */:
+ {
+ if (!(context & Context.OptionsJSX))
+ break;
+ const index = parser.index + 1;
+ // Check that it's not a comment start.
+ if (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 42 /* Asterisk */ || next === 47 /* Slash */)
+ break;
+ }
+ parser.index++;
+ parser.column++;
+ return 25 /* JSXClose */;
+ }
+ default: // ignore
+ return 167774015 /* LessThan */;
+ }
+ // `!`, `!=`, `!==`
+ case 33 /* Exclamation */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 301989933 /* Negate */;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773756 /* LooseNotEqual */;
+ return 167773754 /* StrictNotEqual */;
+ // `'string'`, `"string"`
+ case 39 /* SingleQuote */:
+ case 34 /* DoubleQuote */:
+ return scanString(parser, context, first);
+ // `%`, `%=`
+ case 37 /* Percent */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167774772 /* Modulo */;
+ return 67108902 /* ModuloAssign */;
+ // `&`, `&&`, `&=`
+ case 38 /* Ampersand */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 38 /* Ampersand */) {
+ parser.index++;
+ parser.column++;
+ return 169869879 /* LogicalAnd */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108905 /* BitwiseAndAssign */;
+ }
+ return 167773508 /* BitwiseAnd */;
+ }
+ // `*`, `**`, `*=`, `**=`
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774771 /* Multiply */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108900 /* MultiplyAssign */;
+ }
+ if (next !== 42 /* Asterisk */)
+ return 167774771 /* Multiply */;
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167775030 /* Exponentiate */;
+ return 67108897 /* ExponentiateAssign */;
+ }
+ // `+`, `++`, `+=`
+ case 43 /* Plus */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 436209967 /* Add */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */) {
+ parser.index++;
+ parser.column++;
+ return 570425371 /* Increment */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108898 /* AddAssign */;
+ }
+ return 436209967 /* Add */;
+ }
+ // `\\u{N}var`
+ case 92 /* Backslash */:
+ return scanIdentifier(parser, context);
+ // `=`, `==`, `===`, `=>`
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 167773753 /* StrictEqual */;
+ }
+ else {
+ return 167773755 /* LooseEqual */;
+ }
+ }
+ else if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ return 10 /* Arrow */;
+ }
+ return 83886109 /* Assign */;
+ }
+ // `>`, `>=`, `>>`, `>>>`, `>>=`, `>>>=`
+ case 62 /* GreaterThan */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774016 /* GreaterThan */;
+ if (context & Context.InJSXChild)
+ return 167774016 /* GreaterThan */;
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 167774014 /* GreaterThanOrEqual */;
+ }
+ if (next !== 62 /* GreaterThan */)
+ return 167774016 /* GreaterThan */;
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 67108896 /* LogicalShiftRightAssign */;
+ }
+ else {
+ return 167774275 /* LogicalShiftRight */;
+ }
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108895 /* ShiftRightAssign */;
+ }
+ return 167774274 /* ShiftRight */;
+ }
+ // `^`, `^=`
+ case 94 /* Caret */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773254 /* BitwiseXor */;
+ return 67108903 /* BitwiseXorAssign */;
+ // ``string``
+ case 96 /* Backtick */:
+ return scanTemplate(parser, context);
+ // `|`, `||`, `|=`
+ case 124 /* VerticalBar */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 124 /* VerticalBar */) {
+ parser.index++;
+ parser.column++;
+ return 169869624 /* LogicalOr */;
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108904 /* BitwiseOrAssign */;
+ }
+ return 167772997 /* BitwiseOr */;
+ }
+ // `.`, `...`, `.123` (numeric literal)
+ case 46 /* Period */:
+ {
+ let index = parser.index + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 57 /* Nine */) {
+ scanNumericLiteral(parser, context, NumericState.Float);
+ return 33554434 /* NumericLiteral */;
+ }
+ else if (next === 46 /* Period */) {
+ index++;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 46 /* Period */) {
+ parser.index = index + 1;
+ parser.column += 3;
+ return 14 /* Ellipsis */;
+ }
+ }
+ parser.index++;
+ parser.column++;
+ return 16777229 /* Period */;
+ }
+ // `#`
+ case 35 /* Hash */:
+ {
+ parser.index++;
+ parser.column++;
+ const index = parser.index;
+ const next = parser.source.charCodeAt(index);
+ if (context & Context.OptionsShebang &&
+ lineStart &&
+ next === 33 /* Exclamation */) {
+ parser.index = index + 1;
+ skipSingleLineComment(parser, context, ScannerState.None, 'SheBang');
+ continue;
+ }
+ return scanPrivateName(parser, context);
+ }
+ // `0`...`9`
+ case 48 /* Zero */:
+ {
+ parser.index++;
+ parser.column++;
+ switch (parser.source.charCodeAt(parser.index)) {
+ // Hex number - '0x', '0X'
+ case 88 /* UpperX */:
+ case 120 /* LowerX */:
+ return scanHexIntegerLiteral(parser, context);
+ // Binary number - '0b', '0B'
+ case 66 /* UpperB */:
+ case 98 /* LowerB */:
+ return scanOctalOrBinary(parser, context, 2);
+ // Octal number - '0o', '0O'
+ case 79 /* UpperO */:
+ case 111 /* LowerO */:
+ return scanOctalOrBinary(parser, context, 8);
+ default:
+ // Implicit octal digits startign with '0'
+ return scanImplicitOctalDigits(parser, context);
+ }
+ }
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return scanNumericLiteral(parser, context);
+ // `a`...`z`, `A`...`Z`, `_var`, `$var`
+ case 65 /* UpperA */:
+ case 66 /* UpperB */:
+ case 67 /* UpperC */:
+ case 68 /* UpperD */:
+ case 69 /* UpperE */:
+ case 70 /* UpperF */:
+ case 71 /* UpperG */:
+ case 72 /* UpperH */:
+ case 73 /* UpperI */:
+ case 74 /* UpperJ */:
+ case 75 /* UpperK */:
+ case 76 /* UpperL */:
+ case 77 /* UpperM */:
+ case 78 /* UpperN */:
+ case 79 /* UpperO */:
+ case 80 /* UpperP */:
+ case 81 /* UpperQ */:
+ case 82 /* UpperR */:
+ case 83 /* UpperS */:
+ case 84 /* UpperT */:
+ case 85 /* UpperU */:
+ case 86 /* UpperV */:
+ case 87 /* UpperW */:
+ case 88 /* UpperX */:
+ case 89 /* UpperY */:
+ case 90 /* UpperZ */:
+ case 36 /* Dollar */:
+ case 95 /* Underscore */:
+ case 97 /* LowerA */:
+ case 98 /* LowerB */:
+ case 99 /* LowerC */:
+ case 100 /* LowerD */:
+ case 101 /* LowerE */:
+ case 102 /* LowerF */:
+ case 103 /* LowerG */:
+ case 104 /* LowerH */:
+ case 105 /* LowerI */:
+ case 106 /* LowerJ */:
+ case 107 /* LowerK */:
+ case 108 /* LowerL */:
+ case 109 /* LowerM */:
+ case 110 /* LowerN */:
+ case 111 /* LowerO */:
+ case 112 /* LowerP */:
+ case 113 /* LowerQ */:
+ case 114 /* LowerR */:
+ case 115 /* LowerS */:
+ case 116 /* LowerT */:
+ case 117 /* LowerU */:
+ case 118 /* LowerV */:
+ case 119 /* LowerW */:
+ case 120 /* LowerX */:
+ case 121 /* LowerY */:
+ case 122 /* LowerZ */:
+ default:
+ return scanIdentifier(parser, context, first);
+ }
+ }
+ }
+ return 1048576 /* EndOfSource */;
+} + +/**
+ * Scans regular expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanRegularExpression(parser, context) {
+ const bodyStart = parser.index;
+ let preparseState = RegexState.Empty;
+ loop: while (true) {
+ const ch = parser.source.charCodeAt(parser.index);
+ parser.index++;
+ parser.column++;
+ if (preparseState & RegexState.Escape) {
+ preparseState &= ~RegexState.Escape;
+ }
+ else {
+ switch (ch) {
+ case 47 /* Slash */:
+ if (!preparseState)
+ break loop;
+ else
+ break;
+ case 92 /* Backslash */:
+ preparseState |= RegexState.Escape;
+ break;
+ case 91 /* LeftBracket */:
+ preparseState |= RegexState.Class;
+ break;
+ case 93 /* RightBracket */:
+ preparseState &= RegexState.Escape;
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ report(parser, 7 /* UnterminatedRegExp */);
+ default: // ignore
+ }
+ }
+ if (parser.index >= parser.source.length) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ const bodyEnd = parser.index - 1;
+ let mask = RegexFlags.Empty;
+ const { index: flagStart } = parser;
+ loop: while (parser.index < parser.source.length) {
+ const code = parser.source.charCodeAt(parser.index);
+ switch (code) {
+ case 103 /* LowerG */:
+ if (mask & RegexFlags.Global)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'g');
+ mask |= RegexFlags.Global;
+ break;
+ case 105 /* LowerI */:
+ if (mask & RegexFlags.IgnoreCase)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'i');
+ mask |= RegexFlags.IgnoreCase;
+ break;
+ case 109 /* LowerM */:
+ if (mask & RegexFlags.Multiline)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'm');
+ mask |= RegexFlags.Multiline;
+ break;
+ case 117 /* LowerU */:
+ if (mask & RegexFlags.Unicode)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'u');
+ mask |= RegexFlags.Unicode;
+ break;
+ case 121 /* LowerY */:
+ if (mask & RegexFlags.Sticky)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'y');
+ mask |= RegexFlags.Sticky;
+ break;
+ case 115 /* LowerS */:
+ if (mask & RegexFlags.DotAll)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 's');
+ mask |= RegexFlags.DotAll;
+ break;
+ default:
+ if (!isIdentifierPart(code))
+ break loop;
+ report(parser, 16 /* UnexpectedTokenRegExpFlag */, fromCodePoint(code));
+ }
+ parser.index++;
+ parser.column++;
+ }
+ const flags = parser.source.slice(flagStart, parser.index);
+ const pattern = parser.source.slice(bodyStart, bodyEnd);
+ parser.tokenRegExp = { pattern, flags };
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ parser.tokenValue = validate(parser, context, pattern, flags);
+ return 33554436 /* RegularExpression */;
+}
+/**
+ * Validates regular expressions
+ *
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param pattern Regexp body
+ * @param flags Regexp flags
+ */
+function validate(parser, context, pattern, flags) {
+ if (!(context & Context.OptionsNode)) {
+ try {
+ }
+ catch (e) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ try {
+ return new RegExp(pattern, flags);
+ }
+ catch (e) {
+ return null;
+ }
+} + +// 12.15.5 Destructuring Assignment
+/**
+ * Parses either a binding identifier or binding pattern
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingIdentifierOrPattern(parser, context, args = []) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ return token === 41943052 /* LeftBrace */ ?
+ parserObjectAssignmentPattern(parser, context) :
+ parseArrayAssignmentPattern(parser, context, args);
+ }
+ else if (token & (262144 /* IsAwait */ | 1073741824 /* IsYield */)) {
+ if (token & 262144 /* IsAwait */ && (context & (Context.Async | Context.Module))) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ else if (token & 1073741824 /* IsYield */ && (context & (Context.Yield | Context.Strict))) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ }
+ args.push(parser.tokenValue);
+ return parseBindingIdentifier(parser, context);
+}
+/**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BindingIdentifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingIdentifier(parser, context) {
+ const { token } = parser;
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (context & Context.BlockScope && token === 33574984 /* LetKeyword */) {
+ // let is disallowed as a lexically bound name
+ tolerant(parser, context, 27 /* LetInLexicalBinding */);
+ }
+ else if (hasBit(token, 20480 /* FutureReserved */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ else if (!isValidIdentifier(context, token)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+}
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentRestElement(parser, context, args) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * Parse rest property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+// tslint:disable-next-line:function-name
+function AssignmentRestProperty(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const { token } = parser;
+ const argument = parseBindingIdentifierOrPattern(parser, context);
+ if (hasBit(token, 8388608 /* IsBindingPattern */))
+ tolerant(parser, context, 94 /* InvalidRestBindingPattern */);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * ArrayAssignmentPattern[Yield] :
+ * [ Elisionopt AssignmentRestElement[?Yield]opt ]
+ * [ AssignmentElementList[?Yield] ]
+ * [ AssignmentElementList[?Yield] , Elisionopt AssignmentRestElement[?Yield]opt ]
+ *
+ * AssignmentRestElement[Yield] :
+ * ... DestructuringAssignmentTarget[?Yield]
+ *
+ * AssignmentElementList[Yield] :
+ * AssignmentElisionElement[?Yield]
+ * AssignmentElementList[?Yield] , AssignmentElisionElement[?Yield]
+ *
+ * AssignmentElisionElement[Yield] :
+ * Elisionopt AssignmentElement[?Yield]
+ *
+ * AssignmentElement[Yield] :
+ * DestructuringAssignmentTarget[?Yield] Initializer[In,?Yield]opt
+ *
+ * DestructuringAssignmentTarget[Yield] :
+ * LeftHandSideExpression[?Yield]
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param Parser object
+ * @param Context masks
+ */
+function parseArrayAssignmentPattern(parser, context, args) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else {
+ if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseAssignmentRestElement(parser, context, args));
+ break;
+ }
+ else {
+ elements.push(parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseBindingInitializer));
+ }
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ // tslint:disable-next-line:no-object-literal-type-assertion
+ return finishNode(context, parser, pos, {
+ type: 'ArrayPattern',
+ elements,
+ });
+}
+/**
+ * Parse object assignment pattern
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parserObjectAssignmentPattern(parser, context) {
+ const pos = getLocation(parser);
+ const properties = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ properties.push(AssignmentRestProperty(parser, context));
+ break;
+ }
+ properties.push(parseAssignmentProperty(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ObjectPattern',
+ properties,
+ });
+}
+/** Parse assignment pattern
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param left LHS of assignment pattern
+ * @param pos Location
+ */
+function parseAssignmentPattern(parser, context, left, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse binding initializer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingInitializer(parser, context) {
+ const pos = getLocation(parser);
+ const left = parseBindingIdentifierOrPattern(parser, context);
+ return !consume(parser, context, 83886109 /* Assign */) ?
+ left :
+ finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseAssignmentExpression(parser, context | Context.AllowIn),
+ });
+}
+/**
+ * Parse assignment property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentProperty(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ let key;
+ let value;
+ let computed = false;
+ let shorthand = false;
+ // single name binding
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ key = parseIdentifier(parser, context);
+ shorthand = !consume(parser, context, 16777237 /* Colon */);
+ if (shorthand) {
+ const hasInitializer = consume(parser, context, 83886109 /* Assign */);
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (!isValidIdentifier(context, token))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ value = hasInitializer ? parseAssignmentPattern(parser, context, key, pos) : key;
+ }
+ else
+ value = parseBindingInitializer(parser, context);
+ }
+ else {
+ computed = token === 41943059 /* LeftBracket */;
+ key = parsePropertyName(parser, context);
+ expect(parser, context, 16777237 /* Colon */);
+ value = parseExpressionCoverGrammar(parser, context, parseBindingInitializer);
+ }
+ // Note! The specs specifically state that this is "assignment property", but
+ // nothing in ESTree specs explains the difference between this "property" and the "property" for object literals.
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ kind: 'init',
+ key,
+ computed,
+ value,
+ method: false,
+ shorthand,
+ });
+} + +// JSX Specification
+// https://facebook.github.io/jsx/
+/**
+ * Parses JSX element or JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXRootElement(parser, context) {
+ const pos = getLocation(parser);
+ let children = [];
+ let closingElement = null;
+ let selfClosing = false;
+ let openingElement;
+ expect(parser, context, 167774015 /* LessThan */);
+ const isFragment = parser.token === 167774016 /* GreaterThan */;
+ if (isFragment) {
+ openingElement = parseJSXOpeningFragment(parser, context, pos);
+ }
+ else {
+ const name = parseJSXElementName(parser, context);
+ const attributes = parseJSXAttributes(parser, context);
+ selfClosing = consume(parser, context, 167774773 /* Divide */);
+ openingElement = parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos);
+ }
+ if (isFragment)
+ return parseJSXFragment(parser, context, openingElement, pos);
+ if (!selfClosing) {
+ children = parseJSXChildren(parser, context);
+ closingElement = parseJSXClosingElement(parser, context);
+ const open = isEqualTagNames(openingElement.name);
+ const close = isEqualTagNames(closingElement.name);
+ if (open !== close)
+ report(parser, 85 /* ExpectedJSXClosingTag */, close);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'JSXElement',
+ children,
+ openingElement,
+ closingElement,
+ });
+}
+/**
+ * Parses JSX opening element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param name Element name
+ * @param attributes Element attributes
+ * @param selfClosing True if this is a selfclosing JSX Element
+ * @param pos Line / Column tracking
+ */
+function parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos) {
+ if (context & Context.InJSXChild && selfClosing)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningElement',
+ name,
+ attributes,
+ selfClosing,
+ });
+}
+/**
+ * Parse JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param openingElement Opening fragment
+ * @param pos Line / Column location
+ */
+function parseJSXFragment(parser, context, openingElement, pos) {
+ const children = parseJSXChildren(parser, context);
+ const closingFragment = parseJSXClosingFragment(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXFragment',
+ children,
+ openingElement,
+ closingFragment,
+ });
+}
+/**
+ * Parse JSX opening fragmentD
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXOpeningFragment(parser, context, pos) {
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningFragment',
+ });
+}
+/**
+ * Prime the scanner and advance to the next JSX token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextJSXToken(parser) {
+ return parser.token = scanJSXToken(parser);
+}
+/**
+ * Mini scanner
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXToken(parser) {
+ if (parser.index >= parser.source.length)
+ return 1048576 /* EndOfSource */;
+ parser.lastIndex = parser.startIndex = parser.index;
+ const char = parser.source.charCodeAt(parser.index);
+ if (char === 60 /* LessThan */) {
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 47 /* Slash */) ? 25 /* JSXClose */ : 167774015 /* LessThan */;
+ }
+ else if (char === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ }
+ while (parser.index < parser.source.length) {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 123 /* LeftBrace */ || next === 60 /* LessThan */)
+ break;
+ }
+ return 121 /* JSXText */;
+}
+/**
+ * Parses JSX children
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXChildren(parser, context) {
+ const children = [];
+ while (parser.token !== 25 /* JSXClose */) {
+ children.push(parseJSXChild(parser, context));
+ }
+ return children;
+}
+/**
+ * Parses JSX Text
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXText(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.source.slice(parser.startIndex, parser.index);
+ parser.token = scanJSXToken(parser);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXText',
+ value,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = value;
+ return node;
+}
+/**
+ * Parses JSX Child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXChild(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ case 121 /* JSXText */:
+ return parseJSXText(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpression(parser, context & ~Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context & ~Context.InJSXChild);
+ default:
+ report(parser, 0 /* Unexpected */);
+ }
+ return undefined; // note: get rid of this
+}
+/**
+ * Parses JSX attributes
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributes(parser, context) {
+ const attributes = [];
+ while (parser.index < parser.source.length) {
+ if (parser.token === 167774773 /* Divide */ || parser.token === 167774016 /* GreaterThan */)
+ break;
+ attributes.push(parseJSXAttribute(parser, context));
+ }
+ return attributes;
+}
+/**
+ * Parses JSX spread attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXSpreadAttribute(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadAttribute',
+ argument: expression,
+ });
+}
+/**
+ * Parses JSX namespace name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param namespace Identifier
+ * @param pos Line / Column location
+ */
+function parseJSXNamespacedName(parser, context, namespace, pos) {
+ expect(parser, context, 16777237 /* Colon */);
+ const name = parseJSXIdentifier(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXNamespacedName',
+ namespace,
+ name,
+ });
+}
+/**
+ * Parses JSX attribute name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributeName(parser, context) {
+ const pos = getLocation(parser);
+ const identifier = parseJSXIdentifier(parser, context);
+ return parser.token === 16777237 /* Colon */ ?
+ parseJSXNamespacedName(parser, context, identifier, pos) :
+ identifier;
+}
+/**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributeValue(parser, context) {
+ switch (scanJSXAttributeValue(parser, context)) {
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpressionContainer(parser, context | Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context | Context.InJSXChild);
+ default:
+ tolerant(parser, context, 87 /* InvalidJSXAttributeValue */);
+ return undefined; // note: get rid of this
+ }
+}
+/**
+ * Parses JSX Attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttribute(parser, context) {
+ const pos = getLocation(parser);
+ if (parser.token === 41943052 /* LeftBrace */)
+ return parseJSXSpreadAttribute(parser, context);
+ scanJSXIdentifier(parser);
+ const attrName = parseJSXAttributeName(parser, context);
+ const value = parser.token === 83886109 /* Assign */ ? parseJSXAttributeValue(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'JSXAttribute',
+ value: value,
+ name: attrName,
+ });
+}
+/**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXAttributeValue(parser, context) {
+ parser.lastIndex = parser.index;
+ const ch = parser.source.charCodeAt(parser.index);
+ switch (ch) {
+ case 34 /* DoubleQuote */:
+ case 39 /* SingleQuote */:
+ return scanJSXString(parser, context, ch);
+ default:
+ return nextToken(parser, context);
+ }
+}
+/**
+ * Parses JSX String
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote Code point
+ */
+function scanJSXString(parser, context, quote) {
+ const rawStart = parser.index;
+ parser.index++;
+ parser.column++;
+ let ret = '';
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ ret += fromCodePoint(ch);
+ parser.index++;
+ parser.column++;
+ ch = parser.source.charCodeAt(parser.index);
+ if (parser.index >= parser.source.length)
+ report(parser, 6 /* UnterminatedString */);
+ }
+ parser.index++;
+ parser.column++; // skip the quote
+ // raw
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(rawStart, parser.index);
+ parser.tokenValue = ret;
+ return 33554435 /* StringLiteral */;
+}
+/**
+ * Parses JJSX Empty Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXEmptyExpression(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXEmptyExpression',
+ });
+}
+/**
+ * Parses JSX Spread child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXSpreadChild(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpression(parser, context);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadChild',
+ expression,
+ });
+}
+/**
+ * Parses JSX Expression container
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXExpressionContainer(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ // Note: JSX Expressions can't be empty
+ if (parser.token === 17825807 /* RightBrace */)
+ tolerant(parser, context, 84 /* NonEmptyJSXExpression */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+}
+/**
+ * Parses JSX Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ if (parser.token === 14 /* Ellipsis */)
+ return parseJSXSpreadChild(parser, context);
+ const expression = parser.token === 17825807 /* RightBrace */ ?
+ parseJSXEmptyExpression(parser, context) :
+ parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+}
+/**
+ * Parses JSX Closing fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXClosingFragment(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ expect(parser, context, 167774016 /* GreaterThan */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingFragment',
+ });
+}
+/**
+ * Parses JSX Closing Element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXClosingElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ const name = parseJSXElementName(parser, context);
+ if (context & Context.InJSXChild)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingElement',
+ name,
+ });
+}
+/**
+ * Parses JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXIdentifier(parser, context) {
+ const { token, tokenValue: name, tokenRaw: raw } = parser;
+ if (!(token & (131072 /* IsIdentifier */ | 4096 /* Keyword */))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXIdentifier',
+ name,
+ });
+ if (context & Context.OptionsRawidentifiers)
+ node.raw = raw;
+ return node;
+}
+/**
+ * Parses JSX Member expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXMemberExpression(parser, context, expr, pos) {
+ // Note: In order to be able to parse cases like ''<A.B.C.D.E.foo-bar />', where the dash is located at the
+ // end, we must rescan for the JSX Identifier now. This because JSX identifiers differ from normal identifiers
+ scanJSXIdentifier(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXMemberExpression',
+ object: expr,
+ property: parseJSXIdentifier(parser, context),
+ });
+}
+/**
+ * Parses JSX Element name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXElementName(parser, context) {
+ const pos = getLocation(parser);
+ scanJSXIdentifier(parser);
+ let elementName = parseJSXIdentifier(parser, context);
+ if (parser.token === 16777237 /* Colon */)
+ return parseJSXNamespacedName(parser, context, elementName, pos);
+ while (consume(parser, context, 16777229 /* Period */)) {
+ elementName = parseJSXMemberExpression(parser, context, elementName, pos);
+ }
+ return elementName;
+}
+/**
+ * Scans JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXIdentifier(parser) {
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const firstCharPosition = parser.index;
+ let ch = parser.source.charCodeAt(parser.index);
+ while ((parser.index < parser.source.length) && (ch === 45 /* Hyphen */ || (isValidIdentifierPart(ch)))) {
+ ch = readNext(parser);
+ }
+ parser.tokenValue += parser.source.substr(firstCharPosition, parser.index - firstCharPosition);
+ }
+ return parser.token;
+} + +/**
+ * Expression :
+ * AssignmentExpression
+ * Expression , AssignmentExpression
+ *
+ * ExpressionNoIn :
+ * AssignmentExpressionNoIn
+ * ExpressionNoIn , AssignmentExpressionNoIn
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Expression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpression(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ return parser.token === 16777234 /* Comma */ ?
+ parseSequenceExpression(parser, context, expr, pos) :
+ expr;
+}
+/**
+ * Parse secuence expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSequenceExpression(parser, context, left, pos) {
+ const expressions = [left];
+ while (consume(parser, context, 16777234 /* Comma */)) {
+ expressions.push(parseExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+}
+/**
+ * Parse yield expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-YieldExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseYieldExpression(parser, context, pos) {
+ // YieldExpression[In] :
+ // yield
+ // yield [no LineTerminator here] AssignmentExpression[?In, Yield]
+ // yield [no LineTerminator here] * AssignmentExpression[?In, Yield]
+ // https://tc39.github.io/ecma262/#sec-generator-function-definitions-static-semantics-early-errors
+ if (context & Context.InParameter)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ expect(parser, context, 1107316842 /* YieldKeyword */);
+ let argument = null;
+ let delegate = false;
+ if (!(parser.flags & Flags.NewLine)) {
+ delegate = consume(parser, context, 167774771 /* Multiply */);
+ // 'Token.IsExpressionStart' bitmask contains the complete set of
+ // tokens that can appear after an AssignmentExpression, and none of them
+ // can start an AssignmentExpression.
+ if (delegate || parser.token & 33554432 /* IsExpressionStart */) {
+ argument = parseAssignmentExpression(parser, context);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'YieldExpression',
+ argument,
+ delegate,
+ });
+}
+/**
+ * AssignmentExpression :
+ * ConditionalExpression
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpression
+ * LeftHandSideExpression AssignmentOperator AssignmentExpression
+ *
+ * AssignmentExpressionNoIn :
+ * ConditionalExpressionNoIn
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpressionNoIn
+ * LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentExpression(parser, context) {
+ const pos = getLocation(parser);
+ let { token } = parser;
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ return parseYieldExpression(parser, context, pos);
+ let expr = token & 524288 /* IsAsync */ && lookahead(parser, context, nextTokenisIdentifierOrParen)
+ ? parserCoverCallExpressionAndAsyncArrowHead(parser, context)
+ : parseConditionalExpression(parser, context, pos);
+ if (parser.token === 10 /* Arrow */) {
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & (20480 /* FutureReserved */ | 4194304 /* IsEvalOrArguments */)) {
+ // Invalid: ' yield => { 'use strict'; 0 };'
+ if (token & 20480 /* FutureReserved */) {
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ }
+ expr = [expr];
+ }
+ return parseArrowFunction(parser, context &= ~Context.Async, pos, expr);
+ }
+ if (hasBit(parser.token, 67108864 /* IsAssignOp */)) {
+ token = parser.token;
+ if (context & Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ }
+ else if (consume(parser, context, 83886109 /* Assign */)) {
+ if (!(parser.flags & Flags.AllowDestructuring)) {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ // Only re-interpret if not inside a formal parameter list
+ if (!(context & Context.InParameter))
+ reinterpret(parser, context, expr);
+ if (context & Context.InParen)
+ parser.flags |= Flags.SimpleParameterList;
+ if (parser.token & 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ else if (context & Context.InParen &&
+ context & (Context.Strict | Context.Yield) &&
+ parser.token & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasYield;
+ }
+ }
+ else {
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ nextToken(parser, context);
+ }
+ const right = parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ parser.pendingExpressionError = null;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentExpression',
+ left: expr,
+ operator: tokenDesc(token),
+ right,
+ });
+ }
+ return expr;
+}
+/**
+ * Parse conditional expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ConditionalExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseConditionalExpression(parser, context, pos) {
+ const test = parseBinaryExpression(parser, context, 0, pos);
+ if (!consume(parser, context, 22 /* QuestionMark */))
+ return test;
+ const consequent = parseExpressionCoverGrammar(parser, context & ~Context.AllowDecorator | Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16777237 /* Colon */);
+ return finishNode(context, parser, pos, {
+ type: 'ConditionalExpression',
+ test,
+ consequent,
+ alternate: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse binary expression.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-exp-operator)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-additive-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-bitwise-shift-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-equality-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-relational-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-multiplicative-operators)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param minPrec Minimum precedence value
+ * @param pos Line / Column info
+ * @param Left Left hand side of the binary expression
+ */
+function parseBinaryExpression(parser, context, minPrec, pos, left = parseUnaryExpression(parser, context)) {
+ // Shift-reduce parser for the binary operator part of the JS expression
+ // syntax.
+ const bit = context & Context.AllowIn ^ Context.AllowIn;
+ while (hasBit(parser.token, 167772160 /* IsBinaryOp */)) {
+ const t = parser.token;
+ const prec = t & 3840 /* Precedence */;
+ const delta = (t === 167775030 /* Exponentiate */) << 8 /* PrecStart */;
+ if (bit && t === 167786289 /* InKeyword */)
+ break;
+ // When the next token is no longer a binary operator, it's potentially the
+ // start of an expression, so we break the loop
+ if (prec + delta <= minPrec)
+ break;
+ nextToken(parser, context);
+ left = finishNode(context, parser, pos, {
+ type: t & 2097152 /* IsLogical */ ? 'LogicalExpression' : 'BinaryExpression',
+ left,
+ right: parseBinaryExpression(parser, context & ~Context.AllowIn, prec, getLocation(parser)),
+ operator: tokenDesc(t),
+ });
+ }
+ return left;
+}
+/**
+ * Parse await expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AwaitExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ */
+function parseAwaitExpression(parser, context, pos) {
+ if (context & Context.InParameter)
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ expect(parser, context, 34017389 /* AwaitKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'AwaitExpression',
+ argument: parseUnaryExpression(parser, context),
+ });
+}
+/**
+ * Parses unary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UnaryExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseUnaryExpression(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ if (hasBit(token, 301989888 /* IsUnaryOp */)) {
+ nextToken(parser, context);
+ if (parser.flags & Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ const argument = parseExpressionCoverGrammar(parser, context, parseUnaryExpression);
+ if (parser.token === 167775030 /* Exponentiate */) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & Context.Strict && token === 302002219 /* DeleteKeyword */) {
+ if (argument.type === 'Identifier') {
+ tolerant(parser, context, 43 /* StrictDelete */);
+ }
+ else if (isPropertyWithPrivateFieldKey(argument)) {
+ tolerant(parser, context, 44 /* DeletePrivateField */);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'UnaryExpression',
+ operator: tokenDesc(token),
+ argument,
+ prefix: true,
+ });
+ }
+ return context & Context.Async && token & 262144 /* IsAwait */
+ ? parseAwaitExpression(parser, context, pos)
+ : parseUpdateExpression(parser, context, pos);
+}
+/**
+ * Parses update expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UpdateExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseUpdateExpression(parser, context, pos) {
+ const { token } = parser;
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */)) {
+ nextToken(parser, context);
+ const expr = parseLeftHandSideExpression(parser, context, pos);
+ validateUpdateExpression(parser, context, expr, 'Prefix');
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expr,
+ operator: tokenDesc(token),
+ prefix: true,
+ });
+ }
+ else if (context & Context.OptionsJSX && token === 167774015 /* LessThan */) {
+ return parseJSXRootElement(parser, context | Context.InJSXChild);
+ }
+ const expression = parseLeftHandSideExpression(parser, context, pos);
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */) && !(parser.flags & Flags.NewLine)) {
+ validateUpdateExpression(parser, context, expression, 'Postfix');
+ const operator = parser.token;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expression,
+ operator: tokenDesc(operator),
+ prefix: false,
+ });
+ }
+ return expression;
+}
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseRestElement(parser, context, args = []) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (context & Context.InParen && parser.token & 262144 /* IsAwait */)
+ parser.flags |= Flags.HasAwait;
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * Parse spread element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SpreadElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSpreadElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+}
+/**
+ * Parse left hand side expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LeftHandSideExpression)
+ *
+ * @param Parser Parer instance
+ * @param Context Contextmasks
+ * @param pos Location info
+ */
+function parseLeftHandSideExpression(parser, context, pos) {
+ const expr = context & Context.OptionsNext && parser.token === 33566810 /* ImportKeyword */
+ ? parseCallImportOrMetaProperty(parser, context | Context.AllowIn)
+ : parseMemberExpression(parser, context | Context.AllowIn, pos);
+ return parseCallExpression(parser, context | Context.AllowIn, pos, expr);
+}
+/**
+ * Parse member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ * @param expr Expression
+ */
+function parseMemberExpression(parser, context, pos, expr = parsePrimaryExpression(parser, context)) {
+ while (true) {
+ switch (parser.token) {
+ case 16777229 /* Period */: {
+ consume(parser, context, 16777229 /* Period */);
+ parser.flags = parser.flags & ~Flags.AllowBinding | Flags.AllowDestructuring;
+ const property = parseIdentifierNameOrPrivateName(parser, context);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: false,
+ property,
+ });
+ continue;
+ }
+ case 41943059 /* LeftBracket */: {
+ consume(parser, context, 41943059 /* LeftBracket */);
+ parser.flags = parser.flags & ~Flags.AllowBinding | Flags.AllowDestructuring;
+ const property = parseExpression(parser, context);
+ expect(parser, context, 20 /* RightBracket */);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: true,
+ property,
+ });
+ continue;
+ }
+ case 33554441 /* TemplateTail */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplateLiteral(parser, context),
+ });
+ continue;
+ }
+ case 33554440 /* TemplateCont */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplate(parser, context | Context.TaggedTemplate),
+ });
+ continue;
+ }
+ default:
+ return expr;
+ }
+ }
+}
+/**
+ * Parse call expression
+ *
+ * @param parser Parer instance
+ * @param context Context masks
+ * @param pos Line / Colum info
+ * @param expr Expression
+ */
+function parseCallExpression(parser, context, pos, expr) {
+ while (true) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ if (parser.token !== 50331659 /* LeftParen */)
+ return expr;
+ const args = parseArgumentList(parser, context & ~Context.AllowDecorator);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+}
+/**
+ * Parse cover call expression and async arrow head
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CoverCallExpressionAndAsyncArrowHead)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parserCoverCallExpressionAndAsyncArrowHead(parser, context) {
+ const pos = getLocation(parser);
+ let expr = parseMemberExpression(parser, context | Context.AllowIn, pos);
+ // Here we jump right into it and parse a simple, faster sub-grammar for
+ // async arrow / async identifier + call expression. This could have been done different
+ // but ESTree sucks!
+ //
+ // - J.K. Thomas
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (parser.token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */);
+ return parseAsyncArrowFunction(parser, context, ModifierState.Await, pos, [parseAndClassifyIdentifier(parser, context)]);
+ }
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ while (parser.token === 50331659 /* LeftParen */) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ const args = parseAsyncArgumentList(parser, context);
+ if (parser.token === 10 /* Arrow */) {
+ expr = parseAsyncArrowFunction(parser, context, ModifierState.Await, pos, args);
+ break;
+ }
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ return expr;
+}
+/**
+ * Parse argument list
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parseArgumentList(parser, context) {
+ // ArgumentList :
+ // AssignmentOrSpreadExpression
+ // ArgumentList , AssignmentOrSpreadExpression
+ //
+ // AssignmentOrSpreadExpression :
+ // ... AssignmentExpression
+ // AssignmentExpression
+ expect(parser, context, 50331659 /* LeftParen */);
+ const expressions = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ expressions.push(parseSpreadElement(parser, context));
+ }
+ else {
+ if (context & Context.Yield && hasBit(parser.token, 1073741824 /* IsYield */)) {
+ parser.flags |= Flags.HasYield;
+ setPendingError(parser);
+ }
+ expressions.push(parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ }
+ if (parser.token !== 16 /* RightParen */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return expressions;
+}
+/**
+ * Parse argument list for async arrow / async call expression
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parseAsyncArgumentList(parser, context) {
+ // Here we are parsing an "extended" argument list tweaked to handle async arrows. This is
+ // done here to avoid overhead and possible performance loss if we only
+ // parse out a simple call expression - E.g 'async(foo, bar)' or 'async(foo, bar)()';
+ //
+ // - J.K. Thomas
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = [];
+ let { token } = parser;
+ let state = CoverCallState.Empty;
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ parser.flags |= Flags.SimpleParameterList;
+ args.push(parseSpreadElement(parser, context));
+ state = CoverCallState.HasSpread;
+ }
+ else {
+ token = parser.token;
+ state = validateAsyncArgumentList(parser, context, state);
+ args.push(restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ }
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ parser.flags &= ~Flags.AllowDestructuring;
+ if (state & CoverCallState.HasSpread)
+ state = CoverCallState.SeenSpread;
+ }
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & CoverCallState.SeenSpread) {
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ }
+ else if (state & CoverCallState.EvalOrArguments) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (state & CoverCallState.Yield) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ else if (parser.flags & Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (state & CoverCallState.Await || parser.flags & Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ }
+ return args;
+}
+/**
+ * Parse primary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PrimaryExpression)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parsePrimaryExpression(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ return parseIdentifier(parser, context);
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionOrIdentifier(parser, context);
+ case 50331659 /* LeftParen */:
+ return parseParenthesizedExpression(parser, context | Context.InParen);
+ case 41943059 /* LeftBracket */:
+ return restoreExpressionCoverGrammar(parser, context, parseArrayLiteral);
+ case 41943052 /* LeftBrace */:
+ return restoreExpressionCoverGrammar(parser, context, parseObjectLiteral);
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionExpression(parser, context);
+ case 33566727 /* NullKeyword */:
+ case 33566726 /* TrueKeyword */:
+ case 33566725 /* FalseKeyword */:
+ return parseNullOrTrueOrFalseLiteral(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassExpression(parser, context);
+ case 33566811 /* NewKeyword */:
+ return parseNewExpressionOrMetaProperty(parser, context);
+ case 33566813 /* SuperKeyword */:
+ return parseSuperProperty(parser, context);
+ case 33554551 /* BigIntLiteral */:
+ return parseBigIntLiteral(parser, context);
+ case 33566815 /* ThisKeyword */:
+ return parseThisExpression(parser, context);
+ case 115 /* Hash */:
+ return parseIdentifierNameOrPrivateName(parser, context);
+ case 167774773 /* Divide */:
+ case 100663333 /* DivideAssign */:
+ scanRegularExpression(parser, context);
+ return parseRegularExpressionLiteral(parser, context);
+ case 33554441 /* TemplateTail */:
+ return parseTemplateLiteral(parser, context);
+ case 33554440 /* TemplateCont */:
+ return parseTemplate(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetAsIdentifier(parser, context);
+ case 12369 /* DoKeyword */:
+ if (context & Context.OptionsExperimental)
+ return parseDoExpression(parser, context);
+ default:
+ return parseAndClassifyIdentifier(parser, context);
+ }
+}
+/**
+ * Parse do expression (*experimental*)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDoExpression(parser, context) {
+ // AssignmentExpression ::
+ // do '{' StatementList '}'
+ const pos = getLocation(parser);
+ expect(parser, context, 12369 /* DoKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'DoExpression',
+ body: parseBlockStatement(parser, context)
+ });
+}
+/**
+ * Parse 'let' as identifier in 'sloppy mode', and throws
+ * in 'strict mode' / 'module code'. We also avoid a lookahead on the
+ * ASI restictions while checking this after parsing out the 'let' keyword
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+function parseLetAsIdentifier(parser, context) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ if (parser.flags & Flags.NewLine) {
+ if (parser.token === 41943059 /* LeftBracket */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, 'let');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+}
+/**
+ * Parse either async function expression or identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+function parseAsyncFunctionOrIdentifier(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) :
+ parseIdentifier(parser, context);
+}
+/**
+ * Parses identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIdentifier(parser, context) {
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context | Context.TaggedTemplate);
+ const node = finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ if (context & Context.OptionsRawidentifiers)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parse regular expression literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseRegularExpressionLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenRegExp, tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ regex: tokenRegExp,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = tokenRaw;
+ return node;
+}
+/**
+ * Parses string and number literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StringLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.tokenValue;
+ if (context & Context.Strict && parser.flags & Flags.HasOctal) {
+ tolerant(parser, context, 61 /* StrictOctalLiteral */);
+ }
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parses BigInt literal (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/proposal-bigint/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBigIntLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ bigint: tokenRaw,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parses either null or boolean literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BooleanLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNullOrTrueOrFalseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const raw = tokenDesc(token);
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: token === 33566727 /* NullKeyword */ ? null : raw === 'true',
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = raw;
+ return node;
+}
+/**
+ * Parse this expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseThisExpression(parser, context) {
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ const pos = getLocation(parser);
+ nextToken(parser, context | Context.DisallowEscapedKeyword);
+ return finishNode(context, parser, pos, {
+ type: 'ThisExpression',
+ });
+}
+/**
+ * Parse identifier name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-IdentifierName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t token
+ */
+function parseIdentifierName(parser, context, t) {
+ if (!(t & (131072 /* IsIdentifier */ | 4096 /* Keyword */)))
+ tolerant(parser, context, 4 /* UnexpectedKeyword */, tokenDesc(t));
+ return parseIdentifier(parser, context);
+}
+/**
+ * Parse identifier name or private name (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIdentifierNameOrPrivateName(parser, context) {
+ if (!consume(parser, context, 115 /* Hash */))
+ return parseIdentifierName(parser, context, parser.token);
+ const { tokenValue } = parser;
+ const pos = getLocation(parser);
+ const name = tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+}
+/**
+ * Parse array literal
+ *
+ * ArrayLiteral :
+ * [ Elisionopt ]
+ * [ ElementList ]
+ * [ ElementList , Elisionopt ]
+ *
+ * ElementList :
+ * Elisionopt AssignmentExpression
+ * Elisionopt ... AssignmentExpression
+ * ElementList , Elisionopt AssignmentExpression
+ * ElementList , Elisionopt SpreadElement
+ *
+ * Elision :
+ * ,
+ * Elision ,
+ *
+ * SpreadElement :
+ * ... AssignmentExpression
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseArrayLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseSpreadElement(parser, context));
+ if (parser.token !== 20 /* RightBracket */) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ else {
+ elements.push(restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ return finishNode(context, parser, pos, {
+ type: 'ArrayExpression',
+ elements,
+ });
+}
+/**
+ * Parses cover parenthesized expression and arrow parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-parseCoverParenthesizedExpressionAndArrowParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseParenthesizedExpression(parser, context) {
+ expect(parser, context, 50331659 /* LeftParen */);
+ if (consume(parser, context, 16 /* RightParen */)) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.token === 10 /* Arrow */)
+ return [];
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ const restExpr = [parseRestElement(parser, context)];
+ expect(parser, context, 16 /* RightParen */);
+ parser.flags = parser.flags & ~(Flags.AllowDestructuring | Flags.AllowBinding) | Flags.SimpleParameterList;
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return restExpr;
+ }
+ // Record the sequence position
+ const sequencepos = getLocation(parser);
+ let state = validateCoverParenthesizedExpression(parser, CoverParenthesizedState.None);
+ let expr = restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ // Sequence expression
+ if (parser.token === 16777234 /* Comma */) {
+ state |= CoverParenthesizedState.SequenceExpression;
+ const expressions = [expr];
+ while (consume(parser, context | Context.DisallowEscapedKeyword, 16777234 /* Comma */)) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (!(parser.flags & Flags.AllowBinding))
+ tolerant(parser, context, 77 /* NotBindable */);
+ parser.flags |= Flags.SimpleParameterList;
+ const restElement = parseRestElement(parser, context);
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ expressions.push(restElement);
+ return expressions;
+ }
+ else if (consume(parser, context, 16 /* RightParen */)) {
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return expressions;
+ }
+ else {
+ state = validateCoverParenthesizedExpression(parser, state);
+ expressions.push(restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ }
+ expr = finishNode(context, parser, sequencepos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & CoverParenthesizedState.HasEvalOrArguments) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (state & CoverParenthesizedState.HasReservedWords) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ else if (!(parser.flags & Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (parser.flags & Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (context & Context.Async && parser.flags & Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ parser.flags &= ~(Flags.AllowBinding | Flags.HasAwait | Flags.HasYield);
+ return (state & CoverParenthesizedState.SequenceExpression ? expr.expressions : [expr]);
+ }
+ parser.flags &= ~(Flags.HasAwait | Flags.HasYield | Flags.AllowBinding);
+ if (!isValidSimpleAssignmentTarget(expr))
+ parser.flags &= ~Flags.AllowDestructuring;
+ return expr;
+}
+/**
+ * Parses function expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & ModifierState.Generator) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty), isGenerator, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: false,
+ generator: !!(isGenerator & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parses async function or async generator expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ const isAwait = ModifierState.Await;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict || isAwait & ModifierState.Await)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ if (token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & ModifierState.Generator)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty), isGenerator | isAwait, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: true,
+ generator: !!(isGenerator & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parse computed property names
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ComputedPropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseComputedPropertyName(parser, context) {
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const key = parseAssignmentExpression(parser, context | Context.AllowIn);
+ expect(parser, context, 20 /* RightBracket */);
+ return key;
+}
+/**
+ * Parse property name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePropertyName(parser, context) {
+ switch (parser.token) {
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943059 /* LeftBracket */:
+ return parseComputedPropertyName(parser, context);
+ default:
+ return parseIdentifier(parser, context);
+ }
+}
+/**
+ * Parse object spread properties
+ *
+ * @see [Link](https://tc39.github.io/proposal-object-rest-spread/#Spread)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSpreadProperties(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (parser.token & 8388608 /* IsBindingPattern */)
+ parser.flags &= ~Flags.AllowDestructuring;
+ const argument = parseAssignmentExpression(parser, context | Context.AllowIn);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+}
+/**
+ * Parses object literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ObjectLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseObjectLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const properties = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ properties.push(parser.token === 14 /* Ellipsis */ ?
+ parseSpreadProperties(parser, context) :
+ parsePropertyDefinition(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ parser.flags &= ~Flags.HasProtoField;
+ return finishNode(context, parser, pos, {
+ type: 'ObjectExpression',
+ properties,
+ });
+}
+/**
+ * Parse property definition
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyDefinition)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePropertyDefinition(parser, context) {
+ const pos = getLocation(parser);
+ const flags = parser.flags;
+ let value;
+ let state = consume(parser, context, 167774771 /* Multiply */) ? ObjectState.Generator | ObjectState.Method : ObjectState.Method;
+ const t = parser.token;
+ let key = parsePropertyName(parser, context);
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ else if (!(state & ObjectState.Generator) && t & 524288 /* IsAsync */ && !(parser.flags & Flags.NewLine)) {
+ state |= consume(parser, context, 167774771 /* Multiply */) ? ObjectState.Generator | ObjectState.Async : ObjectState.Async;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69743 /* GetKeyword */) {
+ state = state & ~ObjectState.Method | ObjectState.Getter;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69744 /* SetKeyword */) {
+ state = state & ~ObjectState.Method | ObjectState.Setter;
+ key = parsePropertyName(parser, context);
+ }
+ if (state & (ObjectState.Getter | ObjectState.Setter)) {
+ if (state & ObjectState.Generator)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ state &= ~ObjectState.Method;
+ if (parser.token === 16777237 /* Colon */) {
+ if ((state & (ObjectState.Async | ObjectState.Generator))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ else if (t !== 41943059 /* LeftBracket */ && parser.tokenValue === '__proto__') {
+ if (parser.flags & Flags.HasProtoField) {
+ // Record the error and put it on hold until we've determined
+ // whether or not we're destructuring
+ setPendingExpressionError(parser, 63 /* DuplicateProto */);
+ }
+ else
+ parser.flags |= Flags.HasProtoField;
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ // Invalid: 'async ({a: await}) => 1'
+ if (parser.token & 262144 /* IsAwait */)
+ parser.flags |= Flags.HasAwait;
+ value = restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ }
+ else {
+ if ((state & (ObjectState.Generator | ObjectState.Async)) || !isValidIdentifier(context, t)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(t));
+ }
+ else if (context & (Context.Strict | Context.Yield) && t & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasYield;
+ }
+ state |= ObjectState.Shorthand;
+ if (parser.token === 83886109 /* Assign */) {
+ if (context & Context.Strict && t & 4194304 /* IsEvalOrArguments */) {
+ report(parser, 47 /* StrictEvalArguments */);
+ }
+ else
+ setPendingExpressionError(parser, 91 /* InvalidCoverInitializedName */);
+ expect(parser, context, 83886109 /* Assign */);
+ if (context & (Context.Strict | Context.Yield | Context.Async) && parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */)) {
+ setPendingError(parser);
+ parser.flags |= parser.token & 1073741824 /* IsYield */ ? Flags.HasYield : Flags.HasAwait;
+ }
+ value = parseAssignmentPattern(parser, context, key, pos);
+ }
+ else {
+ if (t & 262144 /* IsAwait */) {
+ if (context & Context.Async)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ value = key;
+ }
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ key,
+ value,
+ kind: !(state & ObjectState.Getter | state & ObjectState.Setter) ? 'init' : (state & ObjectState.Setter) ? 'set' : 'get',
+ computed: t === 41943059 /* LeftBracket */,
+ method: !!(state & ObjectState.Method),
+ shorthand: !!(state & ObjectState.Shorthand),
+ });
+}
+/**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseMethodDeclaration(parser, context, state) {
+ const pos = getLocation(parser);
+ const isGenerator = state & ObjectState.Generator ? ModifierState.Generator : ModifierState.None;
+ const isAsync = state & ObjectState.Async ? ModifierState.Await : ModifierState.None;
+ const { params, body } = swapContext(parser, context | Context.Method, isGenerator | isAsync, parseFormalListAndBody, state);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: !!(state & ObjectState.Async),
+ generator: !!(state & ObjectState.Generator),
+ expression: false,
+ id: null,
+ });
+}
+/**
+ * Parse arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseArrowFunction(parser, context, pos, params) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, '=>');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context & ~Context.Async, params, pos, ModifierState.None);
+}
+/**
+ * Parse async arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncArrowFunction(parser, context, state, pos, params) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context | Context.Async, params, pos, state);
+}
+/**
+ * Shared helper function for both async arrow and arrows
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+// https://tc39.github.io/ecma262/#prod-AsyncArrowFunction
+function parseArrowBody(parser, context, params, pos, state) {
+ parser.pendingExpressionError = null;
+ for (const i in params)
+ reinterpret(parser, context | Context.InParameter, params[i]);
+ const expression = parser.token !== 41943052 /* LeftBrace */;
+ const body = expression ? parseExpressionCoverGrammar(parser, context & ~(Context.Yield | Context.InParameter), parseAssignmentExpression) :
+ swapContext(parser, context & ~(Context.Yield | Context.AllowDecorator) | Context.InFunctionBody, state, parseFunctionBody);
+ return finishNode(context, parser, pos, {
+ type: 'ArrowFunctionExpression',
+ body,
+ params,
+ id: null,
+ async: !!(state & ModifierState.Await),
+ generator: false,
+ expression,
+ });
+}
+/**
+ * Parses formal parameters and function body.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFormalListAndBody(parser, context, state) {
+ const paramList = parseFormalParameters(parser, context | Context.InParameter, state);
+ const args = paramList.args;
+ const params = paramList.params;
+ const body = parseFunctionBody(parser, context & ~Context.AllowDecorator | Context.InFunctionBody, args);
+ return { params, body };
+}
+/**
+ * Parse funciton body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionBody(parser, context, params) {
+ // Note! The 'params' has an 'any' type now because it's really shouldn't be there. This should have been
+ // on the parser object instead. So for now the 'params' arg are only used within the
+ // 'parseFormalListAndBody' method, and not within the arrow function body.
+ const pos = getLocation(parser);
+ expect(parser, context | Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const body = [];
+ while (parser.token === 33554435 /* StringLiteral */) {
+ const { tokenRaw, tokenValue } = parser;
+ body.push(parseDirective(parser, context));
+ if (tokenRaw.length === /* length of prologue*/ 12 && tokenValue === 'use strict') {
+ if (parser.flags & Flags.SimpleParameterList) {
+ tolerant(parser, context, 64 /* IllegalUseStrict */);
+ }
+ else if (parser.flags & (Flags.HasStrictReserved | Flags.StrictFunctionName)) {
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ }
+ else if (parser.flags & Flags.StrictEvalArguments) {
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ }
+ context |= Context.Strict;
+ }
+ }
+ if (context & Context.Strict) {
+ validateParams(parser, context, params);
+ }
+ const { labelSet } = parser;
+ parser.labelSet = {};
+ const savedFlags = parser.flags;
+ parser.flags = parser.flags & ~(Flags.StrictFunctionName | Flags.StrictEvalArguments | Flags.InSwitchStatement | Flags.InIterationStatement) | Flags.AllowDestructuring;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ if (savedFlags & Flags.InIterationStatement)
+ parser.flags |= Flags.InIterationStatement;
+ if (savedFlags & Flags.InSwitchStatement)
+ parser.flags |= Flags.InSwitchStatement;
+ parser.labelSet = labelSet;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body,
+ });
+}
+/**
+ * Parse formal parameters
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param Parser object
+ * @param Context masks
+ * @param Optional objectstate. Default to none
+ */
+function parseFormalParameters(parser, context, state) {
+ // FormalParameterList :
+ // [empty]
+ // FunctionRestParameter
+ // FormalsList
+ // FormalsList , FunctionRestParameter
+ //
+ // FunctionRestParameter :
+ // ... BindingIdentifier
+ //
+ // FormalsList :
+ // FormalParameter
+ // FormalsList , FormalParameter
+ //
+ // FormalParameter :
+ // BindingElement
+ //
+ // BindingElement :
+ // SingleNameBinding
+ // BindingPattern Initializeropt
+ expect(parser, context, 50331659 /* LeftParen */);
+ parser.flags &= ~(Flags.SimpleParameterList | Flags.HasStrictReserved);
+ const args = [];
+ const params = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (state & ObjectState.Setter)
+ tolerant(parser, context, 67 /* BadSetterRestParameter */);
+ parser.flags |= Flags.SimpleParameterList;
+ params.push(parseRestElement(parser, context, args));
+ break;
+ }
+ params.push(parseFormalParameterList(parser, context, args));
+ if (!consume(parser, context, 16777234 /* Comma */))
+ break;
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ if (state & ObjectState.Setter && params.length !== 1) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Setter', 'one', '');
+ }
+ if (state & ObjectState.Getter && params.length > 0) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Getter', 'no', 's');
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return { params, args };
+}
+/**
+ * Parse formal parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFormalParameterList(parser, context, args) {
+ const pos = getLocation(parser);
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (hasBit(parser.token, 20480 /* FutureReserved */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ if (hasBit(parser.token, 4194304 /* IsEvalOrArguments */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ }
+ else {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ const left = parseBindingIdentifierOrPattern(parser, context, args);
+ if (!consume(parser, context, 83886109 /* Assign */))
+ return left;
+ if (parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */) && context & (Context.Yield | Context.Async)) {
+ tolerant(parser, context, parser.token & 262144 /* IsAwait */ ? 52 /* AwaitInParameter */ : 51 /* YieldInParameter */);
+ }
+ parser.flags |= Flags.SimpleParameterList;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse class expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassExpression(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const { token } = parser;
+ let state = ObjectState.None;
+ let id = null;
+ let superClass = null;
+ if ((token !== 41943052 /* LeftBrace */ && token !== 12372 /* ExtendsKeyword */)) {
+ if (context & Context.Async && token & 262144 /* IsAwait */) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context | Context.Strict);
+ }
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | Context.Strict, pos);
+ state |= ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context | Context.Strict, state);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ });
+}
+/**
+ * Parse class body and element list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElementList)
+ *
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassBodyAndElementList(parser, context, state) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const body = [];
+ let decorators = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (!consume(parser, context, 17825809 /* Semicolon */)) {
+ if (context & Context.OptionsExperimental) {
+ decorators = parseDecorators(parser, context);
+ if (parser.token === 17825807 /* RightBrace */)
+ report(parser, 92 /* TrailingDecorators */);
+ if (decorators.length !== 0 && parser.tokenValue === 'constructor') {
+ report(parser, 93 /* GeneratorConstructor */);
+ }
+ }
+ body.push(context & Context.OptionsNext && parser.token === 115 /* Hash */
+ ? parsePrivateFields(parser, context, decorators)
+ : parseClassElement(parser, context, state, decorators));
+ }
+ }
+ parser.flags &= ~Flags.HasConstructor;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ClassBody',
+ body,
+ });
+}
+/**
+ * Parse class element and class public instance fields & private instance fields
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElement)
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassElement(parser, context, state, decorators) {
+ const pos = getLocation(parser);
+ let { tokenValue, token } = parser;
+ const flags = parser.flags;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ state |= ObjectState.Generator;
+ }
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ if (parser.tokenValue === 'constructor') {
+ if (state & ObjectState.Generator)
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'generator');
+ else if (state & ObjectState.Heritage)
+ context |= Context.AllowSuperProperty;
+ state |= ObjectState.Constructor;
+ }
+ let key = parsePropertyName(parser, context);
+ let value;
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ if (token === 20585 /* StaticKeyword */) {
+ token = parser.token;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= ObjectState.Generator;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ if (parser.tokenValue === 'prototype')
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ state |= ObjectState.Static;
+ key = parsePropertyName(parser, context);
+ if (context & Context.OptionsNext && isInstanceField(parser)) {
+ if (tokenValue === 'constructor')
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ }
+ }
+ if (parser.token !== 50331659 /* LeftParen */) {
+ if (token & 524288 /* IsAsync */ && !(state & ObjectState.Generator) && !(parser.flags & Flags.NewLine)) {
+ token = parser.token;
+ tokenValue = parser.tokenValue;
+ state |= ObjectState.Async;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= ObjectState.Generator;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ key = parsePropertyName(parser, context);
+ }
+ else if ((token === 69743 /* GetKeyword */ || token === 69744 /* SetKeyword */)) {
+ state |= token === 69743 /* GetKeyword */ ? ObjectState.Getter : ObjectState.Setter;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ key = parsePropertyName(parser, context & ~Context.Strict);
+ }
+ if (tokenValue === 'prototype') {
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ }
+ else if (!(state & ObjectState.Static) && tokenValue === 'constructor') {
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'accessor');
+ }
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ if (!(state & ObjectState.Computed) && state & ObjectState.Constructor) {
+ if (parser.flags & Flags.HasConstructor)
+ report(parser, 12 /* DuplicateConstructor */);
+ else
+ parser.flags |= Flags.HasConstructor;
+ }
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ if (context & Context.OptionsNext)
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const kind = (state & ObjectState.Constructor) ? 'constructor' : (state & ObjectState.Getter) ? 'get' :
+ (state & ObjectState.Setter) ? 'set' : 'method';
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & ObjectState.Static),
+ computed: !!(state & ObjectState.Computed),
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & ObjectState.Static),
+ computed: !!(state & ObjectState.Computed),
+ key,
+ value,
+ });
+}
+/**
+ * Parses field definition.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFieldDefinition(parser, context, key, state, pos, decorators) {
+ if (state & ObjectState.Constructor)
+ tolerant(parser, context, 0 /* Unexpected */);
+ let value = null;
+ if (state & (ObjectState.Async | ObjectState.Generator))
+ tolerant(parser, context, 0 /* Unexpected */);
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & ObjectState.Computed),
+ static: !!(state & ObjectState.Static),
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & ObjectState.Computed),
+ static: !!(state & ObjectState.Static),
+ });
+}
+/**
+ * Parse private name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePrivateName(parser, context, pos) {
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+}
+/**
+ * Parses private instance fields
+ *
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePrivateFields(parser, context, decorators) {
+ const pos = getLocation(parser);
+ expect(parser, context | Context.InClass, 115 /* Hash */);
+ if (parser.tokenValue === 'constructor')
+ tolerant(parser, context, 41 /* PrivateFieldConstructor */);
+ const key = parsePrivateName(parser, context, pos);
+ if (parser.token === 50331659 /* LeftParen */)
+ return parsePrivateMethod(parser, context, key, pos, decorators);
+ let value = null;
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ });
+}
+function parsePrivateMethod(parser, context, key, pos, decorators) {
+ const value = parseMethodDeclaration(parser, context | Context.Strict, ObjectState.None);
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ });
+}
+/**
+ * Parse either call expression or import expressions
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCallImportOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ // Import.meta - Stage 3 proposal
+ if (consume(parser, context, 16777229 /* Period */)) {
+ if (context & Context.Module && parser.tokenValue === 'meta')
+ return parseMetaProperty(parser, context, id, pos);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ let expr = parseImportExpression(parser, context, pos);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16 /* RightParen */);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: [args],
+ });
+ return expr;
+}
+/**
+ * Parse Import() expression. (Stage 3 proposal)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+function parseImportExpression(parser, context, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'Import',
+ });
+}
+/**
+ * Parse meta property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Identifier
+ * @param pos Location
+ */
+function parseMetaProperty(parser, context, meta, pos) {
+ return finishNode(context, parser, pos, {
+ meta,
+ type: 'MetaProperty',
+ property: parseIdentifier(parser, context),
+ });
+}
+/**
+ * Parse new expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NewExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNewExpressionOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ if (consume(parser, context | Context.DisallowEscapedKeyword, 16777229 /* Period */)) {
+ if (parser.tokenValue !== 'target' ||
+ !(context & (Context.InParameter | Context.InFunctionBody)))
+ tolerant(parser, context, 53 /* MetaNotInFunctionBody */);
+ return parseMetaProperty(parser, context, id, pos);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'NewExpression',
+ callee: parseImportOrMemberExpression(parser, context, pos),
+ arguments: parser.token === 50331659 /* LeftParen */ ? parseArgumentList(parser, context) : [],
+ });
+}
+/**
+ * Parse either import or member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportOrMemberExpression(parser, context, pos) {
+ const { token } = parser;
+ if (context & Context.OptionsNext && token === 33566810 /* ImportKeyword */) {
+ // Invalid: '"new import(x)"'
+ if (lookahead(parser, context, nextTokenIsLeftParen))
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ // Fixes cases like ''new import.meta','
+ return parseCallImportOrMetaProperty(parser, context);
+ }
+ return parseMemberExpression(parser, context, pos);
+}
+/**
+ * Parse super property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SuperProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSuperProperty(parser, context) {
+ // SuperProperty[Yield, Await]:
+ // super[Expression[+In, ?Yield, ?Await]]
+ // super.IdentifierName
+ const pos = getLocation(parser);
+ expect(parser, context, 33566813 /* SuperKeyword */);
+ switch (parser.token) {
+ case 50331659 /* LeftParen */:
+ // The super property has to be within a class constructor
+ if (!(context & Context.AllowSuperProperty))
+ tolerant(parser, context, 54 /* BadSuperCall */);
+ break;
+ case 41943059 /* LeftBracket */:
+ case 16777229 /* Period */:
+ if (!(context & Context.Method))
+ tolerant(parser, context, 55 /* UnexpectedSuper */);
+ break;
+ default:
+ tolerant(parser, context, 56 /* LoneSuper */);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Super',
+ });
+}
+/**
+ * Parse template literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseTemplateLiteral(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions: [],
+ quasis: [parseTemplateSpans(parser, context)],
+ });
+}
+/**
+ * Parse template head
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param cooked Cooked template value
+ * @param raw Raw template value
+ * @param pos Current location
+ */
+function parseTemplateHead(parser, context, cooked = null, raw, pos) {
+ parser.token = consumeTemplateBrace(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked,
+ raw,
+ },
+ tail: false,
+ });
+}
+/**
+ * Parse template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expression Expression AST node
+ * @param quasis Array of Template elements
+ */
+function parseTemplate(parser, context, expressions = [], quasis = []) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554440 /* TemplateCont */);
+ expressions.push(parseExpression(parser, context));
+ const t = getLocation(parser);
+ quasis.push(parseTemplateHead(parser, context, tokenValue, tokenRaw, pos));
+ if (parser.token === 33554441 /* TemplateTail */) {
+ quasis.push(parseTemplateSpans(parser, context, t));
+ }
+ else {
+ parseTemplate(parser, context, expressions, quasis);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions,
+ quasis,
+ });
+}
+/**
+ * Parse template spans
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateSpans)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param loc Current AST node location
+ */
+function parseTemplateSpans(parser, context, pos = getLocation(parser)) {
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554441 /* TemplateTail */);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked: tokenValue,
+ raw: tokenRaw,
+ },
+ tail: true,
+ });
+}
+/**
+ * Parses decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDecoratorList(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'Decorator',
+ expression: parseLeftHandSideExpression(parser, context, pos)
+ });
+}
+/**
+ * Parses a list of decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDecorators(parser, context) {
+ const decoratorList = [];
+ while (consume(parser, context, 120 /* At */)) {
+ decoratorList.push(parseDecoratorList(parser, context | Context.AllowDecorator));
+ }
+ return decoratorList;
+} + +// Context masks
+var Context;
+(function (Context) {
+ Context[Context["Empty"] = 0] = "Empty";
+ Context[Context["OptionsNext"] = 1] = "OptionsNext";
+ Context[Context["OptionsRanges"] = 2] = "OptionsRanges";
+ Context[Context["OptionsJSX"] = 4] = "OptionsJSX";
+ Context[Context["OptionsRaw"] = 8] = "OptionsRaw";
+ Context[Context["OptionsLoc"] = 16] = "OptionsLoc";
+ Context[Context["OptionsGlobalReturn"] = 32] = "OptionsGlobalReturn";
+ Context[Context["OptionsComments"] = 64] = "OptionsComments";
+ Context[Context["OptionsShebang"] = 128] = "OptionsShebang";
+ Context[Context["OptionsRawidentifiers"] = 256] = "OptionsRawidentifiers";
+ Context[Context["OptionsTolerant"] = 512] = "OptionsTolerant";
+ Context[Context["OptionsNode"] = 1024] = "OptionsNode";
+ Context[Context["OptionsExperimental"] = 2048] = "OptionsExperimental";
+ Context[Context["Strict"] = 4096] = "Strict";
+ Context[Context["Module"] = 8192] = "Module";
+ Context[Context["TaggedTemplate"] = 16384] = "TaggedTemplate";
+ Context[Context["InClass"] = 32768] = "InClass";
+ Context[Context["AllowIn"] = 65536] = "AllowIn";
+ Context[Context["Async"] = 131072] = "Async";
+ Context[Context["Yield"] = 262144] = "Yield";
+ Context[Context["InParameter"] = 524288] = "InParameter";
+ Context[Context["InFunctionBody"] = 1048576] = "InFunctionBody";
+ Context[Context["AllowSingleStatement"] = 2097152] = "AllowSingleStatement";
+ Context[Context["BlockScope"] = 4194304] = "BlockScope";
+ Context[Context["ForStatement"] = 8388608] = "ForStatement";
+ Context[Context["RequireIdentifier"] = 16777216] = "RequireIdentifier";
+ Context[Context["Method"] = 33554432] = "Method";
+ Context[Context["AllowSuperProperty"] = 67108864] = "AllowSuperProperty";
+ Context[Context["InParen"] = 134217728] = "InParen";
+ Context[Context["InJSXChild"] = 268435456] = "InJSXChild";
+ Context[Context["DisallowEscapedKeyword"] = 536870912] = "DisallowEscapedKeyword";
+ Context[Context["AllowDecorator"] = 1073741824] = "AllowDecorator";
+ Context[Context["LocationTracker"] = 18] = "LocationTracker";
+})(Context || (Context = {}));
+// Mutual parser flags
+var Flags;
+(function (Flags) {
+ Flags[Flags["None"] = 0] = "None";
+ Flags[Flags["NewLine"] = 1] = "NewLine";
+ Flags[Flags["AllowBinding"] = 2] = "AllowBinding";
+ Flags[Flags["AllowDestructuring"] = 4] = "AllowDestructuring";
+ Flags[Flags["SimpleParameterList"] = 8] = "SimpleParameterList";
+ Flags[Flags["InSwitchStatement"] = 16] = "InSwitchStatement";
+ Flags[Flags["InIterationStatement"] = 32] = "InIterationStatement";
+ Flags[Flags["HasStrictReserved"] = 64] = "HasStrictReserved";
+ Flags[Flags["HasOctal"] = 128] = "HasOctal";
+ Flags[Flags["SimpleAssignmentTarget"] = 256] = "SimpleAssignmentTarget";
+ Flags[Flags["HasProtoField"] = 512] = "HasProtoField";
+ Flags[Flags["StrictFunctionName"] = 1024] = "StrictFunctionName";
+ Flags[Flags["StrictEvalArguments"] = 2048] = "StrictEvalArguments";
+ Flags[Flags["InFunctionBody"] = 4096] = "InFunctionBody";
+ Flags[Flags["HasAwait"] = 8192] = "HasAwait";
+ Flags[Flags["HasYield"] = 16384] = "HasYield";
+ Flags[Flags["EscapedKeyword"] = 32768] = "EscapedKeyword";
+ Flags[Flags["HasConstructor"] = 65536] = "HasConstructor";
+})(Flags || (Flags = {}));
+// Label tracking state
+var Labels;
+(function (Labels) {
+ Labels[Labels["None"] = 0] = "None";
+ Labels[Labels["NotNested"] = 1] = "NotNested";
+ Labels[Labels["Nested"] = 2] = "Nested";
+})(Labels || (Labels = {}));
+var NumericState;
+(function (NumericState) {
+ NumericState[NumericState["None"] = 0] = "None";
+ NumericState[NumericState["SeenSeparator"] = 1] = "SeenSeparator";
+ NumericState[NumericState["EigthOrNine"] = 2] = "EigthOrNine";
+ NumericState[NumericState["Float"] = 4] = "Float";
+ NumericState[NumericState["BigInt"] = 8] = "BigInt";
+})(NumericState || (NumericState = {}));
+var ScannerState;
+(function (ScannerState) {
+ ScannerState[ScannerState["None"] = 0] = "None";
+ ScannerState[ScannerState["NewLine"] = 1] = "NewLine";
+ ScannerState[ScannerState["LastIsCR"] = 2] = "LastIsCR";
+})(ScannerState || (ScannerState = {}));
+var ModifierState;
+(function (ModifierState) {
+ ModifierState[ModifierState["None"] = 0] = "None";
+ ModifierState[ModifierState["Generator"] = 1] = "Generator";
+ ModifierState[ModifierState["Await"] = 2] = "Await";
+})(ModifierState || (ModifierState = {}));
+var CoverParenthesizedState;
+(function (CoverParenthesizedState) {
+ CoverParenthesizedState[CoverParenthesizedState["None"] = 0] = "None";
+ CoverParenthesizedState[CoverParenthesizedState["SequenceExpression"] = 1] = "SequenceExpression";
+ CoverParenthesizedState[CoverParenthesizedState["HasEvalOrArguments"] = 2] = "HasEvalOrArguments";
+ CoverParenthesizedState[CoverParenthesizedState["HasReservedWords"] = 4] = "HasReservedWords";
+ CoverParenthesizedState[CoverParenthesizedState["HasYield"] = 8] = "HasYield";
+ CoverParenthesizedState[CoverParenthesizedState["HasBinding"] = 16] = "HasBinding";
+})(CoverParenthesizedState || (CoverParenthesizedState = {}));
+var Escape;
+(function (Escape) {
+ Escape[Escape["Empty"] = -1] = "Empty";
+ Escape[Escape["StrictOctal"] = -2] = "StrictOctal";
+ Escape[Escape["EightOrNine"] = -3] = "EightOrNine";
+ Escape[Escape["InvalidHex"] = -4] = "InvalidHex";
+ Escape[Escape["OutOfRange"] = -5] = "OutOfRange";
+})(Escape || (Escape = {}));
+var RegexFlags;
+(function (RegexFlags) {
+ RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
+ RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
+ RegexFlags[RegexFlags["Global"] = 2] = "Global";
+ RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
+ RegexFlags[RegexFlags["Unicode"] = 8] = "Unicode";
+ RegexFlags[RegexFlags["Sticky"] = 16] = "Sticky";
+ RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
+})(RegexFlags || (RegexFlags = {}));
+var CoverCallState;
+(function (CoverCallState) {
+ CoverCallState[CoverCallState["Empty"] = 0] = "Empty";
+ CoverCallState[CoverCallState["SeenSpread"] = 1] = "SeenSpread";
+ CoverCallState[CoverCallState["HasSpread"] = 2] = "HasSpread";
+ CoverCallState[CoverCallState["SimpleParameter"] = 4] = "SimpleParameter";
+ CoverCallState[CoverCallState["EvalOrArguments"] = 8] = "EvalOrArguments";
+ CoverCallState[CoverCallState["Yield"] = 16] = "Yield";
+ CoverCallState[CoverCallState["Await"] = 32] = "Await";
+})(CoverCallState || (CoverCallState = {}));
+var RegexState;
+(function (RegexState) {
+ RegexState[RegexState["Empty"] = 0] = "Empty";
+ RegexState[RegexState["Escape"] = 1] = "Escape";
+ RegexState[RegexState["Class"] = 2] = "Class";
+})(RegexState || (RegexState = {}));
+// Shared between class expr / decl & object literal
+var ObjectState;
+(function (ObjectState) {
+ ObjectState[ObjectState["None"] = 0] = "None";
+ ObjectState[ObjectState["Async"] = 1] = "Async";
+ ObjectState[ObjectState["Generator"] = 2] = "Generator";
+ ObjectState[ObjectState["Getter"] = 4] = "Getter";
+ ObjectState[ObjectState["Setter"] = 8] = "Setter";
+ ObjectState[ObjectState["Computed"] = 16] = "Computed";
+ ObjectState[ObjectState["Method"] = 32] = "Method";
+ ObjectState[ObjectState["Shorthand"] = 64] = "Shorthand";
+ ObjectState[ObjectState["Static"] = 128] = "Static";
+ ObjectState[ObjectState["Constructor"] = 256] = "Constructor";
+ ObjectState[ObjectState["Heritage"] = 512] = "Heritage";
+})(ObjectState || (ObjectState = {}));
+/**
+ * Validate break and continue statement
+ *
+ * @param parser Parser object
+ * @param label label
+ * @param isContinue true if validation continue statement
+ */
+function validateBreakOrContinueLabel(parser, context, label, isContinue) {
+ const state = hasLabel(parser, label);
+ if (!state)
+ tolerant(parser, context, 32 /* UnknownLabel */, label);
+ if (isContinue && !(state & Labels.Nested))
+ tolerant(parser, context, 31 /* IllegalContinue */, label);
+}
+/**
+ * Add label to the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+function addLabel(parser, label) {
+ if (parser.labelSet === undefined)
+ parser.labelSet = {};
+ parser.labelSet[`$${label}`] = isIterationStatement(parser.token) ? Labels.Nested : Labels.NotNested;
+}
+/**
+ * Remove label from the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+function popLabel(parser, label) {
+ parser.labelSet[`$${label}`] = Labels.None;
+}
+/**
+ * Returns either true or false. Depends if the label exist.
+ *
+ * @param parser Parser object
+ * @param label Label
+ */
+function hasLabel(parser, label) {
+ return !parser.labelSet ? Labels.None : parser.labelSet[`$${label}`];
+}
+/**
+ * Finish each the node for each parse. Set line / and column on the node if the
+ * options are set for it
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Line / column
+ * @param node AST node
+ */
+function finishNode(context, parser, meta, node) {
+ const { lastIndex, lastLine, lastColumn, sourceFile, index } = parser;
+ if (context & Context.LocationTracker) {
+ if (context & Context.OptionsRanges) {
+ node.start = meta.index;
+ node.end = lastIndex;
+ }
+ if (context & Context.OptionsLoc) {
+ node.loc = {
+ start: { line: meta.line, column: meta.column },
+ end: { line: lastLine, column: lastColumn }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ return node;
+}
+/**
+ * Consumes the next token. If the consumed token is not of the expected type
+ * then report an error and return null. Otherwise return true.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ * @param Err Optionally error message to be thrown
+ */
+function expect(parser, context, token, err = 1 /* UnexpectedToken */) {
+ if (parser.token !== token)
+ report(parser, err, tokenDesc(parser.token));
+ nextToken(parser, context);
+ return true;
+}
+/**
+ * If the next token matches the given token, this consumes the token
+ * and returns true. Otherwise return false.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ */
+function consume(parser, context, token) {
+ if (parser.token !== token)
+ return false;
+ nextToken(parser, context);
+ return true;
+}
+/**
+ * Advance and return the next token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextToken(parser, context) {
+ parser.lastIndex = parser.index;
+ parser.lastLine = parser.line;
+ parser.lastColumn = parser.column;
+ return (parser.token = scan(parser, context));
+}
+const hasBit = (mask, flags) => (mask & flags) === flags;
+/**
+ * Automatic Semicolon Insertion
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeSemicolon(parser, context) {
+ return parser.token & 1048576 /* ASI */ || parser.flags & Flags.NewLine
+ ? consume(parser, context, 17825809 /* Semicolon */)
+ : report(parser, !(context & Context.Async) && parser.token & 262144 /* IsAwait */ ? 38 /* AwaitOutsideAsync */ : 1 /* UnexpectedToken */, tokenDesc(parser.token));
+}
+/**
+ * Bit fiddle current grammar state and keep track of the state during the parse and restore
+ * it back to original state after finish parsing or throw.
+ *
+ * Ideas for this is basicly from V8 and SM, but also the Esprima parser does this in a similar way.
+ *
+ * However this implementation is an major improvement over similiar implementations, and
+ * does not require additonal bitmasks to be set / unset during the parsing outside this function.
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ * @param errMsg Optional error message
+ */
+function parseExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= Flags.AllowBinding | Flags.AllowDestructuring;
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // If there exist an pending expression error, we throw an error at
+ // the same location it was recorded
+ if (!!parser.pendingExpressionError) {
+ const { error, line, column, index } = parser.pendingExpressionError;
+ constructError(parser, context, index, line, column, error);
+ }
+ // Here we - just in case - disallow both binding and destructuring
+ // and only set the bitmaks if the previous flags (before the callback)
+ // is positive.
+ // Note that this bitmasks may have been turned off during parsing
+ // the callback
+ parser.flags &= ~(Flags.AllowBinding | Flags.AllowDestructuring);
+ if (flags & Flags.AllowBinding)
+ parser.flags |= Flags.AllowBinding;
+ if (flags & Flags.AllowDestructuring)
+ parser.flags |= Flags.AllowDestructuring;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+}
+/**
+ * Restor current grammar to previous state, or unset necessary bitmasks
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ */
+function restoreExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= Flags.AllowBinding | Flags.AllowDestructuring;
+ // Clear pending expression error
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // Both the previous bitmasks and bitmasks set during parsing the callback
+ // has to be positive for us to allow further binding or destructuring.
+ // Note that we allow both before the callback, so this is the only thing
+ // we need to check for.
+ if (!(parser.flags & Flags.AllowBinding) || !(flags & Flags.AllowBinding)) {
+ parser.flags &= ~Flags.AllowBinding;
+ }
+ if (!(parser.flags & Flags.AllowDestructuring) || !(flags & Flags.AllowDestructuring)) {
+ parser.flags &= ~Flags.AllowDestructuring;
+ }
+ // Here we either
+ // 1) restore to previous pending expression error
+ // or
+ // 2) if a pending expression error have been set during the parse (*only in object literal*)
+ // we overwrite previous error, and keep the new one
+ parser.pendingExpressionError = pendingExpressionError || parser.pendingExpressionError;
+ return res;
+}
+/**
+ * Set / unset yield / await context masks based on the
+ * ModifierState masks before invoking the callback and
+ * returning it's content
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Modifier state
+ * @param callback Callback function to be invoked
+ * @param methodState Optional Objectstate.
+ */
+function swapContext(parser, context, state, callback, methodState = ObjectState.None) {
+ context &= ~(Context.Async | Context.Yield | Context.InParameter);
+ if (state & ModifierState.Generator)
+ context |= Context.Yield;
+ if (state & ModifierState.Await)
+ context |= Context.Async;
+ return callback(parser, context, methodState);
+}
+/**
+ * Validates function params
+ *
+ * Note! In case anyone want to enable full scoping, replace 'paramSet' with an similiar
+ * object on the parser object itself. Then push / set the tokenValue to
+ * it an use an bitmask to mark it as an 'variable' not 'blockscope'. Then when
+ * implementing lexical scoping, you can use that for validation.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param params Array of token values
+ */
+function validateParams(parser, context, params) {
+ const paramSet = new Map();
+ for (let i = 0; i < params.length; i++) {
+ const key = `@${params[i]}`;
+ if (paramSet.get(key)) {
+ tolerant(parser, context, 81 /* ParamDupe */);
+ }
+ else
+ paramSet.set(key, true);
+ }
+}
+/**
+ * Reinterpret various expressions as pattern
+ * This is only used for assignment and arrow parameter list
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param node AST node
+ */
+const reinterpret = (parser, context, node) => {
+ switch (node.type) {
+ case 'Identifier':
+ if (context & Context.Strict && nameIsArgumentsOrEval(node.name))
+ report(parser, 3 /* InvalidEscapedReservedWord */);
+ case 'ArrayPattern':
+ case 'AssignmentPattern':
+ case 'ObjectPattern':
+ case 'RestElement':
+ case 'MetaProperty':
+ return;
+ case 'ArrayExpression':
+ node.type = 'ArrayPattern';
+ for (let i = 0; i < node.elements.length; ++i) {
+ // skip holes in pattern
+ if (node.elements[i] !== null) {
+ reinterpret(parser, context, node.elements[i]);
+ }
+ }
+ return;
+ case 'ObjectExpression':
+ node.type = 'ObjectPattern';
+ for (let i = 0; i < node.properties.length; i++) {
+ reinterpret(parser, context, node.properties[i]);
+ }
+ return;
+ case 'Property':
+ reinterpret(parser, context, node.value);
+ return;
+ case 'SpreadElement':
+ node.type = 'RestElement';
+ if (node.argument.type !== 'ArrayExpression' &&
+ node.argument.type !== 'ObjectExpression' &&
+ !isValidSimpleAssignmentTarget(node.argument)) {
+ tolerant(parser, context, 71 /* RestDefaultInitializer */);
+ }
+ reinterpret(parser, context, node.argument);
+ break;
+ case 'AssignmentExpression':
+ node.type = 'AssignmentPattern';
+ delete node.operator; // operator is not relevant for assignment pattern
+ reinterpret(parser, context, node.left); // recursive descent
+ return;
+ case 'MemberExpression':
+ if (!(context & Context.InParameter))
+ return;
+ // Fall through
+ default:
+ tolerant(parser, context, context & Context.InParameter ? 77 /* NotBindable */ : 73 /* InvalidDestructuringTarget */, node.type);
+ }
+};
+/**
+ * Does a lookahead.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param callback Callback function to be invoked
+ */
+function lookahead(parser, context, callback) {
+ const { tokenValue, flags, line, column, startColumn, index, lastColumn, startLine, lastLine, lastIndex, startIndex, tokenRaw, token, lastValue, tokenRegExp, labelSet, errors, errorLocation, pendingExpressionError } = parser;
+ const res = callback(parser, context);
+ parser.index = index;
+ parser.token = token;
+ parser.tokenValue = tokenValue;
+ parser.tokenValue = tokenValue;
+ parser.flags = flags;
+ parser.line = line;
+ parser.column = column;
+ parser.tokenRaw = tokenRaw;
+ parser.lastValue = lastValue;
+ parser.startColumn = startColumn;
+ parser.lastColumn = lastColumn;
+ parser.startLine = startLine;
+ parser.lastLine = lastLine;
+ parser.lastIndex = lastIndex;
+ parser.startIndex = startIndex;
+ parser.tokenRegExp = tokenRegExp;
+ parser.labelSet = labelSet;
+ parser.errors = errors;
+ parser.errorLocation = errorLocation;
+ parser.tokenRegExp = tokenRegExp;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+}
+/**
+ * Returns true if this an valid simple assignment target
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isValidSimpleAssignmentTarget(node) {
+ return node.type === 'Identifier' || node.type === 'MemberExpression' ? true : false;
+}
+/**
+ * Get current node location
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function getLocation(parser) {
+ return {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+}
+/**
+ * Returns true if this is an valid identifier
+ *
+ * @param context Context masks
+ * @param t Token
+ */
+function isValidIdentifier(context, t) {
+ if (context & Context.Strict) {
+ if (context & Context.Module && t & 262144 /* IsAwait */)
+ return false;
+ if (t & 1073741824 /* IsYield */)
+ return false;
+ return (t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (t & 69632 /* Contextual */) === 69632 /* Contextual */;
+ }
+ return ((t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (t & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (t & 20480 /* FutureReserved */) === 20480 /* FutureReserved */);
+}
+/**
+ * Returns true if this an valid lexical binding and not an identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isLexical(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return !!(token & (131072 /* IsIdentifier */ | 8388608 /* IsBindingPattern */ | 1073741824 /* IsYield */ | 262144 /* IsAwait */) ||
+ token === 33574984 /* LetKeyword */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */);
+}
+/**
+ * Returns true if this is end of case or default clauses
+ *
+ * @param parser Parser object
+ */
+function isEndOfCaseOrDefaultClauses(parser) {
+ return (parser.token === 12368 /* DefaultKeyword */ || parser.token === 17825807 /* RightBrace */ || parser.token === 12363 /* CaseKeyword */);
+}
+/**
+ * Validates if the next token in the stream is a left paren or a period
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsLeftParenOrPeriod(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */ || parser.token === 16777229 /* Period */;
+}
+/**
+ * Validates if the next token in the stream is a identifier or left paren
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenisIdentifierOrParen(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return token & (131072 /* IsIdentifier */ | 1073741824 /* IsYield */) || token === 50331659 /* LeftParen */;
+}
+/**
+ * Validates if the next token in the stream is left parenthesis.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsLeftParen(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */;
+}
+/**
+ * Validates if the next token in the stream is a function keyword on the same line.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsFuncKeywordOnSameLine(parser, context) {
+ nextToken(parser, context);
+ return !(parser.flags & Flags.NewLine) && parser.token === 33566808 /* FunctionKeyword */;
+}
+/**
+ * Checks if the property has any private field key
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isPropertyWithPrivateFieldKey(expr) {
+ return !expr.property ? false : expr.property.type === 'PrivateName';
+}
+/**
+ * Parse and classify itendifier - similar method as in V8
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAndClassifyIdentifier(parser, context) {
+ const { token, tokenValue: name } = parser;
+ if (context & Context.Strict) {
+ if (context & Context.Module && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (token & 69632 /* Contextual */) === 69632 /* Contextual */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (context & Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+}
+function nameIsArgumentsOrEval(value) {
+ return value === 'eval' || value === 'arguments';
+}
+/**
+ * Records an error from current position. If we report an error later, we'll do it from
+ * this position.
+ *
+ * @param parser Parser object
+ */
+function setPendingError(parser) {
+ parser.errorLocation = {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+}
+/**
+ * Returns tagName for JSX element
+ *
+ * @param elementName JSX Element name
+ */
+function isEqualTagNames(elementName) {
+ // tslint:disable-next-line:switch-default | this switch is exhaustive
+ switch (elementName.type) {
+ case 'JSXIdentifier':
+ return elementName.name;
+ case 'JSXNamespacedName':
+ return `${isEqualTagNames(elementName.namespace)}:${isEqualTagNames(elementName.name)}`;
+ case 'JSXMemberExpression':
+ return `${isEqualTagNames(elementName.object)}.${isEqualTagNames(elementName.property)}`;
+ }
+}
+/**
+ * Returns true if this is an instance field ( stage 3 proposal)
+ *
+ * @param parser Parser object
+ */
+function isInstanceField(parser) {
+ const { token } = parser;
+ return token === 17825807 /* RightBrace */ || token === 17825809 /* Semicolon */ || token === 83886109 /* Assign */;
+}
+/**
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expr AST expressions
+ * @param prefix prefix
+ */
+function validateUpdateExpression(parser, context, expr, prefix) {
+ if (context & Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 68 /* StrictLHSPrefixPostFix */, prefix);
+ }
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+}
+/**
+ * Record expression error
+ *
+ * @param parser Parser object
+ * @param error Error message
+ */
+function setPendingExpressionError(parser, type) {
+ parser.pendingExpressionError = {
+ error: errorMessages[type],
+ line: parser.line,
+ column: parser.column,
+ index: parser.index
+ };
+}
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+function validateCoverParenthesizedExpression(parser, state) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= CoverParenthesizedState.HasEvalOrArguments;
+ }
+ else if ((token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ setPendingError(parser);
+ state |= CoverParenthesizedState.HasReservedWords;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ }
+ return state;
+}
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+function validateAsyncArgumentList(parser, context, state) {
+ const { token } = parser;
+ if (!(parser.flags & Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= CoverCallState.EvalOrArguments;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ state |= CoverCallState.Await;
+ }
+ else if ((token & 1073741824 /* IsYield */) === 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ state |= CoverCallState.Yield;
+ }
+ }
+ return state;
+}
+/**
+ * Returns true if iteration statement. Otherwise return false,
+ *
+ * @param t Token
+ */
+function isIterationStatement(t) {
+ return t === 12369 /* DoKeyword */ || t === 12386 /* WhileKeyword */ || t === 12374 /* ForKeyword */;
+}
+/**
+ * Returns true if in or of token. Otherwise return false,
+ *
+ * @param t Token
+ */
+function isInOrOf(t) {
+ return t === 69746 /* OfKeyword */ || t === 167786289 /* InKeyword */;
+} + +/*@internal*/
+const errorMessages = {
+ [0 /* Unexpected */]: 'Unexpected token',
+ [1 /* UnexpectedToken */]: 'Unexpected token \'%0\'',
+ [2 /* ExpectedToken */]: 'Expected token \'%0\'',
+ [3 /* InvalidEscapedReservedWord */]: 'Keyword must not contain escaped characters',
+ [4 /* UnexpectedKeyword */]: 'Keyword \'%0\' is reserved',
+ [5 /* InvalidLHSInAssignment */]: 'Invalid left-hand side in assignment',
+ [6 /* UnterminatedString */]: 'Unterminated string literal',
+ [7 /* UnterminatedRegExp */]: 'Unterminated regular expression literal',
+ [8 /* UnterminatedComment */]: 'Unterminated MultiLineComment',
+ [9 /* UnterminatedTemplate */]: 'Unterminated template literal',
+ [10 /* UnexpectedChar */]: 'Invalid character \'%0\'',
+ [11 /* StrictOctalEscape */]: 'Octal escapes are not allowed in strict mode',
+ [13 /* InvalidEightAndNine */]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
+ [14 /* UnicodeOutOfRange */]: 'Unicode escape code point out of range',
+ [15 /* DuplicateRegExpFlag */]: 'Duplicate regular expression flag \'%0\'',
+ [16 /* UnexpectedTokenRegExpFlag */]: 'Unexpected regular expression flag \'%0\'',
+ [17 /* StrictLHSAssignment */]: 'Eval or arguments can\'t be assigned to in strict mode code',
+ [18 /* IllegalReturn */]: 'Illegal return statement',
+ [19 /* StrictFunction */]: 'In strict mode code, functions can only be declared at top level or inside a block',
+ [20 /* SloppyFunction */]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
+ [21 /* ForbiddenAsStatement */]: '%0 can\'t appear in single-statement context',
+ [22 /* GeneratorInSingleStatementContext */]: 'Generators can only be declared at the top level or inside a block',
+ [23 /* ForAwaitNotOf */]: '\'for await\' loop should be used with \'of\'',
+ [24 /* DeclarationMissingInitializer */]: 'Missing initializer in %0 declaration',
+ [25 /* ForInOfLoopInitializer */]: '\'for-%0\' loop variable declaration may not have an initializer',
+ [26 /* ForInOfLoopMultiBindings */]: 'Invalid left-hand side in for-%0 loop: Must have a single binding.',
+ [27 /* LetInLexicalBinding */]: 'let is disallowed as a lexically bound name',
+ [28 /* UnexpectedLexicalDeclaration */]: 'Lexical declaration cannot appear in a single-statement context',
+ [29 /* LabelRedeclaration */]: 'Label \'%0\' has already been declared',
+ [30 /* InvalidNestedStatement */]: '%0 statement must be nested within an iteration statement',
+ [31 /* IllegalContinue */]: 'Illegal continue statement: \'%0\' does not denote an iteration statement',
+ [32 /* UnknownLabel */]: 'Undefined label \'%0\'',
+ [33 /* MultipleDefaultsInSwitch */]: 'More than one default clause in switch statement',
+ [34 /* ImportExportDeclAtTopLevel */]: '%0 declarations may only appear at top level of a module',
+ [35 /* AsyncFunctionInSingleStatementContext */]: 'Async functions can only be declared at the top level or inside a block',
+ [36 /* InvalidLineBreak */]: 'No line break is allowed after \'%0\'',
+ [37 /* StrictModeWith */]: 'Strict mode code may not include a with statement',
+ [38 /* AwaitOutsideAsync */]: 'Await is only valid in async functions',
+ [39 /* UnNamedFunctionDecl */]: 'Function declaration must have a name in this context',
+ [12 /* DuplicateConstructor */]: 'Duplicate constructor method in class',
+ [40 /* DisallowedInContext */]: '\'%0\' may not be used as an identifier in this context',
+ [43 /* StrictDelete */]: 'Delete of an unqualified identifier in strict mode',
+ [44 /* DeletePrivateField */]: 'Private fields can not be deleted',
+ [41 /* PrivateFieldConstructor */]: 'Classes may not have a private field named \'#constructor\'',
+ [42 /* PublicFieldConstructor */]: 'Classes may not have a field named \'constructor\'',
+ [45 /* InvalidConstructor */]: 'Class constructor may not be a \'%0\'',
+ [46 /* UnexpectedReserved */]: 'Unexpected reserved word',
+ [47 /* StrictEvalArguments */]: 'Unexpected eval or arguments in strict mode',
+ [48 /* AwaitBindingIdentifier */]: '\'await\' is not a valid identifier inside an async function',
+ [49 /* YieldBindingIdentifier */]: '\'yield\' is not a valid identifier inside an generator function',
+ [50 /* UnexpectedStrictReserved */]: 'Unexpected strict mode reserved word',
+ [52 /* AwaitInParameter */]: 'Await expression not allowed in formal parameter',
+ [51 /* YieldInParameter */]: 'Yield expression not allowed in formal parameter',
+ [53 /* MetaNotInFunctionBody */]: 'new.target only allowed within functions',
+ [54 /* BadSuperCall */]: 'super() is not allowed in this context',
+ [55 /* UnexpectedSuper */]: 'Member access from super not allowed in this context',
+ [56 /* LoneSuper */]: 'Only "(" or "." or "[" are allowed after \'super\'',
+ [57 /* YieldReservedKeyword */]: '\'yield\' is a reserved keyword within generator function bodies',
+ [58 /* ContinuousNumericSeparator */]: 'Only one underscore is allowed as numeric separator',
+ [59 /* TrailingNumericSeparator */]: 'Numeric separators are not allowed at the end of numeric literals',
+ [60 /* ZeroDigitNumericSeparator */]: 'Numeric separator can not be used after leading 0.',
+ [61 /* StrictOctalLiteral */]: 'Legacy octal literals are not allowed in strict mode',
+ [62 /* InvalidLhsInAssignment */]: 'Invalid left-hand side in assignment',
+ [63 /* DuplicateProto */]: 'Property name __proto__ appears more than once in object literal',
+ [64 /* IllegalUseStrict */]: 'Illegal \'use strict\' directive in function with non-simple parameter list',
+ [65 /* StaticPrototype */]: 'Classes may not have a static property named \'prototype\'',
+ [66 /* AccessorWrongArgs */]: '%0 functions must have %1 argument%2',
+ [67 /* BadSetterRestParameter */]: 'Setter function argument must not be a rest parameter',
+ [68 /* StrictLHSPrefixPostFix */]: '%0 increment/decrement may not have eval or arguments operand in strict mode',
+ [69 /* InvalidElisonInObjPropList */]: 'Elision not allowed in object property list',
+ [70 /* ElementAfterRest */]: 'Rest element must be last element',
+ [72 /* ElementAfterSpread */]: 'Spread element must be last element',
+ [71 /* RestDefaultInitializer */]: 'Rest parameter may not have a default initializer',
+ [73 /* InvalidDestructuringTarget */]: 'Invalid destructuring assignment target',
+ [74 /* UnexpectedSurrogate */]: 'Unexpected surrogate pair',
+ [75 /* MalformedEscape */]: 'Malformed %0 character escape sequence',
+ [76 /* TemplateOctalLiteral */]: 'Template literals may not contain octal escape sequences',
+ [77 /* NotBindable */]: 'Invalid binding pattern',
+ [78 /* ParamAfterRest */]: 'Rest parameter must be last formal parameter',
+ [79 /* NoCatchOrFinally */]: 'Missing catch or finally after try',
+ [80 /* NewlineAfterThrow */]: 'Illegal newline after throw',
+ [81 /* ParamDupe */]: 'Duplicate parameter name not allowed in this context',
+ [82 /* AsAfterImportStart */]: 'Missing keyword \'as\' after import *',
+ [83 /* LabelNoColon */]: 'Labels must be followed by a \':\'',
+ [84 /* NonEmptyJSXExpression */]: 'JSX attributes must only be assigned a non-empty \'expression\'',
+ [85 /* ExpectedJSXClosingTag */]: 'Expected corresponding JSX closing tag for %0',
+ [86 /* AdjacentJSXElements */]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
+ [87 /* InvalidJSXAttributeValue */]: 'Invalid JSX attribute value',
+ [88 /* RestWithComma */]: 'Rest element may not have a trailing comma',
+ [89 /* UndefinedUnicodeCodePoint */]: 'Undefined Unicode code-point',
+ [90 /* HtmlCommentInModule */]: 'HTML comments are not allowed in modules',
+ [91 /* InvalidCoverInitializedName */]: 'Invalid shorthand property initializer',
+ [92 /* TrailingDecorators */]: 'Trailing decorator may be followed by method',
+ [93 /* GeneratorConstructor */]: 'Decorators can\'t be used with a constructor',
+ [94 /* InvalidRestBindingPattern */]: '`...` must be followed by an identifier in declaration contexts',
+};
+/**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param index The 0-based end index of the error.
+ * @param line The 0-based line position of the error.
+ * @param column The 0-based column position of the error.
+ * @param parser The 0-based end index of the current node.
+ * @param description Error description
+ */
+/*@internal*/
+function constructError(parser, context, index, line, column, description) {
+ const error = new SyntaxError(`Line ${line}, column ${column}: ${description}`);
+ error.index = index;
+ error.line = line;
+ error.column = column;
+ error.description = description;
+ if (context & Context.OptionsTolerant) {
+ parser.errors.push(error);
+ }
+ else
+ throw error;
+}
+/**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ */
+function getErrorLocation(parser) {
+ let { index, startLine: line, startColumn: column } = parser;
+ const errorLoc = parser.errorLocation;
+ if (!!errorLoc) {
+ index = errorLoc.index;
+ line = errorLoc.line;
+ column = errorLoc.column;
+ }
+ return { index, line, column };
+}
+/**
+ * Throws an error
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+/*@internal*/
+function report(parser, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, Context.Empty, index, line, column, errorMessage);
+}
+/**
+ * If in tolerant mode, all errors are pushed to a top-level error array containing
+ * otherwise throws
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+/*@internal*/
+function tolerant(parser, context, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, context, index, line, column, errorMessage);
+} + +// Declarations
+/**
+ * Parses class declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const id = (context & Context.RequireIdentifier && (parser.token !== 33685505 /* Identifier */))
+ ? null :
+ parseBindingIdentifier(parser, context | Context.Strict | Context.DisallowEscapedKeyword);
+ let state = ObjectState.None;
+ let superClass = null;
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | Context.Strict, pos);
+ state |= ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context & ~Context.RequireIdentifier | Context.Strict | Context.InClass, state);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body
+ });
+}
+/**
+ * Parses function declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ let isGenerator = ModifierState.None;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ if (context & Context.AllowSingleStatement && !(context & Context.InFunctionBody)) {
+ tolerant(parser, context, 22 /* GeneratorInSingleStatementContext */);
+ }
+ isGenerator = ModifierState.Generator;
+ }
+ return parseFunctionDeclarationBody(parser, context, isGenerator, pos);
+}
+/**
+ * Parses out a function declartion body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context mask
+ * @param state Modifier state
+ * @param pos Current location
+ */
+function parseFunctionDeclarationBody(parser, context, state, pos) {
+ const { token } = parser;
+ let id = null;
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (context & Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (token !== 50331659 /* LeftParen */) {
+ id = parseBindingIdentifier(parser, context);
+ // Unnamed functions are forbidden in statement context.
+ }
+ else if (!(context & Context.RequireIdentifier))
+ tolerant(parser, context, 39 /* UnNamedFunctionDecl */);
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty | Context.RequireIdentifier), state, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionDeclaration',
+ params,
+ body,
+ async: !!(state & ModifierState.Await),
+ generator: !!(state & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parses async function or async generator declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isAwait = ModifierState.Await;
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ return parseFunctionDeclarationBody(parser, context, isGenerator | isAwait, pos);
+}
+/**
+ * VariableDeclaration :
+ * BindingIdentifier Initializeropt
+ * BindingPattern Initializer
+ *
+ * VariableDeclarationNoIn :
+ * BindingIdentifier InitializerNoInopt
+ * BindingPattern InitializerNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableDeclaration(parser, context, isConst) {
+ const pos = getLocation(parser);
+ const isBindingPattern = (parser.token & 8388608 /* IsBindingPattern */) !== 0;
+ const id = parseBindingIdentifierOrPattern(parser, context);
+ let init = null;
+ if (consume(parser, context | Context.DisallowEscapedKeyword, 83886109 /* Assign */)) {
+ init = parseExpressionCoverGrammar(parser, context & ~(Context.BlockScope | Context.ForStatement), parseAssignmentExpression);
+ if (isInOrOf(parser.token) && (context & Context.ForStatement || isBindingPattern)) {
+ if (parser.token === 167786289 /* InKeyword */) {
+ // https://github.com/tc39/test262/blob/master/test/annexB/language/statements/for-in/strict-initializer.js
+ if (context & (Context.BlockScope | Context.Strict | Context.Async) || isBindingPattern) {
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ }
+ else
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ // Note: Initializers are required for 'const' and binding patterns
+ }
+ else if (!isInOrOf(parser.token) && (isConst || isBindingPattern)) {
+ tolerant(parser, context, 24 /* DeclarationMissingInitializer */, isConst ? 'const' : 'destructuring');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclarator',
+ init,
+ id,
+ });
+}
+/**
+ * Parses variable declaration list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclarationList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableDeclarationList(parser, context, isConst) {
+ const list = [parseVariableDeclaration(parser, context, isConst)];
+ while (consume(parser, context, 16777234 /* Comma */))
+ list.push(parseVariableDeclaration(parser, context, isConst));
+ if (context & Context.ForStatement && isInOrOf(parser.token) && list.length !== 1) {
+ tolerant(parser, context, 26 /* ForInOfLoopMultiBindings */, tokenDesc(parser.token));
+ }
+ return list;
+} + +// Statements
+/**
+ * Parses statement list items
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementListItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseStatementListItem(parser, context) {
+ switch (parser.token) {
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionDeclaration(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassDeclaration(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetOrExpressionStatement(parser, context | Context.AllowIn);
+ case 33566793 /* ConstKeyword */:
+ return parseVariableStatement(parser, context | Context.BlockScope | Context.AllowIn);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionDeclarationOrStatement(parser, context);
+ case 33566810 /* ImportKeyword */: {
+ if (context & Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod)) {
+ return parseExpressionStatement(parser, context | Context.AllowIn);
+ }
+ }
+ case 12371 /* ExportKeyword */:
+ if (context & Context.Module) {
+ tolerant(parser, context, 34 /* ImportExportDeclAtTopLevel */, tokenDesc(parser.token));
+ }
+ default:
+ return parseStatement(parser, context | Context.AllowSingleStatement);
+ }
+}
+/**
+ * Parses statements
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseStatement(parser, context) {
+ switch (parser.token) {
+ case 33566791 /* VarKeyword */:
+ return parseVariableStatement(parser, context | Context.AllowIn);
+ case 17825809 /* Semicolon */:
+ return parseEmptyStatement(parser, context);
+ case 33566814 /* SwitchKeyword */:
+ return parseSwitchStatement(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseBlockStatement(parser, context);
+ case 12380 /* ReturnKeyword */:
+ return parseReturnStatement(parser, context);
+ case 12377 /* IfKeyword */:
+ return parseIfStatement(parser, context);
+ case 12369 /* DoKeyword */:
+ return parseDoWhileStatement(parser, context);
+ case 12386 /* WhileKeyword */:
+ return parseWhileStatement(parser, context);
+ case 12387 /* WithKeyword */:
+ return parseWithStatement(parser, context);
+ case 12362 /* BreakKeyword */:
+ return parseBreakStatement(parser, context);
+ case 12366 /* ContinueKeyword */:
+ return parseContinueStatement(parser, context);
+ case 12367 /* DebuggerKeyword */:
+ return parseDebuggerStatement(parser, context);
+ case 302002272 /* ThrowKeyword */:
+ return parseThrowStatement(parser, context);
+ case 12385 /* TryKeyword */:
+ return parseTryStatement(parser, context | Context.DisallowEscapedKeyword);
+ case 12374 /* ForKeyword */:
+ return parseForStatement(parser, context | Context.ForStatement);
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ tolerant(parser, context, 35 /* AsyncFunctionInSingleStatementContext */);
+ }
+ return parseExpressionOrLabelledStatement(parser, context | Context.AllowSingleStatement);
+ case 33566808 /* FunctionKeyword */:
+ // V8
+ tolerant(parser, context, context & Context.Strict ? 19 /* StrictFunction */ : 20 /* SloppyFunction */);
+ case 33566797 /* ClassKeyword */:
+ tolerant(parser, context, 21 /* ForbiddenAsStatement */, tokenDesc(parser.token));
+ default:
+ return parseExpressionOrLabelledStatement(parser, context);
+ }
+}
+/**
+ * Parses empty statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-EmptyStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseEmptyStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'EmptyStatement'
+ });
+}
+/**
+ * Parses the continue statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ContinueStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseContinueStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ // Appearing of continue without an IterationStatement leads to syntax error
+ if (!(parser.flags & (Flags.InSwitchStatement | Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, tokenDesc(parser.token));
+ }
+ let label = null;
+ if (!(parser.flags & Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, true);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ContinueStatement',
+ label
+ });
+}
+/**
+ * Parses the break statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BreakStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBreakStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let label = null;
+ if (!(parser.flags & Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, false);
+ }
+ else if (!(parser.flags & (Flags.InSwitchStatement | Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, 'break');
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'BreakStatement',
+ label
+ });
+}
+/**
+ * Parses the if statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-if-statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIfStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const consequent = parseConsequentOrAlternate(parser, context | Context.DisallowEscapedKeyword);
+ const alternate = consume(parser, context, 12370 /* ElseKeyword */) ? parseConsequentOrAlternate(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'IfStatement',
+ test,
+ consequent,
+ alternate
+ });
+}
+/**
+ * Parse either consequent or alternate. Supports AnnexB.
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseConsequentOrAlternate(parser, context) {
+ return context & Context.Strict || parser.token !== 33566808 /* FunctionKeyword */
+ ? parseStatement(parser, context & ~Context.AllowSingleStatement)
+ : parseFunctionDeclaration(parser, context);
+}
+/**
+ * Parses the debugger statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DebuggerStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDebuggerStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'DebuggerStatement'
+ });
+}
+/**
+ * Parses try statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TryStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseTryStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const block = parseBlockStatement(parser, context);
+ const handler = parser.token === 12364 /* CatchKeyword */ ? parseCatchBlock(parser, context) : null;
+ const finalizer = consume(parser, context, 12373 /* FinallyKeyword */) ? parseBlockStatement(parser, context) : null;
+ if (!handler && !finalizer)
+ tolerant(parser, context, 79 /* NoCatchOrFinally */);
+ return finishNode(context, parser, pos, {
+ type: 'TryStatement',
+ block,
+ handler,
+ finalizer
+ });
+}
+/**
+ * Parses catch block
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Catch)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCatchBlock(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let param = null;
+ if (consume(parser, context, 50331659 /* LeftParen */)) {
+ const params = [];
+ param = parseBindingIdentifierOrPattern(parser, context, params);
+ validateParams(parser, context, params);
+ expect(parser, context, 16 /* RightParen */);
+ }
+ const body = parseBlockStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'CatchClause',
+ param,
+ body
+ });
+}
+/**
+ * Parses throw statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ThrowStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseThrowStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 80 /* NewlineAfterThrow */);
+ const argument = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ThrowStatement',
+ argument
+ });
+}
+/**
+ * Parses expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpressionStatement(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+}
+/**
+ * Parse directive node
+ *
+ * * @see [Link](https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDirective(parser, context) {
+ const pos = getLocation(parser);
+ const directive = parser.tokenRaw.slice(1, -1);
+ const expr = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr,
+ directive
+ });
+}
+/**
+ * Parses either expression or labelled statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LabelledStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpressionOrLabelledStatement(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, token } = parser;
+ const expr = parseExpression(parser, (context & ~(Context.AllowSingleStatement | Context.AllowDecorator)) | Context.AllowIn);
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */) && parser.token === 16777237 /* Colon */) {
+ // If within generator function bodies, we do it like this so we can throw an nice error message
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 57 /* YieldReservedKeyword */);
+ expect(parser, context, 16777237 /* Colon */, 83 /* LabelNoColon */);
+ if (hasLabel(parser, tokenValue))
+ tolerant(parser, context, 29 /* LabelRedeclaration */, tokenValue);
+ addLabel(parser, tokenValue);
+ const body = !(context & Context.Strict) &&
+ context & Context.AllowSingleStatement &&
+ parser.token === 33566808 /* FunctionKeyword */
+ ? parseFunctionDeclaration(parser, context)
+ : parseStatement(parser, context);
+ popLabel(parser, tokenValue);
+ return finishNode(context, parser, pos, {
+ type: 'LabeledStatement',
+ label: expr,
+ body
+ });
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+}
+/**
+ * Parses do while statement
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDoWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const body = parseIterationStatement(parser, context);
+ expect(parser, context, 12386 /* WhileKeyword */);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ consume(parser, context, 17825809 /* Semicolon */);
+ return finishNode(context, parser, pos, {
+ type: 'DoWhileStatement',
+ body,
+ test
+ });
+}
+/**
+ * Parses while statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-WhileStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'WhileStatement',
+ test,
+ body
+ });
+}
+/**
+ * Parses block statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BlockStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Block)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBlockStatement(parser, context) {
+ const pos = getLocation(parser);
+ const body = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body
+ });
+}
+/**
+ * Parses return statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ReturnStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseReturnStatement(parser, context) {
+ const pos = getLocation(parser);
+ if (!(context & (Context.OptionsGlobalReturn | Context.InFunctionBody))) {
+ tolerant(parser, context, 18 /* IllegalReturn */);
+ }
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const argument = !(parser.token & 1048576 /* ASI */) && !(parser.flags & Flags.NewLine)
+ ? parseExpression(parser, (context & ~(Context.InFunctionBody | Context.AllowDecorator)) | Context.AllowIn)
+ : null;
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ReturnStatement',
+ argument
+ });
+}
+/**
+ * Sets the necessary mutable parser flags. The parser flags will
+ * be unset after done parsing out the statements.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-IterationStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIterationStatement(parser, context) {
+ // Note: We are deviating from the original grammar here beauce the original grammar says that the
+ // 'iterationStatement' should return either'for', 'do' or 'while' statements. We are doing some
+ // bitfiddling before and after to modify the parser state before we let the 'parseStatement'
+ // return the mentioned statements (to match the original grammar).
+ const savedFlags = parser.flags;
+ parser.flags |= Flags.InIterationStatement | Flags.AllowDestructuring;
+ const body = parseStatement(parser, (context & ~Context.AllowSingleStatement) | Context.DisallowEscapedKeyword);
+ parser.flags = savedFlags;
+ return body;
+}
+/**
+ * Parses with statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-WithStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseWithStatement(parser, context) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 37 /* StrictModeWith */);
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const object = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseStatement(parser, context & ~Context.AllowSingleStatement);
+ return finishNode(context, parser, pos, {
+ type: 'WithStatement',
+ object,
+ body
+ });
+}
+/**
+ * Parses switch statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SwitchStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSwitchStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const discriminant = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ expect(parser, context | Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const cases = [];
+ const savedFlags = parser.flags;
+ parser.flags |= Flags.InSwitchStatement;
+ let seenDefault = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ const clause = parseCaseOrDefaultClauses(parser, context);
+ cases.push(clause);
+ if (clause.test === null) {
+ if (seenDefault)
+ tolerant(parser, context, 33 /* MultipleDefaultsInSwitch */);
+ seenDefault = true;
+ }
+ }
+ parser.flags = savedFlags;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'SwitchStatement',
+ discriminant,
+ cases
+ });
+}
+/**
+ * Parses either default clause or case clauses
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CaseClauses)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DefaultClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCaseOrDefaultClauses(parser, context) {
+ const pos = getLocation(parser);
+ let test = null;
+ if (consume(parser, context, 12363 /* CaseKeyword */)) {
+ test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ }
+ else {
+ expect(parser, context, 12368 /* DefaultKeyword */);
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ const consequent = [];
+ while (!isEndOfCaseOrDefaultClauses(parser)) {
+ consequent.push(parseStatementListItem(parser, context | Context.AllowIn));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SwitchCase',
+ test,
+ consequent
+ });
+}
+/**
+ * Parses variable statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableStatement(parser, context, shouldConsume = true) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const isConst = token === 33566793 /* ConstKeyword */;
+ nextToken(parser, context);
+ const declarations = parseVariableDeclarationList(parser, context, isConst);
+ // Only consume semicolons if not inside the 'ForStatement' production
+ if (shouldConsume)
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclaration',
+ kind: tokenDesc(token),
+ declarations
+ });
+}
+/**
+ * Parses either an lexical declaration (let) or an expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-let-and-const-declarations)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseLetOrExpressionStatement(parser, context, shouldConsume = true) {
+ return lookahead(parser, context, isLexical)
+ ? parseVariableStatement(parser, context | Context.BlockScope, shouldConsume)
+ : parseExpressionOrLabelledStatement(parser, context);
+}
+/**
+ * Parses either async function declaration or statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionDeclarationOrStatement(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)
+ ? parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context)
+ : parseStatement(parser, context);
+}
+/**
+ * Parses either For, ForIn or ForOf statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-statement)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseForStatement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 12374 /* ForKeyword */);
+ const awaitToken = !!(context & Context.Async && consume(parser, context, 34017389 /* AwaitKeyword */));
+ expect(parser, context | Context.DisallowEscapedKeyword, 50331659 /* LeftParen */);
+ const { token } = parser;
+ let init = null;
+ let sequencePos = null;
+ let variableStatement = null;
+ let type = 'ForStatement';
+ let test = null;
+ let update = null;
+ let right;
+ if (token === 33566793 /* ConstKeyword */ || (token === 33574984 /* LetKeyword */ && lookahead(parser, context, isLexical))) {
+ variableStatement = parseVariableStatement(parser, (context & ~Context.AllowIn) | Context.BlockScope, false);
+ }
+ else if (token === 33566791 /* VarKeyword */) {
+ variableStatement = parseVariableStatement(parser, context & ~Context.AllowIn, false);
+ }
+ else if (token !== 17825809 /* Semicolon */) {
+ sequencePos = getLocation(parser);
+ init = restoreExpressionCoverGrammar(parser, (context & ~Context.AllowIn) | Context.DisallowEscapedKeyword, parseAssignmentExpression);
+ }
+ if (consume(parser, context, 69746 /* OfKeyword */)) {
+ type = 'ForOfStatement';
+ if (init) {
+ if (!(parser.flags & Flags.AllowDestructuring) || init.type === 'AssignmentExpression') {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ right = parseAssignmentExpression(parser, context | Context.AllowIn);
+ }
+ else if (consume(parser, context, 167786289 /* InKeyword */)) {
+ if (init) {
+ if (!(parser.flags & Flags.AllowDestructuring))
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ type = 'ForInStatement';
+ right = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ }
+ else {
+ if (parser.token === 16777234 /* Comma */)
+ init = parseSequenceExpression(parser, context, init, sequencePos);
+ if (variableStatement)
+ init = variableStatement;
+ expect(parser, context, 17825809 /* Semicolon */);
+ test = parser.token !== 17825809 /* Semicolon */
+ ? parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn)
+ : null;
+ expect(parser, context, 17825809 /* Semicolon */);
+ update = parser.token !== 16 /* RightParen */
+ ? parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn)
+ : null;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, type === 'ForOfStatement'
+ ? {
+ type,
+ body,
+ left: init,
+ right,
+ await: awaitToken
+ }
+ : right
+ ? {
+ type: type,
+ body,
+ left: init,
+ right
+ }
+ : {
+ type: type,
+ body,
+ init,
+ test,
+ update
+ });
+} + +// 15.2 Modules
+/**
+ * Parse module item list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItemList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleItemList(parser, context) {
+ // Prime the scanner
+ nextToken(parser, context);
+ const statements = [];
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ statements.push(parser.token === 33554435 /* StringLiteral */ ?
+ parseDirective(parser, context) :
+ parseModuleItem(parser, context | Context.AllowIn));
+ }
+ return statements;
+}
+/**
+ * Parse module item
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleItem(parser, context) {
+ switch (parser.token) {
+ // @decorator
+ case 120 /* At */:
+ return parseDecorators(parser, context);
+ // ExportDeclaration
+ case 12371 /* ExportKeyword */:
+ return parseExportDeclaration(parser, context);
+ // ImportDeclaration
+ case 33566810 /* ImportKeyword */:
+ // 'Dynamic Import' or meta property disallowed here
+ if (!(context & Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod))) {
+ return parseImportDeclaration(parser, context);
+ }
+ // falls through
+ default:
+ return parseStatementListItem(parser, context);
+ }
+}
+/**
+ * Parse export declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ const specifiers = [];
+ let source = null;
+ let declaration = null;
+ expect(parser, context | Context.DisallowEscapedKeyword, 12371 /* ExportKeyword */);
+ switch (parser.token) {
+ // export * FromClause ;
+ case 167774771 /* Multiply */:
+ return parseExportAllDeclaration(parser, context, pos);
+ case 12368 /* DefaultKeyword */:
+ return parseExportDefault(parser, context, pos);
+ case 41943052 /* LeftBrace */:
+ {
+ // export ExportClause FromClause ;
+ // export ExportClause ;
+ expect(parser, context, 41943052 /* LeftBrace */);
+ let hasReservedWord = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token !== 69743 /* GetKeyword */ && parser.token & 12288 /* Reserved */) {
+ hasReservedWord = true;
+ setPendingError(parser);
+ }
+ specifiers.push(parseNamedExportDeclaration(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context | Context.DisallowEscapedKeyword, 17825807 /* RightBrace */);
+ if (parser.token === 69745 /* FromKeyword */) {
+ source = parseModuleSpecifier(parser, context);
+ // The left hand side can't be a keyword where there is no
+ // 'from' keyword since it references a local binding.
+ }
+ else if (hasReservedWord)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ consumeSemicolon(parser, context);
+ break;
+ }
+ // export ClassDeclaration
+ case 33566797 /* ClassKeyword */:
+ declaration = (parseClassDeclaration(parser, context));
+ break;
+ // export LexicalDeclaration
+ case 33574984 /* LetKeyword */:
+ case 33566793 /* ConstKeyword */:
+ declaration = parseVariableStatement(parser, context | Context.BlockScope);
+ break;
+ // export VariableDeclaration
+ case 33566791 /* VarKeyword */:
+ declaration = parseVariableStatement(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ declaration = parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context);
+ break;
+ }
+ // Falls through
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportNamedDeclaration',
+ source,
+ specifiers,
+ declaration,
+ });
+}
+/**
+ * Parse export all declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExportAllDeclaration(parser, context, pos) {
+ expect(parser, context, 167774771 /* Multiply */);
+ const source = parseModuleSpecifier(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExportAllDeclaration',
+ source,
+ });
+}
+/**
+ * Parse named export declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNamedExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ // ExportSpecifier :
+ // IdentifierName
+ // IdentifierName as IdentifierName
+ const local = parseIdentifierName(parser, context | Context.DisallowEscapedKeyword, parser.token);
+ const exported = consume(parser, context, 167843947 /* AsKeyword */)
+ ? parseIdentifierName(parser, context, parser.token)
+ : local;
+ return finishNode(context, parser, pos, {
+ type: 'ExportSpecifier',
+ local,
+ exported,
+ });
+}
+/**
+ * Parse export default
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+function parseExportDefault(parser, context, pos) {
+ expect(parser, context | Context.DisallowEscapedKeyword, 12368 /* DefaultKeyword */);
+ let declaration;
+ switch (parser.token) {
+ // export default HoistableDeclaration[Default]
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context | Context.RequireIdentifier);
+ break;
+ // export default ClassDeclaration[Default]
+ // export default @decl ClassDeclaration[Default]
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ declaration = parseClassDeclaration(parser, context & ~Context.AllowIn | Context.RequireIdentifier);
+ break;
+ // export default HoistableDeclaration[Default]
+ case 594028 /* AsyncKeyword */:
+ declaration = parseAsyncFunctionOrAssignmentExpression(parser, context | Context.RequireIdentifier);
+ break;
+ default:
+ // export default [lookahead ∉ {function, class}] AssignmentExpression[In] ;
+ declaration = parseAssignmentExpression(parser, context | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportDefaultDeclaration',
+ declaration,
+ });
+}
+/**
+ * Parse import declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566810 /* ImportKeyword */);
+ let source;
+ let specifiers = [];
+ // 'import' ModuleSpecifier ';'
+ if (parser.token === 33554435 /* StringLiteral */) {
+ source = parseLiteral(parser, context);
+ }
+ else {
+ specifiers = parseImportClause(parser, context | Context.DisallowEscapedKeyword);
+ source = parseModuleSpecifier(parser, context);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ImportDeclaration',
+ specifiers,
+ source,
+ });
+}
+/**
+ * Parse import clause
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportClause(parser, context) {
+ const specifiers = [];
+ switch (parser.token) {
+ // 'import' ModuleSpecifier ';'
+ case 33685505 /* Identifier */:
+ {
+ specifiers.push(parseImportDefaultSpecifier(parser, context));
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ switch (parser.token) {
+ // import a, * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ // import a, {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ default:
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ break;
+ }
+ // import {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ // import * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return specifiers;
+}
+/**
+ * Parse named imports
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NamedImports)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNamedImports(parser, context, specifiers) {
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ specifiers.push(parseImportSpecifier(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+}
+/**
+ * Parse import specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportSpecifier(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const imported = parseIdentifierName(parser, context | Context.DisallowEscapedKeyword, token);
+ let local;
+ if (consume(parser, context, 167843947 /* AsKeyword */)) {
+ local = parseBindingIdentifier(parser, context);
+ }
+ else {
+ // An import name that is a keyword is a syntax error if it is not followed
+ // by the keyword 'as'.
+ if (hasBit(token, 12288 /* Reserved */))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ if (hasBit(token, 4194304 /* IsEvalOrArguments */))
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ local = imported;
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ImportSpecifier',
+ local,
+ imported,
+ });
+}
+/**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NameSpaceImport)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNameSpaceImport(parser, context, specifiers) {
+ // NameSpaceImport:
+ // * as ImportedBinding
+ const pos = getLocation(parser);
+ expect(parser, context, 167774771 /* Multiply */);
+ expect(parser, context, 167843947 /* AsKeyword */, 82 /* AsAfterImportStart */);
+ const local = parseBindingIdentifier(parser, context);
+ specifiers.push(finishNode(context, parser, pos, {
+ type: 'ImportNamespaceSpecifier',
+ local,
+ }));
+}
+/**
+ * Parse module specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleSpecifier(parser, context) {
+ // ModuleSpecifier :
+ // StringLiteral
+ expect(parser, context, 69745 /* FromKeyword */);
+ if (parser.token !== 33554435 /* StringLiteral */)
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseLiteral(parser, context);
+}
+/**
+ * Parse import default specifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportDefaultSpecifier(parser, context) {
+ return finishNode(context, parser, getLocation(parser), {
+ type: 'ImportDefaultSpecifier',
+ local: parseIdentifier(parser, context),
+ });
+}
+/**
+ * Parses either async function or assignment expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAssignmentExpression(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context | Context.RequireIdentifier) :
+ parseAssignmentExpression(parser, context | Context.AllowIn);
+} + +/**
+ * Creates the parser object
+ *
+ * @param source The source coode to parser
+ * @param sourceFile Optional source file info to be attached in every node
+ */
+function createParser(source, sourceFile) {
+ return {
+ // The source code to parse
+ source,
+ // Source length
+ length: source.length,
+ // Current position
+ index: 0,
+ // Current line
+ line: 1,
+ // Current column
+ column: 0,
+ // Start position before current token
+ startIndex: 0,
+ // Start position column before current token
+ startColumn: 0,
+ // Start position line before current token
+ startLine: 1,
+ // End position after parsing after current token
+ lastIndex: 0,
+ // End column position after current token
+ lastColumn: 0,
+ // End line position after current token
+ lastLine: 0,
+ // Pending cover grammar errors
+ pendingExpressionError: undefined,
+ // Mutable parser flags. Allows destructuring by default.
+ flags: Flags.AllowDestructuring,
+ // The tokens
+ token: 1048576 /* EndOfSource */,
+ // Misc
+ tokenRaw: '',
+ lastValue: 0,
+ comments: [],
+ sourceFile,
+ tokenRegExp: undefined,
+ tokenValue: undefined,
+ labelSet: undefined,
+ errorLocation: undefined,
+ errors: [],
+ };
+}
+/**
+ * Creating the parser
+ *
+ * @param source The source coode to parser
+ * @param options The parser options
+ * @param context Context masks
+ */
+function parseSource(source, options, /*@internal*/ context) {
+ let sourceFile = '';
+ if (!!options) {
+ // The flag to enable module syntax support
+ if (options.module)
+ context |= Context.Module;
+ // The flag to enable stage 3 support (ESNext)
+ if (options.next)
+ context |= Context.OptionsNext;
+ // The flag to enable React JSX parsing
+ if (options.jsx)
+ context |= Context.OptionsJSX;
+ // The flag to enable start and end offsets to each node
+ if (options.ranges)
+ context |= Context.OptionsRanges;
+ // The flag to enable line/column location information to each node
+ if (options.loc)
+ context |= Context.OptionsLoc;
+ // The flag to attach raw property to each literal node
+ if (options.raw)
+ context |= Context.OptionsRaw;
+ // Attach raw property to each identifier node
+ if (options.rawIdentifier)
+ context |= Context.OptionsRawidentifiers;
+ // The flag to allow return in the global scope
+ if (options.globalReturn)
+ context |= Context.OptionsGlobalReturn;
+ // The flag to allow to skip shebang - '#'
+ if (options.skipShebang)
+ context |= Context.OptionsShebang;
+ // Enable tolerant mode
+ if (options.tolerant)
+ context |= Context.OptionsTolerant;
+ // Set to true to record the source file in every node's loc object when the loc option is set.
+ if (!!options.source)
+ sourceFile = options.source;
+ // Create a top-level comments array containing all comments
+ if (!!options.comments)
+ context |= Context.OptionsComments;
+ // The flag to enable implied strict mode
+ if (options.impliedStrict)
+ context |= Context.Strict;
+ // The flag to enable experimental features
+ if (options.experimental)
+ context |= Context.OptionsExperimental;
+ // The flag to set to bypass methods in Node
+ if (options.node)
+ context |= Context.OptionsNode;
+ // Accepts a callback function to be invoked for each syntax node (as the node is constructed)
+ }
+ const parser = createParser(source, sourceFile);
+ const body = context & Context.Module ?
+ parseModuleItemList(parser, context) :
+ parseStatementList(parser, context);
+ const node = {
+ type: 'Program',
+ sourceType: context & Context.Module ? 'module' : 'script',
+ body: body,
+ };
+ if (context & Context.LocationTracker) {
+ if (context & Context.OptionsRanges) {
+ node.start = 0;
+ node.end = source.length;
+ }
+ if (context & Context.OptionsLoc) {
+ node.loc = {
+ start: { line: 1, column: 0 },
+ end: { line: parser.line, column: parser.column
+ }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ if (context & Context.OptionsComments)
+ node.comments = parser.comments;
+ if (context & Context.OptionsTolerant)
+ node.errors = parser.errors;
+ return node;
+}
+/**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function parseStatementList(parser, context) {
+ const statements = [];
+ let hasProlog = true; // Parsing directive prologue.
+ // prime the scanner
+ nextToken(parser, context | Context.DisallowEscapedKeyword);
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ if (hasProlog && parser.token !== 33554435 /* StringLiteral */)
+ hasProlog = false;
+ if (hasProlog) {
+ if (!(context & Context.Strict) && parser.tokenRaw.length === 12 && parser.tokenValue === 'use strict') {
+ context |= Context.Strict;
+ }
+ statements.push(parseDirective(parser, context));
+ }
+ else {
+ statements.push(parseStatementListItem(parser, context));
+ }
+ }
+ return statements;
+}
+/**
+ * Parse either script code or module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parse(source, options) {
+ return options && options.module
+ ? parseModule(source, options)
+ : parseScript(source, options);
+}
+/**
+ * Parse script code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parseScript(source, options) {
+ return parseSource(source, options, Context.Empty);
+}
+/**
+ * Parse module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parseModule(source, options) {
+ return parseSource(source, options, Context.Strict | Context.Module);
+} + + + +var estree = /*#__PURE__*/Object.freeze({ + +}); + + + +var index = /*#__PURE__*/Object.freeze({ + scanIdentifier: scanIdentifier, + scanMaybeIdentifier: scanMaybeIdentifier, + scanHexIntegerLiteral: scanHexIntegerLiteral, + scanOctalOrBinary: scanOctalOrBinary, + scanImplicitOctalDigits: scanImplicitOctalDigits, + scanSignedInteger: scanSignedInteger, + scanNumericLiteral: scanNumericLiteral, + scanNumericSeparator: scanNumericSeparator, + scanDecimalDigitsOrSeparator: scanDecimalDigitsOrSeparator, + scanDecimalAsSmi: scanDecimalAsSmi, + scanRegularExpression: scanRegularExpression, + scan: scan, + scanEscapeSequence: scanEscapeSequence, + throwStringError: throwStringError, + scanString: scanString, + consumeTemplateBrace: consumeTemplateBrace, + scanTemplate: scanTemplate, + skipSingleHTMLComment: skipSingleHTMLComment, + skipSingleLineComment: skipSingleLineComment, + skipMultiLineComment: skipMultiLineComment, + addComment: addComment, + nextUnicodeChar: nextUnicodeChar, + isIdentifierPart: isIdentifierPart, + escapeInvalidCharacters: escapeInvalidCharacters, + consumeOpt: consumeOpt, + consumeLineFeed: consumeLineFeed, + scanPrivateName: scanPrivateName, + advanceNewline: advanceNewline, + fromCodePoint: fromCodePoint, + readNext: readNext, + toHex: toHex, + advanceOnMaybeAstral: advanceOnMaybeAstral +}); + + + +var parser = /*#__PURE__*/Object.freeze({ + parseClassDeclaration: parseClassDeclaration, + parseFunctionDeclaration: parseFunctionDeclaration, + parseAsyncFunctionOrAsyncGeneratorDeclaration: parseAsyncFunctionOrAsyncGeneratorDeclaration, + parseVariableDeclarationList: parseVariableDeclarationList, + parseExpression: parseExpression, + parseSequenceExpression: parseSequenceExpression, + parseAssignmentExpression: parseAssignmentExpression, + parseRestElement: parseRestElement, + parseLeftHandSideExpression: parseLeftHandSideExpression, + parsePrimaryExpression: parsePrimaryExpression, + parseIdentifier: parseIdentifier, + parseLiteral: parseLiteral, + parseBigIntLiteral: parseBigIntLiteral, + parseIdentifierName: parseIdentifierName, + parseFunctionExpression: parseFunctionExpression, + parseAsyncFunctionOrAsyncGeneratorExpression: parseAsyncFunctionOrAsyncGeneratorExpression, + parsePropertyName: parsePropertyName, + parseObjectLiteral: parseObjectLiteral, + parseFormalListAndBody: parseFormalListAndBody, + parseFunctionBody: parseFunctionBody, + parseFormalParameters: parseFormalParameters, + parseFormalParameterList: parseFormalParameterList, + parseClassBodyAndElementList: parseClassBodyAndElementList, + parseClassElement: parseClassElement, + parseDecorators: parseDecorators, + parseModuleItemList: parseModuleItemList, + parseModuleItem: parseModuleItem, + parseExportDeclaration: parseExportDeclaration, + parseImportDeclaration: parseImportDeclaration, + createParser: createParser, + parseSource: parseSource, + parseStatementList: parseStatementList, + parse: parse, + parseScript: parseScript, + parseModule: parseModule, + parseBindingIdentifierOrPattern: parseBindingIdentifierOrPattern, + parseBindingIdentifier: parseBindingIdentifier, + parseAssignmentRestElement: parseAssignmentRestElement, + parseAssignmentPattern: parseAssignmentPattern, + parseBindingInitializer: parseBindingInitializer, + parseStatementListItem: parseStatementListItem, + parseStatement: parseStatement, + parseEmptyStatement: parseEmptyStatement, + parseContinueStatement: parseContinueStatement, + parseBreakStatement: parseBreakStatement, + parseIfStatement: parseIfStatement, + parseDebuggerStatement: parseDebuggerStatement, + parseTryStatement: parseTryStatement, + parseCatchBlock: parseCatchBlock, + parseThrowStatement: parseThrowStatement, + parseExpressionStatement: parseExpressionStatement, + parseDirective: parseDirective, + parseExpressionOrLabelledStatement: parseExpressionOrLabelledStatement, + parseDoWhileStatement: parseDoWhileStatement, + parseWhileStatement: parseWhileStatement, + parseBlockStatement: parseBlockStatement, + parseReturnStatement: parseReturnStatement, + parseIterationStatement: parseIterationStatement, + parseWithStatement: parseWithStatement, + parseSwitchStatement: parseSwitchStatement, + parseCaseOrDefaultClauses: parseCaseOrDefaultClauses, + parseVariableStatement: parseVariableStatement, + parseJSXRootElement: parseJSXRootElement, + parseJSXOpeningElement: parseJSXOpeningElement, + nextJSXToken: nextJSXToken, + scanJSXToken: scanJSXToken, + parseJSXText: parseJSXText, + parseJSXAttributes: parseJSXAttributes, + parseJSXSpreadAttribute: parseJSXSpreadAttribute, + parseJSXNamespacedName: parseJSXNamespacedName, + parseJSXAttributeName: parseJSXAttributeName, + parseJSXAttribute: parseJSXAttribute, + parseJSXEmptyExpression: parseJSXEmptyExpression, + parseJSXSpreadChild: parseJSXSpreadChild, + parseJSXExpressionContainer: parseJSXExpressionContainer, + parseJSXExpression: parseJSXExpression, + parseJSXClosingFragment: parseJSXClosingFragment, + parseJSXClosingElement: parseJSXClosingElement, + parseJSXIdentifier: parseJSXIdentifier, + parseJSXMemberExpression: parseJSXMemberExpression, + parseJSXElementName: parseJSXElementName, + scanJSXIdentifier: scanJSXIdentifier +}); + +// tslint:disable-next-line:variable-name
+const Parser = parser; + +const version = '1.6.9'; + +export { version, estree as ESTree, index as Scanner, parse, parseSource, parseModule, parseScript, characterType, errorMessages, constructError, report, tolerant, tokenDesc, descKeyword, Parser, isValidIdentifierPart, isValidIdentifierStart, mustEscape, Context, Flags, Labels, NumericState, ScannerState, ModifierState, CoverParenthesizedState, Escape, RegexFlags, CoverCallState, RegexState, ObjectState, validateBreakOrContinueLabel, addLabel, popLabel, hasLabel, finishNode, expect, consume, nextToken, hasBit, consumeSemicolon, parseExpressionCoverGrammar, restoreExpressionCoverGrammar, swapContext, validateParams, reinterpret, lookahead, isValidSimpleAssignmentTarget, getLocation, isValidIdentifier, isLexical, isEndOfCaseOrDefaultClauses, nextTokenIsLeftParenOrPeriod, nextTokenisIdentifierOrParen, nextTokenIsLeftParen, nextTokenIsFuncKeywordOnSameLine, isPropertyWithPrivateFieldKey, parseAndClassifyIdentifier, nameIsArgumentsOrEval, setPendingError, isEqualTagNames, isInstanceField, validateUpdateExpression, setPendingExpressionError, validateCoverParenthesizedExpression, validateAsyncArgumentList, isInOrOf }; diff --git a/node_modules/cherow/dist/es2017/cherow.min.js b/node_modules/cherow/dist/es2017/cherow.min.js new file mode 100644 index 0000000..2cb3f74 --- /dev/null +++ b/node_modules/cherow/dist/es2017/cherow.min.js @@ -0,0 +1 @@ +const keywordDescTable=["end of source","identifier","number","string","regular expression","false","true","null","template continuation","template end","=>","(","{",".","...","}",")",";",",","[","]",":","?","'",'"',"</","/>","++","--","=","<<=",">>=",">>>=","**=","+=","-=","*=","/=","%=","^=","|=","&=","typeof","delete","void","!","~","+","-","in","instanceof","*","%","/","**","&&","||","===","!==","==","!=","<=",">=","<",">","<<",">>",">>>","&","|","^","var","let","const","break","case","catch","class","continue","debugger","default","do","else","export","extends","finally","for","function","if","import","new","return","super","switch","this","throw","try","while","with","implements","interface","package","private","protected","public","static","yield","as","async","await","constructor","get","set","from","of","#","eval","arguments","enum","BigInt","@","JSXText","KeyOf","ReadOnly","is","unique","declare","type","namespace","abstract","module","global","require","target"];function tokenDesc(e){return keywordDescTable[255&e]}const descKeywordTable=Object.create(null,{this:{value:33566815},function:{value:33566808},if:{value:12377},return:{value:12380},var:{value:33566791},else:{value:12370},for:{value:12374},new:{value:33566811},in:{value:167786289},typeof:{value:302002218},while:{value:12386},case:{value:12363},break:{value:12362},try:{value:12385},catch:{value:12364},delete:{value:302002219},throw:{value:302002272},switch:{value:33566814},continue:{value:12366},default:{value:12368},instanceof:{value:167786290},do:{value:12369},void:{value:302002220},finally:{value:12373},arguments:{value:37879925},keyof:{value:131194},readonly:{value:131195},unique:{value:131197},declare:{value:131198},async:{value:594028},await:{value:34017389},class:{value:33566797},const:{value:33566793},constructor:{value:69742},debugger:{value:12367},enum:{value:12406},eval:{value:37879924},export:{value:12371},extends:{value:12372},false:{value:33566725},from:{value:69745},get:{value:69743},implements:{value:20579},import:{value:33566810},interface:{value:20580},let:{value:33574984},null:{value:33566727},of:{value:69746},package:{value:20581},private:{value:20582},protected:{value:20583},public:{value:20584},set:{value:69744},static:{value:20585},super:{value:33566813},true:{value:33566726},with:{value:12387},yield:{value:1107316842},is:{value:131196},type:{value:131199},namespace:{value:131200},abstract:{value:131201},as:{value:167843947},module:{value:131202},global:{value:131203},require:{value:131204},target:{value:131205}});function descKeyword(e){return 0|descKeywordTable[e]}const characterType=[0,0,0,0,0,0,0,0,0,16,48,16,16,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0];function isValidIdentifierPart(e){return 0!=(1&convert[0+(e>>>5)]>>>e)}function isValidIdentifierStart(e){return 0!=(1&convert[34816+(e>>>5)]>>>e)}function mustEscape(e){return 0!=(1&convert[69632+(e>>>5)]>>>e)}const convert=((e,t)=>{const n=new Uint32Array(104448);let r=0,a=0;for(;r<3392;){const o=e[r++];if(o<0)a-=o;else{let s=e[r++];2&o&&(s=t[s]),1&o?n.fill(s,a,a+=e[r++]):n[a++]=s}}return n})([-1,2,28,2,29,2,5,-1,0,77595648,3,46,2,3,0,14,2,57,2,58,3,0,3,0,3168796671,0,4294956992,2,1,2,0,2,59,3,0,4,0,4294966523,3,0,4,2,15,2,60,2,0,0,4294836735,0,3221225471,0,4294901942,2,61,0,134152192,3,0,2,0,4294951935,3,0,2,0,2683305983,0,2684354047,2,17,2,0,0,4294961151,3,0,2,2,20,2,0,0,608174079,2,0,2,127,2,6,2,62,-1,2,64,2,26,2,1,3,0,3,0,4294901711,2,40,0,4089839103,0,2961209759,0,1342439375,0,4294543342,0,3547201023,0,1577204103,0,4194240,0,4294688750,2,2,0,80831,0,4261478351,0,4294549486,2,2,0,2965387679,0,196559,0,3594373100,0,3288319768,0,8469959,2,171,0,4294828031,0,3825204735,0,123747807,0,65487,2,3,0,4092591615,0,1080049119,0,458703,2,3,2,0,0,2163244511,0,4227923919,0,4236247020,2,68,0,4284449919,0,851904,2,4,2,16,0,67076095,-1,2,69,0,1006628014,0,4093591391,-1,0,50331649,0,3265266687,2,34,0,4294844415,0,4278190047,2,23,2,125,-1,3,0,2,2,33,2,0,2,9,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,10,0,261632,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,2088959,2,31,2,8,0,909311,3,0,2,0,814743551,2,42,0,67057664,3,0,2,2,45,2,0,2,32,2,0,2,18,2,7,0,268374015,2,30,2,51,2,0,2,78,0,134153215,-1,2,6,2,0,2,7,0,2684354559,0,67044351,0,1073676416,-2,3,0,2,2,43,0,1046528,3,0,3,2,8,2,0,2,41,0,4294960127,2,9,2,39,2,10,0,4294377472,2,21,3,0,7,0,4227858431,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-1,2,122,0,1048577,2,84,2,12,-1,2,12,0,131042,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,1046559,2,0,2,13,2,0,0,2147516671,2,24,3,88,2,2,0,-16,2,89,0,524222462,2,4,2,0,0,4269801471,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,2,119,2,0,0,3220242431,3,0,3,2,20,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,2,0,2,27,2,0,2,8,3,0,2,0,67043391,0,3909091327,2,0,2,25,2,8,2,23,3,0,2,0,67076097,2,7,2,0,2,24,0,67059711,0,4236247039,3,0,2,0,939524103,0,8191999,2,97,2,98,2,14,2,95,3,0,3,0,67057663,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,3774349439,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,2,19,0,1638399,2,169,2,104,3,0,3,2,23,2,28,2,29,2,5,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-3,2,146,-4,2,23,2,0,2,37,0,1,2,0,2,63,2,32,2,16,2,9,2,0,2,109,-1,3,0,4,2,9,2,33,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277137519,0,2269118463,-1,3,23,2,-1,2,34,2,38,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,48,-14,2,23,2,44,2,37,-5,3,0,2,2,38,0,2147549120,2,0,2,16,2,17,2,130,2,0,2,52,0,4294901872,0,5242879,3,0,2,0,402595359,-1,2,118,0,1090519039,-2,2,120,2,39,2,0,2,55,2,40,0,4226678271,0,3766565279,0,2039759,-4,3,0,2,0,1140787199,-1,3,0,2,0,67043519,-5,2,0,0,4282384383,0,1056964609,-1,3,0,2,0,67043345,-1,2,0,2,41,2,42,-1,2,10,2,43,-6,2,0,2,16,-3,3,0,2,0,2147484671,-8,2,0,2,7,2,44,2,0,0,603979727,-1,2,0,2,45,-8,2,54,2,46,0,67043329,2,123,2,47,0,8388351,-2,2,124,0,3028287487,2,48,2,126,0,33259519,2,42,-9,2,24,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,2,42,-2,2,17,2,51,2,0,2,24,0,67043343,2,128,2,19,-21,3,0,2,-4,3,0,2,0,4294901791,2,7,2,164,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,0,1677656575,-166,0,4161266656,0,4071,0,15360,-4,0,28,-13,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,0,4294954999,2,0,-16,2,0,2,90,2,0,0,2105343,0,4160749584,0,65534,-42,0,4194303871,0,2011,-62,3,0,6,0,8323103,-1,3,0,2,2,55,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-22583,3,0,7,2,19,-6130,3,5,2,-1,0,69207040,3,46,2,3,0,14,2,57,2,58,-3,0,3168731136,0,4294956864,2,1,2,0,2,59,3,0,4,0,4294966275,3,0,4,2,15,2,60,2,0,2,35,-1,2,17,2,61,-1,2,0,2,62,0,4294885376,3,0,2,0,3145727,0,2617294944,0,4294770688,2,19,2,63,3,0,2,0,131135,2,94,0,70256639,0,71303167,0,272,2,45,2,62,-1,2,64,-2,2,96,0,603979775,0,4278255616,0,4294836227,0,4294549473,0,600178175,0,2952806400,0,268632067,0,4294543328,0,57540095,0,1577058304,0,1835008,0,4294688736,2,65,2,66,0,33554435,2,121,2,65,2,147,0,131075,0,3594373096,0,67094296,2,66,-1,2,67,0,603979263,2,156,0,3,0,4294828001,0,602930687,2,180,0,393219,2,67,0,671088639,0,2154840064,0,4227858435,0,4236247008,2,68,2,38,-1,2,4,0,917503,2,38,-1,2,69,0,537783470,0,4026531935,-1,0,1,-1,2,34,2,70,0,7936,-3,2,0,0,2147485695,0,1010761728,0,4292984930,0,16387,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,16,-1,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,253951,3,20,2,0,122879,2,0,2,8,0,276824064,-2,3,0,2,2,45,2,0,0,4294903295,2,0,2,18,2,7,-1,2,17,2,51,2,0,2,78,2,42,-1,2,24,2,0,2,31,-2,0,128,-2,2,79,2,8,0,4064,-1,2,117,0,4227907585,2,0,2,116,2,0,2,50,2,196,2,9,2,39,2,10,-1,0,6544896,3,0,6,-2,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-3,2,84,2,12,-3,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,817183,2,0,2,13,2,0,0,33023,2,24,3,88,2,-17,2,89,0,524157950,2,4,2,0,2,90,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,0,3072,2,0,0,2147516415,2,9,3,0,2,2,19,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,0,4294965179,0,7,2,0,2,8,2,92,2,8,-1,0,1761345536,2,94,2,95,2,38,2,23,2,96,2,36,2,162,0,2080440287,2,0,2,35,2,138,0,3296722943,2,0,0,1046675455,0,939524101,0,1837055,2,97,2,98,2,14,2,95,3,0,3,0,7,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,2700607615,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,-3,2,104,3,0,3,2,23,-1,3,5,2,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-8,2,23,2,0,2,37,-1,2,0,2,63,2,32,2,18,2,9,2,0,2,109,-1,3,0,4,2,9,2,17,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277075969,2,18,-1,3,23,2,-1,2,34,2,139,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,50,-14,2,23,2,44,2,116,-5,2,117,2,41,-2,2,117,2,19,2,17,2,35,2,117,2,38,0,4294901776,0,4718591,2,117,2,36,0,335544350,-1,2,118,2,119,-2,2,120,2,39,2,7,-1,2,121,2,65,0,3758161920,0,3,-4,2,0,2,31,2,174,-1,2,0,2,19,0,176,-5,2,0,2,49,2,182,-1,2,0,2,19,2,194,-1,2,0,2,62,-2,2,16,-7,2,0,2,119,-3,3,0,2,2,122,-8,0,4294965249,0,67633151,0,4026597376,2,0,0,536871887,-1,2,0,2,45,-8,2,54,2,49,0,1,2,123,2,19,-3,2,124,2,37,2,125,2,126,0,16778239,-10,2,36,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,-3,2,17,2,127,2,0,2,19,2,50,2,128,2,19,-21,3,0,2,-4,3,0,2,0,65567,-1,2,26,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,2,130,-187,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,2,138,-129,3,0,6,2,139,-1,3,0,2,2,50,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-28719,2,0,0,1,-1,2,122,2,0,0,8193,-21,0,50331648,0,10255,0,4,-11,2,66,2,168,-1,0,71680,-1,2,157,0,4292900864,0,805306431,-5,2,146,-1,2,176,-1,0,6144,-2,2,123,-1,2,150,-1,2,153,2,147,2,161,2,0,0,3223322624,2,36,0,4,-4,2,188,0,205128192,0,1333757536,0,2147483696,0,423953,0,747766272,0,2717763192,0,4286578751,0,278545,2,148,0,4294886464,0,33292336,0,417809,2,148,0,1329579616,0,4278190128,0,700594195,0,1006647527,0,4286497336,0,4160749631,2,149,0,469762560,0,4171219488,0,16711728,2,149,0,202375680,0,3214918176,0,4294508592,0,139280,-1,0,983584,2,190,0,58720275,0,3489923072,0,10517376,0,4293066815,0,1,0,2013265920,2,175,2,0,0,17816169,0,3288339281,0,201375904,2,0,-2,0,256,0,122880,0,16777216,2,146,0,4160757760,2,0,-6,2,163,-11,0,3263218176,-1,0,49664,0,2160197632,0,8388802,-1,0,12713984,-1,2,150,2,155,2,158,-2,2,159,-20,0,3758096385,-2,2,151,0,4292878336,2,22,2,166,0,4294057984,-2,2,160,2,152,2,172,-2,2,151,-1,2,179,-1,2,167,2,122,0,4026593280,0,14,0,4292919296,-1,2,154,0,939588608,-1,0,805306368,-1,2,122,0,1610612736,2,152,2,153,3,0,2,-2,2,154,2,155,-3,0,267386880,-1,2,156,0,7168,-1,0,65024,2,150,2,157,2,158,-7,2,165,-8,2,159,-1,0,1426112704,2,160,-1,2,185,0,271581216,0,2149777408,2,19,2,157,2,122,0,851967,0,3758129152,-1,2,19,2,178,-4,2,154,-20,2,192,2,161,-56,0,3145728,2,184,-1,2,191,2,122,-1,2,162,2,122,-4,0,32505856,-1,2,163,-1,0,2147385088,2,22,1,2155905152,2,-3,2,164,2,0,2,165,-2,2,166,-6,2,167,0,4026597375,0,1,-1,0,1,-1,2,168,-3,2,139,2,66,-2,2,162,2,177,-1,2,173,2,122,-6,2,122,-213,2,167,-657,2,17,-36,2,169,-1,2,186,-10,0,4294963200,-5,2,170,-5,2,158,2,0,2,24,-1,0,4227919872,-1,2,170,-2,0,4227874752,-3,0,2146435072,2,155,-2,0,1006649344,2,122,-1,2,22,0,201375744,-3,0,134217720,2,22,0,4286677377,0,32896,-1,2,171,-3,2,172,-349,2,173,2,174,2,175,3,0,264,-11,2,176,-2,2,158,2,0,0,520617856,0,2692743168,0,36,-3,0,524284,-11,2,19,-1,2,183,-1,2,181,0,3221291007,2,158,-1,0,524288,0,2158720,-3,2,155,0,1,-4,2,122,0,3808625411,0,3489628288,0,4096,0,1207959680,0,3221274624,2,0,-3,2,177,0,120,0,7340032,-2,0,4026564608,2,4,2,19,2,160,3,0,4,2,155,-1,2,178,2,175,-1,0,8176,2,179,2,177,2,180,-1,0,4290773232,2,0,-4,2,160,2,187,0,15728640,2,175,-1,2,157,-1,0,4294934512,3,0,4,-9,2,22,2,167,2,181,3,0,4,0,704,0,1849688064,0,4194304,-1,2,122,0,4294901887,2,0,0,130547712,0,1879048192,0,2080374784,3,0,2,-1,2,182,2,183,-1,0,17829776,0,2025848832,0,4261477888,-2,2,0,-1,0,4286580608,-1,0,29360128,2,184,0,16252928,0,3791388672,2,39,3,0,2,-2,2,193,2,0,-1,2,26,-1,0,66584576,-1,2,189,3,0,9,2,122,3,0,4,-1,2,157,2,158,3,0,5,-2,0,245760,0,2147418112,-1,2,146,2,199,0,4227923456,-1,2,185,2,186,2,22,-2,2,176,0,4292870145,0,262144,2,122,3,0,2,0,1073758848,2,187,-1,0,4227921920,2,188,0,68289024,0,528402016,0,4292927536,3,0,4,-2,0,2483027968,2,0,-2,2,189,3,0,5,-1,2,184,2,160,2,0,-2,0,4227923936,2,63,-1,2,170,2,94,2,0,2,150,2,154,3,0,6,-1,2,175,3,0,3,-2,0,2146959360,3,0,8,-2,2,157,-1,2,190,2,117,-1,2,151,3,0,8,2,191,0,8388608,2,171,2,169,2,183,0,4286578944,3,0,2,0,1152,0,1266679808,2,189,0,576,0,4261707776,2,94,3,0,9,2,151,3,0,8,-28,2,158,3,0,3,-3,0,4292902912,-6,2,96,3,0,85,-33,2,164,3,0,126,-18,2,192,3,0,269,-17,2,151,2,122,0,4294917120,3,0,2,2,19,0,4290822144,-2,0,67174336,0,520093700,2,17,3,0,21,-2,2,177,3,0,3,-2,0,65504,2,122,2,49,3,0,2,2,92,-191,2,123,-23,2,26,3,0,296,-8,2,122,3,0,2,2,19,-11,2,175,3,0,72,-3,0,3758159872,0,201391616,3,0,155,-7,2,167,-1,0,384,-1,0,133693440,-3,2,193,-2,2,30,3,0,4,2,166,-2,2,22,2,151,3,0,4,-2,2,185,-1,2,146,0,335552923,2,194,-1,0,538974272,0,2214592512,0,132e3,-10,0,192,-8,0,12288,-21,0,134213632,0,4294901761,3,0,42,0,100663424,0,4294965284,3,0,62,-6,0,4286578784,2,0,-2,0,1006696448,3,0,24,2,37,-1,2,195,3,0,10,2,194,0,4110942569,0,1432950139,0,2701658217,0,4026532864,0,4026532881,2,0,2,47,3,0,8,-1,2,154,-2,2,166,0,98304,0,65537,2,167,2,169,-2,2,154,-1,2,63,2,0,2,116,2,197,2,175,0,4294770176,2,30,3,0,4,-30,2,195,2,196,-3,2,166,-2,2,151,2,0,2,154,-1,2,189,-1,2,157,2,198,3,0,2,2,154,2,122,-1,0,193331200,-1,0,4227923960,2,197,-1,3,0,3,2,198,3,0,44,-1334,2,22,2,0,-129,2,195,-6,2,160,-180,2,199,-233,2,4,3,0,96,-16,2,160,3,0,22583,-7,2,17,3,0,6128],[4294967295,4294967291,4092460543,4294828015,4294967294,134217726,268435455,2147483647,1048575,1073741823,3892314111,1061158911,536805376,4294910143,4160749567,4294901759,134217727,4294901760,4194303,65535,262143,67108863,4286578688,536870911,8388607,4294918143,4294443008,255,67043328,2281701374,4294967232,2097151,4294903807,4294902783,4294967039,511,524287,131071,127,4294902271,4294549487,16777215,1023,67047423,4294901888,33554431,4286578687,4294770687,67043583,32767,15,2047999,4292870143,4294934527,4294966783,67045375,4294967279,262083,20511,4290772991,41943039,493567,2047,4294959104,1071644671,602799615,65536,4294828e3,805044223,4277151126,8191,1031749119,4294917631,2134769663,4286578493,4282253311,4294942719,33540095,4294905855,4294967264,2868854591,1608515583,265232348,534519807,2147614720,1060109444,4093640016,17376,2139062143,224,4169138175,4294909951,4294967292,4294965759,4294966272,4294901823,4294967280,8289918,4294934399,4294901775,4294965375,1602223615,4294967259,268369920,4292804608,486341884,4294963199,3087007615,1073692671,4128527,4279238655,4294902015,4294966591,2445279231,3670015,3238002687,63,4294967288,4294705151,4095,3221208447,4294549472,2147483648,4294705152,4294966143,64,4294966719,16383,3774873592,536807423,67043839,3758096383,3959414372,3755993023,2080374783,4294835295,4294967103,4160749565,4087,31,184024726,2862017156,1593309078,268434431,268434414,4294901763,536870912,2952790016,202506752,139264,402653184,4261412864,4227922944,2147532800,61440,3758096384,117440512,65280,4227858432,3233808384,3221225472,4294965248,32768,57152,4294934528,67108864,4293918720,4290772992,25165824,57344,4278190080,65472,4227907584,65520,1920,4026531840,49152,4160749568,4294836224,63488,1073741824,4294967040,251658240,196608,12582912,2097152,65408,64512,417808,4227923712,48,512,4294967168,4294966784,16,4292870144,4227915776,65528,4294950912,65532]);function nextUnicodeChar(e){const{index:t}=e,n=e.source.charCodeAt(t);if(n<55296||n>56319)return n;const r=e.source.charCodeAt(t+1);return r<56320||r>57343?n:65536+((1023&n)<<10)|1023&r}const isIdentifierPart=e=>0!=(1&characterType[e])||isValidIdentifierPart(e);function escapeInvalidCharacters(e){switch(e){case 0:return"\\0";case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:return mustEscape(e)?e<16?`\\x0${e.toString(16)}`:e<256?`\\x${e.toString(16)}`:e<4096?`\\u0${e.toString(16)}`:e<65536?`\\u${e.toString(16)}`:`\\u{${e.toString(16)}}`:fromCodePoint(e)}}function consumeOpt(e,t){return e.source.charCodeAt(e.index)===t&&(e.index++,e.column++,!0)}function consumeLineFeed(e,t){e.flags|=Flags.NewLine,e.index++,0==(t&ScannerState.LastIsCR)&&(e.column=0,e.line++)}function scanPrivateName(e,t){return t&Context.InClass&&isValidIdentifierStart(e.source.charCodeAt(e.index))||report(e,1,tokenDesc(e.token)),115}function advanceNewline(e){e.flags|=Flags.NewLine,e.index++,e.column=0,e.line++}const fromCodePoint=e=>e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023));function readNext(e){return e.index++,e.column++,e.index>=e.source.length&&report(e,14),nextUnicodeChar(e)}function toHex(e){return e<48?-1:e<=57?e-48:e<65?-1:e<=70?e-65+10:e<97?-1:e<=102?e-97+10:-1}function advanceOnMaybeAstral(e,t){e.index++,e.column++,t>65535&&e.index++}function scanEscapeSequence(e,t,n){switch(n){case 98:return 8;case 102:return 12;case 114:return 13;case 110:return 10;case 116:return 9;case 118:return 11;case 13:case 10:case 8232:case 8233:return e.column=-1,e.line++,Escape.Empty;case 48:case 49:case 50:case 51:{let r=n-48,a=e.index+1,o=e.column+1,s=e.source.charCodeAt(a);if(s<48||s>55){if(0!==r||56===s||57===s){if(t&Context.Strict)return Escape.StrictOctal;e.flags|=Flags.HasOctal}}else{if(t&Context.Strict)return Escape.StrictOctal;e.flags|=Flags.HasOctal,e.lastValue=s,r=8*r+(s-48),a++,o++,(s=e.source.charCodeAt(a))>=48&&s<=55&&(e.lastValue=s,r=8*r+(s-48),a++,o++),e.index=a-1,e.column=o-1}return r}case 52:case 53:case 54:case 55:{if(t&Context.Strict)return Escape.StrictOctal;let r=n-48;const a=e.index+1,o=e.column+1,s=e.source.charCodeAt(a);return s>=48&&s<=55&&(r=8*r+(s-48),e.lastValue=s,e.index=a,e.column=o),r}case 56:case 57:return Escape.EightOrNine;case 120:{const t=toHex(e.lastValue=readNext(e));if(t<0)return Escape.InvalidHex;const n=toHex(e.lastValue=readNext(e));return n<0?Escape.InvalidHex:t<<4|n}case 117:{let t=e.lastValue=readNext(e);if(123===t){let n=toHex(t=e.lastValue=readNext(e));if(n<0)return Escape.InvalidHex;for(t=e.lastValue=readNext(e);125!==t;){const r=toHex(t);if(r<0)return Escape.InvalidHex;if((n=16*n+r)>1114111)return Escape.OutOfRange;t=e.lastValue=readNext(e)}return n}{let n=toHex(t);if(n<0)return Escape.InvalidHex;for(let r=0;r<3;r++){const r=toHex(t=e.lastValue=readNext(e));if(r<0)return Escape.InvalidHex;n=16*n+r}return n}}default:return e.source.charCodeAt(e.index)}}function throwStringError(e,t,n){switch(n){case Escape.Empty:return;case Escape.StrictOctal:report(e,t&Context.TaggedTemplate?76:11);case Escape.EightOrNine:report(e,13);case Escape.InvalidHex:report(e,75,"hexadecimal");case Escape.OutOfRange:report(e,14)}}function scanString(e,t,n){const{index:r,lastValue:a}=e;let o="";e.index++,e.column++;let s=e.source.charCodeAt(e.index);for(;s!==n;){switch(s){case 13:case 10:report(e,6);case 92:if((s=readNext(e))>128)o+=fromCodePoint(s);else{e.lastValue=s;const n=scanEscapeSequence(e,t,s);n>=0?o+=fromCodePoint(n):throwStringError(e,t,n),s=e.lastValue}break;default:o+=fromCodePoint(s)}s=readNext(e)}return e.index++,e.column++,e.tokenRaw=e.source.slice(r,e.index),e.tokenValue=o,e.lastValue=a,33554435}function consumeTemplateBrace(e,t){return e.index>=e.length&&report(e,9),e.index--,e.column--,scanTemplate(e,t)}function scanTemplate(e,t){const{index:n,lastValue:r}=e;let a=!0,o="",s=readNext(e);e:for(;96!==s;){switch(s){case 36:{const t=e.index+1;if(t<e.length&&123===e.source.charCodeAt(t)){e.index=t,e.column++,a=!1;break e}o+="$";break}case 92:if((s=readNext(e))>=128)o+=fromCodePoint(s);else{e.lastValue=s;const n=scanEscapeSequence(e,t|Context.Strict,s);if(n>=0)o+=fromCodePoint(n);else{if(n!==Escape.Empty&&t&Context.TaggedTemplate){o=void 0,(s=scanLooserTemplateSegment(e,e.lastValue))<0&&(a=!1);break e}throwStringError(e,t|Context.TaggedTemplate,n)}s=e.lastValue}break;case 13:case 10:case 8232:case 8233:e.column=-1,e.line++;default:null!=o&&(o+=fromCodePoint(s))}s=readNext(e)}return e.index++,e.column++,e.tokenValue=o,e.lastValue=r,a?(e.tokenRaw=e.source.slice(n+1,e.index-1),33554441):(e.tokenRaw=e.source.slice(n+1,e.index-2),33554440)}function scanLooserTemplateSegment(e,t){for(;96!==t;){if(36===t&&123===e.source.charCodeAt(e.index+1))return e.index++,e.column++,-t;t=readNext(e)}return t}function scanHexIntegerLiteral(e,t){e.index++,e.column++;let n=NumericState.None,r=toHex(e.source.charCodeAt(e.index));for(r<0&&report(e,0),e.index++,e.column++;e.index<e.length;){const a=e.source.charCodeAt(e.index);if(t&Context.OptionsNext&&95===a){n=scanNumericSeparator(e,n);continue}n&=~NumericState.SeenSeparator;const o=toHex(a);if(o<0)break;r=16*r+o,e.index++,e.column++}return n&NumericState.SeenSeparator&&report(e,59),assembleNumericLiteral(e,t,r,consumeOpt(e,110))}function scanOctalOrBinary(e,t,n){e.index++,e.column++;let r,a=0,o=0,s=NumericState.None;for(;e.index<e.length;){if(r=e.source.charCodeAt(e.index),t&Context.OptionsNext&&95===r){s=scanNumericSeparator(e,s);continue}s&=~NumericState.SeenSeparator;const i=r-48;if(!(r>=48&&r<=57)||i>=n)break;o=o*n+i,e.index++,e.column++,a++}return 0===a&&report(e,0),s&NumericState.SeenSeparator&&report(e,59),assembleNumericLiteral(e,t,o,consumeOpt(e,110))}function scanImplicitOctalDigits(e,t){switch(e.source.charCodeAt(e.index)){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:{t&Context.Strict&&report(e,0);let n=e.index,r=e.column,a=0;for(e.flags|=Flags.HasOctal;n<e.length;){const o=e.source.charCodeAt(n);if(95===o)report(e,60);else{if(o<48||o>55)return scanNumericLiteral(e,t);a=8*a+(o-48),n++,r++}}return e.index=n,e.column=r,assembleNumericLiteral(e,t,a,consumeOpt(e,110))}case 56:case 57:e.flags|=Flags.HasOctal;default:return t&Context.OptionsNext&&95===e.source.charCodeAt(e.index)&&report(e,60),scanNumericLiteral(e,t)}}function scanSignedInteger(e,t){let n=e.source.charCodeAt(e.index);43!==n&&45!==n||(e.index++,e.column++,n=e.source.charCodeAt(e.index)),n>=48&&n<=57||report(e,0);const r=e.index,a=scanDecimalDigitsOrSeparator(e);return e.source.substring(t,r)+a}function scanNumericLiteral(e,t,n=NumericState.None){let r=n&NumericState.Float?0:scanDecimalAsSmi(e,t);const a=e.source.charCodeAt(e.index);if(46!==a&&95!==a&&!isValidIdentifierStart(a))return assembleNumericLiteral(e,t,r);consumeOpt(e,46)&&(t&Context.OptionsNext&&95===e.source.charCodeAt(e.index)&&report(e,60),n|=NumericState.Float,r=`${r}.${scanDecimalDigitsOrSeparator(e)}`);const o=e.index;return consumeOpt(e,110)&&(n&NumericState.Float&&report(e,0),n|=NumericState.BigInt),(consumeOpt(e,101)||consumeOpt(e,69))&&(n|=NumericState.Float,r+=scanSignedInteger(e,o)),isValidIdentifierStart(e.source.charCodeAt(e.index))&&report(e,0),assembleNumericLiteral(e,t,n&NumericState.Float?parseFloat(r):parseInt(r,10),!!(n&NumericState.BigInt))}function scanNumericSeparator(e,t){return e.index++,e.column++,t&NumericState.SeenSeparator&&report(e,59),t|=NumericState.SeenSeparator}function scanDecimalDigitsOrSeparator(e){let t=e.index,n=NumericState.None,r="";e:for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 95:const a=e.index;n=scanNumericSeparator(e,n),r+=e.source.substring(t,a),t=e.index;continue;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:n&=~NumericState.SeenSeparator,e.index++,e.column++;break;default:break e}return n&NumericState.SeenSeparator&&report(e,59),r+e.source.substring(t,e.index)}function scanDecimalAsSmi(e,t){let n=NumericState.None,r=0,a=e.source.charCodeAt(e.index);for(;a>=48&&a<=57||95===a;)t&Context.OptionsNext&&95===a?(n=scanNumericSeparator(e,n),a=e.source.charCodeAt(e.index)):(n&=~NumericState.SeenSeparator,r=10*r+(a-48),e.index++,e.column++,a=e.source.charCodeAt(e.index));return n&NumericState.SeenSeparator&&report(e,59),r}function assembleNumericLiteral(e,t,n,r=!1){return e.tokenValue=n,t&Context.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),r?33554551:33554434}function scanIdentifier(e,t,n){let r=e.index,a="",o=!1;n&&advanceOnMaybeAstral(e,n);e:for(;e.index<e.length;){const t=e.index;let n=e.source.charCodeAt(t);switch(n){case 92:a+=e.source.slice(r,t),a+=scanUnicodeCodePointEscape(e),r=e.index,o=!0;break;default:if(n>=55296&&n<=56319){n=(1023&n)<<10|1023&e.source.charCodeAt(t+1)|65536}if(!isIdentifierPart(n))break e;advanceOnMaybeAstral(e,n)}}r<e.index&&(a+=e.source.slice(r,e.index)),e.tokenValue=a;const s=a.length;if(s>=2&&s<=11){const n=descKeyword(a);if(n>0)return o&&(t&Context.DisallowEscapedKeyword&&tolerant(e,t,3),e.flags|=Flags.EscapedKeyword),n}return t&Context.OptionsRawidentifiers&&(e.tokenRaw=e.source.slice(r,e.index)),33685505}function scanMaybeIdentifier(e,t,n){return isValidIdentifierStart(n=nextUnicodeChar(e))||report(e,10,escapeInvalidCharacters(n)),scanIdentifier(e,t,n)}function scanUnicodeCodePointEscape(e){const{index:t}=e;if(t+5<e.length){117!==e.source.charCodeAt(t+1)&&report(e,0),e.index+=2,e.column+=2;const n=scanIdentifierUnicodeEscape(e);return n>=55296&&n<=56319&&report(e,74),isIdentifierPart(n)||report(e,75,"unicode"),fromCodePoint(n)}report(e,0)}function scanIdentifierUnicodeEscape(e){let t=e.source.charCodeAt(e.index),n=0;if(123===t){let r=toHex(t=readNext(e));for(;r>=0;)(n=n<<4|r)>1114111&&report(e,89),e.index++,e.column++,r=toHex(e.source.charCodeAt(e.index));125!==e.source.charCodeAt(e.index)&&report(e,75,"unicode"),consumeOpt(e,125)}else for(let r=0;r<4;r++){const r=toHex(t=e.source.charCodeAt(e.index));r<0&&report(e,75,"unicode"),n=n<<4|r,e.index++,e.column++}return n}function skipSingleHTMLComment(e,t,n,r){return t&Context.Module&&report(e,90),skipSingleLineComment(e,t,n,r)}function skipSingleLineComment(e,t,n,r){const a=e.index,o=!!(t&Context.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 13:return advanceNewline(e),e.index<e.length&&10===e.source.charCodeAt(e.index)&&e.index++,n|ScannerState.NewLine;case 10:case 8232:case 8233:return advanceNewline(e),o&&addComment(e,t,r,a),n|ScannerState.NewLine;default:e.index++,e.column++}return o&&addComment(e,t,r,a),n}function skipMultiLineComment(e,t,n){const r=e.index,a=!!(t&Context.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 42:if(e.index++,e.column++,n&=~ScannerState.LastIsCR,consumeOpt(e,47))return a&&addComment(e,t,"MultiLine",r),n;break;case 13:n|=ScannerState.NewLine|ScannerState.LastIsCR,advanceNewline(e);break;case 10:consumeLineFeed(e,n),n=n&~ScannerState.LastIsCR|ScannerState.NewLine;break;case 8232:case 8233:n=n&~ScannerState.LastIsCR|ScannerState.NewLine,advanceNewline(e);break;default:n&=~ScannerState.LastIsCR,e.index++,e.column++}tolerant(e,t,8)}function addComment(e,t,n,r){const{index:a,startIndex:o,startLine:s,startColumn:i,lastLine:c,lastColumn:l}=e,p={type:n,value:e.source.slice(r,"MultiLine"===n?a-2:a),start:o,end:a};t&Context.OptionsLoc&&(p.loc={start:{line:s,column:i},end:{line:c,column:l}}),e.comments.push(p)}function scan(e,t){e.flags&=~Flags.NewLine|Flags.EscapedKeyword;const n=0===e.index;let r=ScannerState.None;for(;e.index<e.length;){n||(e.startIndex=e.index,e.startColumn=e.column,e.startLine=e.line);const a=e.source.charCodeAt(e.index);if(a>128)switch(a){case 8232:case 8233:r=r&~ScannerState.LastIsCR|ScannerState.NewLine,advanceNewline(e);break;case 65519:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:case 8205:e.index++,e.column++;break;default:return scanMaybeIdentifier(e,t,a)}else switch(a){case 13:r|=ScannerState.NewLine|ScannerState.LastIsCR,advanceNewline(e);break;case 10:consumeLineFeed(e,r),r=r&~ScannerState.LastIsCR|ScannerState.NewLine;break;case 9:case 11:case 12:case 32:e.index++,e.column++;break;case 40:return e.index++,e.column++,50331659;case 41:return e.index++,e.column++,16;case 44:return e.index++,e.column++,16777234;case 58:return e.index++,e.column++,16777237;case 59:return e.index++,e.column++,17825809;case 63:return e.index++,e.column++,22;case 93:return e.index++,e.column++,20;case 123:return e.index++,e.column++,41943052;case 125:return e.index++,e.column++,17825807;case 126:return e.index++,e.column++,301989934;case 91:return e.index++,e.column++,41943059;case 64:return e.index++,e.column++,120;case 47:if(e.index++,e.column++,e.index>=e.length)return 167774773;switch(e.source.charCodeAt(e.index)){case 47:e.index++,e.column++,r=skipSingleLineComment(e,t,r,"SingleLine");continue;case 42:e.index++,e.column++,r=skipMultiLineComment(e,t,r);continue;case 61:return e.index++,e.column++,100663333;default:return 167774773}case 45:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 45:if(e.index++,e.column++,(r&ScannerState.NewLine||n)&&consumeOpt(e,62)){r=skipSingleHTMLComment(e,t,r,"HTMLClose");continue}return 570425372;case 61:return e.index++,e.column++,67108899;default:return 436209968}case 60:if(e.index++,e.column++,consumeOpt(e,33)&&consumeOpt(e,45)&&consumeOpt(e,45)){r=skipSingleHTMLComment(e,t,r,"HTMLOpen");continue}switch(e.source.charCodeAt(e.index)){case 60:return e.index++,e.column++,consumeOpt(e,61)?67108894:167774273;case 61:return e.index++,e.column++,167774013;case 47:{if(!(t&Context.OptionsJSX))break;const n=e.index+1;if(n<e.length){const t=e.source.charCodeAt(n);if(42===t||47===t)break}return e.index++,e.column++,25}default:return 167774015}case 33:return e.index++,e.column++,consumeOpt(e,61)?consumeOpt(e,61)?167773754:167773756:301989933;case 39:case 34:return scanString(e,t,a);case 37:return e.index++,e.column++,consumeOpt(e,61)?67108902:167774772;case 38:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 38===t?(e.index++,e.column++,169869879):61===t?(e.index++,e.column++,67108905):167773508}case 42:{if(e.index++,e.column++,e.index>=e.length)return 167774771;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,67108900):42!==t?167774771:(e.index++,e.column++,consumeOpt(e,61)?67108897:167775030)}case 43:{if(e.index++,e.column++,e.index>=e.length)return 436209967;const t=e.source.charCodeAt(e.index);return 43===t?(e.index++,e.column++,570425371):61===t?(e.index++,e.column++,67108898):436209967}case 92:return scanIdentifier(e,t);case 61:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,consumeOpt(e,61)?167773753:167773755):62===t?(e.index++,e.column++,10):83886109}case 62:{if(e.index++,e.column++,e.index>=e.length)return 167774016;if(t&Context.InJSXChild)return 167774016;let n=e.source.charCodeAt(e.index);return 61===n?(e.index++,e.column++,167774014):62!==n?167774016:(e.index++,e.column++,62===(n=e.source.charCodeAt(e.index))?(e.index++,e.column++,consumeOpt(e,61)?67108896:167774275):61===n?(e.index++,e.column++,67108895):167774274)}case 94:return e.index++,e.column++,consumeOpt(e,61)?67108903:167773254;case 96:return scanTemplate(e,t);case 124:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 124===t?(e.index++,e.column++,169869624):61===t?(e.index++,e.column++,67108904):167772997}case 46:{let n=e.index+1;const r=e.source.charCodeAt(n);return r>=48&&r<=57?(scanNumericLiteral(e,t,NumericState.Float),33554434):46===r&&++n<e.length&&46===e.source.charCodeAt(n)?(e.index=n+1,e.column+=3,14):(e.index++,e.column++,16777229)}case 35:{e.index++,e.column++;const r=e.index,a=e.source.charCodeAt(r);if(t&Context.OptionsShebang&&n&&33===a){e.index=r+1,skipSingleLineComment(e,t,ScannerState.None,"SheBang");continue}return scanPrivateName(e,t)}case 48:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 88:case 120:return scanHexIntegerLiteral(e,t);case 66:case 98:return scanOctalOrBinary(e,t,2);case 79:case 111:return scanOctalOrBinary(e,t,8);default:return scanImplicitOctalDigits(e,t)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return scanNumericLiteral(e,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 36:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:default:return scanIdentifier(e,t,a)}}return 1048576}function scanRegularExpression(e,t){const n=e.index;let r=RegexState.Empty;e:for(;;){const t=e.source.charCodeAt(e.index);if(e.index++,e.column++,r&RegexState.Escape)r&=~RegexState.Escape;else switch(t){case 47:if(r)break;break e;case 92:r|=RegexState.Escape;break;case 91:r|=RegexState.Class;break;case 93:r&=RegexState.Escape;break;case 13:case 10:case 8232:case 8233:report(e,7)}e.index>=e.source.length&&report(e,7)}const a=e.index-1;let o=RegexFlags.Empty;const{index:s}=e;e:for(;e.index<e.source.length;){const n=e.source.charCodeAt(e.index);switch(n){case 103:o&RegexFlags.Global&&tolerant(e,t,15,"g"),o|=RegexFlags.Global;break;case 105:o&RegexFlags.IgnoreCase&&tolerant(e,t,15,"i"),o|=RegexFlags.IgnoreCase;break;case 109:o&RegexFlags.Multiline&&tolerant(e,t,15,"m"),o|=RegexFlags.Multiline;break;case 117:o&RegexFlags.Unicode&&tolerant(e,t,15,"u"),o|=RegexFlags.Unicode;break;case 121:o&RegexFlags.Sticky&&tolerant(e,t,15,"y"),o|=RegexFlags.Sticky;break;case 115:o&RegexFlags.DotAll&&tolerant(e,t,15,"s"),o|=RegexFlags.DotAll;break;default:if(!isIdentifierPart(n))break e;report(e,16,fromCodePoint(n))}e.index++,e.column++}const i=e.source.slice(s,e.index),c=e.source.slice(n,a);return e.tokenRegExp={pattern:c,flags:i},t&Context.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),e.tokenValue=validate(e,t,c,i),33554436}function validate(e,t,n,r){Context.OptionsNode;try{return new RegExp(n,r)}catch(e){return null}}function parseBindingIdentifierOrPattern(e,t,n=[]){const{token:r}=e;return 8388608&r?41943052===r?parserObjectAssignmentPattern(e,t):parseArrayAssignmentPattern(e,t,n):(1074003968&r&&(262144&r&&t&(Context.Async|Context.Module)?tolerant(e,t,48):1073741824&r&&t&(Context.Yield|Context.Strict)&&tolerant(e,t,49)),n.push(e.tokenValue),parseBindingIdentifier(e,t))}function parseBindingIdentifier(e,t){const{token:n}=e;4194304&n?(t&Context.Strict&&tolerant(e,t,17),e.flags|=Flags.StrictEvalArguments):t&Context.BlockScope&&33574984===n?tolerant(e,t,27):hasBit(n,20480)?(t&Context.Strict&&tolerant(e,t,1,tokenDesc(n)),e.flags|=Flags.StrictFunctionName):isValidIdentifier(t,n)||tolerant(e,t,1,tokenDesc(n));const r=getLocation(e),a=e.tokenValue;return nextToken(e,t),finishNode(t,e,r,{type:"Identifier",name:a})}function parseAssignmentRestElement(e,t,n){const r=getLocation(e);expect(e,t,14);const a=parseBindingIdentifierOrPattern(e,t,n);return 16777234===e.token&&tolerant(e,t,88),finishNode(t,e,r,{type:"RestElement",argument:a})}function AssignmentRestProperty(e,t){const n=getLocation(e);expect(e,t,14);const{token:r}=e,a=parseBindingIdentifierOrPattern(e,t);return hasBit(r,8388608)&&tolerant(e,t,94),16777234===e.token&&tolerant(e,t,88),finishNode(t,e,n,{type:"RestElement",argument:a})}function parseArrayAssignmentPattern(e,t,n){const r=getLocation(e);nextToken(e,t);const a=[];for(;20!==e.token;)if(consume(e,t,16777234))a.push(null);else{if(14===e.token){a.push(parseAssignmentRestElement(e,t,n));break}a.push(parseExpressionCoverGrammar(e,t|Context.AllowIn,parseBindingInitializer)),20!==e.token&&expect(e,t,16777234)}return expect(e,t,20),finishNode(t,e,r,{type:"ArrayPattern",elements:a})}function parserObjectAssignmentPattern(e,t){const n=getLocation(e),r=[];for(expect(e,t,41943052);17825807!==e.token;){if(14===e.token){r.push(AssignmentRestProperty(e,t));break}r.push(parseAssignmentProperty(e,t)),17825807!==e.token&&expect(e,t,16777234)}return expect(e,t,17825807),finishNode(t,e,n,{type:"ObjectPattern",properties:r})}function parseAssignmentPattern(e,t,n,r){return finishNode(t,e,r,{type:"AssignmentPattern",left:n,right:parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression)})}function parseBindingInitializer(e,t){const n=getLocation(e),r=parseBindingIdentifierOrPattern(e,t);return consume(e,t,83886109)?finishNode(t,e,n,{type:"AssignmentPattern",left:r,right:parseAssignmentExpression(e,t|Context.AllowIn)}):r}function parseAssignmentProperty(e,t){const n=getLocation(e),{token:r}=e;let a,o,s=!1,i=!1;if(135168&r)if(a=parseIdentifier(e,t),i=!consume(e,t,16777237)){const s=consume(e,t,83886109);t&Context.Yield&&1073741824&r&&tolerant(e,t,49),isValidIdentifier(t,r)||tolerant(e,t,46),o=s?parseAssignmentPattern(e,t,a,n):a}else o=parseBindingInitializer(e,t);else s=41943059===r,a=parsePropertyName(e,t),expect(e,t,16777237),o=parseExpressionCoverGrammar(e,t,parseBindingInitializer);return finishNode(t,e,n,{type:"Property",kind:"init",key:a,computed:s,value:o,method:!1,shorthand:i})}function parseJSXRootElement(e,t){const n=getLocation(e);let r,a=[],o=null,s=!1;expect(e,t,167774015);const i=167774016===e.token;if(i)r=parseJSXOpeningFragment(e,t,n);else{r=parseJSXOpeningElement(e,t,parseJSXElementName(e,t),parseJSXAttributes(e,t),s=consume(e,t,167774773),n)}if(i)return parseJSXFragment(e,t,r,n);if(!s){a=parseJSXChildren(e,t),o=parseJSXClosingElement(e,t);const n=isEqualTagNames(r.name),s=isEqualTagNames(o.name);n!==s&&report(e,85,s)}return finishNode(t,e,n,{type:"JSXElement",children:a,openingElement:r,closingElement:o})}function parseJSXOpeningElement(e,t,n,r,a,o){return t&Context.InJSXChild&&a?expect(e,t,167774016):nextJSXToken(e),finishNode(t,e,o,{type:"JSXOpeningElement",name:n,attributes:r,selfClosing:a})}function parseJSXFragment(e,t,n,r){return finishNode(t,e,r,{type:"JSXFragment",children:parseJSXChildren(e,t),openingElement:n,closingFragment:parseJSXClosingFragment(e,t)})}function parseJSXOpeningFragment(e,t,n){return nextJSXToken(e),finishNode(t,e,n,{type:"JSXOpeningFragment"})}function nextJSXToken(e){return e.token=scanJSXToken(e)}function scanJSXToken(e){if(e.index>=e.source.length)return 1048576;e.lastIndex=e.startIndex=e.index;const t=e.source.charCodeAt(e.index);if(60===t)return e.index++,e.column++,consumeOpt(e,47)?25:167774015;if(123===t)return e.index++,e.column++,41943052;for(;e.index<e.source.length;){e.index++,e.column++;const t=e.source.charCodeAt(e.index);if(123===t||60===t)break}return 121}function parseJSXChildren(e,t){const n=[];for(;25!==e.token;)n.push(parseJSXChild(e,t));return n}function parseJSXText(e,t){const n=getLocation(e),r=e.source.slice(e.startIndex,e.index);e.token=scanJSXToken(e);const a=finishNode(t,e,n,{type:"JSXText",value:r});return t&Context.OptionsRaw&&(a.raw=r),a}function parseJSXChild(e,t){switch(e.token){case 33685505:case 121:return parseJSXText(e,t);case 41943052:return parseJSXExpression(e,t&~Context.InJSXChild);case 167774015:return parseJSXRootElement(e,t&~Context.InJSXChild);default:report(e,0)}}function parseJSXAttributes(e,t){const n=[];for(;e.index<e.source.length&&167774773!==e.token&&167774016!==e.token;)n.push(parseJSXAttribute(e,t));return n}function parseJSXSpreadAttribute(e,t){const n=getLocation(e);expect(e,t,41943052),expect(e,t,14);const r=parseExpressionCoverGrammar(e,t&~Context.InJSXChild,parseAssignmentExpression);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXSpreadAttribute",argument:r})}function parseJSXNamespacedName(e,t,n,r){return expect(e,t,16777237),finishNode(t,e,r,{type:"JSXNamespacedName",namespace:n,name:parseJSXIdentifier(e,t)})}function parseJSXAttributeName(e,t){const n=getLocation(e),r=parseJSXIdentifier(e,t);return 16777237===e.token?parseJSXNamespacedName(e,t,r,n):r}function parseJSXAttributeValue(e,t){switch(scanJSXAttributeValue(e,t)){case 33554435:return parseLiteral(e,t);case 41943052:return parseJSXExpressionContainer(e,t|Context.InJSXChild);case 167774015:return parseJSXRootElement(e,t|Context.InJSXChild);default:return void tolerant(e,t,87)}}function parseJSXAttribute(e,t){const n=getLocation(e);if(41943052===e.token)return parseJSXSpreadAttribute(e,t);scanJSXIdentifier(e);const r=parseJSXAttributeName(e,t);return finishNode(t,e,n,{type:"JSXAttribute",value:83886109===e.token?parseJSXAttributeValue(e,t):null,name:r})}function scanJSXAttributeValue(e,t){e.lastIndex=e.index;const n=e.source.charCodeAt(e.index);switch(n){case 34:case 39:return scanJSXString(e,t,n);default:return nextToken(e,t)}}function scanJSXString(e,t,n){const r=e.index;e.index++,e.column++;let a="",o=e.source.charCodeAt(e.index);for(;o!==n;)a+=fromCodePoint(o),e.index++,e.column++,o=e.source.charCodeAt(e.index),e.index>=e.source.length&&report(e,6);return e.index++,e.column++,t&Context.OptionsRaw&&(e.tokenRaw=e.source.slice(r,e.index)),e.tokenValue=a,33554435}function parseJSXEmptyExpression(e,t){return finishNode(t,e,getLocation(e),{type:"JSXEmptyExpression"})}function parseJSXSpreadChild(e,t){const n=getLocation(e);expect(e,t,14);const r=parseExpression(e,t);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXSpreadChild",expression:r})}function parseJSXExpressionContainer(e,t){const n=getLocation(e);expect(e,t,41943052),17825807===e.token&&tolerant(e,t,84);const r=parseExpressionCoverGrammar(e,t&~Context.InJSXChild,parseAssignmentExpression);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXExpressionContainer",expression:r})}function parseJSXExpression(e,t){const n=getLocation(e);if(expect(e,t,41943052),14===e.token)return parseJSXSpreadChild(e,t);const r=17825807===e.token?parseJSXEmptyExpression(e,t):parseExpressionCoverGrammar(e,t,parseAssignmentExpression);return nextJSXToken(e),finishNode(t,e,n,{type:"JSXExpressionContainer",expression:r})}function parseJSXClosingFragment(e,t){const n=getLocation(e);return expect(e,t,25),expect(e,t,167774016),finishNode(t,e,n,{type:"JSXClosingFragment"})}function parseJSXClosingElement(e,t){const n=getLocation(e);expect(e,t,25);const r=parseJSXElementName(e,t);return t&Context.InJSXChild?expect(e,t,167774016):nextJSXToken(e),finishNode(t,e,n,{type:"JSXClosingElement",name:r})}function parseJSXIdentifier(e,t){const{token:n,tokenValue:r,tokenRaw:a}=e;135168&n||tolerant(e,t,1,tokenDesc(e.token));const o=getLocation(e);nextToken(e,t);const s=finishNode(t,e,o,{type:"JSXIdentifier",name:r});return t&Context.OptionsRawidentifiers&&(s.raw=a),s}function parseJSXMemberExpression(e,t,n,r){return scanJSXIdentifier(e),finishNode(t,e,r,{type:"JSXMemberExpression",object:n,property:parseJSXIdentifier(e,t)})}function parseJSXElementName(e,t){const n=getLocation(e);scanJSXIdentifier(e);let r=parseJSXIdentifier(e,t);if(16777237===e.token)return parseJSXNamespacedName(e,t,r,n);for(;consume(e,t,16777229);)r=parseJSXMemberExpression(e,t,r,n);return r}function scanJSXIdentifier(e){const{token:t}=e;if(135168&t){const t=e.index;let n=e.source.charCodeAt(e.index);for(;e.index<e.source.length&&(45===n||isValidIdentifierPart(n));)n=readNext(e);e.tokenValue+=e.source.substr(t,e.index-t)}return e.token}function parseExpression(e,t){const n=getLocation(e),r=parseExpressionCoverGrammar(e,t,parseAssignmentExpression);return 16777234===e.token?parseSequenceExpression(e,t,r,n):r}function parseSequenceExpression(e,t,n,r){const a=[n];for(;consume(e,t,16777234);)a.push(parseExpressionCoverGrammar(e,t,parseAssignmentExpression));return finishNode(t,e,r,{type:"SequenceExpression",expressions:a})}function parseYieldExpression(e,t,n){t&Context.InParameter&&tolerant(e,t,51),expect(e,t,1107316842);let r=null,a=!1;return e.flags&Flags.NewLine||((a=consume(e,t,167774771))||33554432&e.token)&&(r=parseAssignmentExpression(e,t)),finishNode(t,e,n,{type:"YieldExpression",argument:r,delegate:a})}function parseAssignmentExpression(e,t){const n=getLocation(e);let{token:r}=e;if(t&Context.Yield&&1073741824&r)return parseYieldExpression(e,t,n);let a=524288&r&&lookahead(e,t,nextTokenisIdentifierOrParen)?parserCoverCallExpressionAndAsyncArrowHead(e,t):parseConditionalExpression(e,t,n);if(10===e.token)return 135168&r&&(4214784&r&&(20480&r&&(e.flags|=Flags.HasStrictReserved),4194304&r&&(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments)),a=[a]),parseArrowFunction(e,t&=~Context.Async,n,a);if(hasBit(e.token,67108864)){r=e.token,t&Context.Strict&&nameIsArgumentsOrEval(a.name)?tolerant(e,t,17):consume(e,t,83886109)?(e.flags&Flags.AllowDestructuring||tolerant(e,t,73),t&Context.InParameter||reinterpret(e,t,a),t&Context.InParen&&(e.flags|=Flags.SimpleParameterList),262144&e.token?(setPendingError(e),e.flags|=Flags.HasAwait):t&Context.InParen&&t&(Context.Strict|Context.Yield)&&1073741824&e.token&&(setPendingError(e),e.flags|=Flags.HasYield)):(isValidSimpleAssignmentTarget(a)||tolerant(e,t,5),e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),nextToken(e,t));const o=parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression);return e.pendingExpressionError=null,finishNode(t,e,n,{type:"AssignmentExpression",left:a,operator:tokenDesc(r),right:o})}return a}function parseConditionalExpression(e,t,n){const r=parseBinaryExpression(e,t,0,n);if(!consume(e,t,22))return r;const a=parseExpressionCoverGrammar(e,t&~Context.AllowDecorator|Context.AllowIn,parseAssignmentExpression);return expect(e,t,16777237),finishNode(t,e,n,{type:"ConditionalExpression",test:r,consequent:a,alternate:parseExpressionCoverGrammar(e,t,parseAssignmentExpression)})}function parseBinaryExpression(e,t,n,r,a=parseUnaryExpression(e,t)){const o=t&Context.AllowIn^Context.AllowIn;for(;hasBit(e.token,167772160);){const s=e.token,i=3840&s;if(o&&167786289===s)break;if(i+((167775030===s)<<8)<=n)break;nextToken(e,t),a=finishNode(t,e,r,{type:2097152&s?"LogicalExpression":"BinaryExpression",left:a,right:parseBinaryExpression(e,t&~Context.AllowIn,i,getLocation(e)),operator:tokenDesc(s)})}return a}function parseAwaitExpression(e,t,n){return t&Context.InParameter&&tolerant(e,t,52),expect(e,t,34017389),finishNode(t,e,n,{type:"AwaitExpression",argument:parseUnaryExpression(e,t)})}function parseUnaryExpression(e,t){const n=getLocation(e),{token:r}=e;if(hasBit(r,301989888)){nextToken(e,t),e.flags&Flags.EscapedKeyword&&tolerant(e,t,3);const a=parseExpressionCoverGrammar(e,t,parseUnaryExpression);return 167775030===e.token&&tolerant(e,t,1,tokenDesc(e.token)),t&Context.Strict&&302002219===r&&("Identifier"===a.type?tolerant(e,t,43):isPropertyWithPrivateFieldKey(a)&&tolerant(e,t,44)),finishNode(t,e,n,{type:"UnaryExpression",operator:tokenDesc(r),argument:a,prefix:!0})}return t&Context.Async&&262144&r?parseAwaitExpression(e,t,n):parseUpdateExpression(e,t,n)}function parseUpdateExpression(e,t,n){const{token:r}=e;if(hasBit(e.token,570425344)){nextToken(e,t);const a=parseLeftHandSideExpression(e,t,n);return validateUpdateExpression(e,t,a,"Prefix"),finishNode(t,e,n,{type:"UpdateExpression",argument:a,operator:tokenDesc(r),prefix:!0})}if(t&Context.OptionsJSX&&167774015===r)return parseJSXRootElement(e,t|Context.InJSXChild);const a=parseLeftHandSideExpression(e,t,n);if(hasBit(e.token,570425344)&&!(e.flags&Flags.NewLine)){validateUpdateExpression(e,t,a,"Postfix");const r=e.token;return nextToken(e,t),finishNode(t,e,n,{type:"UpdateExpression",argument:a,operator:tokenDesc(r),prefix:!1})}return a}function parseRestElement(e,t,n=[]){const r=getLocation(e);return expect(e,t,14),t&Context.InParen&&262144&e.token&&(e.flags|=Flags.HasAwait),finishNode(t,e,r,{type:"RestElement",argument:parseBindingIdentifierOrPattern(e,t,n)})}function parseSpreadElement(e,t){const n=getLocation(e);return expect(e,t,14),finishNode(t,e,n,{type:"SpreadElement",argument:restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression)})}function parseLeftHandSideExpression(e,t,n){const r=t&Context.OptionsNext&&33566810===e.token?parseCallImportOrMetaProperty(e,t|Context.AllowIn):parseMemberExpression(e,t|Context.AllowIn,n);return parseCallExpression(e,t|Context.AllowIn,n,r)}function parseMemberExpression(e,t,n,r=parsePrimaryExpression(e,t)){for(;;)switch(e.token){case 16777229:consume(e,t,16777229),e.flags=e.flags&~Flags.AllowBinding|Flags.AllowDestructuring,r=finishNode(t,e,n,{type:"MemberExpression",object:r,computed:!1,property:parseIdentifierNameOrPrivateName(e,t)});continue;case 41943059:{consume(e,t,41943059),e.flags=e.flags&~Flags.AllowBinding|Flags.AllowDestructuring;const a=parseExpression(e,t);expect(e,t,20),r=finishNode(t,e,n,{type:"MemberExpression",object:r,computed:!0,property:a});continue}case 33554441:r=finishNode(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:parseTemplateLiteral(e,t)});continue;case 33554440:r=finishNode(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:parseTemplate(e,t|Context.TaggedTemplate)});continue;default:return r}}function parseCallExpression(e,t,n,r){for(;;){if(r=parseMemberExpression(e,t,n,r),50331659!==e.token)return r;r=finishNode(t,e,n,{type:"CallExpression",callee:r,arguments:parseArgumentList(e,t&~Context.AllowDecorator)})}}function parserCoverCallExpressionAndAsyncArrowHead(e,t){const n=getLocation(e);let r=parseMemberExpression(e,t|Context.AllowIn,n);if(135168&e.token)return 262144&e.token&&tolerant(e,t,40),parseAsyncArrowFunction(e,t,ModifierState.Await,n,[parseAndClassifyIdentifier(e,t)]);for(e.flags&Flags.NewLine&&tolerant(e,t,36,"async");50331659===e.token;){r=parseMemberExpression(e,t,n,r);const a=parseAsyncArgumentList(e,t);if(10===e.token){r=parseAsyncArrowFunction(e,t,ModifierState.Await,n,a);break}r=finishNode(t,e,n,{type:"CallExpression",callee:r,arguments:a})}return r}function parseArgumentList(e,t){expect(e,t,50331659);const n=[];for(;16!==e.token;)14===e.token?n.push(parseSpreadElement(e,t)):(t&Context.Yield&&hasBit(e.token,1073741824)&&(e.flags|=Flags.HasYield,setPendingError(e)),n.push(parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression))),16!==e.token&&expect(e,t,16777234);return expect(e,t,16),n}function parseAsyncArgumentList(e,t){expect(e,t,50331659);const n=[];let{token:r}=e,a=CoverCallState.Empty;for(;16!==e.token&&(14===e.token?(e.flags|=Flags.SimpleParameterList,n.push(parseSpreadElement(e,t)),a=CoverCallState.HasSpread):(r=e.token,a=validateAsyncArgumentList(e,t,a),n.push(restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression))),consume(e,t,16777234)&&(e.flags&=~Flags.AllowDestructuring,a&CoverCallState.HasSpread&&(a=CoverCallState.SeenSpread)),16!==e.token););return expect(e,t,16),10===e.token&&(a&CoverCallState.SeenSpread?tolerant(e,t,78):a&CoverCallState.EvalOrArguments?(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments):a&CoverCallState.Yield?(t&Context.Strict&&tolerant(e,t,51),e.flags|=Flags.HasStrictReserved):e.flags&Flags.HasYield?tolerant(e,t,51):(a&CoverCallState.Await||e.flags&Flags.HasAwait)&&tolerant(e,t,52)),n}function parsePrimaryExpression(e,t){switch(e.token){case 33685505:return parseIdentifier(e,t);case 33554434:case 33554435:return parseLiteral(e,t);case 594028:return parseAsyncFunctionOrIdentifier(e,t);case 50331659:return parseParenthesizedExpression(e,t|Context.InParen);case 41943059:return restoreExpressionCoverGrammar(e,t,parseArrayLiteral);case 41943052:return restoreExpressionCoverGrammar(e,t,parseObjectLiteral);case 33566808:return parseFunctionExpression(e,t);case 33566727:case 33566726:case 33566725:return parseNullOrTrueOrFalseLiteral(e,t);case 120:case 33566797:return parseClassExpression(e,t);case 33566811:return parseNewExpressionOrMetaProperty(e,t);case 33566813:return parseSuperProperty(e,t);case 33554551:return parseBigIntLiteral(e,t);case 33566815:return parseThisExpression(e,t);case 115:return parseIdentifierNameOrPrivateName(e,t);case 167774773:case 100663333:return scanRegularExpression(e,t),parseRegularExpressionLiteral(e,t);case 33554441:return parseTemplateLiteral(e,t);case 33554440:return parseTemplate(e,t);case 33574984:return parseLetAsIdentifier(e,t);case 12369:if(t&Context.OptionsExperimental)return parseDoExpression(e,t);default:return parseAndClassifyIdentifier(e,t)}}function parseDoExpression(e,t){const n=getLocation(e);return expect(e,t,12369),finishNode(t,e,n,{type:"DoExpression",body:parseBlockStatement(e,t)})}function parseLetAsIdentifier(e,t){t&Context.Strict&&tolerant(e,t,50);const n=getLocation(e),r=e.tokenValue;return nextToken(e,t),e.flags&Flags.NewLine&&41943059===e.token&&tolerant(e,t,1,"let"),finishNode(t,e,n,{type:"Identifier",name:r})}function parseAsyncFunctionOrIdentifier(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorExpression(e,t):parseIdentifier(e,t)}function parseIdentifier(e,t){const n=getLocation(e),r=e.tokenValue;nextToken(e,t|Context.TaggedTemplate);const a=finishNode(t,e,n,{type:"Identifier",name:r});return t&Context.OptionsRawidentifiers&&(a.raw=e.tokenRaw),a}function parseRegularExpressionLiteral(e,t){const n=getLocation(e),{tokenRegExp:r,tokenValue:a,tokenRaw:o}=e;nextToken(e,t);const s=finishNode(t,e,n,{type:"Literal",value:a,regex:r});return t&Context.OptionsRaw&&(s.raw=o),s}function parseLiteral(e,t){const n=getLocation(e),r=e.tokenValue;t&Context.Strict&&e.flags&Flags.HasOctal&&tolerant(e,t,61),nextToken(e,t);const a=finishNode(t,e,n,{type:"Literal",value:r});return t&Context.OptionsRaw&&(a.raw=e.tokenRaw),a}function parseBigIntLiteral(e,t){const n=getLocation(e),{tokenValue:r,tokenRaw:a}=e;nextToken(e,t);const o=finishNode(t,e,n,{type:"Literal",value:r,bigint:a});return t&Context.OptionsRaw&&(o.raw=e.tokenRaw),o}function parseNullOrTrueOrFalseLiteral(e,t){const n=getLocation(e),{token:r}=e,a=tokenDesc(r);e.flags&Flags.EscapedKeyword&&tolerant(e,t,3),nextToken(e,t);const o=finishNode(t,e,n,{type:"Literal",value:33566727===r?null:"true"===a});return t&Context.OptionsRaw&&(o.raw=a),o}function parseThisExpression(e,t){e.flags&Flags.EscapedKeyword&&tolerant(e,t,3);const n=getLocation(e);return nextToken(e,t|Context.DisallowEscapedKeyword),finishNode(t,e,n,{type:"ThisExpression"})}function parseIdentifierName(e,t,n){return 135168&n||tolerant(e,t,4,tokenDesc(n)),parseIdentifier(e,t)}function parseIdentifierNameOrPrivateName(e,t){if(!consume(e,t,115))return parseIdentifierName(e,t,e.token);const{tokenValue:n}=e,r=getLocation(e),a=n;return nextToken(e,t),finishNode(t,e,r,{type:"PrivateName",name:a})}function parseArrayLiteral(e,t){const n=getLocation(e);expect(e,t,41943059);const r=[];for(;20!==e.token;)consume(e,t,16777234)?r.push(null):14===e.token?(r.push(parseSpreadElement(e,t)),20!==e.token&&(e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),expect(e,t,16777234))):(r.push(restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression)),20!==e.token&&expect(e,t,16777234));return expect(e,t,20),finishNode(t,e,n,{type:"ArrayExpression",elements:r})}function parseParenthesizedExpression(e,t){if(expect(e,t,50331659),consume(e,t,16)){if(e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),10===e.token)return[]}else if(14===e.token){const n=[parseRestElement(e,t)];return expect(e,t,16),e.flags=e.flags&~(Flags.AllowDestructuring|Flags.AllowBinding)|Flags.SimpleParameterList,10!==e.token&&tolerant(e,t,1,tokenDesc(e.token)),n}const n=getLocation(e);let r=validateCoverParenthesizedExpression(e,CoverParenthesizedState.None),a=restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression);if(16777234===e.token){r|=CoverParenthesizedState.SequenceExpression;const o=[a];for(;consume(e,t|Context.DisallowEscapedKeyword,16777234);){if(14===e.token){e.flags&Flags.AllowBinding||tolerant(e,t,77),e.flags|=Flags.SimpleParameterList;const n=parseRestElement(e,t);return expect(e,t,16),10!==e.token&&tolerant(e,t,78),o.push(n),o}if(consume(e,t,16))return 10!==e.token&&tolerant(e,t,1,tokenDesc(e.token)),o;r=validateCoverParenthesizedExpression(e,r),o.push(restoreExpressionCoverGrammar(e,t,parseAssignmentExpression))}a=finishNode(t,e,n,{type:"SequenceExpression",expressions:o})}return expect(e,t,16),10===e.token?(r&CoverParenthesizedState.HasEvalOrArguments?(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments):r&CoverParenthesizedState.HasReservedWords?(t&Context.Strict&&tolerant(e,t,50),e.flags|=Flags.HasStrictReserved):e.flags&Flags.AllowBinding?e.flags&Flags.HasYield?tolerant(e,t,51):t&Context.Async&&e.flags&Flags.HasAwait&&tolerant(e,t,52):tolerant(e,t,77),e.flags&=~(Flags.AllowBinding|Flags.HasAwait|Flags.HasYield),r&CoverParenthesizedState.SequenceExpression?a.expressions:[a]):(e.flags&=~(Flags.HasAwait|Flags.HasYield|Flags.AllowBinding),isValidSimpleAssignmentTarget(a)||(e.flags&=~Flags.AllowDestructuring),a)}function parseFunctionExpression(e,t){const n=getLocation(e);expect(e,t,33566808);const r=consume(e,t,167774771)?ModifierState.Generator:ModifierState.None;let a=null;const{token:o}=e;135168&o&&(4194304&o&&(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments),1073741824&e.token&&r&ModifierState.Generator&&tolerant(e,t,49),a=parseBindingIdentifier(e,t));const{params:s,body:i}=swapContext(e,t&~(Context.Method|Context.AllowSuperProperty),r,parseFormalListAndBody);return finishNode(t,e,n,{type:"FunctionExpression",params:s,body:i,async:!1,generator:!!(r&ModifierState.Generator),expression:!1,id:a})}function parseAsyncFunctionOrAsyncGeneratorExpression(e,t){const n=getLocation(e);expect(e,t,594028),expect(e,t,33566808);const r=consume(e,t,167774771)?ModifierState.Generator:ModifierState.None,a=ModifierState.Await;let o=null;const{token:s}=e;135168&s&&(4194304&s&&((t&Context.Strict||a&ModifierState.Await)&&tolerant(e,t,47),e.flags|=Flags.StrictFunctionName),262144&s&&tolerant(e,t,48),1073741824&e.token&&r&ModifierState.Generator&&tolerant(e,t,49),o=parseBindingIdentifier(e,t));const{params:i,body:c}=swapContext(e,t&~(Context.Method|Context.AllowSuperProperty),r|a,parseFormalListAndBody);return finishNode(t,e,n,{type:"FunctionExpression",params:i,body:c,async:!0,generator:!!(r&ModifierState.Generator),expression:!1,id:o})}function parseComputedPropertyName(e,t){expect(e,t,41943059);const n=parseAssignmentExpression(e,t|Context.AllowIn);return expect(e,t,20),n}function parsePropertyName(e,t){switch(e.token){case 33554434:case 33554435:return parseLiteral(e,t);case 41943059:return parseComputedPropertyName(e,t);default:return parseIdentifier(e,t)}}function parseSpreadProperties(e,t){const n=getLocation(e);return expect(e,t,14),8388608&e.token&&(e.flags&=~Flags.AllowDestructuring),finishNode(t,e,n,{type:"SpreadElement",argument:parseAssignmentExpression(e,t|Context.AllowIn)})}function parseObjectLiteral(e,t){const n=getLocation(e);expect(e,t,41943052);const r=[];for(;17825807!==e.token;)r.push(14===e.token?parseSpreadProperties(e,t):parsePropertyDefinition(e,t)),17825807!==e.token&&expect(e,t,16777234);return expect(e,t,17825807),e.flags&=~Flags.HasProtoField,finishNode(t,e,n,{type:"ObjectExpression",properties:r})}function parsePropertyDefinition(e,t){const n=getLocation(e),r=e.flags;let a,o=consume(e,t,167774771)?ObjectState.Generator|ObjectState.Method:ObjectState.Method;const s=e.token;let i=parsePropertyName(e,t);return 16777216&e.token||(r&Flags.EscapedKeyword?tolerant(e,t,3):o&ObjectState.Generator||!(524288&s)||e.flags&Flags.NewLine?69743===s?(o=o&~ObjectState.Method|ObjectState.Getter,i=parsePropertyName(e,t)):69744===s&&(o=o&~ObjectState.Method|ObjectState.Setter,i=parsePropertyName(e,t)):(o|=consume(e,t,167774771)?ObjectState.Generator|ObjectState.Async:ObjectState.Async,i=parsePropertyName(e,t)),o&(ObjectState.Getter|ObjectState.Setter)&&o&ObjectState.Generator&&tolerant(e,t,1,tokenDesc(e.token))),50331659===e.token?a=parseMethodDeclaration(e,t,o):(o&=~ObjectState.Method,16777237===e.token?(o&(ObjectState.Async|ObjectState.Generator)?tolerant(e,t,1,tokenDesc(e.token)):41943059!==s&&"__proto__"===e.tokenValue&&(e.flags&Flags.HasProtoField?setPendingExpressionError(e,63):e.flags|=Flags.HasProtoField),expect(e,t,16777237),262144&e.token&&(e.flags|=Flags.HasAwait),a=restoreExpressionCoverGrammar(e,t,parseAssignmentExpression)):(o&(ObjectState.Generator|ObjectState.Async)||!isValidIdentifier(t,s)?tolerant(e,t,1,tokenDesc(s)):t&(Context.Strict|Context.Yield)&&1073741824&s&&(setPendingError(e),e.flags|=Flags.HasYield),o|=ObjectState.Shorthand,83886109===e.token?(t&Context.Strict&&4194304&s?report(e,47):setPendingExpressionError(e,91),expect(e,t,83886109),t&(Context.Strict|Context.Yield|Context.Async)&&1074003968&e.token&&(setPendingError(e),e.flags|=1073741824&e.token?Flags.HasYield:Flags.HasAwait),a=parseAssignmentPattern(e,t,i,n)):(262144&s&&(t&Context.Async&&tolerant(e,t,46),setPendingError(e),e.flags|=Flags.HasAwait),a=i))),finishNode(t,e,n,{type:"Property",key:i,value:a,kind:o&ObjectState.Getter|o&ObjectState.Setter?o&ObjectState.Setter?"set":"get":"init",computed:41943059===s,method:!!(o&ObjectState.Method),shorthand:!!(o&ObjectState.Shorthand)})}function parseMethodDeclaration(e,t,n){const r=getLocation(e),a=n&ObjectState.Generator?ModifierState.Generator:ModifierState.None,o=n&ObjectState.Async?ModifierState.Await:ModifierState.None,{params:s,body:i}=swapContext(e,t|Context.Method,a|o,parseFormalListAndBody,n);return finishNode(t,e,r,{type:"FunctionExpression",params:s,body:i,async:!!(n&ObjectState.Async),generator:!!(n&ObjectState.Generator),expression:!1,id:null})}function parseArrowFunction(e,t,n,r){return e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),e.flags&Flags.NewLine&&tolerant(e,t,36,"=>"),expect(e,t,10),parseArrowBody(e,t&~Context.Async,r,n,ModifierState.None)}function parseAsyncArrowFunction(e,t,n,r,a){return e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),e.flags&Flags.NewLine&&tolerant(e,t,36,"async"),expect(e,t,10),parseArrowBody(e,t|Context.Async,a,r,n)}function parseArrowBody(e,t,n,r,a){e.pendingExpressionError=null;for(const r in n)reinterpret(e,t|Context.InParameter,n[r]);const o=41943052!==e.token;return finishNode(t,e,r,{type:"ArrowFunctionExpression",body:o?parseExpressionCoverGrammar(e,t&~(Context.Yield|Context.InParameter),parseAssignmentExpression):swapContext(e,t&~(Context.Yield|Context.AllowDecorator)|Context.InFunctionBody,a,parseFunctionBody),params:n,id:null,async:!!(a&ModifierState.Await),generator:!1,expression:o})}function parseFormalListAndBody(e,t,n){const r=parseFormalParameters(e,t|Context.InParameter,n),a=r.args;return{params:r.params,body:parseFunctionBody(e,t&~Context.AllowDecorator|Context.InFunctionBody,a)}}function parseFunctionBody(e,t,n){const r=getLocation(e);expect(e,t|Context.DisallowEscapedKeyword,41943052);const a=[];for(;33554435===e.token;){const{tokenRaw:n,tokenValue:r}=e;a.push(parseDirective(e,t)),12===n.length&&"use strict"===r&&(e.flags&Flags.SimpleParameterList?tolerant(e,t,64):e.flags&(Flags.HasStrictReserved|Flags.StrictFunctionName)?tolerant(e,t,50):e.flags&Flags.StrictEvalArguments&&tolerant(e,t,47),t|=Context.Strict)}t&Context.Strict&&validateParams(e,t,n);const{labelSet:o}=e;e.labelSet={};const s=e.flags;for(e.flags=e.flags&~(Flags.StrictFunctionName|Flags.StrictEvalArguments|Flags.InSwitchStatement|Flags.InIterationStatement)|Flags.AllowDestructuring;17825807!==e.token;)a.push(parseStatementListItem(e,t));return s&Flags.InIterationStatement&&(e.flags|=Flags.InIterationStatement),s&Flags.InSwitchStatement&&(e.flags|=Flags.InSwitchStatement),e.labelSet=o,expect(e,t,17825807),finishNode(t,e,r,{type:"BlockStatement",body:a})}function parseFormalParameters(e,t,n){expect(e,t,50331659),e.flags&=~(Flags.SimpleParameterList|Flags.HasStrictReserved);const r=[],a=[];for(;16!==e.token;){if(14===e.token){n&ObjectState.Setter&&tolerant(e,t,67),e.flags|=Flags.SimpleParameterList,a.push(parseRestElement(e,t,r));break}if(a.push(parseFormalParameterList(e,t,r)),!consume(e,t,16777234))break;if(16===e.token)break}return n&ObjectState.Setter&&1!==a.length&&tolerant(e,t,66,"Setter","one",""),n&ObjectState.Getter&&a.length>0&&tolerant(e,t,66,"Getter","no","s"),expect(e,t,16),{params:a,args:r}}function parseFormalParameterList(e,t,n){const r=getLocation(e);135168&e.token?(hasBit(e.token,20480)&&(t&Context.Strict&&tolerant(e,t,50),e.flags|=Flags.StrictFunctionName),hasBit(e.token,4194304)&&(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments)):e.flags|=Flags.SimpleParameterList;const a=parseBindingIdentifierOrPattern(e,t,n);return consume(e,t,83886109)?(1074003968&e.token&&t&(Context.Yield|Context.Async)&&tolerant(e,t,262144&e.token?52:51),e.flags|=Flags.SimpleParameterList,finishNode(t,e,r,{type:"AssignmentPattern",left:a,right:parseExpressionCoverGrammar(e,t,parseAssignmentExpression)})):a}function parseClassExpression(e,t){const n=getLocation(e);let r=[];t&Context.OptionsExperimental&&(r=parseDecorators(e,t)),expect(e,t|Context.DisallowEscapedKeyword,33566797);const{token:a}=e;let o=ObjectState.None,s=null,i=null;41943052!==a&&12372!==a&&(t&Context.Async&&262144&a&&tolerant(e,t,48),s=parseBindingIdentifier(e,t|Context.Strict)),consume(e,t,12372)&&(i=parseLeftHandSideExpression(e,t|Context.Strict,n),o|=ObjectState.Heritage);const c=parseClassBodyAndElementList(e,t|Context.Strict,o);return finishNode(t,e,n,t&Context.OptionsExperimental?{type:"ClassExpression",id:s,superClass:i,body:c,decorators:r}:{type:"ClassExpression",id:s,superClass:i,body:c})}function parseClassBodyAndElementList(e,t,n){const r=getLocation(e);expect(e,t,41943052);const a=[];let o=[];for(;17825807!==e.token;)consume(e,t,17825809)||(t&Context.OptionsExperimental&&(o=parseDecorators(e,t),17825807===e.token&&report(e,92),0!==o.length&&"constructor"===e.tokenValue&&report(e,93)),a.push(t&Context.OptionsNext&&115===e.token?parsePrivateFields(e,t,o):parseClassElement(e,t,n,o)));return e.flags&=~Flags.HasConstructor,expect(e,t,17825807),finishNode(t,e,r,{type:"ClassBody",body:a})}function parseClassElement(e,t,n,r){const a=getLocation(e);let{tokenValue:o,token:s}=e;const i=e.flags;consume(e,t,167774771)&&(n|=ObjectState.Generator),41943059===e.token&&(n|=ObjectState.Computed),"constructor"===e.tokenValue&&(n&ObjectState.Generator?tolerant(e,t,45,"generator"):n&ObjectState.Heritage&&(t|=Context.AllowSuperProperty),n|=ObjectState.Constructor);let c,l=parsePropertyName(e,t);if(!(16777216&e.token)){if(i&Flags.EscapedKeyword&&tolerant(e,t,3),20585===s&&(s=e.token,consume(e,t,167774771)&&(n|=ObjectState.Generator),o=e.tokenValue,41943059===e.token&&(n|=ObjectState.Computed),"prototype"===e.tokenValue&&tolerant(e,t,65),n|=ObjectState.Static,l=parsePropertyName(e,t),t&Context.OptionsNext&&isInstanceField(e)))return"constructor"===o&&tolerant(e,t,1,tokenDesc(e.token)),parseFieldDefinition(e,t,l,n,a,r);50331659!==e.token&&(!(524288&s)||n&ObjectState.Generator||e.flags&Flags.NewLine?69743!==s&&69744!==s||(n|=69743===s?ObjectState.Getter:ObjectState.Setter,o=e.tokenValue,41943059===e.token&&(n|=ObjectState.Computed),l=parsePropertyName(e,t&~Context.Strict)):(s=e.token,o=e.tokenValue,n|=ObjectState.Async,consume(e,t,167774771)&&(n|=ObjectState.Generator),41943059===e.token&&(n|=ObjectState.Computed),l=parsePropertyName(e,t)),"prototype"===o?tolerant(e,t,65):n&ObjectState.Static||"constructor"!==o||tolerant(e,t,45,"accessor"))}if(50331659===e.token)!(n&ObjectState.Computed)&&n&ObjectState.Constructor&&(e.flags&Flags.HasConstructor?report(e,12):e.flags|=Flags.HasConstructor),c=parseMethodDeclaration(e,t,n);else{if(t&Context.OptionsNext)return parseFieldDefinition(e,t,l,n,a,r);tolerant(e,t,1,tokenDesc(s))}const p=n&ObjectState.Constructor?"constructor":n&ObjectState.Getter?"get":n&ObjectState.Setter?"set":"method";return finishNode(t,e,a,t&Context.OptionsExperimental?{type:"MethodDefinition",kind:p,static:!!(n&ObjectState.Static),computed:!!(n&ObjectState.Computed),key:l,value:c,decorators:r}:{type:"MethodDefinition",kind:p,static:!!(n&ObjectState.Static),computed:!!(n&ObjectState.Computed),key:l,value:c})}function parseFieldDefinition(e,t,n,r,a,o){r&ObjectState.Constructor&&tolerant(e,t,0);let s=null;return r&(ObjectState.Async|ObjectState.Generator)&&tolerant(e,t,0),consume(e,t,83886109)&&(4194304&e.token&&tolerant(e,t,47),s=parseAssignmentExpression(e,t)),consume(e,t,16777234),finishNode(t,e,a,t&Context.OptionsExperimental?{type:"FieldDefinition",key:n,value:s,computed:!!(r&ObjectState.Computed),static:!!(r&ObjectState.Static),decorators:o}:{type:"FieldDefinition",key:n,value:s,computed:!!(r&ObjectState.Computed),static:!!(r&ObjectState.Static)})}function parsePrivateName(e,t,n){const r=e.tokenValue;return nextToken(e,t),finishNode(t,e,n,{type:"PrivateName",name:r})}function parsePrivateFields(e,t,n){const r=getLocation(e);expect(e,t|Context.InClass,115),"constructor"===e.tokenValue&&tolerant(e,t,41);const a=parsePrivateName(e,t,r);if(50331659===e.token)return parsePrivateMethod(e,t,a,r,n);let o=null;return consume(e,t,83886109)&&(4194304&e.token&&tolerant(e,t,47),o=parseAssignmentExpression(e,t)),consume(e,t,16777234),finishNode(t,e,r,t&Context.OptionsExperimental?{type:"FieldDefinition",key:a,value:o,computed:!1,static:!1,decorators:n}:{type:"FieldDefinition",key:a,value:o,computed:!1,static:!1})}function parsePrivateMethod(e,t,n,r,a){const o=parseMethodDeclaration(e,t|Context.Strict,ObjectState.None);return e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),finishNode(t,e,r,t&Context.OptionsExperimental?{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:o,decorators:a}:{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:o})}function parseCallImportOrMetaProperty(e,t){const n=getLocation(e),r=parseIdentifier(e,t);if(consume(e,t,16777229)){if(t&Context.Module&&"meta"===e.tokenValue)return parseMetaProperty(e,t,r,n);tolerant(e,t,1,tokenDesc(e.token))}let a=parseImportExpression(e,t,n);expect(e,t,50331659);const o=parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression);return expect(e,t,16),a=finishNode(t,e,n,{type:"CallExpression",callee:a,arguments:[o]})}function parseImportExpression(e,t,n){return finishNode(t,e,n,{type:"Import"})}function parseMetaProperty(e,t,n,r){return finishNode(t,e,r,{meta:n,type:"MetaProperty",property:parseIdentifier(e,t)})}function parseNewExpressionOrMetaProperty(e,t){const n=getLocation(e),r=parseIdentifier(e,t);return consume(e,t|Context.DisallowEscapedKeyword,16777229)?("target"===e.tokenValue&&t&(Context.InParameter|Context.InFunctionBody)||tolerant(e,t,53),parseMetaProperty(e,t,r,n)):finishNode(t,e,n,{type:"NewExpression",callee:parseImportOrMemberExpression(e,t,n),arguments:50331659===e.token?parseArgumentList(e,t):[]})}function parseImportOrMemberExpression(e,t,n){const{token:r}=e;return t&Context.OptionsNext&&33566810===r?(lookahead(e,t,nextTokenIsLeftParen)&&tolerant(e,t,1,tokenDesc(r)),parseCallImportOrMetaProperty(e,t)):parseMemberExpression(e,t,n)}function parseSuperProperty(e,t){const n=getLocation(e);switch(expect(e,t,33566813),e.token){case 50331659:t&Context.AllowSuperProperty||tolerant(e,t,54);break;case 41943059:case 16777229:t&Context.Method||tolerant(e,t,55);break;default:tolerant(e,t,56)}return finishNode(t,e,n,{type:"Super"})}function parseTemplateLiteral(e,t){return finishNode(t,e,getLocation(e),{type:"TemplateLiteral",expressions:[],quasis:[parseTemplateSpans(e,t)]})}function parseTemplateHead(e,t,n=null,r,a){return e.token=consumeTemplateBrace(e,t),finishNode(t,e,a,{type:"TemplateElement",value:{cooked:n,raw:r},tail:!1})}function parseTemplate(e,t,n=[],r=[]){const a=getLocation(e),{tokenValue:o,tokenRaw:s}=e;expect(e,t,33554440),n.push(parseExpression(e,t));const i=getLocation(e);return r.push(parseTemplateHead(e,t,o,s,a)),33554441===e.token?r.push(parseTemplateSpans(e,t,i)):parseTemplate(e,t,n,r),finishNode(t,e,a,{type:"TemplateLiteral",expressions:n,quasis:r})}function parseTemplateSpans(e,t,n=getLocation(e)){const{tokenValue:r,tokenRaw:a}=e;return expect(e,t,33554441),finishNode(t,e,n,{type:"TemplateElement",value:{cooked:r,raw:a},tail:!0})}function parseDecoratorList(e,t){const n=getLocation(e);return finishNode(t,e,n,{type:"Decorator",expression:parseLeftHandSideExpression(e,t,n)})}function parseDecorators(e,t){const n=[];for(;consume(e,t,120);)n.push(parseDecoratorList(e,t|Context.AllowDecorator));return n}var Context,Flags,Labels,NumericState,ScannerState,ModifierState,CoverParenthesizedState,Escape,RegexFlags,CoverCallState,RegexState,ObjectState;function validateBreakOrContinueLabel(e,t,n,r){const a=hasLabel(e,n);a||tolerant(e,t,32,n),!r||a&Labels.Nested||tolerant(e,t,31,n)}function addLabel(e,t){void 0===e.labelSet&&(e.labelSet={}),e.labelSet[`$${t}`]=isIterationStatement(e.token)?Labels.Nested:Labels.NotNested}function popLabel(e,t){e.labelSet[`$${t}`]=Labels.None}function hasLabel(e,t){return e.labelSet?e.labelSet[`$${t}`]:Labels.None}function finishNode(e,t,n,r){const{lastIndex:a,lastLine:o,lastColumn:s,sourceFile:i,index:c}=t;return e&Context.LocationTracker&&(e&Context.OptionsRanges&&(r.start=n.index,r.end=a),e&Context.OptionsLoc&&(r.loc={start:{line:n.line,column:n.column},end:{line:o,column:s}},i&&(r.loc.source=i))),r}function expect(e,t,n,r=1){return e.token!==n&&report(e,r,tokenDesc(e.token)),nextToken(e,t),!0}function consume(e,t,n){return e.token===n&&(nextToken(e,t),!0)}function nextToken(e,t){return e.lastIndex=e.index,e.lastLine=e.line,e.lastColumn=e.column,e.token=scan(e,t)}!function(e){e[e.Empty=0]="Empty",e[e.OptionsNext=1]="OptionsNext",e[e.OptionsRanges=2]="OptionsRanges",e[e.OptionsJSX=4]="OptionsJSX",e[e.OptionsRaw=8]="OptionsRaw",e[e.OptionsLoc=16]="OptionsLoc",e[e.OptionsGlobalReturn=32]="OptionsGlobalReturn",e[e.OptionsComments=64]="OptionsComments",e[e.OptionsShebang=128]="OptionsShebang",e[e.OptionsRawidentifiers=256]="OptionsRawidentifiers",e[e.OptionsTolerant=512]="OptionsTolerant",e[e.OptionsNode=1024]="OptionsNode",e[e.OptionsExperimental=2048]="OptionsExperimental",e[e.Strict=4096]="Strict",e[e.Module=8192]="Module",e[e.TaggedTemplate=16384]="TaggedTemplate",e[e.InClass=32768]="InClass",e[e.AllowIn=65536]="AllowIn",e[e.Async=131072]="Async",e[e.Yield=262144]="Yield",e[e.InParameter=524288]="InParameter",e[e.InFunctionBody=1048576]="InFunctionBody",e[e.AllowSingleStatement=2097152]="AllowSingleStatement",e[e.BlockScope=4194304]="BlockScope",e[e.ForStatement=8388608]="ForStatement",e[e.RequireIdentifier=16777216]="RequireIdentifier",e[e.Method=33554432]="Method",e[e.AllowSuperProperty=67108864]="AllowSuperProperty",e[e.InParen=134217728]="InParen",e[e.InJSXChild=268435456]="InJSXChild",e[e.DisallowEscapedKeyword=536870912]="DisallowEscapedKeyword",e[e.AllowDecorator=1073741824]="AllowDecorator",e[e.LocationTracker=18]="LocationTracker"}(Context||(Context={})),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.AllowBinding=2]="AllowBinding",e[e.AllowDestructuring=4]="AllowDestructuring",e[e.SimpleParameterList=8]="SimpleParameterList",e[e.InSwitchStatement=16]="InSwitchStatement",e[e.InIterationStatement=32]="InIterationStatement",e[e.HasStrictReserved=64]="HasStrictReserved",e[e.HasOctal=128]="HasOctal",e[e.SimpleAssignmentTarget=256]="SimpleAssignmentTarget",e[e.HasProtoField=512]="HasProtoField",e[e.StrictFunctionName=1024]="StrictFunctionName",e[e.StrictEvalArguments=2048]="StrictEvalArguments",e[e.InFunctionBody=4096]="InFunctionBody",e[e.HasAwait=8192]="HasAwait",e[e.HasYield=16384]="HasYield",e[e.EscapedKeyword=32768]="EscapedKeyword",e[e.HasConstructor=65536]="HasConstructor"}(Flags||(Flags={})),function(e){e[e.None=0]="None",e[e.NotNested=1]="NotNested",e[e.Nested=2]="Nested"}(Labels||(Labels={})),function(e){e[e.None=0]="None",e[e.SeenSeparator=1]="SeenSeparator",e[e.EigthOrNine=2]="EigthOrNine",e[e.Float=4]="Float",e[e.BigInt=8]="BigInt"}(NumericState||(NumericState={})),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.LastIsCR=2]="LastIsCR"}(ScannerState||(ScannerState={})),function(e){e[e.None=0]="None",e[e.Generator=1]="Generator",e[e.Await=2]="Await"}(ModifierState||(ModifierState={})),function(e){e[e.None=0]="None",e[e.SequenceExpression=1]="SequenceExpression",e[e.HasEvalOrArguments=2]="HasEvalOrArguments",e[e.HasReservedWords=4]="HasReservedWords",e[e.HasYield=8]="HasYield",e[e.HasBinding=16]="HasBinding"}(CoverParenthesizedState||(CoverParenthesizedState={})),function(e){e[e.Empty=-1]="Empty",e[e.StrictOctal=-2]="StrictOctal",e[e.EightOrNine=-3]="EightOrNine",e[e.InvalidHex=-4]="InvalidHex",e[e.OutOfRange=-5]="OutOfRange"}(Escape||(Escape={})),function(e){e[e.Empty=0]="Empty",e[e.IgnoreCase=1]="IgnoreCase",e[e.Global=2]="Global",e[e.Multiline=4]="Multiline",e[e.Unicode=8]="Unicode",e[e.Sticky=16]="Sticky",e[e.DotAll=32]="DotAll"}(RegexFlags||(RegexFlags={})),function(e){e[e.Empty=0]="Empty",e[e.SeenSpread=1]="SeenSpread",e[e.HasSpread=2]="HasSpread",e[e.SimpleParameter=4]="SimpleParameter",e[e.EvalOrArguments=8]="EvalOrArguments",e[e.Yield=16]="Yield",e[e.Await=32]="Await"}(CoverCallState||(CoverCallState={})),function(e){e[e.Empty=0]="Empty",e[e.Escape=1]="Escape",e[e.Class=2]="Class"}(RegexState||(RegexState={})),function(e){e[e.None=0]="None",e[e.Async=1]="Async",e[e.Generator=2]="Generator",e[e.Getter=4]="Getter",e[e.Setter=8]="Setter",e[e.Computed=16]="Computed",e[e.Method=32]="Method",e[e.Shorthand=64]="Shorthand",e[e.Static=128]="Static",e[e.Constructor=256]="Constructor",e[e.Heritage=512]="Heritage"}(ObjectState||(ObjectState={}));const hasBit=(e,t)=>(e&t)===t;function consumeSemicolon(e,t){return 1048576&e.token||e.flags&Flags.NewLine?consume(e,t,17825809):report(e,!(t&Context.Async)&&262144&e.token?38:1,tokenDesc(e.token))}function parseExpressionCoverGrammar(e,t,n){const{flags:r,pendingExpressionError:a}=e;e.flags|=Flags.AllowBinding|Flags.AllowDestructuring,e.pendingExpressionError=void 0;const o=n(e,t);if(e.pendingExpressionError){const{error:n,line:r,column:a,index:o}=e.pendingExpressionError;constructError(e,t,o,r,a,n)}return e.flags&=~(Flags.AllowBinding|Flags.AllowDestructuring),r&Flags.AllowBinding&&(e.flags|=Flags.AllowBinding),r&Flags.AllowDestructuring&&(e.flags|=Flags.AllowDestructuring),e.pendingExpressionError=a,o}function restoreExpressionCoverGrammar(e,t,n){const{flags:r,pendingExpressionError:a}=e;e.flags|=Flags.AllowBinding|Flags.AllowDestructuring,e.pendingExpressionError=void 0;const o=n(e,t);return e.flags&Flags.AllowBinding&&r&Flags.AllowBinding||(e.flags&=~Flags.AllowBinding),e.flags&Flags.AllowDestructuring&&r&Flags.AllowDestructuring||(e.flags&=~Flags.AllowDestructuring),e.pendingExpressionError=a||e.pendingExpressionError,o}function swapContext(e,t,n,r,a=ObjectState.None){return t&=~(Context.Async|Context.Yield|Context.InParameter),n&ModifierState.Generator&&(t|=Context.Yield),n&ModifierState.Await&&(t|=Context.Async),r(e,t,a)}function validateParams(e,t,n){const r=new Map;for(let a=0;a<n.length;a++){const o=`@${n[a]}`;r.get(o)?tolerant(e,t,81):r.set(o,!0)}}const reinterpret=(e,t,n)=>{switch(n.type){case"Identifier":t&Context.Strict&&nameIsArgumentsOrEval(n.name)&&report(e,3);case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":case"RestElement":case"MetaProperty":return;case"ArrayExpression":n.type="ArrayPattern";for(let r=0;r<n.elements.length;++r)null!==n.elements[r]&&reinterpret(e,t,n.elements[r]);return;case"ObjectExpression":n.type="ObjectPattern";for(let r=0;r<n.properties.length;r++)reinterpret(e,t,n.properties[r]);return;case"Property":return void reinterpret(e,t,n.value);case"SpreadElement":n.type="RestElement","ArrayExpression"===n.argument.type||"ObjectExpression"===n.argument.type||isValidSimpleAssignmentTarget(n.argument)||tolerant(e,t,71),reinterpret(e,t,n.argument);break;case"AssignmentExpression":return n.type="AssignmentPattern",delete n.operator,void reinterpret(e,t,n.left);case"MemberExpression":if(!(t&Context.InParameter))return;default:tolerant(e,t,t&Context.InParameter?77:73,n.type)}};function lookahead(e,t,n){const{tokenValue:r,flags:a,line:o,column:s,startColumn:i,index:c,lastColumn:l,startLine:p,lastLine:u,lastIndex:d,startIndex:m,tokenRaw:x,token:f,lastValue:g,tokenRegExp:S,labelSet:C,errors:k,errorLocation:E,pendingExpressionError:h}=e,y=n(e,t);return e.index=c,e.token=f,e.tokenValue=r,e.tokenValue=r,e.flags=a,e.line=o,e.column=s,e.tokenRaw=x,e.lastValue=g,e.startColumn=i,e.lastColumn=l,e.startLine=p,e.lastLine=u,e.lastIndex=d,e.startIndex=m,e.tokenRegExp=S,e.labelSet=C,e.errors=k,e.errorLocation=E,e.tokenRegExp=S,e.pendingExpressionError=h,y}function isValidSimpleAssignmentTarget(e){return"Identifier"===e.type||"MemberExpression"===e.type}function getLocation(e){return{line:e.startLine,column:e.startColumn,index:e.startIndex}}function isValidIdentifier(e,t){return e&Context.Strict?!(e&Context.Module&&262144&t)&&(!(1073741824&t)&&(131072==(131072&t)||69632==(69632&t))):131072==(131072&t)||69632==(69632&t)||20480==(20480&t)}function isLexical(e,t){nextToken(e,t);const{token:n}=e;return!!(1082523648&n||33574984===n||69632==(69632&n))}function isEndOfCaseOrDefaultClauses(e){return 12368===e.token||17825807===e.token||12363===e.token}function nextTokenIsLeftParenOrPeriod(e,t){return nextToken(e,t),50331659===e.token||16777229===e.token}function nextTokenisIdentifierOrParen(e,t){nextToken(e,t);const{token:n}=e;return 1073872896&n||50331659===n}function nextTokenIsLeftParen(e,t){return nextToken(e,t),50331659===e.token}function nextTokenIsFuncKeywordOnSameLine(e,t){return nextToken(e,t),!(e.flags&Flags.NewLine)&&33566808===e.token}function isPropertyWithPrivateFieldKey(e){return!!e.property&&"PrivateName"===e.property.type}function parseAndClassifyIdentifier(e,t){const{token:n,tokenValue:r}=e;if(t&Context.Strict){if(t&Context.Module&&262144&n&&tolerant(e,t,40,tokenDesc(e.token)),1073741824&n&&tolerant(e,t,40,tokenDesc(e.token)),131072==(131072&n)||69632==(69632&n))return parseIdentifier(e,t);report(e,1,tokenDesc(e.token))}if(t&Context.Yield&&1073741824&n&&tolerant(e,t,40,tokenDesc(e.token)),t&Context.Async&&262144&n&&tolerant(e,t,40,tokenDesc(e.token)),131072==(131072&n)||69632==(69632&n)||20480==(20480&n))return parseIdentifier(e,t);report(e,1,tokenDesc(e.token))}function nameIsArgumentsOrEval(e){return"eval"===e||"arguments"===e}function setPendingError(e){e.errorLocation={line:e.startLine,column:e.startColumn,index:e.startIndex}}function isEqualTagNames(e){switch(e.type){case"JSXIdentifier":return e.name;case"JSXNamespacedName":return`${isEqualTagNames(e.namespace)}:${isEqualTagNames(e.name)}`;case"JSXMemberExpression":return`${isEqualTagNames(e.object)}.${isEqualTagNames(e.property)}`}}function isInstanceField(e){const{token:t}=e;return 17825807===t||17825809===t||83886109===t}function validateUpdateExpression(e,t,n,r){t&Context.Strict&&nameIsArgumentsOrEval(n.name)&&tolerant(e,t,68,r),isValidSimpleAssignmentTarget(n)||tolerant(e,t,5)}function setPendingExpressionError(e,t){e.pendingExpressionError={error:errorMessages[t],line:e.line,column:e.column,index:e.index}}function validateCoverParenthesizedExpression(e,t){const{token:n}=e;return 8388608&n?e.flags|=Flags.SimpleParameterList:4194304==(4194304&n)?(setPendingError(e),t|=CoverParenthesizedState.HasEvalOrArguments):20480==(20480&n)?(setPendingError(e),t|=CoverParenthesizedState.HasReservedWords):262144==(262144&n)&&(setPendingError(e),e.flags|=Flags.HasAwait),t}function validateAsyncArgumentList(e,t,n){const{token:r}=e;return e.flags&Flags.AllowBinding?8388608&r?e.flags|=Flags.SimpleParameterList:4194304==(4194304&r)?(setPendingError(e),n|=CoverCallState.EvalOrArguments):262144==(262144&r)?(setPendingError(e),n|=CoverCallState.Await):1073741824==(1073741824&r)&&(setPendingError(e),n|=CoverCallState.Yield):tolerant(e,t,77),n}function isIterationStatement(e){return 12369===e||12386===e||12374===e}function isInOrOf(e){return 69746===e||167786289===e}const errorMessages={0:"Unexpected token",1:"Unexpected token '%0'",2:"Expected token '%0'",3:"Keyword must not contain escaped characters",4:"Keyword '%0' is reserved",5:"Invalid left-hand side in assignment",6:"Unterminated string literal",7:"Unterminated regular expression literal",8:"Unterminated MultiLineComment",9:"Unterminated template literal",10:"Invalid character '%0'",11:"Octal escapes are not allowed in strict mode",13:"Escapes \\8 or \\9 are not syntactically valid escapes",14:"Unicode escape code point out of range",15:"Duplicate regular expression flag '%0'",16:"Unexpected regular expression flag '%0'",17:"Eval or arguments can't be assigned to in strict mode code",18:"Illegal return statement",19:"In strict mode code, functions can only be declared at top level or inside a block",20:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",21:"%0 can't appear in single-statement context",22:"Generators can only be declared at the top level or inside a block",23:"'for await' loop should be used with 'of'",24:"Missing initializer in %0 declaration",25:"'for-%0' loop variable declaration may not have an initializer",26:"Invalid left-hand side in for-%0 loop: Must have a single binding.",27:"let is disallowed as a lexically bound name",28:"Lexical declaration cannot appear in a single-statement context",29:"Label '%0' has already been declared",30:"%0 statement must be nested within an iteration statement",31:"Illegal continue statement: '%0' does not denote an iteration statement",32:"Undefined label '%0'",33:"More than one default clause in switch statement",34:"%0 declarations may only appear at top level of a module",35:"Async functions can only be declared at the top level or inside a block",36:"No line break is allowed after '%0'",37:"Strict mode code may not include a with statement",38:"Await is only valid in async functions",39:"Function declaration must have a name in this context",12:"Duplicate constructor method in class",40:"'%0' may not be used as an identifier in this context",43:"Delete of an unqualified identifier in strict mode",44:"Private fields can not be deleted",41:"Classes may not have a private field named '#constructor'",42:"Classes may not have a field named 'constructor'",45:"Class constructor may not be a '%0'",46:"Unexpected reserved word",47:"Unexpected eval or arguments in strict mode",48:"'await' is not a valid identifier inside an async function",49:"'yield' is not a valid identifier inside an generator function",50:"Unexpected strict mode reserved word",52:"Await expression not allowed in formal parameter",51:"Yield expression not allowed in formal parameter",53:"new.target only allowed within functions",54:"super() is not allowed in this context",55:"Member access from super not allowed in this context",56:'Only "(" or "." or "[" are allowed after \'super\'',57:"'yield' is a reserved keyword within generator function bodies",58:"Only one underscore is allowed as numeric separator",59:"Numeric separators are not allowed at the end of numeric literals",60:"Numeric separator can not be used after leading 0.",61:"Legacy octal literals are not allowed in strict mode",62:"Invalid left-hand side in assignment",63:"Property name __proto__ appears more than once in object literal",64:"Illegal 'use strict' directive in function with non-simple parameter list",65:"Classes may not have a static property named 'prototype'",66:"%0 functions must have %1 argument%2",67:"Setter function argument must not be a rest parameter",68:"%0 increment/decrement may not have eval or arguments operand in strict mode",69:"Elision not allowed in object property list",70:"Rest element must be last element",72:"Spread element must be last element",71:"Rest parameter may not have a default initializer",73:"Invalid destructuring assignment target",74:"Unexpected surrogate pair",75:"Malformed %0 character escape sequence",76:"Template literals may not contain octal escape sequences",77:"Invalid binding pattern",78:"Rest parameter must be last formal parameter",79:"Missing catch or finally after try",80:"Illegal newline after throw",81:"Duplicate parameter name not allowed in this context",82:"Missing keyword 'as' after import *",83:"Labels must be followed by a ':'",84:"JSX attributes must only be assigned a non-empty 'expression'",85:"Expected corresponding JSX closing tag for %0",86:"Adjacent JSX elements must be wrapped in an enclosing tag",87:"Invalid JSX attribute value",88:"Rest element may not have a trailing comma",89:"Undefined Unicode code-point",90:"HTML comments are not allowed in modules",91:"Invalid shorthand property initializer",92:"Trailing decorator may be followed by method",93:"Decorators can't be used with a constructor",94:"`...` must be followed by an identifier in declaration contexts"};function constructError(e,t,n,r,a,o){const s=new SyntaxError(`Line ${r}, column ${a}: ${o}`);if(s.index=n,s.line=r,s.column=a,s.description=o,!(t&Context.OptionsTolerant))throw s;e.errors.push(s)}function getErrorLocation(e){let{index:t,startLine:n,startColumn:r}=e;const a=e.errorLocation;return a&&(t=a.index,n=a.line,r=a.column),{index:t,line:n,column:r}}function report(e,t,...n){const{index:r,line:a,column:o}=getErrorLocation(e),s=errorMessages[t].replace(/%(\d+)/g,(e,t)=>n[t]);constructError(e,Context.Empty,r,a,o,s)}function tolerant(e,t,n,...r){const{index:a,line:o,column:s}=getErrorLocation(e);constructError(e,t,a,o,s,errorMessages[n].replace(/%(\d+)/g,(e,t)=>r[t]))}function parseClassDeclaration(e,t){const n=getLocation(e);let r=[];t&Context.OptionsExperimental&&(r=parseDecorators(e,t)),expect(e,t|Context.DisallowEscapedKeyword,33566797);const a=t&Context.RequireIdentifier&&33685505!==e.token?null:parseBindingIdentifier(e,t|Context.Strict|Context.DisallowEscapedKeyword);let o=ObjectState.None,s=null;consume(e,t,12372)&&(s=parseLeftHandSideExpression(e,t|Context.Strict,n),o|=ObjectState.Heritage);const i=parseClassBodyAndElementList(e,t&~Context.RequireIdentifier|Context.Strict|Context.InClass,o);return finishNode(t,e,n,t&Context.OptionsExperimental?{type:"ClassDeclaration",id:a,superClass:s,body:i,decorators:r}:{type:"ClassDeclaration",id:a,superClass:s,body:i})}function parseFunctionDeclaration(e,t){const n=getLocation(e);expect(e,t,33566808);let r=ModifierState.None;return consume(e,t,167774771)&&(t&Context.AllowSingleStatement&&!(t&Context.InFunctionBody)&&tolerant(e,t,22),r=ModifierState.Generator),parseFunctionDeclarationBody(e,t,r,n)}function parseFunctionDeclarationBody(e,t,n,r){const{token:a}=e;let o=null;t&Context.Yield&&1073741824&a&&tolerant(e,t,49),t&Context.Async&&262144&a&&tolerant(e,t,48),50331659!==a?o=parseBindingIdentifier(e,t):t&Context.RequireIdentifier||tolerant(e,t,39);const{params:s,body:i}=swapContext(e,t&~(Context.Method|Context.AllowSuperProperty|Context.RequireIdentifier),n,parseFormalListAndBody);return finishNode(t,e,r,{type:"FunctionDeclaration",params:s,body:i,async:!!(n&ModifierState.Await),generator:!!(n&ModifierState.Generator),expression:!1,id:o})}function parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t){const n=getLocation(e);expect(e,t,594028),expect(e,t,33566808);const r=ModifierState.Await;return parseFunctionDeclarationBody(e,t,(consume(e,t,167774771)?ModifierState.Generator:ModifierState.None)|r,n)}function parseVariableDeclaration(e,t,n){const r=getLocation(e),a=0!=(8388608&e.token),o=parseBindingIdentifierOrPattern(e,t);let s=null;return consume(e,t|Context.DisallowEscapedKeyword,83886109)?(s=parseExpressionCoverGrammar(e,t&~(Context.BlockScope|Context.ForStatement),parseAssignmentExpression),isInOrOf(e.token)&&(t&Context.ForStatement||a)&&(167786289===e.token?(t&(Context.BlockScope|Context.Strict|Context.Async)||a)&&tolerant(e,t,25,tokenDesc(e.token)):tolerant(e,t,25,tokenDesc(e.token)))):isInOrOf(e.token)||!n&&!a||tolerant(e,t,24,n?"const":"destructuring"),finishNode(t,e,r,{type:"VariableDeclarator",init:s,id:o})}function parseVariableDeclarationList(e,t,n){const r=[parseVariableDeclaration(e,t,n)];for(;consume(e,t,16777234);)r.push(parseVariableDeclaration(e,t,n));return t&Context.ForStatement&&isInOrOf(e.token)&&1!==r.length&&tolerant(e,t,26,tokenDesc(e.token)),r}function parseStatementListItem(e,t){switch(e.token){case 33566808:return parseFunctionDeclaration(e,t);case 120:case 33566797:return parseClassDeclaration(e,t);case 33574984:return parseLetOrExpressionStatement(e,t|Context.AllowIn);case 33566793:return parseVariableStatement(e,t|Context.BlockScope|Context.AllowIn);case 594028:return parseAsyncFunctionDeclarationOrStatement(e,t);case 33566810:if(t&Context.OptionsNext&&lookahead(e,t,nextTokenIsLeftParenOrPeriod))return parseExpressionStatement(e,t|Context.AllowIn);case 12371:t&Context.Module&&tolerant(e,t,34,tokenDesc(e.token));default:return parseStatement(e,t|Context.AllowSingleStatement)}}function parseStatement(e,t){switch(e.token){case 33566791:return parseVariableStatement(e,t|Context.AllowIn);case 17825809:return parseEmptyStatement(e,t);case 33566814:return parseSwitchStatement(e,t);case 41943052:return parseBlockStatement(e,t);case 12380:return parseReturnStatement(e,t);case 12377:return parseIfStatement(e,t);case 12369:return parseDoWhileStatement(e,t);case 12386:return parseWhileStatement(e,t);case 12387:return parseWithStatement(e,t);case 12362:return parseBreakStatement(e,t);case 12366:return parseContinueStatement(e,t);case 12367:return parseDebuggerStatement(e,t);case 302002272:return parseThrowStatement(e,t);case 12385:return parseTryStatement(e,t|Context.DisallowEscapedKeyword);case 12374:return parseForStatement(e,t|Context.ForStatement);case 594028:return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)&&tolerant(e,t,35),parseExpressionOrLabelledStatement(e,t|Context.AllowSingleStatement);case 33566808:tolerant(e,t,t&Context.Strict?19:20);case 33566797:tolerant(e,t,21,tokenDesc(e.token));default:return parseExpressionOrLabelledStatement(e,t)}}function parseEmptyStatement(e,t){const n=getLocation(e);return nextToken(e,t),finishNode(t,e,n,{type:"EmptyStatement"})}function parseContinueStatement(e,t){const n=getLocation(e);nextToken(e,t),e.flags&(Flags.InSwitchStatement|Flags.InIterationStatement)||tolerant(e,t,30,tokenDesc(e.token));let r=null;if(!(e.flags&Flags.NewLine)&&135168&e.token){const{tokenValue:n}=e;r=parseIdentifier(e,t),validateBreakOrContinueLabel(e,t,n,!0)}return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ContinueStatement",label:r})}function parseBreakStatement(e,t){const n=getLocation(e);nextToken(e,t);let r=null;if(!(e.flags&Flags.NewLine)&&135168&e.token){const{tokenValue:n}=e;r=parseIdentifier(e,t),validateBreakOrContinueLabel(e,t,n,!1)}else e.flags&(Flags.InSwitchStatement|Flags.InIterationStatement)||tolerant(e,t,30,"break");return consumeSemicolon(e,t),finishNode(t,e,n,{type:"BreakStatement",label:r})}function parseIfStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"IfStatement",test:r,consequent:parseConsequentOrAlternate(e,t|Context.DisallowEscapedKeyword),alternate:consume(e,t,12370)?parseConsequentOrAlternate(e,t):null})}function parseConsequentOrAlternate(e,t){return t&Context.Strict||33566808!==e.token?parseStatement(e,t&~Context.AllowSingleStatement):parseFunctionDeclaration(e,t)}function parseDebuggerStatement(e,t){const n=getLocation(e);return nextToken(e,t),consumeSemicolon(e,t),finishNode(t,e,n,{type:"DebuggerStatement"})}function parseTryStatement(e,t){const n=getLocation(e);nextToken(e,t);const r=parseBlockStatement(e,t),a=12364===e.token?parseCatchBlock(e,t):null,o=consume(e,t,12373)?parseBlockStatement(e,t):null;return a||o||tolerant(e,t,79),finishNode(t,e,n,{type:"TryStatement",block:r,handler:a,finalizer:o})}function parseCatchBlock(e,t){const n=getLocation(e);nextToken(e,t);let r=null;if(consume(e,t,50331659)){const n=[];r=parseBindingIdentifierOrPattern(e,t,n),validateParams(e,t,n),expect(e,t,16)}return finishNode(t,e,n,{type:"CatchClause",param:r,body:parseBlockStatement(e,t)})}function parseThrowStatement(e,t){const n=getLocation(e);nextToken(e,t),e.flags&Flags.NewLine&&tolerant(e,t,80);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ThrowStatement",argument:r})}function parseExpressionStatement(e,t){const n=getLocation(e),r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:r})}function parseDirective(e,t){const n=getLocation(e),r=e.tokenRaw.slice(1,-1),a=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:a,directive:r})}function parseExpressionOrLabelledStatement(e,t){const n=getLocation(e),{tokenValue:r,token:a}=e,o=parseExpression(e,t&~(Context.AllowSingleStatement|Context.AllowDecorator)|Context.AllowIn);if(135168&a&&16777237===e.token){t&Context.Yield&&1073741824&a&&tolerant(e,t,57),expect(e,t,16777237,83),hasLabel(e,r)&&tolerant(e,t,29,r),addLabel(e,r);const s=!(t&Context.Strict)&&t&Context.AllowSingleStatement&&33566808===e.token?parseFunctionDeclaration(e,t):parseStatement(e,t);return popLabel(e,r),finishNode(t,e,n,{type:"LabeledStatement",label:o,body:s})}return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:o})}function parseDoWhileStatement(e,t){const n=getLocation(e);nextToken(e,t);const r=parseIterationStatement(e,t);expect(e,t,12386),expect(e,t,50331659);const a=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),consume(e,t,17825809),finishNode(t,e,n,{type:"DoWhileStatement",body:r,test:a})}function parseWhileStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"WhileStatement",test:r,body:parseIterationStatement(e,t)})}function parseBlockStatement(e,t){const n=getLocation(e),r=[];for(expect(e,t,41943052);17825807!==e.token;)r.push(parseStatementListItem(e,t));return expect(e,t,17825807),finishNode(t,e,n,{type:"BlockStatement",body:r})}function parseReturnStatement(e,t){const n=getLocation(e);t&(Context.OptionsGlobalReturn|Context.InFunctionBody)||tolerant(e,t,18),e.flags&Flags.EscapedKeyword&&tolerant(e,t,3),nextToken(e,t);const r=1048576&e.token||e.flags&Flags.NewLine?null:parseExpression(e,t&~(Context.InFunctionBody|Context.AllowDecorator)|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ReturnStatement",argument:r})}function parseIterationStatement(e,t){const n=e.flags;e.flags|=Flags.InIterationStatement|Flags.AllowDestructuring;const r=parseStatement(e,t&~Context.AllowSingleStatement|Context.DisallowEscapedKeyword);return e.flags=n,r}function parseWithStatement(e,t){t&Context.Strict&&tolerant(e,t,37);const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"WithStatement",object:r,body:parseStatement(e,t&~Context.AllowSingleStatement)})}function parseSwitchStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);expect(e,t,16),expect(e,t|Context.DisallowEscapedKeyword,41943052);const a=[],o=e.flags;e.flags|=Flags.InSwitchStatement;let s=!1;for(;17825807!==e.token;){const n=parseCaseOrDefaultClauses(e,t);a.push(n),null===n.test&&(s&&tolerant(e,t,33),s=!0)}return e.flags=o,expect(e,t,17825807),finishNode(t,e,n,{type:"SwitchStatement",discriminant:r,cases:a})}function parseCaseOrDefaultClauses(e,t){const n=getLocation(e);let r=null;consume(e,t,12363)?r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn):expect(e,t,12368),expect(e,t,16777237);const a=[];for(;!isEndOfCaseOrDefaultClauses(e);)a.push(parseStatementListItem(e,t|Context.AllowIn));return finishNode(t,e,n,{type:"SwitchCase",test:r,consequent:a})}function parseVariableStatement(e,t,n=!0){const r=getLocation(e),{token:a}=e,o=33566793===a;nextToken(e,t);const s=parseVariableDeclarationList(e,t,o);return n&&consumeSemicolon(e,t),finishNode(t,e,r,{type:"VariableDeclaration",kind:tokenDesc(a),declarations:s})}function parseLetOrExpressionStatement(e,t,n=!0){return lookahead(e,t,isLexical)?parseVariableStatement(e,t|Context.BlockScope,n):parseExpressionOrLabelledStatement(e,t)}function parseAsyncFunctionDeclarationOrStatement(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t):parseStatement(e,t)}function parseForStatement(e,t){const n=getLocation(e);expect(e,t,12374);const r=!!(t&Context.Async&&consume(e,t,34017389));expect(e,t|Context.DisallowEscapedKeyword,50331659);const{token:a}=e;let o,s=null,i=null,c=null,l="ForStatement",p=null,u=null;33566793===a||33574984===a&&lookahead(e,t,isLexical)?c=parseVariableStatement(e,t&~Context.AllowIn|Context.BlockScope,!1):33566791===a?c=parseVariableStatement(e,t&~Context.AllowIn,!1):17825809!==a&&(i=getLocation(e),s=restoreExpressionCoverGrammar(e,t&~Context.AllowIn|Context.DisallowEscapedKeyword,parseAssignmentExpression)),consume(e,t,69746)?(l="ForOfStatement",s?(e.flags&Flags.AllowDestructuring&&"AssignmentExpression"!==s.type||tolerant(e,t,73),reinterpret(e,t,s)):s=c,o=parseAssignmentExpression(e,t|Context.AllowIn)):consume(e,t,167786289)?(s?(e.flags&Flags.AllowDestructuring||tolerant(e,t,73),reinterpret(e,t,s)):s=c,l="ForInStatement",o=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn)):(16777234===e.token&&(s=parseSequenceExpression(e,t,s,i)),c&&(s=c),expect(e,t,17825809),p=17825809!==e.token?parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn):null,expect(e,t,17825809),u=16!==e.token?parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn):null),expect(e,t,16);const d=parseIterationStatement(e,t);return finishNode(t,e,n,"ForOfStatement"===l?{type:l,body:d,left:s,right:o,await:r}:o?{type:l,body:d,left:s,right:o}:{type:l,body:d,init:s,test:p,update:u})}function parseModuleItemList(e,t){nextToken(e,t);const n=[];for(;1048576!==e.token;)n.push(33554435===e.token?parseDirective(e,t):parseModuleItem(e,t|Context.AllowIn));return n}function parseModuleItem(e,t){switch(e.token){case 120:return parseDecorators(e,t);case 12371:return parseExportDeclaration(e,t);case 33566810:if(!(t&Context.OptionsNext&&lookahead(e,t,nextTokenIsLeftParenOrPeriod)))return parseImportDeclaration(e,t);default:return parseStatementListItem(e,t)}}function parseExportDeclaration(e,t){const n=getLocation(e),r=[];let a=null,o=null;switch(expect(e,t|Context.DisallowEscapedKeyword,12371),e.token){case 167774771:return parseExportAllDeclaration(e,t,n);case 12368:return parseExportDefault(e,t,n);case 41943052:{expect(e,t,41943052);let n=!1;for(;17825807!==e.token;)69743!==e.token&&12288&e.token&&(n=!0,setPendingError(e)),r.push(parseNamedExportDeclaration(e,t)),17825807!==e.token&&expect(e,t,16777234);expect(e,t|Context.DisallowEscapedKeyword,17825807),69745===e.token?a=parseModuleSpecifier(e,t):n&&tolerant(e,t,46),consumeSemicolon(e,t);break}case 33566797:o=parseClassDeclaration(e,t);break;case 33574984:case 33566793:o=parseVariableStatement(e,t|Context.BlockScope);break;case 33566791:o=parseVariableStatement(e,t);break;case 33566808:o=parseFunctionDeclaration(e,t);break;case 594028:if(lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)){o=parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t);break}default:report(e,1,tokenDesc(e.token))}return finishNode(t,e,n,{type:"ExportNamedDeclaration",source:a,specifiers:r,declaration:o})}function parseExportAllDeclaration(e,t,n){expect(e,t,167774771);const r=parseModuleSpecifier(e,t);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExportAllDeclaration",source:r})}function parseNamedExportDeclaration(e,t){const n=getLocation(e),r=parseIdentifierName(e,t|Context.DisallowEscapedKeyword,e.token);return finishNode(t,e,n,{type:"ExportSpecifier",local:r,exported:consume(e,t,167843947)?parseIdentifierName(e,t,e.token):r})}function parseExportDefault(e,t,n){let r;switch(expect(e,t|Context.DisallowEscapedKeyword,12368),e.token){case 33566808:r=parseFunctionDeclaration(e,t|Context.RequireIdentifier);break;case 120:case 33566797:r=parseClassDeclaration(e,t&~Context.AllowIn|Context.RequireIdentifier);break;case 594028:r=parseAsyncFunctionOrAssignmentExpression(e,t|Context.RequireIdentifier);break;default:r=parseAssignmentExpression(e,t|Context.AllowIn),consumeSemicolon(e,t)}return finishNode(t,e,n,{type:"ExportDefaultDeclaration",declaration:r})}function parseImportDeclaration(e,t){const n=getLocation(e);let r;expect(e,t,33566810);let a=[];return 33554435===e.token?r=parseLiteral(e,t):(a=parseImportClause(e,t|Context.DisallowEscapedKeyword),r=parseModuleSpecifier(e,t)),consumeSemicolon(e,t),finishNode(t,e,n,{type:"ImportDeclaration",specifiers:a,source:r})}function parseImportClause(e,t){const n=[];switch(e.token){case 33685505:if(n.push(parseImportDefaultSpecifier(e,t)),consume(e,t,16777234))switch(e.token){case 167774771:parseNameSpaceImport(e,t,n);break;case 41943052:parseNamedImports(e,t,n);break;default:tolerant(e,t,1,tokenDesc(e.token))}break;case 41943052:parseNamedImports(e,t,n);break;case 167774771:parseNameSpaceImport(e,t,n);break;default:report(e,1,tokenDesc(e.token))}return n}function parseNamedImports(e,t,n){for(expect(e,t,41943052);17825807!==e.token;)n.push(parseImportSpecifier(e,t)),17825807!==e.token&&expect(e,t,16777234);expect(e,t,17825807)}function parseImportSpecifier(e,t){const n=getLocation(e),{token:r}=e,a=parseIdentifierName(e,t|Context.DisallowEscapedKeyword,r);let o;return consume(e,t,167843947)?o=parseBindingIdentifier(e,t):(hasBit(r,12288)&&tolerant(e,t,46),hasBit(r,4194304)&&tolerant(e,t,47),o=a),finishNode(t,e,n,{type:"ImportSpecifier",local:o,imported:a})}function parseNameSpaceImport(e,t,n){const r=getLocation(e);expect(e,t,167774771),expect(e,t,167843947,82);const a=parseBindingIdentifier(e,t);n.push(finishNode(t,e,r,{type:"ImportNamespaceSpecifier",local:a}))}function parseModuleSpecifier(e,t){return expect(e,t,69745),33554435!==e.token&&report(e,1,tokenDesc(e.token)),parseLiteral(e,t)}function parseImportDefaultSpecifier(e,t){return finishNode(t,e,getLocation(e),{type:"ImportDefaultSpecifier",local:parseIdentifier(e,t)})}function parseAsyncFunctionOrAssignmentExpression(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t|Context.RequireIdentifier):parseAssignmentExpression(e,t|Context.AllowIn)}function createParser(e,t){return{source:e,length:e.length,index:0,line:1,column:0,startIndex:0,startColumn:0,startLine:1,lastIndex:0,lastColumn:0,lastLine:0,pendingExpressionError:void 0,flags:Flags.AllowDestructuring,token:1048576,tokenRaw:"",lastValue:0,comments:[],sourceFile:t,tokenRegExp:void 0,tokenValue:void 0,labelSet:void 0,errorLocation:void 0,errors:[]}}function parseSource(e,t,n){let r="";t&&(t.module&&(n|=Context.Module),t.next&&(n|=Context.OptionsNext),t.jsx&&(n|=Context.OptionsJSX),t.ranges&&(n|=Context.OptionsRanges),t.loc&&(n|=Context.OptionsLoc),t.raw&&(n|=Context.OptionsRaw),t.rawIdentifier&&(n|=Context.OptionsRawidentifiers),t.globalReturn&&(n|=Context.OptionsGlobalReturn),t.skipShebang&&(n|=Context.OptionsShebang),t.tolerant&&(n|=Context.OptionsTolerant),t.source&&(r=t.source),t.comments&&(n|=Context.OptionsComments),t.impliedStrict&&(n|=Context.Strict),t.experimental&&(n|=Context.OptionsExperimental),t.node&&(n|=Context.OptionsNode));const a=createParser(e,r),o=n&Context.Module?parseModuleItemList(a,n):parseStatementList(a,n),s={type:"Program",sourceType:n&Context.Module?"module":"script",body:o};return n&Context.LocationTracker&&(n&Context.OptionsRanges&&(s.start=0,s.end=e.length),n&Context.OptionsLoc&&(s.loc={start:{line:1,column:0},end:{line:a.line,column:a.column}},r&&(s.loc.source=r))),n&Context.OptionsComments&&(s.comments=a.comments),n&Context.OptionsTolerant&&(s.errors=a.errors),s}function parseStatementList(e,t){const n=[];let r=!0;for(nextToken(e,t|Context.DisallowEscapedKeyword);1048576!==e.token;)r&&33554435!==e.token&&(r=!1),r?(t&Context.Strict||12!==e.tokenRaw.length||"use strict"!==e.tokenValue||(t|=Context.Strict),n.push(parseDirective(e,t))):n.push(parseStatementListItem(e,t));return n}function parse(e,t){return t&&t.module?parseModule(e,t):parseScript(e,t)}function parseScript(e,t){return parseSource(e,t,Context.Empty)}function parseModule(e,t){return parseSource(e,t,Context.Strict|Context.Module)}var estree=Object.freeze({}),index=Object.freeze({scanIdentifier:scanIdentifier,scanMaybeIdentifier:scanMaybeIdentifier,scanHexIntegerLiteral:scanHexIntegerLiteral,scanOctalOrBinary:scanOctalOrBinary,scanImplicitOctalDigits:scanImplicitOctalDigits,scanSignedInteger:scanSignedInteger,scanNumericLiteral:scanNumericLiteral,scanNumericSeparator:scanNumericSeparator,scanDecimalDigitsOrSeparator:scanDecimalDigitsOrSeparator,scanDecimalAsSmi:scanDecimalAsSmi,scanRegularExpression:scanRegularExpression,scan:scan,scanEscapeSequence:scanEscapeSequence,throwStringError:throwStringError,scanString:scanString,consumeTemplateBrace:consumeTemplateBrace,scanTemplate:scanTemplate,skipSingleHTMLComment:skipSingleHTMLComment,skipSingleLineComment:skipSingleLineComment,skipMultiLineComment:skipMultiLineComment,addComment:addComment,nextUnicodeChar:nextUnicodeChar,isIdentifierPart:isIdentifierPart,escapeInvalidCharacters:escapeInvalidCharacters,consumeOpt:consumeOpt,consumeLineFeed:consumeLineFeed,scanPrivateName:scanPrivateName,advanceNewline:advanceNewline,fromCodePoint:fromCodePoint,readNext:readNext,toHex:toHex,advanceOnMaybeAstral:advanceOnMaybeAstral}),parser=Object.freeze({parseClassDeclaration:parseClassDeclaration,parseFunctionDeclaration:parseFunctionDeclaration,parseAsyncFunctionOrAsyncGeneratorDeclaration:parseAsyncFunctionOrAsyncGeneratorDeclaration,parseVariableDeclarationList:parseVariableDeclarationList,parseExpression:parseExpression,parseSequenceExpression:parseSequenceExpression,parseAssignmentExpression:parseAssignmentExpression,parseRestElement:parseRestElement,parseLeftHandSideExpression:parseLeftHandSideExpression,parsePrimaryExpression:parsePrimaryExpression,parseIdentifier:parseIdentifier,parseLiteral:parseLiteral,parseBigIntLiteral:parseBigIntLiteral,parseIdentifierName:parseIdentifierName,parseFunctionExpression:parseFunctionExpression,parseAsyncFunctionOrAsyncGeneratorExpression:parseAsyncFunctionOrAsyncGeneratorExpression,parsePropertyName:parsePropertyName,parseObjectLiteral:parseObjectLiteral,parseFormalListAndBody:parseFormalListAndBody,parseFunctionBody:parseFunctionBody,parseFormalParameters:parseFormalParameters,parseFormalParameterList:parseFormalParameterList,parseClassBodyAndElementList:parseClassBodyAndElementList,parseClassElement:parseClassElement,parseDecorators:parseDecorators,parseModuleItemList:parseModuleItemList,parseModuleItem:parseModuleItem,parseExportDeclaration:parseExportDeclaration,parseImportDeclaration:parseImportDeclaration,createParser:createParser,parseSource:parseSource,parseStatementList:parseStatementList,parse:parse,parseScript:parseScript,parseModule:parseModule,parseBindingIdentifierOrPattern:parseBindingIdentifierOrPattern,parseBindingIdentifier:parseBindingIdentifier,parseAssignmentRestElement:parseAssignmentRestElement,parseAssignmentPattern:parseAssignmentPattern,parseBindingInitializer:parseBindingInitializer,parseStatementListItem:parseStatementListItem,parseStatement:parseStatement,parseEmptyStatement:parseEmptyStatement,parseContinueStatement:parseContinueStatement,parseBreakStatement:parseBreakStatement,parseIfStatement:parseIfStatement,parseDebuggerStatement:parseDebuggerStatement,parseTryStatement:parseTryStatement,parseCatchBlock:parseCatchBlock,parseThrowStatement:parseThrowStatement,parseExpressionStatement:parseExpressionStatement,parseDirective:parseDirective,parseExpressionOrLabelledStatement:parseExpressionOrLabelledStatement,parseDoWhileStatement:parseDoWhileStatement,parseWhileStatement:parseWhileStatement,parseBlockStatement:parseBlockStatement,parseReturnStatement:parseReturnStatement,parseIterationStatement:parseIterationStatement,parseWithStatement:parseWithStatement,parseSwitchStatement:parseSwitchStatement,parseCaseOrDefaultClauses:parseCaseOrDefaultClauses,parseVariableStatement:parseVariableStatement,parseJSXRootElement:parseJSXRootElement,parseJSXOpeningElement:parseJSXOpeningElement,nextJSXToken:nextJSXToken,scanJSXToken:scanJSXToken,parseJSXText:parseJSXText,parseJSXAttributes:parseJSXAttributes,parseJSXSpreadAttribute:parseJSXSpreadAttribute,parseJSXNamespacedName:parseJSXNamespacedName,parseJSXAttributeName:parseJSXAttributeName,parseJSXAttribute:parseJSXAttribute,parseJSXEmptyExpression:parseJSXEmptyExpression,parseJSXSpreadChild:parseJSXSpreadChild,parseJSXExpressionContainer:parseJSXExpressionContainer,parseJSXExpression:parseJSXExpression,parseJSXClosingFragment:parseJSXClosingFragment,parseJSXClosingElement:parseJSXClosingElement,parseJSXIdentifier:parseJSXIdentifier,parseJSXMemberExpression:parseJSXMemberExpression,parseJSXElementName:parseJSXElementName,scanJSXIdentifier:scanJSXIdentifier});const Parser=parser,version="1.6.9";export{version,estree as ESTree,index as Scanner,parse,parseSource,parseModule,parseScript,characterType,errorMessages,constructError,report,tolerant,tokenDesc,descKeyword,Parser,isValidIdentifierPart,isValidIdentifierStart,mustEscape,Context,Flags,Labels,NumericState,ScannerState,ModifierState,CoverParenthesizedState,Escape,RegexFlags,CoverCallState,RegexState,ObjectState,validateBreakOrContinueLabel,addLabel,popLabel,hasLabel,finishNode,expect,consume,nextToken,hasBit,consumeSemicolon,parseExpressionCoverGrammar,restoreExpressionCoverGrammar,swapContext,validateParams,reinterpret,lookahead,isValidSimpleAssignmentTarget,getLocation,isValidIdentifier,isLexical,isEndOfCaseOrDefaultClauses,nextTokenIsLeftParenOrPeriod,nextTokenisIdentifierOrParen,nextTokenIsLeftParen,nextTokenIsFuncKeywordOnSameLine,isPropertyWithPrivateFieldKey,parseAndClassifyIdentifier,nameIsArgumentsOrEval,setPendingError,isEqualTagNames,isInstanceField,validateUpdateExpression,setPendingExpressionError,validateCoverParenthesizedExpression,validateAsyncArgumentList,isInOrOf}; diff --git a/node_modules/cherow/dist/native-modules/cherow.js b/node_modules/cherow/dist/native-modules/cherow.js new file mode 100644 index 0000000..aad8f46 --- /dev/null +++ b/node_modules/cherow/dist/native-modules/cherow.js @@ -0,0 +1,7276 @@ +// Note: this *must* be kept in sync with the enum's order.
+//
+// It exploits the enum value ordering, and it's necessarily a complete and
+// utter hack.
+//
+// All to lower it to a single monomorphic array access.
+const keywordDescTable = [
+ 'end of source',
+ /* Constants/Bindings */
+ 'identifier', 'number', 'string', 'regular expression',
+ 'false', 'true', 'null',
+ /* Template nodes */
+ 'template continuation', 'template end',
+ /* Punctuators */
+ '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '</', '/>',
+ /* Update operators */
+ '++', '--',
+ /* Assign operators */
+ '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
+ '&=',
+ /* Unary/binary operators */
+ 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
+ '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
+ /* Variable declaration kinds */
+ 'var', 'let', 'const',
+ /* Other reserved words */
+ 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
+ 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
+ 'this', 'throw', 'try', 'while', 'with',
+ /* Strict mode reserved words */
+ 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
+ /* Contextual keywords */
+ 'as', 'async', 'await', 'constructor', 'get', 'set', 'from', 'of',
+ '#',
+ 'eval', 'arguments', 'enum', 'BigInt', '@', 'JSXText',
+ /** TS */
+ 'KeyOf', 'ReadOnly', 'is', 'unique', 'declare', 'type', 'namespace', 'abstract', 'module',
+ 'global', 'require', 'target'
+];
+/**
+ * The conversion function between token and its string description/representation.
+ */
+function tokenDesc(token) {
+ return keywordDescTable[token & 255 /* Type */];
+}
+// Used `Object.create(null)` to avoid potential `Object.prototype`
+// interference.
+const descKeywordTable = Object.create(null, {
+ this: { value: 33566815 /* ThisKeyword */ },
+ function: { value: 33566808 /* FunctionKeyword */ },
+ if: { value: 12377 /* IfKeyword */ },
+ return: { value: 12380 /* ReturnKeyword */ },
+ var: { value: 33566791 /* VarKeyword */ },
+ else: { value: 12370 /* ElseKeyword */ },
+ for: { value: 12374 /* ForKeyword */ },
+ new: { value: 33566811 /* NewKeyword */ },
+ in: { value: 167786289 /* InKeyword */ },
+ typeof: { value: 302002218 /* TypeofKeyword */ },
+ while: { value: 12386 /* WhileKeyword */ },
+ case: { value: 12363 /* CaseKeyword */ },
+ break: { value: 12362 /* BreakKeyword */ },
+ try: { value: 12385 /* TryKeyword */ },
+ catch: { value: 12364 /* CatchKeyword */ },
+ delete: { value: 302002219 /* DeleteKeyword */ },
+ throw: { value: 302002272 /* ThrowKeyword */ },
+ switch: { value: 33566814 /* SwitchKeyword */ },
+ continue: { value: 12366 /* ContinueKeyword */ },
+ default: { value: 12368 /* DefaultKeyword */ },
+ instanceof: { value: 167786290 /* InstanceofKeyword */ },
+ do: { value: 12369 /* DoKeyword */ },
+ void: { value: 302002220 /* VoidKeyword */ },
+ finally: { value: 12373 /* FinallyKeyword */ },
+ arguments: { value: 37879925 /* Arguments */ },
+ keyof: { value: 131194 /* KeyOfKeyword */ },
+ readonly: { value: 131195 /* ReadOnlyKeyword */ },
+ unique: { value: 131197 /* UniqueKeyword */ },
+ declare: { value: 131198 /* DeclareKeyword */ },
+ async: { value: 594028 /* AsyncKeyword */ },
+ await: { value: 34017389 /* AwaitKeyword */ },
+ class: { value: 33566797 /* ClassKeyword */ },
+ const: { value: 33566793 /* ConstKeyword */ },
+ constructor: { value: 69742 /* ConstructorKeyword */ },
+ debugger: { value: 12367 /* DebuggerKeyword */ },
+ enum: { value: 12406 /* EnumKeyword */ },
+ eval: { value: 37879924 /* Eval */ },
+ export: { value: 12371 /* ExportKeyword */ },
+ extends: { value: 12372 /* ExtendsKeyword */ },
+ false: { value: 33566725 /* FalseKeyword */ },
+ from: { value: 69745 /* FromKeyword */ },
+ get: { value: 69743 /* GetKeyword */ },
+ implements: { value: 20579 /* ImplementsKeyword */ },
+ import: { value: 33566810 /* ImportKeyword */ },
+ interface: { value: 20580 /* InterfaceKeyword */ },
+ let: { value: 33574984 /* LetKeyword */ },
+ null: { value: 33566727 /* NullKeyword */ },
+ of: { value: 69746 /* OfKeyword */ },
+ package: { value: 20581 /* PackageKeyword */ },
+ private: { value: 20582 /* PrivateKeyword */ },
+ protected: { value: 20583 /* ProtectedKeyword */ },
+ public: { value: 20584 /* PublicKeyword */ },
+ set: { value: 69744 /* SetKeyword */ },
+ static: { value: 20585 /* StaticKeyword */ },
+ super: { value: 33566813 /* SuperKeyword */ },
+ true: { value: 33566726 /* TrueKeyword */ },
+ with: { value: 12387 /* WithKeyword */ },
+ yield: { value: 1107316842 /* YieldKeyword */ },
+ is: { value: 131196 /* IsKeyword */ },
+ type: { value: 131199 /* TypeKeyword */ },
+ namespace: { value: 131200 /* NameSpaceKeyword */ },
+ abstract: { value: 131201 /* AbstractKeyword */ },
+ as: { value: 167843947 /* AsKeyword */ },
+ module: { value: 131202 /* ModuleKeyword */ },
+ global: { value: 131203 /* GlobalKeyword */ },
+ require: { value: 131204 /* RequireKeyword */ },
+ target: { value: 131205 /* TargetKeyword */ },
+});
+function descKeyword(value) {
+ return (descKeywordTable[value] | 0);
+} + +/*@internal*/
+const characterType = [
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 16 /* Space */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+]; + +// Unicode v. 11 support
+// tslint:disable
+function isValidIdentifierPart(code) {
+ return (convert[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
+}
+function isValidIdentifierStart(code) {
+ return (convert[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
+}
+function mustEscape(code) {
+ return (convert[(code >>> 5) + 69632] >>> code & 31 & 1) !== 0;
+}
+const convert = ((compressed, lookup) => {
+ const result = new Uint32Array(104448);
+ let index = 0;
+ let subIndex = 0;
+ while (index < 3392) {
+ const inst = compressed[index++];
+ if (inst < 0) {
+ subIndex -= inst;
+ }
+ else {
+ let code = compressed[index++];
+ if (inst & 2)
+ code = lookup[code];
+ if (inst & 1) {
+ result.fill(code, subIndex, subIndex += compressed[index++]);
+ }
+ else {
+ result[subIndex++] = code;
+ }
+ }
+ }
+ return result;
+})([-1, 2, 28, 2, 29, 2, 5, -1, 0, 77595648, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 15, 2, 60, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 61, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 20, 2, 0, 0, 608174079, 2, 0, 2, 127, 2, 6, 2, 62, -1, 2, 64, 2, 26, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2965387679, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 2, 171, 0, 4294828031, 0, 3825204735, 0, 123747807, 0, 65487, 2, 3, 0, 4092591615, 0, 1080049119, 0, 458703, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247020, 2, 68, 0, 4284449919, 0, 851904, 2, 4, 2, 16, 0, 67076095, -1, 2, 69, 0, 1006628014, 0, 4093591391, -1, 0, 50331649, 0, 3265266687, 2, 34, 0, 4294844415, 0, 4278190047, 2, 23, 2, 125, -1, 3, 0, 2, 2, 33, 2, 0, 2, 9, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 10, 0, 261632, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 2088959, 2, 31, 2, 8, 0, 909311, 3, 0, 2, 0, 814743551, 2, 42, 0, 67057664, 3, 0, 2, 2, 45, 2, 0, 2, 32, 2, 0, 2, 18, 2, 7, 0, 268374015, 2, 30, 2, 51, 2, 0, 2, 78, 0, 134153215, -1, 2, 6, 2, 0, 2, 7, 0, 2684354559, 0, 67044351, 0, 1073676416, -2, 3, 0, 2, 2, 43, 0, 1046528, 3, 0, 3, 2, 8, 2, 0, 2, 41, 0, 4294960127, 2, 9, 2, 39, 2, 10, 0, 4294377472, 2, 21, 3, 0, 7, 0, 4227858431, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -1, 2, 122, 0, 1048577, 2, 84, 2, 12, -1, 2, 12, 0, 131042, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 1046559, 2, 0, 2, 13, 2, 0, 0, 2147516671, 2, 24, 3, 88, 2, 2, 0, -16, 2, 89, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 2, 119, 2, 0, 0, 3220242431, 3, 0, 3, 2, 20, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 2, 0, 2, 27, 2, 0, 2, 8, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 25, 2, 8, 2, 23, 3, 0, 2, 0, 67076097, 2, 7, 2, 0, 2, 24, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 3774349439, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, 2, 19, 0, 1638399, 2, 169, 2, 104, 3, 0, 3, 2, 23, 2, 28, 2, 29, 2, 5, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -3, 2, 146, -4, 2, 23, 2, 0, 2, 37, 0, 1, 2, 0, 2, 63, 2, 32, 2, 16, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 33, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277137519, 0, 2269118463, -1, 3, 23, 2, -1, 2, 34, 2, 38, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 48, -14, 2, 23, 2, 44, 2, 37, -5, 3, 0, 2, 2, 38, 0, 2147549120, 2, 0, 2, 16, 2, 17, 2, 130, 2, 0, 2, 52, 0, 4294901872, 0, 5242879, 3, 0, 2, 0, 402595359, -1, 2, 118, 0, 1090519039, -2, 2, 120, 2, 39, 2, 0, 2, 55, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, -4, 3, 0, 2, 0, 1140787199, -1, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 41, 2, 42, -1, 2, 10, 2, 43, -6, 2, 0, 2, 16, -3, 3, 0, 2, 0, 2147484671, -8, 2, 0, 2, 7, 2, 44, 2, 0, 0, 603979727, -1, 2, 0, 2, 45, -8, 2, 54, 2, 46, 0, 67043329, 2, 123, 2, 47, 0, 8388351, -2, 2, 124, 0, 3028287487, 2, 48, 2, 126, 0, 33259519, 2, 42, -9, 2, 24, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, 2, 42, -2, 2, 17, 2, 51, 2, 0, 2, 24, 0, 67043343, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 4294901791, 2, 7, 2, 164, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 0, 1677656575, -166, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 90, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -42, 0, 4194303871, 0, 2011, -62, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 55, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -22583, 3, 0, 7, 2, 19, -6130, 3, 5, 2, -1, 0, 69207040, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 15, 2, 60, 2, 0, 2, 35, -1, 2, 17, 2, 61, -1, 2, 0, 2, 62, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 19, 2, 63, 3, 0, 2, 0, 131135, 2, 94, 0, 70256639, 0, 71303167, 0, 272, 2, 45, 2, 62, -1, 2, 64, -2, 2, 96, 0, 603979775, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 65, 2, 66, 0, 33554435, 2, 121, 2, 65, 2, 147, 0, 131075, 0, 3594373096, 0, 67094296, 2, 66, -1, 2, 67, 0, 603979263, 2, 156, 0, 3, 0, 4294828001, 0, 602930687, 2, 180, 0, 393219, 2, 67, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 68, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 69, 0, 537783470, 0, 4026531935, -1, 0, 1, -1, 2, 34, 2, 70, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 16, -1, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 253951, 3, 20, 2, 0, 122879, 2, 0, 2, 8, 0, 276824064, -2, 3, 0, 2, 2, 45, 2, 0, 0, 4294903295, 2, 0, 2, 18, 2, 7, -1, 2, 17, 2, 51, 2, 0, 2, 78, 2, 42, -1, 2, 24, 2, 0, 2, 31, -2, 0, 128, -2, 2, 79, 2, 8, 0, 4064, -1, 2, 117, 0, 4227907585, 2, 0, 2, 116, 2, 0, 2, 50, 2, 196, 2, 9, 2, 39, 2, 10, -1, 0, 6544896, 3, 0, 6, -2, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -3, 2, 84, 2, 12, -3, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 817183, 2, 0, 2, 13, 2, 0, 0, 33023, 2, 24, 3, 88, 2, -17, 2, 89, 0, 524157950, 2, 4, 2, 0, 2, 90, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 19, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 0, 4294965179, 0, 7, 2, 0, 2, 8, 2, 92, 2, 8, -1, 0, 1761345536, 2, 94, 2, 95, 2, 38, 2, 23, 2, 96, 2, 36, 2, 162, 0, 2080440287, 2, 0, 2, 35, 2, 138, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 7, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 2700607615, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, -3, 2, 104, 3, 0, 3, 2, 23, -1, 3, 5, 2, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -8, 2, 23, 2, 0, 2, 37, -1, 2, 0, 2, 63, 2, 32, 2, 18, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 17, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277075969, 2, 18, -1, 3, 23, 2, -1, 2, 34, 2, 139, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 50, -14, 2, 23, 2, 44, 2, 116, -5, 2, 117, 2, 41, -2, 2, 117, 2, 19, 2, 17, 2, 35, 2, 117, 2, 38, 0, 4294901776, 0, 4718591, 2, 117, 2, 36, 0, 335544350, -1, 2, 118, 2, 119, -2, 2, 120, 2, 39, 2, 7, -1, 2, 121, 2, 65, 0, 3758161920, 0, 3, -4, 2, 0, 2, 31, 2, 174, -1, 2, 0, 2, 19, 0, 176, -5, 2, 0, 2, 49, 2, 182, -1, 2, 0, 2, 19, 2, 194, -1, 2, 0, 2, 62, -2, 2, 16, -7, 2, 0, 2, 119, -3, 3, 0, 2, 2, 122, -8, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871887, -1, 2, 0, 2, 45, -8, 2, 54, 2, 49, 0, 1, 2, 123, 2, 19, -3, 2, 124, 2, 37, 2, 125, 2, 126, 0, 16778239, -10, 2, 36, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, -3, 2, 17, 2, 127, 2, 0, 2, 19, 2, 50, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 65567, -1, 2, 26, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 2, 130, -187, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 2, 138, -129, 3, 0, 6, 2, 139, -1, 3, 0, 2, 2, 50, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -28719, 2, 0, 0, 1, -1, 2, 122, 2, 0, 0, 8193, -21, 0, 50331648, 0, 10255, 0, 4, -11, 2, 66, 2, 168, -1, 0, 71680, -1, 2, 157, 0, 4292900864, 0, 805306431, -5, 2, 146, -1, 2, 176, -1, 0, 6144, -2, 2, 123, -1, 2, 150, -1, 2, 153, 2, 147, 2, 161, 2, 0, 0, 3223322624, 2, 36, 0, 4, -4, 2, 188, 0, 205128192, 0, 1333757536, 0, 2147483696, 0, 423953, 0, 747766272, 0, 2717763192, 0, 4286578751, 0, 278545, 2, 148, 0, 4294886464, 0, 33292336, 0, 417809, 2, 148, 0, 1329579616, 0, 4278190128, 0, 700594195, 0, 1006647527, 0, 4286497336, 0, 4160749631, 2, 149, 0, 469762560, 0, 4171219488, 0, 16711728, 2, 149, 0, 202375680, 0, 3214918176, 0, 4294508592, 0, 139280, -1, 0, 983584, 2, 190, 0, 58720275, 0, 3489923072, 0, 10517376, 0, 4293066815, 0, 1, 0, 2013265920, 2, 175, 2, 0, 0, 17816169, 0, 3288339281, 0, 201375904, 2, 0, -2, 0, 256, 0, 122880, 0, 16777216, 2, 146, 0, 4160757760, 2, 0, -6, 2, 163, -11, 0, 3263218176, -1, 0, 49664, 0, 2160197632, 0, 8388802, -1, 0, 12713984, -1, 2, 150, 2, 155, 2, 158, -2, 2, 159, -20, 0, 3758096385, -2, 2, 151, 0, 4292878336, 2, 22, 2, 166, 0, 4294057984, -2, 2, 160, 2, 152, 2, 172, -2, 2, 151, -1, 2, 179, -1, 2, 167, 2, 122, 0, 4026593280, 0, 14, 0, 4292919296, -1, 2, 154, 0, 939588608, -1, 0, 805306368, -1, 2, 122, 0, 1610612736, 2, 152, 2, 153, 3, 0, 2, -2, 2, 154, 2, 155, -3, 0, 267386880, -1, 2, 156, 0, 7168, -1, 0, 65024, 2, 150, 2, 157, 2, 158, -7, 2, 165, -8, 2, 159, -1, 0, 1426112704, 2, 160, -1, 2, 185, 0, 271581216, 0, 2149777408, 2, 19, 2, 157, 2, 122, 0, 851967, 0, 3758129152, -1, 2, 19, 2, 178, -4, 2, 154, -20, 2, 192, 2, 161, -56, 0, 3145728, 2, 184, -1, 2, 191, 2, 122, -1, 2, 162, 2, 122, -4, 0, 32505856, -1, 2, 163, -1, 0, 2147385088, 2, 22, 1, 2155905152, 2, -3, 2, 164, 2, 0, 2, 165, -2, 2, 166, -6, 2, 167, 0, 4026597375, 0, 1, -1, 0, 1, -1, 2, 168, -3, 2, 139, 2, 66, -2, 2, 162, 2, 177, -1, 2, 173, 2, 122, -6, 2, 122, -213, 2, 167, -657, 2, 17, -36, 2, 169, -1, 2, 186, -10, 0, 4294963200, -5, 2, 170, -5, 2, 158, 2, 0, 2, 24, -1, 0, 4227919872, -1, 2, 170, -2, 0, 4227874752, -3, 0, 2146435072, 2, 155, -2, 0, 1006649344, 2, 122, -1, 2, 22, 0, 201375744, -3, 0, 134217720, 2, 22, 0, 4286677377, 0, 32896, -1, 2, 171, -3, 2, 172, -349, 2, 173, 2, 174, 2, 175, 3, 0, 264, -11, 2, 176, -2, 2, 158, 2, 0, 0, 520617856, 0, 2692743168, 0, 36, -3, 0, 524284, -11, 2, 19, -1, 2, 183, -1, 2, 181, 0, 3221291007, 2, 158, -1, 0, 524288, 0, 2158720, -3, 2, 155, 0, 1, -4, 2, 122, 0, 3808625411, 0, 3489628288, 0, 4096, 0, 1207959680, 0, 3221274624, 2, 0, -3, 2, 177, 0, 120, 0, 7340032, -2, 0, 4026564608, 2, 4, 2, 19, 2, 160, 3, 0, 4, 2, 155, -1, 2, 178, 2, 175, -1, 0, 8176, 2, 179, 2, 177, 2, 180, -1, 0, 4290773232, 2, 0, -4, 2, 160, 2, 187, 0, 15728640, 2, 175, -1, 2, 157, -1, 0, 4294934512, 3, 0, 4, -9, 2, 22, 2, 167, 2, 181, 3, 0, 4, 0, 704, 0, 1849688064, 0, 4194304, -1, 2, 122, 0, 4294901887, 2, 0, 0, 130547712, 0, 1879048192, 0, 2080374784, 3, 0, 2, -1, 2, 182, 2, 183, -1, 0, 17829776, 0, 2025848832, 0, 4261477888, -2, 2, 0, -1, 0, 4286580608, -1, 0, 29360128, 2, 184, 0, 16252928, 0, 3791388672, 2, 39, 3, 0, 2, -2, 2, 193, 2, 0, -1, 2, 26, -1, 0, 66584576, -1, 2, 189, 3, 0, 9, 2, 122, 3, 0, 4, -1, 2, 157, 2, 158, 3, 0, 5, -2, 0, 245760, 0, 2147418112, -1, 2, 146, 2, 199, 0, 4227923456, -1, 2, 185, 2, 186, 2, 22, -2, 2, 176, 0, 4292870145, 0, 262144, 2, 122, 3, 0, 2, 0, 1073758848, 2, 187, -1, 0, 4227921920, 2, 188, 0, 68289024, 0, 528402016, 0, 4292927536, 3, 0, 4, -2, 0, 2483027968, 2, 0, -2, 2, 189, 3, 0, 5, -1, 2, 184, 2, 160, 2, 0, -2, 0, 4227923936, 2, 63, -1, 2, 170, 2, 94, 2, 0, 2, 150, 2, 154, 3, 0, 6, -1, 2, 175, 3, 0, 3, -2, 0, 2146959360, 3, 0, 8, -2, 2, 157, -1, 2, 190, 2, 117, -1, 2, 151, 3, 0, 8, 2, 191, 0, 8388608, 2, 171, 2, 169, 2, 183, 0, 4286578944, 3, 0, 2, 0, 1152, 0, 1266679808, 2, 189, 0, 576, 0, 4261707776, 2, 94, 3, 0, 9, 2, 151, 3, 0, 8, -28, 2, 158, 3, 0, 3, -3, 0, 4292902912, -6, 2, 96, 3, 0, 85, -33, 2, 164, 3, 0, 126, -18, 2, 192, 3, 0, 269, -17, 2, 151, 2, 122, 0, 4294917120, 3, 0, 2, 2, 19, 0, 4290822144, -2, 0, 67174336, 0, 520093700, 2, 17, 3, 0, 21, -2, 2, 177, 3, 0, 3, -2, 0, 65504, 2, 122, 2, 49, 3, 0, 2, 2, 92, -191, 2, 123, -23, 2, 26, 3, 0, 296, -8, 2, 122, 3, 0, 2, 2, 19, -11, 2, 175, 3, 0, 72, -3, 0, 3758159872, 0, 201391616, 3, 0, 155, -7, 2, 167, -1, 0, 384, -1, 0, 133693440, -3, 2, 193, -2, 2, 30, 3, 0, 4, 2, 166, -2, 2, 22, 2, 151, 3, 0, 4, -2, 2, 185, -1, 2, 146, 0, 335552923, 2, 194, -1, 0, 538974272, 0, 2214592512, 0, 132000, -10, 0, 192, -8, 0, 12288, -21, 0, 134213632, 0, 4294901761, 3, 0, 42, 0, 100663424, 0, 4294965284, 3, 0, 62, -6, 0, 4286578784, 2, 0, -2, 0, 1006696448, 3, 0, 24, 2, 37, -1, 2, 195, 3, 0, 10, 2, 194, 0, 4110942569, 0, 1432950139, 0, 2701658217, 0, 4026532864, 0, 4026532881, 2, 0, 2, 47, 3, 0, 8, -1, 2, 154, -2, 2, 166, 0, 98304, 0, 65537, 2, 167, 2, 169, -2, 2, 154, -1, 2, 63, 2, 0, 2, 116, 2, 197, 2, 175, 0, 4294770176, 2, 30, 3, 0, 4, -30, 2, 195, 2, 196, -3, 2, 166, -2, 2, 151, 2, 0, 2, 154, -1, 2, 189, -1, 2, 157, 2, 198, 3, 0, 2, 2, 154, 2, 122, -1, 0, 193331200, -1, 0, 4227923960, 2, 197, -1, 3, 0, 3, 2, 198, 3, 0, 44, -1334, 2, 22, 2, 0, -129, 2, 195, -6, 2, 160, -180, 2, 199, -233, 2, 4, 3, 0, 96, -16, 2, 160, 3, 0, 22583, -7, 2, 17, 3, 0, 6128], [4294967295, 4294967291, 4092460543, 4294828015, 4294967294, 134217726, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 1061158911, 536805376, 4294910143, 4160749567, 4294901759, 134217727, 4294901760, 4194303, 65535, 262143, 67108863, 4286578688, 536870911, 8388607, 4294918143, 4294443008, 255, 67043328, 2281701374, 4294967232, 2097151, 4294903807, 4294902783, 4294967039, 511, 524287, 131071, 127, 4294902271, 4294549487, 16777215, 1023, 67047423, 4294901888, 33554431, 4286578687, 4294770687, 67043583, 32767, 15, 2047999, 4292870143, 4294934527, 4294966783, 67045375, 4294967279, 262083, 20511, 4290772991, 41943039, 493567, 2047, 4294959104, 1071644671, 602799615, 65536, 4294828000, 805044223, 4277151126, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 4294967264, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4294967292, 4294965759, 4294966272, 4294901823, 4294967280, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 268369920, 4292804608, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4294966591, 2445279231, 3670015, 3238002687, 63, 4294967288, 4294705151, 4095, 3221208447, 4294549472, 2147483648, 4294705152, 4294966143, 64, 4294966719, 16383, 3774873592, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4087, 31, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 536870912, 2952790016, 202506752, 139264, 402653184, 4261412864, 4227922944, 2147532800, 61440, 3758096384, 117440512, 65280, 4227858432, 3233808384, 3221225472, 4294965248, 32768, 57152, 4294934528, 67108864, 4293918720, 4290772992, 25165824, 57344, 4278190080, 65472, 4227907584, 65520, 1920, 4026531840, 49152, 4160749568, 4294836224, 63488, 1073741824, 4294967040, 251658240, 196608, 12582912, 2097152, 65408, 64512, 417808, 4227923712, 48, 512, 4294967168, 4294966784, 16, 4292870144, 4227915776, 65528, 4294950912, 65532]); + +/**
+ * Return the next unicodechar in the stream
+ *
+ * @param parser Parser object
+ */
+function nextUnicodeChar(parser) {
+ const { index } = parser;
+ const hi = parser.source.charCodeAt(index);
+ if (hi < 55296 /* LeadSurrogateMin */ || hi > 56319 /* LeadSurrogateMax */)
+ return hi;
+ const lo = parser.source.charCodeAt(index + 1);
+ if (lo < 56320 /* TrailSurrogateMin */ || lo > 57343 /* TrailSurrogateMax */)
+ return hi;
+ return 65536 /* NonBMPMin */ + ((hi & 0x3FF) << 10) | lo & 0x3FF;
+}
+/**
+ * Returns true if this is a valid identifier part
+ *
+ * @param code Codepoint
+ */
+const isIdentifierPart = (code) => (characterType[code] & 1 /* IdentifierStart */) !== 0 || isValidIdentifierPart(code);
+function escapeInvalidCharacters(code) {
+ switch (code) {
+ case 0 /* Null */:
+ return '\\0';
+ case 8 /* Backspace */:
+ return '\\b';
+ case 9 /* Tab */:
+ return '\\t';
+ case 10 /* LineFeed */:
+ return '\\n';
+ case 11 /* VerticalTab */:
+ return '\\v';
+ case 12 /* FormFeed */:
+ return '\\f';
+ case 13 /* CarriageReturn */:
+ return '\\r';
+ default:
+ if (!mustEscape(code))
+ return fromCodePoint(code);
+ if (code < 0x10)
+ return `\\x0${code.toString(16)}`;
+ if (code < 0x100)
+ return `\\x${code.toString(16)}`;
+ if (code < 0x1000)
+ return `\\u0${code.toString(16)}`;
+ if (code < 0x10000)
+ return `\\u${code.toString(16)}`;
+ return `\\u{${code.toString(16)}}`;
+ }
+}
+/**
+ * Consume an token in the scanner on match. This is an equalent to
+ * 'consume' used in the parser code itself.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeOpt(parser, code) {
+ if (parser.source.charCodeAt(parser.index) !== code)
+ return false;
+ parser.index++;
+ parser.column++;
+ return true;
+}
+/**
+ * Consumes line feed
+ *
+ * @param parser Parser object
+ * @param state Scanner state
+ */
+function consumeLineFeed(parser, state) {
+ parser.flags |= Flags.NewLine;
+ parser.index++;
+ if ((state & ScannerState.LastIsCR) === 0) {
+ parser.column = 0;
+ parser.line++;
+ }
+}
+/**
+ * Scans private name. Stage 3 proposal related
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanPrivateName(parser, context) {
+ if (!(context & Context.InClass) || !isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return 115 /* Hash */;
+}
+/**
+ * Advance to new line
+ *
+ * @param parser Parser object
+ */
+function advanceNewline(parser) {
+ parser.flags |= Flags.NewLine;
+ parser.index++;
+ parser.column = 0;
+ parser.line++;
+}
+const fromCodePoint = (code) => {
+ return code <= 0xFFFF ?
+ String.fromCharCode(code) :
+ String.fromCharCode(((code - 65536 /* NonBMPMin */) >> 10) + 55296 /* LeadSurrogateMin */, ((code - 65536 /* NonBMPMin */) & (1024 - 1)) + 56320 /* TrailSurrogateMin */);
+};
+function readNext(parser) {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.source.length)
+ report(parser, 14 /* UnicodeOutOfRange */);
+ return nextUnicodeChar(parser);
+}
+function toHex(code) {
+ if (code < 48 /* Zero */)
+ return -1;
+ if (code <= 57 /* Nine */)
+ return code - 48 /* Zero */;
+ if (code < 65 /* UpperA */)
+ return -1;
+ if (code <= 70 /* UpperF */)
+ return code - 65 /* UpperA */ + 10;
+ if (code < 97 /* LowerA */)
+ return -1;
+ if (code <= 102 /* LowerF */)
+ return code - 97 /* LowerA */ + 10;
+ return -1;
+}
+function advanceOnMaybeAstral(parser, ch) {
+ parser.index++;
+ parser.column++;
+ if (ch > 0xFFFF)
+ parser.index++;
+} + +/**
+ * Scan escape sequence
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanEscapeSequence(parser, context, first) {
+ switch (first) {
+ case 98 /* LowerB */:
+ return 8 /* Backspace */;
+ case 102 /* LowerF */:
+ return 12 /* FormFeed */;
+ case 114 /* LowerR */:
+ return 13 /* CarriageReturn */;
+ case 110 /* LowerN */:
+ return 10 /* LineFeed */;
+ case 116 /* LowerT */:
+ return 9 /* Tab */;
+ case 118 /* LowerV */:
+ return 11 /* VerticalTab */;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ return Escape.Empty;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ {
+ // 1 to 3 octal digits
+ let code = first - 48 /* Zero */;
+ let index = parser.index + 1;
+ let column = parser.column + 1;
+ let next = parser.source.charCodeAt(index);
+ if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ // Strict mode code allows only \0, then a non-digit.
+ if (code !== 0 || next === 56 /* Eight */ || next === 57 /* Nine */) {
+ if (context & Context.Strict)
+ return Escape.StrictOctal;
+ parser.flags |= Flags.HasOctal;
+ }
+ }
+ else if (context & Context.Strict) {
+ return Escape.StrictOctal;
+ }
+ else {
+ parser.flags |= Flags.HasOctal;
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ parser.index = index - 1;
+ parser.column = column - 1;
+ }
+ return code;
+ }
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ // 1 to 2 octal digits
+ if (context & Context.Strict)
+ return Escape.StrictOctal;
+ let code = first - 48 /* Zero */;
+ const index = parser.index + 1;
+ const column = parser.column + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ code = code * 8 + (next - 48 /* Zero */);
+ parser.lastValue = next;
+ parser.index = index;
+ parser.column = column;
+ }
+ return code;
+ }
+ // `8`, `9` (invalid escapes)
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return Escape.EightOrNine;
+ // ASCII escapes
+ case 120 /* LowerX */:
+ {
+ const ch1 = parser.lastValue = readNext(parser);
+ const hi = toHex(ch1);
+ if (hi < 0)
+ return Escape.InvalidHex;
+ const ch2 = parser.lastValue = readNext(parser);
+ const lo = toHex(ch2);
+ if (lo < 0)
+ return Escape.InvalidHex;
+ return hi << 4 | lo;
+ }
+ // UCS-2/Unicode escapes
+ case 117 /* LowerU */:
+ {
+ let ch = parser.lastValue = readNext(parser);
+ if (ch === 123 /* LeftBrace */) {
+ ch = parser.lastValue = readNext(parser);
+ let code = toHex(ch);
+ if (code < 0)
+ return Escape.InvalidHex;
+ ch = parser.lastValue = readNext(parser);
+ while (ch !== 125 /* RightBrace */) {
+ const digit = toHex(ch);
+ if (digit < 0)
+ return Escape.InvalidHex;
+ code = code * 16 + digit;
+ // Code point out of bounds
+ if (code > 1114111 /* NonBMPMax */)
+ return Escape.OutOfRange;
+ ch = parser.lastValue = readNext(parser);
+ }
+ return code;
+ }
+ else {
+ // \uNNNN
+ let codePoint = toHex(ch);
+ if (codePoint < 0)
+ return Escape.InvalidHex;
+ for (let i = 0; i < 3; i++) {
+ ch = parser.lastValue = readNext(parser);
+ const digit = toHex(ch);
+ if (digit < 0)
+ return Escape.InvalidHex;
+ codePoint = codePoint * 16 + digit;
+ }
+ return codePoint;
+ }
+ }
+ default:
+ return parser.source.charCodeAt(parser.index);
+ }
+}
+/**
+ * Throws a string error for either string or template literal
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function throwStringError(parser, context, code) {
+ switch (code) {
+ case Escape.Empty:
+ return;
+ case Escape.StrictOctal:
+ report(parser, context & Context.TaggedTemplate ?
+ 76 /* TemplateOctalLiteral */ :
+ 11 /* StrictOctalEscape */);
+ case Escape.EightOrNine:
+ report(parser, 13 /* InvalidEightAndNine */);
+ case Escape.InvalidHex:
+ report(parser, 75 /* MalformedEscape */, 'hexadecimal');
+ case Escape.OutOfRange:
+ report(parser, 14 /* UnicodeOutOfRange */);
+ /* istanbul ignore next */
+ default:
+ // ignore
+ }
+}
+/**
+ * Scan a string literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote codepoint
+ */
+function scanString(parser, context, quote) {
+ const { index: start, lastValue } = parser;
+ let ret = '';
+ parser.index++;
+ parser.column++; // consume quote
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ switch (ch) {
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ report(parser, 6 /* UnterminatedString */);
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch > 128 /* MaxAsciiCharacter */) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ const code = scanEscapeSequence(parser, context, ch);
+ if (code >= 0)
+ ret += fromCodePoint(code);
+ else
+ throwStringError(parser, context, code);
+ ch = parser.lastValue;
+ }
+ break;
+ default:
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++; // consume quote
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ return 33554435 /* StringLiteral */;
+} + +/**
+ * Consumes template brace
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeTemplateBrace(parser, context) {
+ if (parser.index >= parser.length)
+ report(parser, 9 /* UnterminatedTemplate */);
+ // Upon reaching a '}', consume it and rewind the scanner state
+ parser.index--;
+ parser.column--;
+ return scanTemplate(parser, context);
+}
+/**
+ * Scan template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param first Codepoint
+ */
+function scanTemplate(parser, context) {
+ const { index: start, lastValue } = parser;
+ let tail = true;
+ let ret = '';
+ let ch = readNext(parser);
+ loop: while (ch !== 96 /* Backtick */) {
+ switch (ch) {
+ // Break after a literal `${` (thus the dedicated code path).
+ case 36 /* Dollar */:
+ {
+ const index = parser.index + 1;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 123 /* LeftBrace */) {
+ parser.index = index;
+ parser.column++;
+ tail = false;
+ break loop;
+ }
+ ret += '$';
+ break;
+ }
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch >= 128) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ // Because octals are forbidden in escaped template sequences and the fact that
+ // both string and template scanning uses the same method - 'scanEscapeSequence',
+ // we set the strict context mask.
+ const code = scanEscapeSequence(parser, context | Context.Strict, ch);
+ if (code >= 0) {
+ ret += fromCodePoint(code);
+ }
+ else if (code !== Escape.Empty && context & Context.TaggedTemplate) {
+ ret = undefined;
+ ch = scanLooserTemplateSegment(parser, parser.lastValue);
+ if (ch < 0) {
+ tail = false;
+ }
+ break loop;
+ }
+ else {
+ throwStringError(parser, context | Context.TaggedTemplate, code);
+ }
+ ch = parser.lastValue;
+ }
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ // falls through
+ default:
+ if (ret != null)
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++;
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ if (tail) {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 1);
+ return 33554441 /* TemplateTail */;
+ }
+ else {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 2);
+ return 33554440 /* TemplateCont */;
+ }
+}
+/**
+ * Scan looser template segment
+ *
+ * @param parser Parser object
+ * @param ch codepoint
+ */
+function scanLooserTemplateSegment(parser, ch) {
+ while (ch !== 96 /* Backtick */) {
+ if (ch === 36 /* Dollar */ && parser.source.charCodeAt(parser.index + 1) === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return -ch;
+ }
+ // Skip '\' and continue to scan the template token to search
+ // for the end, without validating any escape sequences
+ ch = readNext(parser);
+ }
+ return ch;
+} + +// 11.8.3 Numeric Literals
+/**
+ * Scans hex integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HexIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanHexIntegerLiteral(parser, context) {
+ parser.index++;
+ parser.column++;
+ let state = NumericState.None;
+ let value = toHex(parser.source.charCodeAt(parser.index));
+ if (value < 0)
+ report(parser, 0 /* Unexpected */);
+ parser.index++;
+ parser.column++;
+ while (parser.index < parser.length) {
+ const next = parser.source.charCodeAt(parser.index);
+ if (context & Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ const digit = toHex(next);
+ if (digit < 0)
+ break;
+ value = value * 16 + digit;
+ parser.index++;
+ parser.column++;
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+}
+/**
+ * Scans binary and octal integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalIntegerLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BinaryIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanOctalOrBinary(parser, context, base) {
+ parser.index++;
+ parser.column++;
+ let digits = 0;
+ let ch;
+ let value = 0;
+ let state = NumericState.None;
+ while (parser.index < parser.length) {
+ ch = parser.source.charCodeAt(parser.index);
+ if (context & Context.OptionsNext && ch === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ const converted = ch - 48 /* Zero */;
+ if (!(ch >= 48 /* Zero */ && ch <= 57 /* Nine */) || converted >= base)
+ break;
+ value = value * base + converted;
+ parser.index++;
+ parser.column++;
+ digits++;
+ }
+ if (digits === 0)
+ report(parser, 0 /* Unexpected */);
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+}
+/**
+ * Scans implicit octal digits
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalDigits)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanImplicitOctalDigits(parser, context) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ if (context & Context.Strict)
+ report(parser, 0 /* Unexpected */);
+ let index = parser.index;
+ let column = parser.column;
+ let code = 0;
+ parser.flags |= Flags.HasOctal;
+ // Implicit octal, unless there is a non-octal digit.
+ // (Annex B.1.1 on Numeric Literals)
+ while (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ else if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ return scanNumericLiteral(parser, context);
+ }
+ else {
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ }
+ parser.index = index;
+ parser.column = column;
+ return assembleNumericLiteral(parser, context, code, consumeOpt(parser, 110 /* LowerN */));
+ }
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ parser.flags |= Flags.HasOctal;
+ default:
+ if (context & Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ return scanNumericLiteral(parser, context);
+ }
+}
+/**
+ * Scans signed integer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SignedInteger)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanSignedInteger(parser, end) {
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */ || next === 45 /* Hyphen */) {
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (!(next >= 48 /* Zero */ && next <= 57 /* Nine */)) {
+ report(parser, 0 /* Unexpected */);
+ }
+ const preNumericPart = parser.index;
+ const finalFragment = scanDecimalDigitsOrSeparator(parser);
+ return parser.source.substring(end, preNumericPart) + finalFragment;
+}
+/**
+ * Scans numeric literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanNumericLiteral(parser, context, state = NumericState.None) {
+ let value = state & NumericState.Float ?
+ 0 :
+ scanDecimalAsSmi(parser, context);
+ const next = parser.source.charCodeAt(parser.index);
+ // I know I'm causing a bug here. The question is - will anyone figure this out?
+ if (next !== 46 /* Period */ && next !== 95 /* Underscore */ && !isValidIdentifierStart(next)) {
+ return assembleNumericLiteral(parser, context, value);
+ }
+ if (consumeOpt(parser, 46 /* Period */)) {
+ if (context & Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ state |= NumericState.Float;
+ value = `${value}.${scanDecimalDigitsOrSeparator(parser)}`;
+ }
+ const end = parser.index;
+ if (consumeOpt(parser, 110 /* LowerN */)) {
+ if (state & NumericState.Float)
+ report(parser, 0 /* Unexpected */);
+ state |= NumericState.BigInt;
+ }
+ if (consumeOpt(parser, 101 /* LowerE */) || consumeOpt(parser, 69 /* UpperE */)) {
+ state |= NumericState.Float;
+ value += scanSignedInteger(parser, end);
+ }
+ if (isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 0 /* Unexpected */);
+ }
+ return assembleNumericLiteral(parser, context, state & NumericState.Float ? parseFloat(value) : parseInt(value, 10), !!(state & NumericState.BigInt));
+}
+/**
+ * Internal helper function for scanning numeric separators.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state NumericState state
+ */
+function scanNumericSeparator(parser, state) {
+ parser.index++;
+ parser.column++;
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ state |= NumericState.SeenSeparator;
+ return state;
+}
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanDecimalDigitsOrSeparator(parser) {
+ let start = parser.index;
+ let state = NumericState.None;
+ let ret = '';
+ loop: while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 95 /* Underscore */:
+ const preUnderscoreIndex = parser.index;
+ state = scanNumericSeparator(parser, state);
+ ret += parser.source.substring(start, preUnderscoreIndex);
+ start = parser.index;
+ continue;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ state = state & ~NumericState.SeenSeparator;
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ break loop;
+ }
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return ret + parser.source.substring(start, parser.index);
+}
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanDecimalAsSmi(parser, context) {
+ let state = NumericState.None;
+ let value = 0;
+ let next = parser.source.charCodeAt(parser.index);
+ while (next >= 48 /* Zero */ && next <= 57 /* Nine */ || next === 95 /* Underscore */) {
+ if (context & Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ next = parser.source.charCodeAt(parser.index);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ value = value * 10 + (next - 48 /* Zero */);
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return value;
+}
+/**
+ * Internal helper function that assamble the number scanning parts and return
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param value The numeric value
+ */
+function assembleNumericLiteral(parser, context, value, isBigInt = false) {
+ parser.tokenValue = value;
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ return isBigInt ? 33554551 /* BigIntLiteral */ : 33554434 /* NumericLiteral */;
+} + +/**
+ * Scan identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanIdentifier(parser, context, first) {
+ let start = parser.index;
+ let ret = '';
+ let isEscaped = false;
+ if (first)
+ advanceOnMaybeAstral(parser, first);
+ loop: while (parser.index < parser.length) {
+ const index = parser.index;
+ let ch = parser.source.charCodeAt(index);
+ switch (ch) {
+ case 92 /* Backslash */:
+ ret += parser.source.slice(start, index);
+ ret += scanUnicodeCodePointEscape(parser);
+ start = parser.index;
+ isEscaped = true;
+ break;
+ default:
+ if (ch >= 0xD800 && ch <= 0xDBFF) {
+ const lo = parser.source.charCodeAt(index + 1);
+ ch = (ch & 0x3FF) << 10 | lo & 0x3FF | 0x10000;
+ }
+ if (!isIdentifierPart(ch))
+ break loop;
+ advanceOnMaybeAstral(parser, ch);
+ }
+ }
+ if (start < parser.index)
+ ret += parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ const len = ret.length;
+ // Keywords are between 2 and 11 characters long and start with a lowercase letter
+ // https://tc39.github.io/ecma262/#sec-keywords
+ if (len >= 2 && len <= 11) {
+ const token = descKeyword(ret);
+ if (token > 0) {
+ if (isEscaped) {
+ if (context & Context.DisallowEscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ // Here we fall back to a mutual parser flag if the escaped keyword isn't disallowed through
+ // context masks. This is similiar to how V8 does it - they are using an
+ // 'escaped_keyword' token.
+ // - J.K. Thomas
+ parser.flags |= Flags.EscapedKeyword;
+ }
+ return token;
+ }
+ }
+ if (context & Context.OptionsRawidentifiers)
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ return 33685505 /* Identifier */;
+}
+/**
+ * Scanning chars in the range 0...127, and treat them as an possible
+ * identifier. This allows subsequent checking to be faster.
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param first Code point
+ */
+function scanMaybeIdentifier(parser, context, first) {
+ first = nextUnicodeChar(parser);
+ if (!isValidIdentifierStart(first)) {
+ report(parser, 10 /* UnexpectedChar */, escapeInvalidCharacters(first));
+ }
+ return scanIdentifier(parser, context, first);
+}
+/**
+ * Scan unicode codepoint escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanUnicodeCodePointEscape(parser) {
+ const { index } = parser;
+ if (index + 5 < parser.length) {
+ if (parser.source.charCodeAt(index + 1) !== 117 /* LowerU */) {
+ report(parser, 0 /* Unexpected */);
+ }
+ parser.index += 2;
+ parser.column += 2;
+ const code = scanIdentifierUnicodeEscape(parser);
+ if (code >= 55296 /* LeadSurrogateMin */ && code <= 56319 /* LeadSurrogateMax */) {
+ report(parser, 74 /* UnexpectedSurrogate */);
+ }
+ if (!isIdentifierPart(code)) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ return fromCodePoint(code);
+ }
+ report(parser, 0 /* Unexpected */);
+}
+/**
+ * Scan identifier unicode escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function scanIdentifierUnicodeEscape(parser) {
+ // Accept both \uxxxx and \u{xxxxxx}. In the latter case, the number of
+ // hex digits between { } is arbitrary. \ and u have already been read.
+ let ch = parser.source.charCodeAt(parser.index);
+ let codePoint = 0;
+ // '\u{DDDDDDDD}'
+ if (ch === 123 /* LeftBrace */) { // {
+ ch = readNext(parser);
+ let digit = toHex(ch);
+ while (digit >= 0) {
+ codePoint = (codePoint << 4) | digit;
+ if (codePoint > 1114111 /* NonBMPMax */) {
+ report(parser, 89 /* UndefinedUnicodeCodePoint */);
+ }
+ parser.index++;
+ parser.column++;
+ digit = toHex(parser.source.charCodeAt(parser.index));
+ }
+ if (parser.source.charCodeAt(parser.index) !== 125 /* RightBrace */) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ consumeOpt(parser, 125 /* RightBrace */);
+ // '\uDDDD'
+ }
+ else {
+ for (let i = 0; i < 4; i++) {
+ ch = parser.source.charCodeAt(parser.index);
+ const digit = toHex(ch);
+ if (digit < 0)
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ codePoint = (codePoint << 4) | digit;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ return codePoint;
+} + +// 11.4 Comments
+/**
+ * Skips single HTML comments. Same behavior as in V8.
+ *
+ * @param parser Parser Object
+ * @param context Context masks.
+ * @param state Scanner state
+ * @param type Comment type
+ */
+function skipSingleHTMLComment(parser, context, state, type) {
+ if (context & Context.Module)
+ report(parser, 90 /* HtmlCommentInModule */);
+ return skipSingleLineComment(parser, context, state, type);
+}
+/**
+ * Skips SingleLineComment, SingleLineHTMLCloseComment and SingleLineHTMLOpenComment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SingleLineComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLOpenComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLCloseComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ * @param type Comment type
+ */
+function skipSingleLineComment(parser, context, state, type) {
+ const start = parser.index;
+ const collectable = !!(context & Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 13 /* CarriageReturn */:
+ advanceNewline(parser);
+ if ((parser.index < parser.length) && parser.source.charCodeAt(parser.index) === 10 /* LineFeed */)
+ parser.index++;
+ return state | ScannerState.NewLine;
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ advanceNewline(parser);
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state | ScannerState.NewLine;
+ default:
+ parser.index++;
+ parser.column++;
+ }
+ }
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state;
+}
+/**
+ * Skips multiline comment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-MultiLineComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ */
+function skipMultiLineComment(parser, context, state) {
+ const start = parser.index;
+ const collectable = !!(context & Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 42 /* Asterisk */:
+ parser.index++;
+ parser.column++;
+ state &= ~ScannerState.LastIsCR;
+ if (consumeOpt(parser, 47 /* Slash */)) {
+ if (collectable)
+ addComment(parser, context, 'MultiLine', start);
+ return state;
+ }
+ break;
+ // Mark multiline comments containing linebreaks as new lines
+ // so we can perfectly handle edge cases like: '1/*\n*/--> a comment'
+ case 13 /* CarriageReturn */:
+ state |= ScannerState.NewLine | ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ break;
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ default:
+ state &= ~ScannerState.LastIsCR;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ // Unterminated multi-line comment.
+ tolerant(parser, context, 8 /* UnterminatedComment */);
+}
+/**
+ * Add comments
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param type Comment type
+ * @param commentStart Start position of comment
+ */
+function addComment(parser, context, type, commentStart) {
+ const { index, startIndex: start, startLine, startColumn, lastLine, lastColumn } = parser;
+ const comment = {
+ type,
+ value: parser.source.slice(commentStart, type === 'MultiLine' ? index - 2 : index),
+ start,
+ end: index,
+ };
+ if (context & Context.OptionsLoc) {
+ comment.loc = {
+ start: { line: startLine, column: startColumn },
+ end: { line: lastLine, column: lastColumn },
+ };
+ }
+ parser.comments.push(comment);
+} + +/**
+ * Scan
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-punctuatorss)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scan(parser, context) {
+ parser.flags &= ~Flags.NewLine | Flags.EscapedKeyword;
+ const lineStart = parser.index === 0;
+ let state = ScannerState.None;
+ while (parser.index < parser.length) {
+ if (!lineStart) {
+ parser.startIndex = parser.index;
+ parser.startColumn = parser.column;
+ parser.startLine = parser.line;
+ }
+ const first = parser.source.charCodeAt(parser.index);
+ if (first > 128 /* MaxAsciiCharacter */) {
+ switch (first) {
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ case 65519 /* ByteOrderMark */:
+ case 160 /* NonBreakingSpace */:
+ case 5760 /* Ogham */:
+ case 8192 /* EnQuad */:
+ case 8193 /* EmQuad */:
+ case 8194 /* EnSpace */:
+ case 8195 /* EmSpace */:
+ case 8196 /* ThreePerEmSpace */:
+ case 8197 /* FourPerEmSpace */:
+ case 8198 /* SixPerEmSpace */:
+ case 8199 /* FigureSpace */:
+ case 8200 /* PunctuationSpace */:
+ case 8201 /* ThinSpace */:
+ case 8202 /* HairSpace */:
+ case 8239 /* NarrowNoBreakSpace */:
+ case 8287 /* MathematicalSpace */:
+ case 12288 /* IdeographicSpace */:
+ case 65279 /* Zwnbs */:
+ case 8205 /* Zwj */:
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ return scanMaybeIdentifier(parser, context, first);
+ }
+ }
+ else {
+ // Note: Here we first get rid of LT and WS, then we make sure that the lookup time
+ // for the single punctuator char is short as possible. A single punctuator
+ // char is a valid token that cannot also be a prefix of a combination
+ // of long tokens - e.g. '(', ')' and '=' is valid. '==' is not.
+ switch (first) {
+ case 13 /* CarriageReturn */:
+ state |= ScannerState.NewLine | ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ break;
+ case 9 /* Tab */:
+ case 11 /* VerticalTab */:
+ case 12 /* FormFeed */:
+ case 32 /* Space */:
+ parser.index++;
+ parser.column++;
+ break;
+ // `(`
+ case 40 /* LeftParen */:
+ parser.index++;
+ parser.column++;
+ return 50331659 /* LeftParen */;
+ // `)`
+ case 41 /* RightParen */:
+ parser.index++;
+ parser.column++;
+ return 16 /* RightParen */;
+ // `,`
+ case 44 /* Comma */:
+ parser.index++;
+ parser.column++;
+ return 16777234 /* Comma */;
+ // `:`
+ case 58 /* Colon */:
+ parser.index++;
+ parser.column++;
+ return 16777237 /* Colon */;
+ // `;`
+ case 59 /* Semicolon */:
+ parser.index++;
+ parser.column++;
+ return 17825809 /* Semicolon */;
+ // `?`
+ case 63 /* QuestionMark */:
+ parser.index++;
+ parser.column++;
+ return 22 /* QuestionMark */;
+ // `]`
+ case 93 /* RightBracket */:
+ parser.index++;
+ parser.column++;
+ return 20 /* RightBracket */;
+ // `{`
+ case 123 /* LeftBrace */:
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ // `}`
+ case 125 /* RightBrace */:
+ parser.index++;
+ parser.column++;
+ return 17825807 /* RightBrace */;
+ // `~`
+ case 126 /* Tilde */:
+ parser.index++;
+ parser.column++;
+ return 301989934 /* Complement */;
+ // `[`
+ case 91 /* LeftBracket */:
+ parser.index++;
+ parser.column++;
+ return 41943059 /* LeftBracket */;
+ // `@`
+ case 64 /* At */:
+ parser.index++;
+ parser.column++;
+ return 120 /* At */;
+ // `/`, `/=`, `/>`
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774773 /* Divide */;
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipSingleLineComment(parser, context, state, 'SingleLine');
+ continue;
+ }
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipMultiLineComment(parser, context, state);
+ continue;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 100663333 /* DivideAssign */;
+ }
+ default:
+ return 167774773 /* Divide */;
+ }
+ }
+ // `-`, `--`, `-=`
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++; // skip `-`
+ const next = parser.source.charCodeAt(parser.index);
+ switch (next) {
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++;
+ if ((state & ScannerState.NewLine || lineStart) &&
+ consumeOpt(parser, 62 /* GreaterThan */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLClose');
+ continue;
+ }
+ return 570425372 /* Decrement */;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 67108899 /* SubtractAssign */;
+ }
+ default:
+ return 436209968 /* Subtract */;
+ }
+ }
+ // `<`, `<=`, `<<`, `<<=`, `</`, <!--
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++; // skip `<`
+ if (consumeOpt(parser, 33 /* Exclamation */) &&
+ consumeOpt(parser, 45 /* Hyphen */) &&
+ consumeOpt(parser, 45 /* Hyphen */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLOpen');
+ continue;
+ }
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 61 /* EqualSign */) ?
+ 67108894 /* ShiftLeftAssign */ :
+ 167774273 /* ShiftLeft */;
+ case 61 /* EqualSign */:
+ parser.index++;
+ parser.column++;
+ return 167774013 /* LessThanOrEqual */;
+ case 47 /* Slash */:
+ {
+ if (!(context & Context.OptionsJSX))
+ break;
+ const index = parser.index + 1;
+ // Check that it's not a comment start.
+ if (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 42 /* Asterisk */ || next === 47 /* Slash */)
+ break;
+ }
+ parser.index++;
+ parser.column++;
+ return 25 /* JSXClose */;
+ }
+ default: // ignore
+ return 167774015 /* LessThan */;
+ }
+ // `!`, `!=`, `!==`
+ case 33 /* Exclamation */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 301989933 /* Negate */;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773756 /* LooseNotEqual */;
+ return 167773754 /* StrictNotEqual */;
+ // `'string'`, `"string"`
+ case 39 /* SingleQuote */:
+ case 34 /* DoubleQuote */:
+ return scanString(parser, context, first);
+ // `%`, `%=`
+ case 37 /* Percent */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167774772 /* Modulo */;
+ return 67108902 /* ModuloAssign */;
+ // `&`, `&&`, `&=`
+ case 38 /* Ampersand */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 38 /* Ampersand */) {
+ parser.index++;
+ parser.column++;
+ return 169869879 /* LogicalAnd */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108905 /* BitwiseAndAssign */;
+ }
+ return 167773508 /* BitwiseAnd */;
+ }
+ // `*`, `**`, `*=`, `**=`
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774771 /* Multiply */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108900 /* MultiplyAssign */;
+ }
+ if (next !== 42 /* Asterisk */)
+ return 167774771 /* Multiply */;
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167775030 /* Exponentiate */;
+ return 67108897 /* ExponentiateAssign */;
+ }
+ // `+`, `++`, `+=`
+ case 43 /* Plus */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 436209967 /* Add */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */) {
+ parser.index++;
+ parser.column++;
+ return 570425371 /* Increment */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108898 /* AddAssign */;
+ }
+ return 436209967 /* Add */;
+ }
+ // `\\u{N}var`
+ case 92 /* Backslash */:
+ return scanIdentifier(parser, context);
+ // `=`, `==`, `===`, `=>`
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 167773753 /* StrictEqual */;
+ }
+ else {
+ return 167773755 /* LooseEqual */;
+ }
+ }
+ else if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ return 10 /* Arrow */;
+ }
+ return 83886109 /* Assign */;
+ }
+ // `>`, `>=`, `>>`, `>>>`, `>>=`, `>>>=`
+ case 62 /* GreaterThan */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774016 /* GreaterThan */;
+ if (context & Context.InJSXChild)
+ return 167774016 /* GreaterThan */;
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 167774014 /* GreaterThanOrEqual */;
+ }
+ if (next !== 62 /* GreaterThan */)
+ return 167774016 /* GreaterThan */;
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 67108896 /* LogicalShiftRightAssign */;
+ }
+ else {
+ return 167774275 /* LogicalShiftRight */;
+ }
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108895 /* ShiftRightAssign */;
+ }
+ return 167774274 /* ShiftRight */;
+ }
+ // `^`, `^=`
+ case 94 /* Caret */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773254 /* BitwiseXor */;
+ return 67108903 /* BitwiseXorAssign */;
+ // ``string``
+ case 96 /* Backtick */:
+ return scanTemplate(parser, context);
+ // `|`, `||`, `|=`
+ case 124 /* VerticalBar */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 124 /* VerticalBar */) {
+ parser.index++;
+ parser.column++;
+ return 169869624 /* LogicalOr */;
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108904 /* BitwiseOrAssign */;
+ }
+ return 167772997 /* BitwiseOr */;
+ }
+ // `.`, `...`, `.123` (numeric literal)
+ case 46 /* Period */:
+ {
+ let index = parser.index + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 57 /* Nine */) {
+ scanNumericLiteral(parser, context, NumericState.Float);
+ return 33554434 /* NumericLiteral */;
+ }
+ else if (next === 46 /* Period */) {
+ index++;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 46 /* Period */) {
+ parser.index = index + 1;
+ parser.column += 3;
+ return 14 /* Ellipsis */;
+ }
+ }
+ parser.index++;
+ parser.column++;
+ return 16777229 /* Period */;
+ }
+ // `#`
+ case 35 /* Hash */:
+ {
+ parser.index++;
+ parser.column++;
+ const index = parser.index;
+ const next = parser.source.charCodeAt(index);
+ if (context & Context.OptionsShebang &&
+ lineStart &&
+ next === 33 /* Exclamation */) {
+ parser.index = index + 1;
+ skipSingleLineComment(parser, context, ScannerState.None, 'SheBang');
+ continue;
+ }
+ return scanPrivateName(parser, context);
+ }
+ // `0`...`9`
+ case 48 /* Zero */:
+ {
+ parser.index++;
+ parser.column++;
+ switch (parser.source.charCodeAt(parser.index)) {
+ // Hex number - '0x', '0X'
+ case 88 /* UpperX */:
+ case 120 /* LowerX */:
+ return scanHexIntegerLiteral(parser, context);
+ // Binary number - '0b', '0B'
+ case 66 /* UpperB */:
+ case 98 /* LowerB */:
+ return scanOctalOrBinary(parser, context, 2);
+ // Octal number - '0o', '0O'
+ case 79 /* UpperO */:
+ case 111 /* LowerO */:
+ return scanOctalOrBinary(parser, context, 8);
+ default:
+ // Implicit octal digits startign with '0'
+ return scanImplicitOctalDigits(parser, context);
+ }
+ }
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return scanNumericLiteral(parser, context);
+ // `a`...`z`, `A`...`Z`, `_var`, `$var`
+ case 65 /* UpperA */:
+ case 66 /* UpperB */:
+ case 67 /* UpperC */:
+ case 68 /* UpperD */:
+ case 69 /* UpperE */:
+ case 70 /* UpperF */:
+ case 71 /* UpperG */:
+ case 72 /* UpperH */:
+ case 73 /* UpperI */:
+ case 74 /* UpperJ */:
+ case 75 /* UpperK */:
+ case 76 /* UpperL */:
+ case 77 /* UpperM */:
+ case 78 /* UpperN */:
+ case 79 /* UpperO */:
+ case 80 /* UpperP */:
+ case 81 /* UpperQ */:
+ case 82 /* UpperR */:
+ case 83 /* UpperS */:
+ case 84 /* UpperT */:
+ case 85 /* UpperU */:
+ case 86 /* UpperV */:
+ case 87 /* UpperW */:
+ case 88 /* UpperX */:
+ case 89 /* UpperY */:
+ case 90 /* UpperZ */:
+ case 36 /* Dollar */:
+ case 95 /* Underscore */:
+ case 97 /* LowerA */:
+ case 98 /* LowerB */:
+ case 99 /* LowerC */:
+ case 100 /* LowerD */:
+ case 101 /* LowerE */:
+ case 102 /* LowerF */:
+ case 103 /* LowerG */:
+ case 104 /* LowerH */:
+ case 105 /* LowerI */:
+ case 106 /* LowerJ */:
+ case 107 /* LowerK */:
+ case 108 /* LowerL */:
+ case 109 /* LowerM */:
+ case 110 /* LowerN */:
+ case 111 /* LowerO */:
+ case 112 /* LowerP */:
+ case 113 /* LowerQ */:
+ case 114 /* LowerR */:
+ case 115 /* LowerS */:
+ case 116 /* LowerT */:
+ case 117 /* LowerU */:
+ case 118 /* LowerV */:
+ case 119 /* LowerW */:
+ case 120 /* LowerX */:
+ case 121 /* LowerY */:
+ case 122 /* LowerZ */:
+ default:
+ return scanIdentifier(parser, context, first);
+ }
+ }
+ }
+ return 1048576 /* EndOfSource */;
+} + +/**
+ * Scans regular expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanRegularExpression(parser, context) {
+ const bodyStart = parser.index;
+ let preparseState = RegexState.Empty;
+ loop: while (true) {
+ const ch = parser.source.charCodeAt(parser.index);
+ parser.index++;
+ parser.column++;
+ if (preparseState & RegexState.Escape) {
+ preparseState &= ~RegexState.Escape;
+ }
+ else {
+ switch (ch) {
+ case 47 /* Slash */:
+ if (!preparseState)
+ break loop;
+ else
+ break;
+ case 92 /* Backslash */:
+ preparseState |= RegexState.Escape;
+ break;
+ case 91 /* LeftBracket */:
+ preparseState |= RegexState.Class;
+ break;
+ case 93 /* RightBracket */:
+ preparseState &= RegexState.Escape;
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ report(parser, 7 /* UnterminatedRegExp */);
+ default: // ignore
+ }
+ }
+ if (parser.index >= parser.source.length) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ const bodyEnd = parser.index - 1;
+ let mask = RegexFlags.Empty;
+ const { index: flagStart } = parser;
+ loop: while (parser.index < parser.source.length) {
+ const code = parser.source.charCodeAt(parser.index);
+ switch (code) {
+ case 103 /* LowerG */:
+ if (mask & RegexFlags.Global)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'g');
+ mask |= RegexFlags.Global;
+ break;
+ case 105 /* LowerI */:
+ if (mask & RegexFlags.IgnoreCase)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'i');
+ mask |= RegexFlags.IgnoreCase;
+ break;
+ case 109 /* LowerM */:
+ if (mask & RegexFlags.Multiline)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'm');
+ mask |= RegexFlags.Multiline;
+ break;
+ case 117 /* LowerU */:
+ if (mask & RegexFlags.Unicode)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'u');
+ mask |= RegexFlags.Unicode;
+ break;
+ case 121 /* LowerY */:
+ if (mask & RegexFlags.Sticky)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'y');
+ mask |= RegexFlags.Sticky;
+ break;
+ case 115 /* LowerS */:
+ if (mask & RegexFlags.DotAll)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 's');
+ mask |= RegexFlags.DotAll;
+ break;
+ default:
+ if (!isIdentifierPart(code))
+ break loop;
+ report(parser, 16 /* UnexpectedTokenRegExpFlag */, fromCodePoint(code));
+ }
+ parser.index++;
+ parser.column++;
+ }
+ const flags = parser.source.slice(flagStart, parser.index);
+ const pattern = parser.source.slice(bodyStart, bodyEnd);
+ parser.tokenRegExp = { pattern, flags };
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ parser.tokenValue = validate(parser, context, pattern, flags);
+ return 33554436 /* RegularExpression */;
+}
+/**
+ * Validates regular expressions
+ *
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param pattern Regexp body
+ * @param flags Regexp flags
+ */
+function validate(parser, context, pattern, flags) {
+ if (!(context & Context.OptionsNode)) {
+ try {
+ }
+ catch (e) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ try {
+ return new RegExp(pattern, flags);
+ }
+ catch (e) {
+ return null;
+ }
+} + +// 12.15.5 Destructuring Assignment
+/**
+ * Parses either a binding identifier or binding pattern
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingIdentifierOrPattern(parser, context, args = []) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ return token === 41943052 /* LeftBrace */ ?
+ parserObjectAssignmentPattern(parser, context) :
+ parseArrayAssignmentPattern(parser, context, args);
+ }
+ else if (token & (262144 /* IsAwait */ | 1073741824 /* IsYield */)) {
+ if (token & 262144 /* IsAwait */ && (context & (Context.Async | Context.Module))) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ else if (token & 1073741824 /* IsYield */ && (context & (Context.Yield | Context.Strict))) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ }
+ args.push(parser.tokenValue);
+ return parseBindingIdentifier(parser, context);
+}
+/**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BindingIdentifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingIdentifier(parser, context) {
+ const { token } = parser;
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (context & Context.BlockScope && token === 33574984 /* LetKeyword */) {
+ // let is disallowed as a lexically bound name
+ tolerant(parser, context, 27 /* LetInLexicalBinding */);
+ }
+ else if (hasBit(token, 20480 /* FutureReserved */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ else if (!isValidIdentifier(context, token)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+}
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentRestElement(parser, context, args) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * Parse rest property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+// tslint:disable-next-line:function-name
+function AssignmentRestProperty(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const { token } = parser;
+ const argument = parseBindingIdentifierOrPattern(parser, context);
+ if (hasBit(token, 8388608 /* IsBindingPattern */))
+ tolerant(parser, context, 94 /* InvalidRestBindingPattern */);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * ArrayAssignmentPattern[Yield] :
+ * [ Elisionopt AssignmentRestElement[?Yield]opt ]
+ * [ AssignmentElementList[?Yield] ]
+ * [ AssignmentElementList[?Yield] , Elisionopt AssignmentRestElement[?Yield]opt ]
+ *
+ * AssignmentRestElement[Yield] :
+ * ... DestructuringAssignmentTarget[?Yield]
+ *
+ * AssignmentElementList[Yield] :
+ * AssignmentElisionElement[?Yield]
+ * AssignmentElementList[?Yield] , AssignmentElisionElement[?Yield]
+ *
+ * AssignmentElisionElement[Yield] :
+ * Elisionopt AssignmentElement[?Yield]
+ *
+ * AssignmentElement[Yield] :
+ * DestructuringAssignmentTarget[?Yield] Initializer[In,?Yield]opt
+ *
+ * DestructuringAssignmentTarget[Yield] :
+ * LeftHandSideExpression[?Yield]
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param Parser object
+ * @param Context masks
+ */
+function parseArrayAssignmentPattern(parser, context, args) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else {
+ if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseAssignmentRestElement(parser, context, args));
+ break;
+ }
+ else {
+ elements.push(parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseBindingInitializer));
+ }
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ // tslint:disable-next-line:no-object-literal-type-assertion
+ return finishNode(context, parser, pos, {
+ type: 'ArrayPattern',
+ elements,
+ });
+}
+/**
+ * Parse object assignment pattern
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parserObjectAssignmentPattern(parser, context) {
+ const pos = getLocation(parser);
+ const properties = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ properties.push(AssignmentRestProperty(parser, context));
+ break;
+ }
+ properties.push(parseAssignmentProperty(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ObjectPattern',
+ properties,
+ });
+}
+/** Parse assignment pattern
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param left LHS of assignment pattern
+ * @param pos Location
+ */
+function parseAssignmentPattern(parser, context, left, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse binding initializer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBindingInitializer(parser, context) {
+ const pos = getLocation(parser);
+ const left = parseBindingIdentifierOrPattern(parser, context);
+ return !consume(parser, context, 83886109 /* Assign */) ?
+ left :
+ finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseAssignmentExpression(parser, context | Context.AllowIn),
+ });
+}
+/**
+ * Parse assignment property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentProperty(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ let key;
+ let value;
+ let computed = false;
+ let shorthand = false;
+ // single name binding
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ key = parseIdentifier(parser, context);
+ shorthand = !consume(parser, context, 16777237 /* Colon */);
+ if (shorthand) {
+ const hasInitializer = consume(parser, context, 83886109 /* Assign */);
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (!isValidIdentifier(context, token))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ value = hasInitializer ? parseAssignmentPattern(parser, context, key, pos) : key;
+ }
+ else
+ value = parseBindingInitializer(parser, context);
+ }
+ else {
+ computed = token === 41943059 /* LeftBracket */;
+ key = parsePropertyName(parser, context);
+ expect(parser, context, 16777237 /* Colon */);
+ value = parseExpressionCoverGrammar(parser, context, parseBindingInitializer);
+ }
+ // Note! The specs specifically state that this is "assignment property", but
+ // nothing in ESTree specs explains the difference between this "property" and the "property" for object literals.
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ kind: 'init',
+ key,
+ computed,
+ value,
+ method: false,
+ shorthand,
+ });
+} + +// JSX Specification
+// https://facebook.github.io/jsx/
+/**
+ * Parses JSX element or JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXRootElement(parser, context) {
+ const pos = getLocation(parser);
+ let children = [];
+ let closingElement = null;
+ let selfClosing = false;
+ let openingElement;
+ expect(parser, context, 167774015 /* LessThan */);
+ const isFragment = parser.token === 167774016 /* GreaterThan */;
+ if (isFragment) {
+ openingElement = parseJSXOpeningFragment(parser, context, pos);
+ }
+ else {
+ const name = parseJSXElementName(parser, context);
+ const attributes = parseJSXAttributes(parser, context);
+ selfClosing = consume(parser, context, 167774773 /* Divide */);
+ openingElement = parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos);
+ }
+ if (isFragment)
+ return parseJSXFragment(parser, context, openingElement, pos);
+ if (!selfClosing) {
+ children = parseJSXChildren(parser, context);
+ closingElement = parseJSXClosingElement(parser, context);
+ const open = isEqualTagNames(openingElement.name);
+ const close = isEqualTagNames(closingElement.name);
+ if (open !== close)
+ report(parser, 85 /* ExpectedJSXClosingTag */, close);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'JSXElement',
+ children,
+ openingElement,
+ closingElement,
+ });
+}
+/**
+ * Parses JSX opening element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param name Element name
+ * @param attributes Element attributes
+ * @param selfClosing True if this is a selfclosing JSX Element
+ * @param pos Line / Column tracking
+ */
+function parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos) {
+ if (context & Context.InJSXChild && selfClosing)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningElement',
+ name,
+ attributes,
+ selfClosing,
+ });
+}
+/**
+ * Parse JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param openingElement Opening fragment
+ * @param pos Line / Column location
+ */
+function parseJSXFragment(parser, context, openingElement, pos) {
+ const children = parseJSXChildren(parser, context);
+ const closingFragment = parseJSXClosingFragment(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXFragment',
+ children,
+ openingElement,
+ closingFragment,
+ });
+}
+/**
+ * Parse JSX opening fragmentD
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXOpeningFragment(parser, context, pos) {
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningFragment',
+ });
+}
+/**
+ * Prime the scanner and advance to the next JSX token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextJSXToken(parser) {
+ return parser.token = scanJSXToken(parser);
+}
+/**
+ * Mini scanner
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXToken(parser) {
+ if (parser.index >= parser.source.length)
+ return 1048576 /* EndOfSource */;
+ parser.lastIndex = parser.startIndex = parser.index;
+ const char = parser.source.charCodeAt(parser.index);
+ if (char === 60 /* LessThan */) {
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 47 /* Slash */) ? 25 /* JSXClose */ : 167774015 /* LessThan */;
+ }
+ else if (char === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ }
+ while (parser.index < parser.source.length) {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 123 /* LeftBrace */ || next === 60 /* LessThan */)
+ break;
+ }
+ return 121 /* JSXText */;
+}
+/**
+ * Parses JSX children
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXChildren(parser, context) {
+ const children = [];
+ while (parser.token !== 25 /* JSXClose */) {
+ children.push(parseJSXChild(parser, context));
+ }
+ return children;
+}
+/**
+ * Parses JSX Text
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXText(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.source.slice(parser.startIndex, parser.index);
+ parser.token = scanJSXToken(parser);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXText',
+ value,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = value;
+ return node;
+}
+/**
+ * Parses JSX Child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXChild(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ case 121 /* JSXText */:
+ return parseJSXText(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpression(parser, context & ~Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context & ~Context.InJSXChild);
+ default:
+ report(parser, 0 /* Unexpected */);
+ }
+ return undefined; // note: get rid of this
+}
+/**
+ * Parses JSX attributes
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributes(parser, context) {
+ const attributes = [];
+ while (parser.index < parser.source.length) {
+ if (parser.token === 167774773 /* Divide */ || parser.token === 167774016 /* GreaterThan */)
+ break;
+ attributes.push(parseJSXAttribute(parser, context));
+ }
+ return attributes;
+}
+/**
+ * Parses JSX spread attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXSpreadAttribute(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadAttribute',
+ argument: expression,
+ });
+}
+/**
+ * Parses JSX namespace name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param namespace Identifier
+ * @param pos Line / Column location
+ */
+function parseJSXNamespacedName(parser, context, namespace, pos) {
+ expect(parser, context, 16777237 /* Colon */);
+ const name = parseJSXIdentifier(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXNamespacedName',
+ namespace,
+ name,
+ });
+}
+/**
+ * Parses JSX attribute name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributeName(parser, context) {
+ const pos = getLocation(parser);
+ const identifier = parseJSXIdentifier(parser, context);
+ return parser.token === 16777237 /* Colon */ ?
+ parseJSXNamespacedName(parser, context, identifier, pos) :
+ identifier;
+}
+/**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttributeValue(parser, context) {
+ switch (scanJSXAttributeValue(parser, context)) {
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpressionContainer(parser, context | Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context | Context.InJSXChild);
+ default:
+ tolerant(parser, context, 87 /* InvalidJSXAttributeValue */);
+ return undefined; // note: get rid of this
+ }
+}
+/**
+ * Parses JSX Attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXAttribute(parser, context) {
+ const pos = getLocation(parser);
+ if (parser.token === 41943052 /* LeftBrace */)
+ return parseJSXSpreadAttribute(parser, context);
+ scanJSXIdentifier(parser);
+ const attrName = parseJSXAttributeName(parser, context);
+ const value = parser.token === 83886109 /* Assign */ ? parseJSXAttributeValue(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'JSXAttribute',
+ value: value,
+ name: attrName,
+ });
+}
+/**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXAttributeValue(parser, context) {
+ parser.lastIndex = parser.index;
+ const ch = parser.source.charCodeAt(parser.index);
+ switch (ch) {
+ case 34 /* DoubleQuote */:
+ case 39 /* SingleQuote */:
+ return scanJSXString(parser, context, ch);
+ default:
+ return nextToken(parser, context);
+ }
+}
+/**
+ * Parses JSX String
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote Code point
+ */
+function scanJSXString(parser, context, quote) {
+ const rawStart = parser.index;
+ parser.index++;
+ parser.column++;
+ let ret = '';
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ ret += fromCodePoint(ch);
+ parser.index++;
+ parser.column++;
+ ch = parser.source.charCodeAt(parser.index);
+ if (parser.index >= parser.source.length)
+ report(parser, 6 /* UnterminatedString */);
+ }
+ parser.index++;
+ parser.column++; // skip the quote
+ // raw
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(rawStart, parser.index);
+ parser.tokenValue = ret;
+ return 33554435 /* StringLiteral */;
+}
+/**
+ * Parses JJSX Empty Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXEmptyExpression(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXEmptyExpression',
+ });
+}
+/**
+ * Parses JSX Spread child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXSpreadChild(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpression(parser, context);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadChild',
+ expression,
+ });
+}
+/**
+ * Parses JSX Expression container
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXExpressionContainer(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ // Note: JSX Expressions can't be empty
+ if (parser.token === 17825807 /* RightBrace */)
+ tolerant(parser, context, 84 /* NonEmptyJSXExpression */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+}
+/**
+ * Parses JSX Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ if (parser.token === 14 /* Ellipsis */)
+ return parseJSXSpreadChild(parser, context);
+ const expression = parser.token === 17825807 /* RightBrace */ ?
+ parseJSXEmptyExpression(parser, context) :
+ parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+}
+/**
+ * Parses JSX Closing fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXClosingFragment(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ expect(parser, context, 167774016 /* GreaterThan */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingFragment',
+ });
+}
+/**
+ * Parses JSX Closing Element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXClosingElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ const name = parseJSXElementName(parser, context);
+ if (context & Context.InJSXChild)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingElement',
+ name,
+ });
+}
+/**
+ * Parses JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXIdentifier(parser, context) {
+ const { token, tokenValue: name, tokenRaw: raw } = parser;
+ if (!(token & (131072 /* IsIdentifier */ | 4096 /* Keyword */))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXIdentifier',
+ name,
+ });
+ if (context & Context.OptionsRawidentifiers)
+ node.raw = raw;
+ return node;
+}
+/**
+ * Parses JSX Member expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+function parseJSXMemberExpression(parser, context, expr, pos) {
+ // Note: In order to be able to parse cases like ''<A.B.C.D.E.foo-bar />', where the dash is located at the
+ // end, we must rescan for the JSX Identifier now. This because JSX identifiers differ from normal identifiers
+ scanJSXIdentifier(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXMemberExpression',
+ object: expr,
+ property: parseJSXIdentifier(parser, context),
+ });
+}
+/**
+ * Parses JSX Element name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseJSXElementName(parser, context) {
+ const pos = getLocation(parser);
+ scanJSXIdentifier(parser);
+ let elementName = parseJSXIdentifier(parser, context);
+ if (parser.token === 16777237 /* Colon */)
+ return parseJSXNamespacedName(parser, context, elementName, pos);
+ while (consume(parser, context, 16777229 /* Period */)) {
+ elementName = parseJSXMemberExpression(parser, context, elementName, pos);
+ }
+ return elementName;
+}
+/**
+ * Scans JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function scanJSXIdentifier(parser) {
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const firstCharPosition = parser.index;
+ let ch = parser.source.charCodeAt(parser.index);
+ while ((parser.index < parser.source.length) && (ch === 45 /* Hyphen */ || (isValidIdentifierPart(ch)))) {
+ ch = readNext(parser);
+ }
+ parser.tokenValue += parser.source.substr(firstCharPosition, parser.index - firstCharPosition);
+ }
+ return parser.token;
+} + +/**
+ * Expression :
+ * AssignmentExpression
+ * Expression , AssignmentExpression
+ *
+ * ExpressionNoIn :
+ * AssignmentExpressionNoIn
+ * ExpressionNoIn , AssignmentExpressionNoIn
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Expression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpression(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ return parser.token === 16777234 /* Comma */ ?
+ parseSequenceExpression(parser, context, expr, pos) :
+ expr;
+}
+/**
+ * Parse secuence expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSequenceExpression(parser, context, left, pos) {
+ const expressions = [left];
+ while (consume(parser, context, 16777234 /* Comma */)) {
+ expressions.push(parseExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+}
+/**
+ * Parse yield expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-YieldExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseYieldExpression(parser, context, pos) {
+ // YieldExpression[In] :
+ // yield
+ // yield [no LineTerminator here] AssignmentExpression[?In, Yield]
+ // yield [no LineTerminator here] * AssignmentExpression[?In, Yield]
+ // https://tc39.github.io/ecma262/#sec-generator-function-definitions-static-semantics-early-errors
+ if (context & Context.InParameter)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ expect(parser, context, 1107316842 /* YieldKeyword */);
+ let argument = null;
+ let delegate = false;
+ if (!(parser.flags & Flags.NewLine)) {
+ delegate = consume(parser, context, 167774771 /* Multiply */);
+ // 'Token.IsExpressionStart' bitmask contains the complete set of
+ // tokens that can appear after an AssignmentExpression, and none of them
+ // can start an AssignmentExpression.
+ if (delegate || parser.token & 33554432 /* IsExpressionStart */) {
+ argument = parseAssignmentExpression(parser, context);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'YieldExpression',
+ argument,
+ delegate,
+ });
+}
+/**
+ * AssignmentExpression :
+ * ConditionalExpression
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpression
+ * LeftHandSideExpression AssignmentOperator AssignmentExpression
+ *
+ * AssignmentExpressionNoIn :
+ * ConditionalExpressionNoIn
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpressionNoIn
+ * LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAssignmentExpression(parser, context) {
+ const pos = getLocation(parser);
+ let { token } = parser;
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ return parseYieldExpression(parser, context, pos);
+ let expr = token & 524288 /* IsAsync */ && lookahead(parser, context, nextTokenisIdentifierOrParen)
+ ? parserCoverCallExpressionAndAsyncArrowHead(parser, context)
+ : parseConditionalExpression(parser, context, pos);
+ if (parser.token === 10 /* Arrow */) {
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & (20480 /* FutureReserved */ | 4194304 /* IsEvalOrArguments */)) {
+ // Invalid: ' yield => { 'use strict'; 0 };'
+ if (token & 20480 /* FutureReserved */) {
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ }
+ expr = [expr];
+ }
+ return parseArrowFunction(parser, context &= ~Context.Async, pos, expr);
+ }
+ if (hasBit(parser.token, 67108864 /* IsAssignOp */)) {
+ token = parser.token;
+ if (context & Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ }
+ else if (consume(parser, context, 83886109 /* Assign */)) {
+ if (!(parser.flags & Flags.AllowDestructuring)) {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ // Only re-interpret if not inside a formal parameter list
+ if (!(context & Context.InParameter))
+ reinterpret(parser, context, expr);
+ if (context & Context.InParen)
+ parser.flags |= Flags.SimpleParameterList;
+ if (parser.token & 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ else if (context & Context.InParen &&
+ context & (Context.Strict | Context.Yield) &&
+ parser.token & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasYield;
+ }
+ }
+ else {
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ nextToken(parser, context);
+ }
+ const right = parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ parser.pendingExpressionError = null;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentExpression',
+ left: expr,
+ operator: tokenDesc(token),
+ right,
+ });
+ }
+ return expr;
+}
+/**
+ * Parse conditional expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ConditionalExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseConditionalExpression(parser, context, pos) {
+ const test = parseBinaryExpression(parser, context, 0, pos);
+ if (!consume(parser, context, 22 /* QuestionMark */))
+ return test;
+ const consequent = parseExpressionCoverGrammar(parser, context & ~Context.AllowDecorator | Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16777237 /* Colon */);
+ return finishNode(context, parser, pos, {
+ type: 'ConditionalExpression',
+ test,
+ consequent,
+ alternate: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse binary expression.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-exp-operator)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-additive-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-bitwise-shift-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-equality-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-relational-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-multiplicative-operators)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param minPrec Minimum precedence value
+ * @param pos Line / Column info
+ * @param Left Left hand side of the binary expression
+ */
+function parseBinaryExpression(parser, context, minPrec, pos, left = parseUnaryExpression(parser, context)) {
+ // Shift-reduce parser for the binary operator part of the JS expression
+ // syntax.
+ const bit = context & Context.AllowIn ^ Context.AllowIn;
+ while (hasBit(parser.token, 167772160 /* IsBinaryOp */)) {
+ const t = parser.token;
+ const prec = t & 3840 /* Precedence */;
+ const delta = (t === 167775030 /* Exponentiate */) << 8 /* PrecStart */;
+ if (bit && t === 167786289 /* InKeyword */)
+ break;
+ // When the next token is no longer a binary operator, it's potentially the
+ // start of an expression, so we break the loop
+ if (prec + delta <= minPrec)
+ break;
+ nextToken(parser, context);
+ left = finishNode(context, parser, pos, {
+ type: t & 2097152 /* IsLogical */ ? 'LogicalExpression' : 'BinaryExpression',
+ left,
+ right: parseBinaryExpression(parser, context & ~Context.AllowIn, prec, getLocation(parser)),
+ operator: tokenDesc(t),
+ });
+ }
+ return left;
+}
+/**
+ * Parse await expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AwaitExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ */
+function parseAwaitExpression(parser, context, pos) {
+ if (context & Context.InParameter)
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ expect(parser, context, 34017389 /* AwaitKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'AwaitExpression',
+ argument: parseUnaryExpression(parser, context),
+ });
+}
+/**
+ * Parses unary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UnaryExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseUnaryExpression(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ if (hasBit(token, 301989888 /* IsUnaryOp */)) {
+ nextToken(parser, context);
+ if (parser.flags & Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ const argument = parseExpressionCoverGrammar(parser, context, parseUnaryExpression);
+ if (parser.token === 167775030 /* Exponentiate */) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & Context.Strict && token === 302002219 /* DeleteKeyword */) {
+ if (argument.type === 'Identifier') {
+ tolerant(parser, context, 43 /* StrictDelete */);
+ }
+ else if (isPropertyWithPrivateFieldKey(argument)) {
+ tolerant(parser, context, 44 /* DeletePrivateField */);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'UnaryExpression',
+ operator: tokenDesc(token),
+ argument,
+ prefix: true,
+ });
+ }
+ return context & Context.Async && token & 262144 /* IsAwait */
+ ? parseAwaitExpression(parser, context, pos)
+ : parseUpdateExpression(parser, context, pos);
+}
+/**
+ * Parses update expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UpdateExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseUpdateExpression(parser, context, pos) {
+ const { token } = parser;
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */)) {
+ nextToken(parser, context);
+ const expr = parseLeftHandSideExpression(parser, context, pos);
+ validateUpdateExpression(parser, context, expr, 'Prefix');
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expr,
+ operator: tokenDesc(token),
+ prefix: true,
+ });
+ }
+ else if (context & Context.OptionsJSX && token === 167774015 /* LessThan */) {
+ return parseJSXRootElement(parser, context | Context.InJSXChild);
+ }
+ const expression = parseLeftHandSideExpression(parser, context, pos);
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */) && !(parser.flags & Flags.NewLine)) {
+ validateUpdateExpression(parser, context, expression, 'Postfix');
+ const operator = parser.token;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expression,
+ operator: tokenDesc(operator),
+ prefix: false,
+ });
+ }
+ return expression;
+}
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseRestElement(parser, context, args = []) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (context & Context.InParen && parser.token & 262144 /* IsAwait */)
+ parser.flags |= Flags.HasAwait;
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+}
+/**
+ * Parse spread element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SpreadElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSpreadElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+}
+/**
+ * Parse left hand side expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LeftHandSideExpression)
+ *
+ * @param Parser Parer instance
+ * @param Context Contextmasks
+ * @param pos Location info
+ */
+function parseLeftHandSideExpression(parser, context, pos) {
+ const expr = context & Context.OptionsNext && parser.token === 33566810 /* ImportKeyword */
+ ? parseCallImportOrMetaProperty(parser, context | Context.AllowIn)
+ : parseMemberExpression(parser, context | Context.AllowIn, pos);
+ return parseCallExpression(parser, context | Context.AllowIn, pos, expr);
+}
+/**
+ * Parse member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ * @param expr Expression
+ */
+function parseMemberExpression(parser, context, pos, expr = parsePrimaryExpression(parser, context)) {
+ while (true) {
+ switch (parser.token) {
+ case 16777229 /* Period */: {
+ consume(parser, context, 16777229 /* Period */);
+ parser.flags = parser.flags & ~Flags.AllowBinding | Flags.AllowDestructuring;
+ const property = parseIdentifierNameOrPrivateName(parser, context);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: false,
+ property,
+ });
+ continue;
+ }
+ case 41943059 /* LeftBracket */: {
+ consume(parser, context, 41943059 /* LeftBracket */);
+ parser.flags = parser.flags & ~Flags.AllowBinding | Flags.AllowDestructuring;
+ const property = parseExpression(parser, context);
+ expect(parser, context, 20 /* RightBracket */);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: true,
+ property,
+ });
+ continue;
+ }
+ case 33554441 /* TemplateTail */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplateLiteral(parser, context),
+ });
+ continue;
+ }
+ case 33554440 /* TemplateCont */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplate(parser, context | Context.TaggedTemplate),
+ });
+ continue;
+ }
+ default:
+ return expr;
+ }
+ }
+}
+/**
+ * Parse call expression
+ *
+ * @param parser Parer instance
+ * @param context Context masks
+ * @param pos Line / Colum info
+ * @param expr Expression
+ */
+function parseCallExpression(parser, context, pos, expr) {
+ while (true) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ if (parser.token !== 50331659 /* LeftParen */)
+ return expr;
+ const args = parseArgumentList(parser, context & ~Context.AllowDecorator);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+}
+/**
+ * Parse cover call expression and async arrow head
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CoverCallExpressionAndAsyncArrowHead)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parserCoverCallExpressionAndAsyncArrowHead(parser, context) {
+ const pos = getLocation(parser);
+ let expr = parseMemberExpression(parser, context | Context.AllowIn, pos);
+ // Here we jump right into it and parse a simple, faster sub-grammar for
+ // async arrow / async identifier + call expression. This could have been done different
+ // but ESTree sucks!
+ //
+ // - J.K. Thomas
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (parser.token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */);
+ return parseAsyncArrowFunction(parser, context, ModifierState.Await, pos, [parseAndClassifyIdentifier(parser, context)]);
+ }
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ while (parser.token === 50331659 /* LeftParen */) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ const args = parseAsyncArgumentList(parser, context);
+ if (parser.token === 10 /* Arrow */) {
+ expr = parseAsyncArrowFunction(parser, context, ModifierState.Await, pos, args);
+ break;
+ }
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ return expr;
+}
+/**
+ * Parse argument list
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parseArgumentList(parser, context) {
+ // ArgumentList :
+ // AssignmentOrSpreadExpression
+ // ArgumentList , AssignmentOrSpreadExpression
+ //
+ // AssignmentOrSpreadExpression :
+ // ... AssignmentExpression
+ // AssignmentExpression
+ expect(parser, context, 50331659 /* LeftParen */);
+ const expressions = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ expressions.push(parseSpreadElement(parser, context));
+ }
+ else {
+ if (context & Context.Yield && hasBit(parser.token, 1073741824 /* IsYield */)) {
+ parser.flags |= Flags.HasYield;
+ setPendingError(parser);
+ }
+ expressions.push(parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ }
+ if (parser.token !== 16 /* RightParen */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return expressions;
+}
+/**
+ * Parse argument list for async arrow / async call expression
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parseAsyncArgumentList(parser, context) {
+ // Here we are parsing an "extended" argument list tweaked to handle async arrows. This is
+ // done here to avoid overhead and possible performance loss if we only
+ // parse out a simple call expression - E.g 'async(foo, bar)' or 'async(foo, bar)()';
+ //
+ // - J.K. Thomas
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = [];
+ let { token } = parser;
+ let state = CoverCallState.Empty;
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ parser.flags |= Flags.SimpleParameterList;
+ args.push(parseSpreadElement(parser, context));
+ state = CoverCallState.HasSpread;
+ }
+ else {
+ token = parser.token;
+ state = validateAsyncArgumentList(parser, context, state);
+ args.push(restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ }
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ parser.flags &= ~Flags.AllowDestructuring;
+ if (state & CoverCallState.HasSpread)
+ state = CoverCallState.SeenSpread;
+ }
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & CoverCallState.SeenSpread) {
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ }
+ else if (state & CoverCallState.EvalOrArguments) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (state & CoverCallState.Yield) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ else if (parser.flags & Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (state & CoverCallState.Await || parser.flags & Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ }
+ return args;
+}
+/**
+ * Parse primary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PrimaryExpression)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+function parsePrimaryExpression(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ return parseIdentifier(parser, context);
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionOrIdentifier(parser, context);
+ case 50331659 /* LeftParen */:
+ return parseParenthesizedExpression(parser, context | Context.InParen);
+ case 41943059 /* LeftBracket */:
+ return restoreExpressionCoverGrammar(parser, context, parseArrayLiteral);
+ case 41943052 /* LeftBrace */:
+ return restoreExpressionCoverGrammar(parser, context, parseObjectLiteral);
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionExpression(parser, context);
+ case 33566727 /* NullKeyword */:
+ case 33566726 /* TrueKeyword */:
+ case 33566725 /* FalseKeyword */:
+ return parseNullOrTrueOrFalseLiteral(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassExpression(parser, context);
+ case 33566811 /* NewKeyword */:
+ return parseNewExpressionOrMetaProperty(parser, context);
+ case 33566813 /* SuperKeyword */:
+ return parseSuperProperty(parser, context);
+ case 33554551 /* BigIntLiteral */:
+ return parseBigIntLiteral(parser, context);
+ case 33566815 /* ThisKeyword */:
+ return parseThisExpression(parser, context);
+ case 115 /* Hash */:
+ return parseIdentifierNameOrPrivateName(parser, context);
+ case 167774773 /* Divide */:
+ case 100663333 /* DivideAssign */:
+ scanRegularExpression(parser, context);
+ return parseRegularExpressionLiteral(parser, context);
+ case 33554441 /* TemplateTail */:
+ return parseTemplateLiteral(parser, context);
+ case 33554440 /* TemplateCont */:
+ return parseTemplate(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetAsIdentifier(parser, context);
+ case 12369 /* DoKeyword */:
+ if (context & Context.OptionsExperimental)
+ return parseDoExpression(parser, context);
+ default:
+ return parseAndClassifyIdentifier(parser, context);
+ }
+}
+/**
+ * Parse do expression (*experimental*)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDoExpression(parser, context) {
+ // AssignmentExpression ::
+ // do '{' StatementList '}'
+ const pos = getLocation(parser);
+ expect(parser, context, 12369 /* DoKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'DoExpression',
+ body: parseBlockStatement(parser, context)
+ });
+}
+/**
+ * Parse 'let' as identifier in 'sloppy mode', and throws
+ * in 'strict mode' / 'module code'. We also avoid a lookahead on the
+ * ASI restictions while checking this after parsing out the 'let' keyword
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+function parseLetAsIdentifier(parser, context) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ if (parser.flags & Flags.NewLine) {
+ if (parser.token === 41943059 /* LeftBracket */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, 'let');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+}
+/**
+ * Parse either async function expression or identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+function parseAsyncFunctionOrIdentifier(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) :
+ parseIdentifier(parser, context);
+}
+/**
+ * Parses identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIdentifier(parser, context) {
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context | Context.TaggedTemplate);
+ const node = finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ if (context & Context.OptionsRawidentifiers)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parse regular expression literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseRegularExpressionLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenRegExp, tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ regex: tokenRegExp,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = tokenRaw;
+ return node;
+}
+/**
+ * Parses string and number literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StringLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.tokenValue;
+ if (context & Context.Strict && parser.flags & Flags.HasOctal) {
+ tolerant(parser, context, 61 /* StrictOctalLiteral */);
+ }
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parses BigInt literal (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/proposal-bigint/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBigIntLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ bigint: tokenRaw,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+}
+/**
+ * Parses either null or boolean literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BooleanLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNullOrTrueOrFalseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const raw = tokenDesc(token);
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: token === 33566727 /* NullKeyword */ ? null : raw === 'true',
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = raw;
+ return node;
+}
+/**
+ * Parse this expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseThisExpression(parser, context) {
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ const pos = getLocation(parser);
+ nextToken(parser, context | Context.DisallowEscapedKeyword);
+ return finishNode(context, parser, pos, {
+ type: 'ThisExpression',
+ });
+}
+/**
+ * Parse identifier name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-IdentifierName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t token
+ */
+function parseIdentifierName(parser, context, t) {
+ if (!(t & (131072 /* IsIdentifier */ | 4096 /* Keyword */)))
+ tolerant(parser, context, 4 /* UnexpectedKeyword */, tokenDesc(t));
+ return parseIdentifier(parser, context);
+}
+/**
+ * Parse identifier name or private name (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIdentifierNameOrPrivateName(parser, context) {
+ if (!consume(parser, context, 115 /* Hash */))
+ return parseIdentifierName(parser, context, parser.token);
+ const { tokenValue } = parser;
+ const pos = getLocation(parser);
+ const name = tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+}
+/**
+ * Parse array literal
+ *
+ * ArrayLiteral :
+ * [ Elisionopt ]
+ * [ ElementList ]
+ * [ ElementList , Elisionopt ]
+ *
+ * ElementList :
+ * Elisionopt AssignmentExpression
+ * Elisionopt ... AssignmentExpression
+ * ElementList , Elisionopt AssignmentExpression
+ * ElementList , Elisionopt SpreadElement
+ *
+ * Elision :
+ * ,
+ * Elision ,
+ *
+ * SpreadElement :
+ * ... AssignmentExpression
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseArrayLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseSpreadElement(parser, context));
+ if (parser.token !== 20 /* RightBracket */) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ else {
+ elements.push(restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ return finishNode(context, parser, pos, {
+ type: 'ArrayExpression',
+ elements,
+ });
+}
+/**
+ * Parses cover parenthesized expression and arrow parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-parseCoverParenthesizedExpressionAndArrowParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseParenthesizedExpression(parser, context) {
+ expect(parser, context, 50331659 /* LeftParen */);
+ if (consume(parser, context, 16 /* RightParen */)) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.token === 10 /* Arrow */)
+ return [];
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ const restExpr = [parseRestElement(parser, context)];
+ expect(parser, context, 16 /* RightParen */);
+ parser.flags = parser.flags & ~(Flags.AllowDestructuring | Flags.AllowBinding) | Flags.SimpleParameterList;
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return restExpr;
+ }
+ // Record the sequence position
+ const sequencepos = getLocation(parser);
+ let state = validateCoverParenthesizedExpression(parser, CoverParenthesizedState.None);
+ let expr = restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ // Sequence expression
+ if (parser.token === 16777234 /* Comma */) {
+ state |= CoverParenthesizedState.SequenceExpression;
+ const expressions = [expr];
+ while (consume(parser, context | Context.DisallowEscapedKeyword, 16777234 /* Comma */)) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (!(parser.flags & Flags.AllowBinding))
+ tolerant(parser, context, 77 /* NotBindable */);
+ parser.flags |= Flags.SimpleParameterList;
+ const restElement = parseRestElement(parser, context);
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ expressions.push(restElement);
+ return expressions;
+ }
+ else if (consume(parser, context, 16 /* RightParen */)) {
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return expressions;
+ }
+ else {
+ state = validateCoverParenthesizedExpression(parser, state);
+ expressions.push(restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ }
+ expr = finishNode(context, parser, sequencepos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & CoverParenthesizedState.HasEvalOrArguments) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (state & CoverParenthesizedState.HasReservedWords) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ else if (!(parser.flags & Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (parser.flags & Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (context & Context.Async && parser.flags & Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ parser.flags &= ~(Flags.AllowBinding | Flags.HasAwait | Flags.HasYield);
+ return (state & CoverParenthesizedState.SequenceExpression ? expr.expressions : [expr]);
+ }
+ parser.flags &= ~(Flags.HasAwait | Flags.HasYield | Flags.AllowBinding);
+ if (!isValidSimpleAssignmentTarget(expr))
+ parser.flags &= ~Flags.AllowDestructuring;
+ return expr;
+}
+/**
+ * Parses function expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & ModifierState.Generator) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty), isGenerator, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: false,
+ generator: !!(isGenerator & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parses async function or async generator expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ const isAwait = ModifierState.Await;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict || isAwait & ModifierState.Await)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ if (token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & ModifierState.Generator)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty), isGenerator | isAwait, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: true,
+ generator: !!(isGenerator & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parse computed property names
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ComputedPropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseComputedPropertyName(parser, context) {
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const key = parseAssignmentExpression(parser, context | Context.AllowIn);
+ expect(parser, context, 20 /* RightBracket */);
+ return key;
+}
+/**
+ * Parse property name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePropertyName(parser, context) {
+ switch (parser.token) {
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943059 /* LeftBracket */:
+ return parseComputedPropertyName(parser, context);
+ default:
+ return parseIdentifier(parser, context);
+ }
+}
+/**
+ * Parse object spread properties
+ *
+ * @see [Link](https://tc39.github.io/proposal-object-rest-spread/#Spread)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSpreadProperties(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (parser.token & 8388608 /* IsBindingPattern */)
+ parser.flags &= ~Flags.AllowDestructuring;
+ const argument = parseAssignmentExpression(parser, context | Context.AllowIn);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+}
+/**
+ * Parses object literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ObjectLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseObjectLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const properties = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ properties.push(parser.token === 14 /* Ellipsis */ ?
+ parseSpreadProperties(parser, context) :
+ parsePropertyDefinition(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ parser.flags &= ~Flags.HasProtoField;
+ return finishNode(context, parser, pos, {
+ type: 'ObjectExpression',
+ properties,
+ });
+}
+/**
+ * Parse property definition
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyDefinition)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePropertyDefinition(parser, context) {
+ const pos = getLocation(parser);
+ const flags = parser.flags;
+ let value;
+ let state = consume(parser, context, 167774771 /* Multiply */) ? ObjectState.Generator | ObjectState.Method : ObjectState.Method;
+ const t = parser.token;
+ let key = parsePropertyName(parser, context);
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ else if (!(state & ObjectState.Generator) && t & 524288 /* IsAsync */ && !(parser.flags & Flags.NewLine)) {
+ state |= consume(parser, context, 167774771 /* Multiply */) ? ObjectState.Generator | ObjectState.Async : ObjectState.Async;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69743 /* GetKeyword */) {
+ state = state & ~ObjectState.Method | ObjectState.Getter;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69744 /* SetKeyword */) {
+ state = state & ~ObjectState.Method | ObjectState.Setter;
+ key = parsePropertyName(parser, context);
+ }
+ if (state & (ObjectState.Getter | ObjectState.Setter)) {
+ if (state & ObjectState.Generator)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ state &= ~ObjectState.Method;
+ if (parser.token === 16777237 /* Colon */) {
+ if ((state & (ObjectState.Async | ObjectState.Generator))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ else if (t !== 41943059 /* LeftBracket */ && parser.tokenValue === '__proto__') {
+ if (parser.flags & Flags.HasProtoField) {
+ // Record the error and put it on hold until we've determined
+ // whether or not we're destructuring
+ setPendingExpressionError(parser, 63 /* DuplicateProto */);
+ }
+ else
+ parser.flags |= Flags.HasProtoField;
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ // Invalid: 'async ({a: await}) => 1'
+ if (parser.token & 262144 /* IsAwait */)
+ parser.flags |= Flags.HasAwait;
+ value = restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ }
+ else {
+ if ((state & (ObjectState.Generator | ObjectState.Async)) || !isValidIdentifier(context, t)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(t));
+ }
+ else if (context & (Context.Strict | Context.Yield) && t & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasYield;
+ }
+ state |= ObjectState.Shorthand;
+ if (parser.token === 83886109 /* Assign */) {
+ if (context & Context.Strict && t & 4194304 /* IsEvalOrArguments */) {
+ report(parser, 47 /* StrictEvalArguments */);
+ }
+ else
+ setPendingExpressionError(parser, 91 /* InvalidCoverInitializedName */);
+ expect(parser, context, 83886109 /* Assign */);
+ if (context & (Context.Strict | Context.Yield | Context.Async) && parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */)) {
+ setPendingError(parser);
+ parser.flags |= parser.token & 1073741824 /* IsYield */ ? Flags.HasYield : Flags.HasAwait;
+ }
+ value = parseAssignmentPattern(parser, context, key, pos);
+ }
+ else {
+ if (t & 262144 /* IsAwait */) {
+ if (context & Context.Async)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ value = key;
+ }
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ key,
+ value,
+ kind: !(state & ObjectState.Getter | state & ObjectState.Setter) ? 'init' : (state & ObjectState.Setter) ? 'set' : 'get',
+ computed: t === 41943059 /* LeftBracket */,
+ method: !!(state & ObjectState.Method),
+ shorthand: !!(state & ObjectState.Shorthand),
+ });
+}
+/**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseMethodDeclaration(parser, context, state) {
+ const pos = getLocation(parser);
+ const isGenerator = state & ObjectState.Generator ? ModifierState.Generator : ModifierState.None;
+ const isAsync = state & ObjectState.Async ? ModifierState.Await : ModifierState.None;
+ const { params, body } = swapContext(parser, context | Context.Method, isGenerator | isAsync, parseFormalListAndBody, state);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: !!(state & ObjectState.Async),
+ generator: !!(state & ObjectState.Generator),
+ expression: false,
+ id: null,
+ });
+}
+/**
+ * Parse arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseArrowFunction(parser, context, pos, params) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, '=>');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context & ~Context.Async, params, pos, ModifierState.None);
+}
+/**
+ * Parse async arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncArrowFunction(parser, context, state, pos, params) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context | Context.Async, params, pos, state);
+}
+/**
+ * Shared helper function for both async arrow and arrows
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+// https://tc39.github.io/ecma262/#prod-AsyncArrowFunction
+function parseArrowBody(parser, context, params, pos, state) {
+ parser.pendingExpressionError = null;
+ for (const i in params)
+ reinterpret(parser, context | Context.InParameter, params[i]);
+ const expression = parser.token !== 41943052 /* LeftBrace */;
+ const body = expression ? parseExpressionCoverGrammar(parser, context & ~(Context.Yield | Context.InParameter), parseAssignmentExpression) :
+ swapContext(parser, context & ~(Context.Yield | Context.AllowDecorator) | Context.InFunctionBody, state, parseFunctionBody);
+ return finishNode(context, parser, pos, {
+ type: 'ArrowFunctionExpression',
+ body,
+ params,
+ id: null,
+ async: !!(state & ModifierState.Await),
+ generator: false,
+ expression,
+ });
+}
+/**
+ * Parses formal parameters and function body.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFormalListAndBody(parser, context, state) {
+ const paramList = parseFormalParameters(parser, context | Context.InParameter, state);
+ const args = paramList.args;
+ const params = paramList.params;
+ const body = parseFunctionBody(parser, context & ~Context.AllowDecorator | Context.InFunctionBody, args);
+ return { params, body };
+}
+/**
+ * Parse funciton body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionBody(parser, context, params) {
+ // Note! The 'params' has an 'any' type now because it's really shouldn't be there. This should have been
+ // on the parser object instead. So for now the 'params' arg are only used within the
+ // 'parseFormalListAndBody' method, and not within the arrow function body.
+ const pos = getLocation(parser);
+ expect(parser, context | Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const body = [];
+ while (parser.token === 33554435 /* StringLiteral */) {
+ const { tokenRaw, tokenValue } = parser;
+ body.push(parseDirective(parser, context));
+ if (tokenRaw.length === /* length of prologue*/ 12 && tokenValue === 'use strict') {
+ if (parser.flags & Flags.SimpleParameterList) {
+ tolerant(parser, context, 64 /* IllegalUseStrict */);
+ }
+ else if (parser.flags & (Flags.HasStrictReserved | Flags.StrictFunctionName)) {
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ }
+ else if (parser.flags & Flags.StrictEvalArguments) {
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ }
+ context |= Context.Strict;
+ }
+ }
+ if (context & Context.Strict) {
+ validateParams(parser, context, params);
+ }
+ const { labelSet } = parser;
+ parser.labelSet = {};
+ const savedFlags = parser.flags;
+ parser.flags = parser.flags & ~(Flags.StrictFunctionName | Flags.StrictEvalArguments | Flags.InSwitchStatement | Flags.InIterationStatement) | Flags.AllowDestructuring;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ if (savedFlags & Flags.InIterationStatement)
+ parser.flags |= Flags.InIterationStatement;
+ if (savedFlags & Flags.InSwitchStatement)
+ parser.flags |= Flags.InSwitchStatement;
+ parser.labelSet = labelSet;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body,
+ });
+}
+/**
+ * Parse formal parameters
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param Parser object
+ * @param Context masks
+ * @param Optional objectstate. Default to none
+ */
+function parseFormalParameters(parser, context, state) {
+ // FormalParameterList :
+ // [empty]
+ // FunctionRestParameter
+ // FormalsList
+ // FormalsList , FunctionRestParameter
+ //
+ // FunctionRestParameter :
+ // ... BindingIdentifier
+ //
+ // FormalsList :
+ // FormalParameter
+ // FormalsList , FormalParameter
+ //
+ // FormalParameter :
+ // BindingElement
+ //
+ // BindingElement :
+ // SingleNameBinding
+ // BindingPattern Initializeropt
+ expect(parser, context, 50331659 /* LeftParen */);
+ parser.flags &= ~(Flags.SimpleParameterList | Flags.HasStrictReserved);
+ const args = [];
+ const params = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (state & ObjectState.Setter)
+ tolerant(parser, context, 67 /* BadSetterRestParameter */);
+ parser.flags |= Flags.SimpleParameterList;
+ params.push(parseRestElement(parser, context, args));
+ break;
+ }
+ params.push(parseFormalParameterList(parser, context, args));
+ if (!consume(parser, context, 16777234 /* Comma */))
+ break;
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ if (state & ObjectState.Setter && params.length !== 1) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Setter', 'one', '');
+ }
+ if (state & ObjectState.Getter && params.length > 0) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Getter', 'no', 's');
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return { params, args };
+}
+/**
+ * Parse formal parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFormalParameterList(parser, context, args) {
+ const pos = getLocation(parser);
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (hasBit(parser.token, 20480 /* FutureReserved */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ if (hasBit(parser.token, 4194304 /* IsEvalOrArguments */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ }
+ else {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ const left = parseBindingIdentifierOrPattern(parser, context, args);
+ if (!consume(parser, context, 83886109 /* Assign */))
+ return left;
+ if (parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */) && context & (Context.Yield | Context.Async)) {
+ tolerant(parser, context, parser.token & 262144 /* IsAwait */ ? 52 /* AwaitInParameter */ : 51 /* YieldInParameter */);
+ }
+ parser.flags |= Flags.SimpleParameterList;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+}
+/**
+ * Parse class expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassExpression(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const { token } = parser;
+ let state = ObjectState.None;
+ let id = null;
+ let superClass = null;
+ if ((token !== 41943052 /* LeftBrace */ && token !== 12372 /* ExtendsKeyword */)) {
+ if (context & Context.Async && token & 262144 /* IsAwait */) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context | Context.Strict);
+ }
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | Context.Strict, pos);
+ state |= ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context | Context.Strict, state);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ });
+}
+/**
+ * Parse class body and element list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElementList)
+ *
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassBodyAndElementList(parser, context, state) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const body = [];
+ let decorators = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (!consume(parser, context, 17825809 /* Semicolon */)) {
+ if (context & Context.OptionsExperimental) {
+ decorators = parseDecorators(parser, context);
+ if (parser.token === 17825807 /* RightBrace */)
+ report(parser, 92 /* TrailingDecorators */);
+ if (decorators.length !== 0 && parser.tokenValue === 'constructor') {
+ report(parser, 93 /* GeneratorConstructor */);
+ }
+ }
+ body.push(context & Context.OptionsNext && parser.token === 115 /* Hash */
+ ? parsePrivateFields(parser, context, decorators)
+ : parseClassElement(parser, context, state, decorators));
+ }
+ }
+ parser.flags &= ~Flags.HasConstructor;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ClassBody',
+ body,
+ });
+}
+/**
+ * Parse class element and class public instance fields & private instance fields
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElement)
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassElement(parser, context, state, decorators) {
+ const pos = getLocation(parser);
+ let { tokenValue, token } = parser;
+ const flags = parser.flags;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ state |= ObjectState.Generator;
+ }
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ if (parser.tokenValue === 'constructor') {
+ if (state & ObjectState.Generator)
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'generator');
+ else if (state & ObjectState.Heritage)
+ context |= Context.AllowSuperProperty;
+ state |= ObjectState.Constructor;
+ }
+ let key = parsePropertyName(parser, context);
+ let value;
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ if (token === 20585 /* StaticKeyword */) {
+ token = parser.token;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= ObjectState.Generator;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ if (parser.tokenValue === 'prototype')
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ state |= ObjectState.Static;
+ key = parsePropertyName(parser, context);
+ if (context & Context.OptionsNext && isInstanceField(parser)) {
+ if (tokenValue === 'constructor')
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ }
+ }
+ if (parser.token !== 50331659 /* LeftParen */) {
+ if (token & 524288 /* IsAsync */ && !(state & ObjectState.Generator) && !(parser.flags & Flags.NewLine)) {
+ token = parser.token;
+ tokenValue = parser.tokenValue;
+ state |= ObjectState.Async;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= ObjectState.Generator;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ key = parsePropertyName(parser, context);
+ }
+ else if ((token === 69743 /* GetKeyword */ || token === 69744 /* SetKeyword */)) {
+ state |= token === 69743 /* GetKeyword */ ? ObjectState.Getter : ObjectState.Setter;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ key = parsePropertyName(parser, context & ~Context.Strict);
+ }
+ if (tokenValue === 'prototype') {
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ }
+ else if (!(state & ObjectState.Static) && tokenValue === 'constructor') {
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'accessor');
+ }
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ if (!(state & ObjectState.Computed) && state & ObjectState.Constructor) {
+ if (parser.flags & Flags.HasConstructor)
+ report(parser, 12 /* DuplicateConstructor */);
+ else
+ parser.flags |= Flags.HasConstructor;
+ }
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ if (context & Context.OptionsNext)
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const kind = (state & ObjectState.Constructor) ? 'constructor' : (state & ObjectState.Getter) ? 'get' :
+ (state & ObjectState.Setter) ? 'set' : 'method';
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & ObjectState.Static),
+ computed: !!(state & ObjectState.Computed),
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & ObjectState.Static),
+ computed: !!(state & ObjectState.Computed),
+ key,
+ value,
+ });
+}
+/**
+ * Parses field definition.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFieldDefinition(parser, context, key, state, pos, decorators) {
+ if (state & ObjectState.Constructor)
+ tolerant(parser, context, 0 /* Unexpected */);
+ let value = null;
+ if (state & (ObjectState.Async | ObjectState.Generator))
+ tolerant(parser, context, 0 /* Unexpected */);
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & ObjectState.Computed),
+ static: !!(state & ObjectState.Static),
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & ObjectState.Computed),
+ static: !!(state & ObjectState.Static),
+ });
+}
+/**
+ * Parse private name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePrivateName(parser, context, pos) {
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+}
+/**
+ * Parses private instance fields
+ *
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parsePrivateFields(parser, context, decorators) {
+ const pos = getLocation(parser);
+ expect(parser, context | Context.InClass, 115 /* Hash */);
+ if (parser.tokenValue === 'constructor')
+ tolerant(parser, context, 41 /* PrivateFieldConstructor */);
+ const key = parsePrivateName(parser, context, pos);
+ if (parser.token === 50331659 /* LeftParen */)
+ return parsePrivateMethod(parser, context, key, pos, decorators);
+ let value = null;
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ });
+}
+function parsePrivateMethod(parser, context, key, pos, decorators) {
+ const value = parseMethodDeclaration(parser, context | Context.Strict, ObjectState.None);
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ });
+}
+/**
+ * Parse either call expression or import expressions
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCallImportOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ // Import.meta - Stage 3 proposal
+ if (consume(parser, context, 16777229 /* Period */)) {
+ if (context & Context.Module && parser.tokenValue === 'meta')
+ return parseMetaProperty(parser, context, id, pos);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ let expr = parseImportExpression(parser, context, pos);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16 /* RightParen */);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: [args],
+ });
+ return expr;
+}
+/**
+ * Parse Import() expression. (Stage 3 proposal)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+function parseImportExpression(parser, context, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'Import',
+ });
+}
+/**
+ * Parse meta property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Identifier
+ * @param pos Location
+ */
+function parseMetaProperty(parser, context, meta, pos) {
+ return finishNode(context, parser, pos, {
+ meta,
+ type: 'MetaProperty',
+ property: parseIdentifier(parser, context),
+ });
+}
+/**
+ * Parse new expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NewExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNewExpressionOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ if (consume(parser, context | Context.DisallowEscapedKeyword, 16777229 /* Period */)) {
+ if (parser.tokenValue !== 'target' ||
+ !(context & (Context.InParameter | Context.InFunctionBody)))
+ tolerant(parser, context, 53 /* MetaNotInFunctionBody */);
+ return parseMetaProperty(parser, context, id, pos);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'NewExpression',
+ callee: parseImportOrMemberExpression(parser, context, pos),
+ arguments: parser.token === 50331659 /* LeftParen */ ? parseArgumentList(parser, context) : [],
+ });
+}
+/**
+ * Parse either import or member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportOrMemberExpression(parser, context, pos) {
+ const { token } = parser;
+ if (context & Context.OptionsNext && token === 33566810 /* ImportKeyword */) {
+ // Invalid: '"new import(x)"'
+ if (lookahead(parser, context, nextTokenIsLeftParen))
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ // Fixes cases like ''new import.meta','
+ return parseCallImportOrMetaProperty(parser, context);
+ }
+ return parseMemberExpression(parser, context, pos);
+}
+/**
+ * Parse super property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SuperProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSuperProperty(parser, context) {
+ // SuperProperty[Yield, Await]:
+ // super[Expression[+In, ?Yield, ?Await]]
+ // super.IdentifierName
+ const pos = getLocation(parser);
+ expect(parser, context, 33566813 /* SuperKeyword */);
+ switch (parser.token) {
+ case 50331659 /* LeftParen */:
+ // The super property has to be within a class constructor
+ if (!(context & Context.AllowSuperProperty))
+ tolerant(parser, context, 54 /* BadSuperCall */);
+ break;
+ case 41943059 /* LeftBracket */:
+ case 16777229 /* Period */:
+ if (!(context & Context.Method))
+ tolerant(parser, context, 55 /* UnexpectedSuper */);
+ break;
+ default:
+ tolerant(parser, context, 56 /* LoneSuper */);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Super',
+ });
+}
+/**
+ * Parse template literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseTemplateLiteral(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions: [],
+ quasis: [parseTemplateSpans(parser, context)],
+ });
+}
+/**
+ * Parse template head
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param cooked Cooked template value
+ * @param raw Raw template value
+ * @param pos Current location
+ */
+function parseTemplateHead(parser, context, cooked = null, raw, pos) {
+ parser.token = consumeTemplateBrace(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked,
+ raw,
+ },
+ tail: false,
+ });
+}
+/**
+ * Parse template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expression Expression AST node
+ * @param quasis Array of Template elements
+ */
+function parseTemplate(parser, context, expressions = [], quasis = []) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554440 /* TemplateCont */);
+ expressions.push(parseExpression(parser, context));
+ const t = getLocation(parser);
+ quasis.push(parseTemplateHead(parser, context, tokenValue, tokenRaw, pos));
+ if (parser.token === 33554441 /* TemplateTail */) {
+ quasis.push(parseTemplateSpans(parser, context, t));
+ }
+ else {
+ parseTemplate(parser, context, expressions, quasis);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions,
+ quasis,
+ });
+}
+/**
+ * Parse template spans
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateSpans)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param loc Current AST node location
+ */
+function parseTemplateSpans(parser, context, pos = getLocation(parser)) {
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554441 /* TemplateTail */);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked: tokenValue,
+ raw: tokenRaw,
+ },
+ tail: true,
+ });
+}
+/**
+ * Parses decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDecoratorList(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'Decorator',
+ expression: parseLeftHandSideExpression(parser, context, pos)
+ });
+}
+/**
+ * Parses a list of decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDecorators(parser, context) {
+ const decoratorList = [];
+ while (consume(parser, context, 120 /* At */)) {
+ decoratorList.push(parseDecoratorList(parser, context | Context.AllowDecorator));
+ }
+ return decoratorList;
+} + +// Context masks
+var Context;
+(function (Context) {
+ Context[Context["Empty"] = 0] = "Empty";
+ Context[Context["OptionsNext"] = 1] = "OptionsNext";
+ Context[Context["OptionsRanges"] = 2] = "OptionsRanges";
+ Context[Context["OptionsJSX"] = 4] = "OptionsJSX";
+ Context[Context["OptionsRaw"] = 8] = "OptionsRaw";
+ Context[Context["OptionsLoc"] = 16] = "OptionsLoc";
+ Context[Context["OptionsGlobalReturn"] = 32] = "OptionsGlobalReturn";
+ Context[Context["OptionsComments"] = 64] = "OptionsComments";
+ Context[Context["OptionsShebang"] = 128] = "OptionsShebang";
+ Context[Context["OptionsRawidentifiers"] = 256] = "OptionsRawidentifiers";
+ Context[Context["OptionsTolerant"] = 512] = "OptionsTolerant";
+ Context[Context["OptionsNode"] = 1024] = "OptionsNode";
+ Context[Context["OptionsExperimental"] = 2048] = "OptionsExperimental";
+ Context[Context["Strict"] = 4096] = "Strict";
+ Context[Context["Module"] = 8192] = "Module";
+ Context[Context["TaggedTemplate"] = 16384] = "TaggedTemplate";
+ Context[Context["InClass"] = 32768] = "InClass";
+ Context[Context["AllowIn"] = 65536] = "AllowIn";
+ Context[Context["Async"] = 131072] = "Async";
+ Context[Context["Yield"] = 262144] = "Yield";
+ Context[Context["InParameter"] = 524288] = "InParameter";
+ Context[Context["InFunctionBody"] = 1048576] = "InFunctionBody";
+ Context[Context["AllowSingleStatement"] = 2097152] = "AllowSingleStatement";
+ Context[Context["BlockScope"] = 4194304] = "BlockScope";
+ Context[Context["ForStatement"] = 8388608] = "ForStatement";
+ Context[Context["RequireIdentifier"] = 16777216] = "RequireIdentifier";
+ Context[Context["Method"] = 33554432] = "Method";
+ Context[Context["AllowSuperProperty"] = 67108864] = "AllowSuperProperty";
+ Context[Context["InParen"] = 134217728] = "InParen";
+ Context[Context["InJSXChild"] = 268435456] = "InJSXChild";
+ Context[Context["DisallowEscapedKeyword"] = 536870912] = "DisallowEscapedKeyword";
+ Context[Context["AllowDecorator"] = 1073741824] = "AllowDecorator";
+ Context[Context["LocationTracker"] = 18] = "LocationTracker";
+})(Context || (Context = {}));
+// Mutual parser flags
+var Flags;
+(function (Flags) {
+ Flags[Flags["None"] = 0] = "None";
+ Flags[Flags["NewLine"] = 1] = "NewLine";
+ Flags[Flags["AllowBinding"] = 2] = "AllowBinding";
+ Flags[Flags["AllowDestructuring"] = 4] = "AllowDestructuring";
+ Flags[Flags["SimpleParameterList"] = 8] = "SimpleParameterList";
+ Flags[Flags["InSwitchStatement"] = 16] = "InSwitchStatement";
+ Flags[Flags["InIterationStatement"] = 32] = "InIterationStatement";
+ Flags[Flags["HasStrictReserved"] = 64] = "HasStrictReserved";
+ Flags[Flags["HasOctal"] = 128] = "HasOctal";
+ Flags[Flags["SimpleAssignmentTarget"] = 256] = "SimpleAssignmentTarget";
+ Flags[Flags["HasProtoField"] = 512] = "HasProtoField";
+ Flags[Flags["StrictFunctionName"] = 1024] = "StrictFunctionName";
+ Flags[Flags["StrictEvalArguments"] = 2048] = "StrictEvalArguments";
+ Flags[Flags["InFunctionBody"] = 4096] = "InFunctionBody";
+ Flags[Flags["HasAwait"] = 8192] = "HasAwait";
+ Flags[Flags["HasYield"] = 16384] = "HasYield";
+ Flags[Flags["EscapedKeyword"] = 32768] = "EscapedKeyword";
+ Flags[Flags["HasConstructor"] = 65536] = "HasConstructor";
+})(Flags || (Flags = {}));
+// Label tracking state
+var Labels;
+(function (Labels) {
+ Labels[Labels["None"] = 0] = "None";
+ Labels[Labels["NotNested"] = 1] = "NotNested";
+ Labels[Labels["Nested"] = 2] = "Nested";
+})(Labels || (Labels = {}));
+var NumericState;
+(function (NumericState) {
+ NumericState[NumericState["None"] = 0] = "None";
+ NumericState[NumericState["SeenSeparator"] = 1] = "SeenSeparator";
+ NumericState[NumericState["EigthOrNine"] = 2] = "EigthOrNine";
+ NumericState[NumericState["Float"] = 4] = "Float";
+ NumericState[NumericState["BigInt"] = 8] = "BigInt";
+})(NumericState || (NumericState = {}));
+var ScannerState;
+(function (ScannerState) {
+ ScannerState[ScannerState["None"] = 0] = "None";
+ ScannerState[ScannerState["NewLine"] = 1] = "NewLine";
+ ScannerState[ScannerState["LastIsCR"] = 2] = "LastIsCR";
+})(ScannerState || (ScannerState = {}));
+var ModifierState;
+(function (ModifierState) {
+ ModifierState[ModifierState["None"] = 0] = "None";
+ ModifierState[ModifierState["Generator"] = 1] = "Generator";
+ ModifierState[ModifierState["Await"] = 2] = "Await";
+})(ModifierState || (ModifierState = {}));
+var CoverParenthesizedState;
+(function (CoverParenthesizedState) {
+ CoverParenthesizedState[CoverParenthesizedState["None"] = 0] = "None";
+ CoverParenthesizedState[CoverParenthesizedState["SequenceExpression"] = 1] = "SequenceExpression";
+ CoverParenthesizedState[CoverParenthesizedState["HasEvalOrArguments"] = 2] = "HasEvalOrArguments";
+ CoverParenthesizedState[CoverParenthesizedState["HasReservedWords"] = 4] = "HasReservedWords";
+ CoverParenthesizedState[CoverParenthesizedState["HasYield"] = 8] = "HasYield";
+ CoverParenthesizedState[CoverParenthesizedState["HasBinding"] = 16] = "HasBinding";
+})(CoverParenthesizedState || (CoverParenthesizedState = {}));
+var Escape;
+(function (Escape) {
+ Escape[Escape["Empty"] = -1] = "Empty";
+ Escape[Escape["StrictOctal"] = -2] = "StrictOctal";
+ Escape[Escape["EightOrNine"] = -3] = "EightOrNine";
+ Escape[Escape["InvalidHex"] = -4] = "InvalidHex";
+ Escape[Escape["OutOfRange"] = -5] = "OutOfRange";
+})(Escape || (Escape = {}));
+var RegexFlags;
+(function (RegexFlags) {
+ RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
+ RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
+ RegexFlags[RegexFlags["Global"] = 2] = "Global";
+ RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
+ RegexFlags[RegexFlags["Unicode"] = 8] = "Unicode";
+ RegexFlags[RegexFlags["Sticky"] = 16] = "Sticky";
+ RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
+})(RegexFlags || (RegexFlags = {}));
+var CoverCallState;
+(function (CoverCallState) {
+ CoverCallState[CoverCallState["Empty"] = 0] = "Empty";
+ CoverCallState[CoverCallState["SeenSpread"] = 1] = "SeenSpread";
+ CoverCallState[CoverCallState["HasSpread"] = 2] = "HasSpread";
+ CoverCallState[CoverCallState["SimpleParameter"] = 4] = "SimpleParameter";
+ CoverCallState[CoverCallState["EvalOrArguments"] = 8] = "EvalOrArguments";
+ CoverCallState[CoverCallState["Yield"] = 16] = "Yield";
+ CoverCallState[CoverCallState["Await"] = 32] = "Await";
+})(CoverCallState || (CoverCallState = {}));
+var RegexState;
+(function (RegexState) {
+ RegexState[RegexState["Empty"] = 0] = "Empty";
+ RegexState[RegexState["Escape"] = 1] = "Escape";
+ RegexState[RegexState["Class"] = 2] = "Class";
+})(RegexState || (RegexState = {}));
+// Shared between class expr / decl & object literal
+var ObjectState;
+(function (ObjectState) {
+ ObjectState[ObjectState["None"] = 0] = "None";
+ ObjectState[ObjectState["Async"] = 1] = "Async";
+ ObjectState[ObjectState["Generator"] = 2] = "Generator";
+ ObjectState[ObjectState["Getter"] = 4] = "Getter";
+ ObjectState[ObjectState["Setter"] = 8] = "Setter";
+ ObjectState[ObjectState["Computed"] = 16] = "Computed";
+ ObjectState[ObjectState["Method"] = 32] = "Method";
+ ObjectState[ObjectState["Shorthand"] = 64] = "Shorthand";
+ ObjectState[ObjectState["Static"] = 128] = "Static";
+ ObjectState[ObjectState["Constructor"] = 256] = "Constructor";
+ ObjectState[ObjectState["Heritage"] = 512] = "Heritage";
+})(ObjectState || (ObjectState = {}));
+/**
+ * Validate break and continue statement
+ *
+ * @param parser Parser object
+ * @param label label
+ * @param isContinue true if validation continue statement
+ */
+function validateBreakOrContinueLabel(parser, context, label, isContinue) {
+ const state = hasLabel(parser, label);
+ if (!state)
+ tolerant(parser, context, 32 /* UnknownLabel */, label);
+ if (isContinue && !(state & Labels.Nested))
+ tolerant(parser, context, 31 /* IllegalContinue */, label);
+}
+/**
+ * Add label to the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+function addLabel(parser, label) {
+ if (parser.labelSet === undefined)
+ parser.labelSet = {};
+ parser.labelSet[`$${label}`] = isIterationStatement(parser.token) ? Labels.Nested : Labels.NotNested;
+}
+/**
+ * Remove label from the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+function popLabel(parser, label) {
+ parser.labelSet[`$${label}`] = Labels.None;
+}
+/**
+ * Returns either true or false. Depends if the label exist.
+ *
+ * @param parser Parser object
+ * @param label Label
+ */
+function hasLabel(parser, label) {
+ return !parser.labelSet ? Labels.None : parser.labelSet[`$${label}`];
+}
+/**
+ * Finish each the node for each parse. Set line / and column on the node if the
+ * options are set for it
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Line / column
+ * @param node AST node
+ */
+function finishNode(context, parser, meta, node) {
+ const { lastIndex, lastLine, lastColumn, sourceFile, index } = parser;
+ if (context & Context.LocationTracker) {
+ if (context & Context.OptionsRanges) {
+ node.start = meta.index;
+ node.end = lastIndex;
+ }
+ if (context & Context.OptionsLoc) {
+ node.loc = {
+ start: { line: meta.line, column: meta.column },
+ end: { line: lastLine, column: lastColumn }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ return node;
+}
+/**
+ * Consumes the next token. If the consumed token is not of the expected type
+ * then report an error and return null. Otherwise return true.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ * @param Err Optionally error message to be thrown
+ */
+function expect(parser, context, token, err = 1 /* UnexpectedToken */) {
+ if (parser.token !== token)
+ report(parser, err, tokenDesc(parser.token));
+ nextToken(parser, context);
+ return true;
+}
+/**
+ * If the next token matches the given token, this consumes the token
+ * and returns true. Otherwise return false.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ */
+function consume(parser, context, token) {
+ if (parser.token !== token)
+ return false;
+ nextToken(parser, context);
+ return true;
+}
+/**
+ * Advance and return the next token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextToken(parser, context) {
+ parser.lastIndex = parser.index;
+ parser.lastLine = parser.line;
+ parser.lastColumn = parser.column;
+ return (parser.token = scan(parser, context));
+}
+const hasBit = (mask, flags) => (mask & flags) === flags;
+/**
+ * Automatic Semicolon Insertion
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function consumeSemicolon(parser, context) {
+ return parser.token & 1048576 /* ASI */ || parser.flags & Flags.NewLine
+ ? consume(parser, context, 17825809 /* Semicolon */)
+ : report(parser, !(context & Context.Async) && parser.token & 262144 /* IsAwait */ ? 38 /* AwaitOutsideAsync */ : 1 /* UnexpectedToken */, tokenDesc(parser.token));
+}
+/**
+ * Bit fiddle current grammar state and keep track of the state during the parse and restore
+ * it back to original state after finish parsing or throw.
+ *
+ * Ideas for this is basicly from V8 and SM, but also the Esprima parser does this in a similar way.
+ *
+ * However this implementation is an major improvement over similiar implementations, and
+ * does not require additonal bitmasks to be set / unset during the parsing outside this function.
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ * @param errMsg Optional error message
+ */
+function parseExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= Flags.AllowBinding | Flags.AllowDestructuring;
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // If there exist an pending expression error, we throw an error at
+ // the same location it was recorded
+ if (!!parser.pendingExpressionError) {
+ const { error, line, column, index } = parser.pendingExpressionError;
+ constructError(parser, context, index, line, column, error);
+ }
+ // Here we - just in case - disallow both binding and destructuring
+ // and only set the bitmaks if the previous flags (before the callback)
+ // is positive.
+ // Note that this bitmasks may have been turned off during parsing
+ // the callback
+ parser.flags &= ~(Flags.AllowBinding | Flags.AllowDestructuring);
+ if (flags & Flags.AllowBinding)
+ parser.flags |= Flags.AllowBinding;
+ if (flags & Flags.AllowDestructuring)
+ parser.flags |= Flags.AllowDestructuring;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+}
+/**
+ * Restor current grammar to previous state, or unset necessary bitmasks
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ */
+function restoreExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= Flags.AllowBinding | Flags.AllowDestructuring;
+ // Clear pending expression error
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // Both the previous bitmasks and bitmasks set during parsing the callback
+ // has to be positive for us to allow further binding or destructuring.
+ // Note that we allow both before the callback, so this is the only thing
+ // we need to check for.
+ if (!(parser.flags & Flags.AllowBinding) || !(flags & Flags.AllowBinding)) {
+ parser.flags &= ~Flags.AllowBinding;
+ }
+ if (!(parser.flags & Flags.AllowDestructuring) || !(flags & Flags.AllowDestructuring)) {
+ parser.flags &= ~Flags.AllowDestructuring;
+ }
+ // Here we either
+ // 1) restore to previous pending expression error
+ // or
+ // 2) if a pending expression error have been set during the parse (*only in object literal*)
+ // we overwrite previous error, and keep the new one
+ parser.pendingExpressionError = pendingExpressionError || parser.pendingExpressionError;
+ return res;
+}
+/**
+ * Set / unset yield / await context masks based on the
+ * ModifierState masks before invoking the callback and
+ * returning it's content
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Modifier state
+ * @param callback Callback function to be invoked
+ * @param methodState Optional Objectstate.
+ */
+function swapContext(parser, context, state, callback, methodState = ObjectState.None) {
+ context &= ~(Context.Async | Context.Yield | Context.InParameter);
+ if (state & ModifierState.Generator)
+ context |= Context.Yield;
+ if (state & ModifierState.Await)
+ context |= Context.Async;
+ return callback(parser, context, methodState);
+}
+/**
+ * Validates function params
+ *
+ * Note! In case anyone want to enable full scoping, replace 'paramSet' with an similiar
+ * object on the parser object itself. Then push / set the tokenValue to
+ * it an use an bitmask to mark it as an 'variable' not 'blockscope'. Then when
+ * implementing lexical scoping, you can use that for validation.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param params Array of token values
+ */
+function validateParams(parser, context, params) {
+ const paramSet = new Map();
+ for (let i = 0; i < params.length; i++) {
+ const key = `@${params[i]}`;
+ if (paramSet.get(key)) {
+ tolerant(parser, context, 81 /* ParamDupe */);
+ }
+ else
+ paramSet.set(key, true);
+ }
+}
+/**
+ * Reinterpret various expressions as pattern
+ * This is only used for assignment and arrow parameter list
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param node AST node
+ */
+const reinterpret = (parser, context, node) => {
+ switch (node.type) {
+ case 'Identifier':
+ if (context & Context.Strict && nameIsArgumentsOrEval(node.name))
+ report(parser, 3 /* InvalidEscapedReservedWord */);
+ case 'ArrayPattern':
+ case 'AssignmentPattern':
+ case 'ObjectPattern':
+ case 'RestElement':
+ case 'MetaProperty':
+ return;
+ case 'ArrayExpression':
+ node.type = 'ArrayPattern';
+ for (let i = 0; i < node.elements.length; ++i) {
+ // skip holes in pattern
+ if (node.elements[i] !== null) {
+ reinterpret(parser, context, node.elements[i]);
+ }
+ }
+ return;
+ case 'ObjectExpression':
+ node.type = 'ObjectPattern';
+ for (let i = 0; i < node.properties.length; i++) {
+ reinterpret(parser, context, node.properties[i]);
+ }
+ return;
+ case 'Property':
+ reinterpret(parser, context, node.value);
+ return;
+ case 'SpreadElement':
+ node.type = 'RestElement';
+ if (node.argument.type !== 'ArrayExpression' &&
+ node.argument.type !== 'ObjectExpression' &&
+ !isValidSimpleAssignmentTarget(node.argument)) {
+ tolerant(parser, context, 71 /* RestDefaultInitializer */);
+ }
+ reinterpret(parser, context, node.argument);
+ break;
+ case 'AssignmentExpression':
+ node.type = 'AssignmentPattern';
+ delete node.operator; // operator is not relevant for assignment pattern
+ reinterpret(parser, context, node.left); // recursive descent
+ return;
+ case 'MemberExpression':
+ if (!(context & Context.InParameter))
+ return;
+ // Fall through
+ default:
+ tolerant(parser, context, context & Context.InParameter ? 77 /* NotBindable */ : 73 /* InvalidDestructuringTarget */, node.type);
+ }
+};
+/**
+ * Does a lookahead.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param callback Callback function to be invoked
+ */
+function lookahead(parser, context, callback) {
+ const { tokenValue, flags, line, column, startColumn, index, lastColumn, startLine, lastLine, lastIndex, startIndex, tokenRaw, token, lastValue, tokenRegExp, labelSet, errors, errorLocation, pendingExpressionError } = parser;
+ const res = callback(parser, context);
+ parser.index = index;
+ parser.token = token;
+ parser.tokenValue = tokenValue;
+ parser.tokenValue = tokenValue;
+ parser.flags = flags;
+ parser.line = line;
+ parser.column = column;
+ parser.tokenRaw = tokenRaw;
+ parser.lastValue = lastValue;
+ parser.startColumn = startColumn;
+ parser.lastColumn = lastColumn;
+ parser.startLine = startLine;
+ parser.lastLine = lastLine;
+ parser.lastIndex = lastIndex;
+ parser.startIndex = startIndex;
+ parser.tokenRegExp = tokenRegExp;
+ parser.labelSet = labelSet;
+ parser.errors = errors;
+ parser.errorLocation = errorLocation;
+ parser.tokenRegExp = tokenRegExp;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+}
+/**
+ * Returns true if this an valid simple assignment target
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isValidSimpleAssignmentTarget(node) {
+ return node.type === 'Identifier' || node.type === 'MemberExpression' ? true : false;
+}
+/**
+ * Get current node location
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function getLocation(parser) {
+ return {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+}
+/**
+ * Returns true if this is an valid identifier
+ *
+ * @param context Context masks
+ * @param t Token
+ */
+function isValidIdentifier(context, t) {
+ if (context & Context.Strict) {
+ if (context & Context.Module && t & 262144 /* IsAwait */)
+ return false;
+ if (t & 1073741824 /* IsYield */)
+ return false;
+ return (t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (t & 69632 /* Contextual */) === 69632 /* Contextual */;
+ }
+ return ((t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (t & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (t & 20480 /* FutureReserved */) === 20480 /* FutureReserved */);
+}
+/**
+ * Returns true if this an valid lexical binding and not an identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isLexical(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return !!(token & (131072 /* IsIdentifier */ | 8388608 /* IsBindingPattern */ | 1073741824 /* IsYield */ | 262144 /* IsAwait */) ||
+ token === 33574984 /* LetKeyword */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */);
+}
+/**
+ * Returns true if this is end of case or default clauses
+ *
+ * @param parser Parser object
+ */
+function isEndOfCaseOrDefaultClauses(parser) {
+ return (parser.token === 12368 /* DefaultKeyword */ || parser.token === 17825807 /* RightBrace */ || parser.token === 12363 /* CaseKeyword */);
+}
+/**
+ * Validates if the next token in the stream is a left paren or a period
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsLeftParenOrPeriod(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */ || parser.token === 16777229 /* Period */;
+}
+/**
+ * Validates if the next token in the stream is a identifier or left paren
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenisIdentifierOrParen(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return token & (131072 /* IsIdentifier */ | 1073741824 /* IsYield */) || token === 50331659 /* LeftParen */;
+}
+/**
+ * Validates if the next token in the stream is left parenthesis.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsLeftParen(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */;
+}
+/**
+ * Validates if the next token in the stream is a function keyword on the same line.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function nextTokenIsFuncKeywordOnSameLine(parser, context) {
+ nextToken(parser, context);
+ return !(parser.flags & Flags.NewLine) && parser.token === 33566808 /* FunctionKeyword */;
+}
+/**
+ * Checks if the property has any private field key
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function isPropertyWithPrivateFieldKey(expr) {
+ return !expr.property ? false : expr.property.type === 'PrivateName';
+}
+/**
+ * Parse and classify itendifier - similar method as in V8
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAndClassifyIdentifier(parser, context) {
+ const { token, tokenValue: name } = parser;
+ if (context & Context.Strict) {
+ if (context & Context.Module && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (token & 69632 /* Contextual */) === 69632 /* Contextual */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (context & Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+}
+function nameIsArgumentsOrEval(value) {
+ return value === 'eval' || value === 'arguments';
+}
+/**
+ * Records an error from current position. If we report an error later, we'll do it from
+ * this position.
+ *
+ * @param parser Parser object
+ */
+function setPendingError(parser) {
+ parser.errorLocation = {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+}
+/**
+ * Returns tagName for JSX element
+ *
+ * @param elementName JSX Element name
+ */
+function isEqualTagNames(elementName) {
+ // tslint:disable-next-line:switch-default | this switch is exhaustive
+ switch (elementName.type) {
+ case 'JSXIdentifier':
+ return elementName.name;
+ case 'JSXNamespacedName':
+ return `${isEqualTagNames(elementName.namespace)}:${isEqualTagNames(elementName.name)}`;
+ case 'JSXMemberExpression':
+ return `${isEqualTagNames(elementName.object)}.${isEqualTagNames(elementName.property)}`;
+ }
+}
+/**
+ * Returns true if this is an instance field ( stage 3 proposal)
+ *
+ * @param parser Parser object
+ */
+function isInstanceField(parser) {
+ const { token } = parser;
+ return token === 17825807 /* RightBrace */ || token === 17825809 /* Semicolon */ || token === 83886109 /* Assign */;
+}
+/**
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expr AST expressions
+ * @param prefix prefix
+ */
+function validateUpdateExpression(parser, context, expr, prefix) {
+ if (context & Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 68 /* StrictLHSPrefixPostFix */, prefix);
+ }
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+}
+/**
+ * Record expression error
+ *
+ * @param parser Parser object
+ * @param error Error message
+ */
+function setPendingExpressionError(parser, type) {
+ parser.pendingExpressionError = {
+ error: errorMessages[type],
+ line: parser.line,
+ column: parser.column,
+ index: parser.index
+ };
+}
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+function validateCoverParenthesizedExpression(parser, state) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= CoverParenthesizedState.HasEvalOrArguments;
+ }
+ else if ((token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ setPendingError(parser);
+ state |= CoverParenthesizedState.HasReservedWords;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ }
+ return state;
+}
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+function validateAsyncArgumentList(parser, context, state) {
+ const { token } = parser;
+ if (!(parser.flags & Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= CoverCallState.EvalOrArguments;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ state |= CoverCallState.Await;
+ }
+ else if ((token & 1073741824 /* IsYield */) === 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ state |= CoverCallState.Yield;
+ }
+ }
+ return state;
+}
+/**
+ * Returns true if iteration statement. Otherwise return false,
+ *
+ * @param t Token
+ */
+function isIterationStatement(t) {
+ return t === 12369 /* DoKeyword */ || t === 12386 /* WhileKeyword */ || t === 12374 /* ForKeyword */;
+}
+/**
+ * Returns true if in or of token. Otherwise return false,
+ *
+ * @param t Token
+ */
+function isInOrOf(t) {
+ return t === 69746 /* OfKeyword */ || t === 167786289 /* InKeyword */;
+} + +/*@internal*/
+const errorMessages = {
+ [0 /* Unexpected */]: 'Unexpected token',
+ [1 /* UnexpectedToken */]: 'Unexpected token \'%0\'',
+ [2 /* ExpectedToken */]: 'Expected token \'%0\'',
+ [3 /* InvalidEscapedReservedWord */]: 'Keyword must not contain escaped characters',
+ [4 /* UnexpectedKeyword */]: 'Keyword \'%0\' is reserved',
+ [5 /* InvalidLHSInAssignment */]: 'Invalid left-hand side in assignment',
+ [6 /* UnterminatedString */]: 'Unterminated string literal',
+ [7 /* UnterminatedRegExp */]: 'Unterminated regular expression literal',
+ [8 /* UnterminatedComment */]: 'Unterminated MultiLineComment',
+ [9 /* UnterminatedTemplate */]: 'Unterminated template literal',
+ [10 /* UnexpectedChar */]: 'Invalid character \'%0\'',
+ [11 /* StrictOctalEscape */]: 'Octal escapes are not allowed in strict mode',
+ [13 /* InvalidEightAndNine */]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
+ [14 /* UnicodeOutOfRange */]: 'Unicode escape code point out of range',
+ [15 /* DuplicateRegExpFlag */]: 'Duplicate regular expression flag \'%0\'',
+ [16 /* UnexpectedTokenRegExpFlag */]: 'Unexpected regular expression flag \'%0\'',
+ [17 /* StrictLHSAssignment */]: 'Eval or arguments can\'t be assigned to in strict mode code',
+ [18 /* IllegalReturn */]: 'Illegal return statement',
+ [19 /* StrictFunction */]: 'In strict mode code, functions can only be declared at top level or inside a block',
+ [20 /* SloppyFunction */]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
+ [21 /* ForbiddenAsStatement */]: '%0 can\'t appear in single-statement context',
+ [22 /* GeneratorInSingleStatementContext */]: 'Generators can only be declared at the top level or inside a block',
+ [23 /* ForAwaitNotOf */]: '\'for await\' loop should be used with \'of\'',
+ [24 /* DeclarationMissingInitializer */]: 'Missing initializer in %0 declaration',
+ [25 /* ForInOfLoopInitializer */]: '\'for-%0\' loop variable declaration may not have an initializer',
+ [26 /* ForInOfLoopMultiBindings */]: 'Invalid left-hand side in for-%0 loop: Must have a single binding.',
+ [27 /* LetInLexicalBinding */]: 'let is disallowed as a lexically bound name',
+ [28 /* UnexpectedLexicalDeclaration */]: 'Lexical declaration cannot appear in a single-statement context',
+ [29 /* LabelRedeclaration */]: 'Label \'%0\' has already been declared',
+ [30 /* InvalidNestedStatement */]: '%0 statement must be nested within an iteration statement',
+ [31 /* IllegalContinue */]: 'Illegal continue statement: \'%0\' does not denote an iteration statement',
+ [32 /* UnknownLabel */]: 'Undefined label \'%0\'',
+ [33 /* MultipleDefaultsInSwitch */]: 'More than one default clause in switch statement',
+ [34 /* ImportExportDeclAtTopLevel */]: '%0 declarations may only appear at top level of a module',
+ [35 /* AsyncFunctionInSingleStatementContext */]: 'Async functions can only be declared at the top level or inside a block',
+ [36 /* InvalidLineBreak */]: 'No line break is allowed after \'%0\'',
+ [37 /* StrictModeWith */]: 'Strict mode code may not include a with statement',
+ [38 /* AwaitOutsideAsync */]: 'Await is only valid in async functions',
+ [39 /* UnNamedFunctionDecl */]: 'Function declaration must have a name in this context',
+ [12 /* DuplicateConstructor */]: 'Duplicate constructor method in class',
+ [40 /* DisallowedInContext */]: '\'%0\' may not be used as an identifier in this context',
+ [43 /* StrictDelete */]: 'Delete of an unqualified identifier in strict mode',
+ [44 /* DeletePrivateField */]: 'Private fields can not be deleted',
+ [41 /* PrivateFieldConstructor */]: 'Classes may not have a private field named \'#constructor\'',
+ [42 /* PublicFieldConstructor */]: 'Classes may not have a field named \'constructor\'',
+ [45 /* InvalidConstructor */]: 'Class constructor may not be a \'%0\'',
+ [46 /* UnexpectedReserved */]: 'Unexpected reserved word',
+ [47 /* StrictEvalArguments */]: 'Unexpected eval or arguments in strict mode',
+ [48 /* AwaitBindingIdentifier */]: '\'await\' is not a valid identifier inside an async function',
+ [49 /* YieldBindingIdentifier */]: '\'yield\' is not a valid identifier inside an generator function',
+ [50 /* UnexpectedStrictReserved */]: 'Unexpected strict mode reserved word',
+ [52 /* AwaitInParameter */]: 'Await expression not allowed in formal parameter',
+ [51 /* YieldInParameter */]: 'Yield expression not allowed in formal parameter',
+ [53 /* MetaNotInFunctionBody */]: 'new.target only allowed within functions',
+ [54 /* BadSuperCall */]: 'super() is not allowed in this context',
+ [55 /* UnexpectedSuper */]: 'Member access from super not allowed in this context',
+ [56 /* LoneSuper */]: 'Only "(" or "." or "[" are allowed after \'super\'',
+ [57 /* YieldReservedKeyword */]: '\'yield\' is a reserved keyword within generator function bodies',
+ [58 /* ContinuousNumericSeparator */]: 'Only one underscore is allowed as numeric separator',
+ [59 /* TrailingNumericSeparator */]: 'Numeric separators are not allowed at the end of numeric literals',
+ [60 /* ZeroDigitNumericSeparator */]: 'Numeric separator can not be used after leading 0.',
+ [61 /* StrictOctalLiteral */]: 'Legacy octal literals are not allowed in strict mode',
+ [62 /* InvalidLhsInAssignment */]: 'Invalid left-hand side in assignment',
+ [63 /* DuplicateProto */]: 'Property name __proto__ appears more than once in object literal',
+ [64 /* IllegalUseStrict */]: 'Illegal \'use strict\' directive in function with non-simple parameter list',
+ [65 /* StaticPrototype */]: 'Classes may not have a static property named \'prototype\'',
+ [66 /* AccessorWrongArgs */]: '%0 functions must have %1 argument%2',
+ [67 /* BadSetterRestParameter */]: 'Setter function argument must not be a rest parameter',
+ [68 /* StrictLHSPrefixPostFix */]: '%0 increment/decrement may not have eval or arguments operand in strict mode',
+ [69 /* InvalidElisonInObjPropList */]: 'Elision not allowed in object property list',
+ [70 /* ElementAfterRest */]: 'Rest element must be last element',
+ [72 /* ElementAfterSpread */]: 'Spread element must be last element',
+ [71 /* RestDefaultInitializer */]: 'Rest parameter may not have a default initializer',
+ [73 /* InvalidDestructuringTarget */]: 'Invalid destructuring assignment target',
+ [74 /* UnexpectedSurrogate */]: 'Unexpected surrogate pair',
+ [75 /* MalformedEscape */]: 'Malformed %0 character escape sequence',
+ [76 /* TemplateOctalLiteral */]: 'Template literals may not contain octal escape sequences',
+ [77 /* NotBindable */]: 'Invalid binding pattern',
+ [78 /* ParamAfterRest */]: 'Rest parameter must be last formal parameter',
+ [79 /* NoCatchOrFinally */]: 'Missing catch or finally after try',
+ [80 /* NewlineAfterThrow */]: 'Illegal newline after throw',
+ [81 /* ParamDupe */]: 'Duplicate parameter name not allowed in this context',
+ [82 /* AsAfterImportStart */]: 'Missing keyword \'as\' after import *',
+ [83 /* LabelNoColon */]: 'Labels must be followed by a \':\'',
+ [84 /* NonEmptyJSXExpression */]: 'JSX attributes must only be assigned a non-empty \'expression\'',
+ [85 /* ExpectedJSXClosingTag */]: 'Expected corresponding JSX closing tag for %0',
+ [86 /* AdjacentJSXElements */]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
+ [87 /* InvalidJSXAttributeValue */]: 'Invalid JSX attribute value',
+ [88 /* RestWithComma */]: 'Rest element may not have a trailing comma',
+ [89 /* UndefinedUnicodeCodePoint */]: 'Undefined Unicode code-point',
+ [90 /* HtmlCommentInModule */]: 'HTML comments are not allowed in modules',
+ [91 /* InvalidCoverInitializedName */]: 'Invalid shorthand property initializer',
+ [92 /* TrailingDecorators */]: 'Trailing decorator may be followed by method',
+ [93 /* GeneratorConstructor */]: 'Decorators can\'t be used with a constructor',
+ [94 /* InvalidRestBindingPattern */]: '`...` must be followed by an identifier in declaration contexts',
+};
+/**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param index The 0-based end index of the error.
+ * @param line The 0-based line position of the error.
+ * @param column The 0-based column position of the error.
+ * @param parser The 0-based end index of the current node.
+ * @param description Error description
+ */
+/*@internal*/
+function constructError(parser, context, index, line, column, description) {
+ const error = new SyntaxError(`Line ${line}, column ${column}: ${description}`);
+ error.index = index;
+ error.line = line;
+ error.column = column;
+ error.description = description;
+ if (context & Context.OptionsTolerant) {
+ parser.errors.push(error);
+ }
+ else
+ throw error;
+}
+/**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ */
+function getErrorLocation(parser) {
+ let { index, startLine: line, startColumn: column } = parser;
+ const errorLoc = parser.errorLocation;
+ if (!!errorLoc) {
+ index = errorLoc.index;
+ line = errorLoc.line;
+ column = errorLoc.column;
+ }
+ return { index, line, column };
+}
+/**
+ * Throws an error
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+/*@internal*/
+function report(parser, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, Context.Empty, index, line, column, errorMessage);
+}
+/**
+ * If in tolerant mode, all errors are pushed to a top-level error array containing
+ * otherwise throws
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+/*@internal*/
+function tolerant(parser, context, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, context, index, line, column, errorMessage);
+} + +// Declarations
+/**
+ * Parses class declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseClassDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const id = (context & Context.RequireIdentifier && (parser.token !== 33685505 /* Identifier */))
+ ? null :
+ parseBindingIdentifier(parser, context | Context.Strict | Context.DisallowEscapedKeyword);
+ let state = ObjectState.None;
+ let superClass = null;
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | Context.Strict, pos);
+ state |= ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context & ~Context.RequireIdentifier | Context.Strict | Context.InClass, state);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body
+ });
+}
+/**
+ * Parses function declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseFunctionDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ let isGenerator = ModifierState.None;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ if (context & Context.AllowSingleStatement && !(context & Context.InFunctionBody)) {
+ tolerant(parser, context, 22 /* GeneratorInSingleStatementContext */);
+ }
+ isGenerator = ModifierState.Generator;
+ }
+ return parseFunctionDeclarationBody(parser, context, isGenerator, pos);
+}
+/**
+ * Parses out a function declartion body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context mask
+ * @param state Modifier state
+ * @param pos Current location
+ */
+function parseFunctionDeclarationBody(parser, context, state, pos) {
+ const { token } = parser;
+ let id = null;
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (context & Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (token !== 50331659 /* LeftParen */) {
+ id = parseBindingIdentifier(parser, context);
+ // Unnamed functions are forbidden in statement context.
+ }
+ else if (!(context & Context.RequireIdentifier))
+ tolerant(parser, context, 39 /* UnNamedFunctionDecl */);
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty | Context.RequireIdentifier), state, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionDeclaration',
+ params,
+ body,
+ async: !!(state & ModifierState.Await),
+ generator: !!(state & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+}
+/**
+ * Parses async function or async generator declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isAwait = ModifierState.Await;
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ return parseFunctionDeclarationBody(parser, context, isGenerator | isAwait, pos);
+}
+/**
+ * VariableDeclaration :
+ * BindingIdentifier Initializeropt
+ * BindingPattern Initializer
+ *
+ * VariableDeclarationNoIn :
+ * BindingIdentifier InitializerNoInopt
+ * BindingPattern InitializerNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableDeclaration(parser, context, isConst) {
+ const pos = getLocation(parser);
+ const isBindingPattern = (parser.token & 8388608 /* IsBindingPattern */) !== 0;
+ const id = parseBindingIdentifierOrPattern(parser, context);
+ let init = null;
+ if (consume(parser, context | Context.DisallowEscapedKeyword, 83886109 /* Assign */)) {
+ init = parseExpressionCoverGrammar(parser, context & ~(Context.BlockScope | Context.ForStatement), parseAssignmentExpression);
+ if (isInOrOf(parser.token) && (context & Context.ForStatement || isBindingPattern)) {
+ if (parser.token === 167786289 /* InKeyword */) {
+ // https://github.com/tc39/test262/blob/master/test/annexB/language/statements/for-in/strict-initializer.js
+ if (context & (Context.BlockScope | Context.Strict | Context.Async) || isBindingPattern) {
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ }
+ else
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ // Note: Initializers are required for 'const' and binding patterns
+ }
+ else if (!isInOrOf(parser.token) && (isConst || isBindingPattern)) {
+ tolerant(parser, context, 24 /* DeclarationMissingInitializer */, isConst ? 'const' : 'destructuring');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclarator',
+ init,
+ id,
+ });
+}
+/**
+ * Parses variable declaration list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclarationList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableDeclarationList(parser, context, isConst) {
+ const list = [parseVariableDeclaration(parser, context, isConst)];
+ while (consume(parser, context, 16777234 /* Comma */))
+ list.push(parseVariableDeclaration(parser, context, isConst));
+ if (context & Context.ForStatement && isInOrOf(parser.token) && list.length !== 1) {
+ tolerant(parser, context, 26 /* ForInOfLoopMultiBindings */, tokenDesc(parser.token));
+ }
+ return list;
+} + +// Statements
+/**
+ * Parses statement list items
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementListItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseStatementListItem(parser, context) {
+ switch (parser.token) {
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionDeclaration(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassDeclaration(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetOrExpressionStatement(parser, context | Context.AllowIn);
+ case 33566793 /* ConstKeyword */:
+ return parseVariableStatement(parser, context | Context.BlockScope | Context.AllowIn);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionDeclarationOrStatement(parser, context);
+ case 33566810 /* ImportKeyword */: {
+ if (context & Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod)) {
+ return parseExpressionStatement(parser, context | Context.AllowIn);
+ }
+ }
+ case 12371 /* ExportKeyword */:
+ if (context & Context.Module) {
+ tolerant(parser, context, 34 /* ImportExportDeclAtTopLevel */, tokenDesc(parser.token));
+ }
+ default:
+ return parseStatement(parser, context | Context.AllowSingleStatement);
+ }
+}
+/**
+ * Parses statements
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseStatement(parser, context) {
+ switch (parser.token) {
+ case 33566791 /* VarKeyword */:
+ return parseVariableStatement(parser, context | Context.AllowIn);
+ case 17825809 /* Semicolon */:
+ return parseEmptyStatement(parser, context);
+ case 33566814 /* SwitchKeyword */:
+ return parseSwitchStatement(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseBlockStatement(parser, context);
+ case 12380 /* ReturnKeyword */:
+ return parseReturnStatement(parser, context);
+ case 12377 /* IfKeyword */:
+ return parseIfStatement(parser, context);
+ case 12369 /* DoKeyword */:
+ return parseDoWhileStatement(parser, context);
+ case 12386 /* WhileKeyword */:
+ return parseWhileStatement(parser, context);
+ case 12387 /* WithKeyword */:
+ return parseWithStatement(parser, context);
+ case 12362 /* BreakKeyword */:
+ return parseBreakStatement(parser, context);
+ case 12366 /* ContinueKeyword */:
+ return parseContinueStatement(parser, context);
+ case 12367 /* DebuggerKeyword */:
+ return parseDebuggerStatement(parser, context);
+ case 302002272 /* ThrowKeyword */:
+ return parseThrowStatement(parser, context);
+ case 12385 /* TryKeyword */:
+ return parseTryStatement(parser, context | Context.DisallowEscapedKeyword);
+ case 12374 /* ForKeyword */:
+ return parseForStatement(parser, context | Context.ForStatement);
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ tolerant(parser, context, 35 /* AsyncFunctionInSingleStatementContext */);
+ }
+ return parseExpressionOrLabelledStatement(parser, context | Context.AllowSingleStatement);
+ case 33566808 /* FunctionKeyword */:
+ // V8
+ tolerant(parser, context, context & Context.Strict ? 19 /* StrictFunction */ : 20 /* SloppyFunction */);
+ case 33566797 /* ClassKeyword */:
+ tolerant(parser, context, 21 /* ForbiddenAsStatement */, tokenDesc(parser.token));
+ default:
+ return parseExpressionOrLabelledStatement(parser, context);
+ }
+}
+/**
+ * Parses empty statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-EmptyStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseEmptyStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'EmptyStatement'
+ });
+}
+/**
+ * Parses the continue statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ContinueStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseContinueStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ // Appearing of continue without an IterationStatement leads to syntax error
+ if (!(parser.flags & (Flags.InSwitchStatement | Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, tokenDesc(parser.token));
+ }
+ let label = null;
+ if (!(parser.flags & Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, true);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ContinueStatement',
+ label
+ });
+}
+/**
+ * Parses the break statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BreakStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBreakStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let label = null;
+ if (!(parser.flags & Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, false);
+ }
+ else if (!(parser.flags & (Flags.InSwitchStatement | Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, 'break');
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'BreakStatement',
+ label
+ });
+}
+/**
+ * Parses the if statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-if-statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIfStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const consequent = parseConsequentOrAlternate(parser, context | Context.DisallowEscapedKeyword);
+ const alternate = consume(parser, context, 12370 /* ElseKeyword */) ? parseConsequentOrAlternate(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'IfStatement',
+ test,
+ consequent,
+ alternate
+ });
+}
+/**
+ * Parse either consequent or alternate. Supports AnnexB.
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseConsequentOrAlternate(parser, context) {
+ return context & Context.Strict || parser.token !== 33566808 /* FunctionKeyword */
+ ? parseStatement(parser, context & ~Context.AllowSingleStatement)
+ : parseFunctionDeclaration(parser, context);
+}
+/**
+ * Parses the debugger statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DebuggerStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDebuggerStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'DebuggerStatement'
+ });
+}
+/**
+ * Parses try statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TryStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseTryStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const block = parseBlockStatement(parser, context);
+ const handler = parser.token === 12364 /* CatchKeyword */ ? parseCatchBlock(parser, context) : null;
+ const finalizer = consume(parser, context, 12373 /* FinallyKeyword */) ? parseBlockStatement(parser, context) : null;
+ if (!handler && !finalizer)
+ tolerant(parser, context, 79 /* NoCatchOrFinally */);
+ return finishNode(context, parser, pos, {
+ type: 'TryStatement',
+ block,
+ handler,
+ finalizer
+ });
+}
+/**
+ * Parses catch block
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Catch)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCatchBlock(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let param = null;
+ if (consume(parser, context, 50331659 /* LeftParen */)) {
+ const params = [];
+ param = parseBindingIdentifierOrPattern(parser, context, params);
+ validateParams(parser, context, params);
+ expect(parser, context, 16 /* RightParen */);
+ }
+ const body = parseBlockStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'CatchClause',
+ param,
+ body
+ });
+}
+/**
+ * Parses throw statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ThrowStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseThrowStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 80 /* NewlineAfterThrow */);
+ const argument = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ThrowStatement',
+ argument
+ });
+}
+/**
+ * Parses expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpressionStatement(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+}
+/**
+ * Parse directive node
+ *
+ * * @see [Link](https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDirective(parser, context) {
+ const pos = getLocation(parser);
+ const directive = parser.tokenRaw.slice(1, -1);
+ const expr = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr,
+ directive
+ });
+}
+/**
+ * Parses either expression or labelled statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LabelledStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExpressionOrLabelledStatement(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, token } = parser;
+ const expr = parseExpression(parser, (context & ~(Context.AllowSingleStatement | Context.AllowDecorator)) | Context.AllowIn);
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */) && parser.token === 16777237 /* Colon */) {
+ // If within generator function bodies, we do it like this so we can throw an nice error message
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 57 /* YieldReservedKeyword */);
+ expect(parser, context, 16777237 /* Colon */, 83 /* LabelNoColon */);
+ if (hasLabel(parser, tokenValue))
+ tolerant(parser, context, 29 /* LabelRedeclaration */, tokenValue);
+ addLabel(parser, tokenValue);
+ const body = !(context & Context.Strict) &&
+ context & Context.AllowSingleStatement &&
+ parser.token === 33566808 /* FunctionKeyword */
+ ? parseFunctionDeclaration(parser, context)
+ : parseStatement(parser, context);
+ popLabel(parser, tokenValue);
+ return finishNode(context, parser, pos, {
+ type: 'LabeledStatement',
+ label: expr,
+ body
+ });
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+}
+/**
+ * Parses do while statement
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseDoWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const body = parseIterationStatement(parser, context);
+ expect(parser, context, 12386 /* WhileKeyword */);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ consume(parser, context, 17825809 /* Semicolon */);
+ return finishNode(context, parser, pos, {
+ type: 'DoWhileStatement',
+ body,
+ test
+ });
+}
+/**
+ * Parses while statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-WhileStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'WhileStatement',
+ test,
+ body
+ });
+}
+/**
+ * Parses block statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BlockStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Block)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseBlockStatement(parser, context) {
+ const pos = getLocation(parser);
+ const body = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body
+ });
+}
+/**
+ * Parses return statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ReturnStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseReturnStatement(parser, context) {
+ const pos = getLocation(parser);
+ if (!(context & (Context.OptionsGlobalReturn | Context.InFunctionBody))) {
+ tolerant(parser, context, 18 /* IllegalReturn */);
+ }
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const argument = !(parser.token & 1048576 /* ASI */) && !(parser.flags & Flags.NewLine)
+ ? parseExpression(parser, (context & ~(Context.InFunctionBody | Context.AllowDecorator)) | Context.AllowIn)
+ : null;
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ReturnStatement',
+ argument
+ });
+}
+/**
+ * Sets the necessary mutable parser flags. The parser flags will
+ * be unset after done parsing out the statements.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-IterationStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseIterationStatement(parser, context) {
+ // Note: We are deviating from the original grammar here beauce the original grammar says that the
+ // 'iterationStatement' should return either'for', 'do' or 'while' statements. We are doing some
+ // bitfiddling before and after to modify the parser state before we let the 'parseStatement'
+ // return the mentioned statements (to match the original grammar).
+ const savedFlags = parser.flags;
+ parser.flags |= Flags.InIterationStatement | Flags.AllowDestructuring;
+ const body = parseStatement(parser, (context & ~Context.AllowSingleStatement) | Context.DisallowEscapedKeyword);
+ parser.flags = savedFlags;
+ return body;
+}
+/**
+ * Parses with statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-WithStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseWithStatement(parser, context) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 37 /* StrictModeWith */);
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const object = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseStatement(parser, context & ~Context.AllowSingleStatement);
+ return finishNode(context, parser, pos, {
+ type: 'WithStatement',
+ object,
+ body
+ });
+}
+/**
+ * Parses switch statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SwitchStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseSwitchStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const discriminant = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ expect(parser, context | Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const cases = [];
+ const savedFlags = parser.flags;
+ parser.flags |= Flags.InSwitchStatement;
+ let seenDefault = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ const clause = parseCaseOrDefaultClauses(parser, context);
+ cases.push(clause);
+ if (clause.test === null) {
+ if (seenDefault)
+ tolerant(parser, context, 33 /* MultipleDefaultsInSwitch */);
+ seenDefault = true;
+ }
+ }
+ parser.flags = savedFlags;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'SwitchStatement',
+ discriminant,
+ cases
+ });
+}
+/**
+ * Parses either default clause or case clauses
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CaseClauses)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DefaultClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseCaseOrDefaultClauses(parser, context) {
+ const pos = getLocation(parser);
+ let test = null;
+ if (consume(parser, context, 12363 /* CaseKeyword */)) {
+ test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ }
+ else {
+ expect(parser, context, 12368 /* DefaultKeyword */);
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ const consequent = [];
+ while (!isEndOfCaseOrDefaultClauses(parser)) {
+ consequent.push(parseStatementListItem(parser, context | Context.AllowIn));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SwitchCase',
+ test,
+ consequent
+ });
+}
+/**
+ * Parses variable statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseVariableStatement(parser, context, shouldConsume = true) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const isConst = token === 33566793 /* ConstKeyword */;
+ nextToken(parser, context);
+ const declarations = parseVariableDeclarationList(parser, context, isConst);
+ // Only consume semicolons if not inside the 'ForStatement' production
+ if (shouldConsume)
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclaration',
+ kind: tokenDesc(token),
+ declarations
+ });
+}
+/**
+ * Parses either an lexical declaration (let) or an expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-let-and-const-declarations)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseLetOrExpressionStatement(parser, context, shouldConsume = true) {
+ return lookahead(parser, context, isLexical)
+ ? parseVariableStatement(parser, context | Context.BlockScope, shouldConsume)
+ : parseExpressionOrLabelledStatement(parser, context);
+}
+/**
+ * Parses either async function declaration or statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionDeclarationOrStatement(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)
+ ? parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context)
+ : parseStatement(parser, context);
+}
+/**
+ * Parses either For, ForIn or ForOf statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-statement)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseForStatement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 12374 /* ForKeyword */);
+ const awaitToken = !!(context & Context.Async && consume(parser, context, 34017389 /* AwaitKeyword */));
+ expect(parser, context | Context.DisallowEscapedKeyword, 50331659 /* LeftParen */);
+ const { token } = parser;
+ let init = null;
+ let sequencePos = null;
+ let variableStatement = null;
+ let type = 'ForStatement';
+ let test = null;
+ let update = null;
+ let right;
+ if (token === 33566793 /* ConstKeyword */ || (token === 33574984 /* LetKeyword */ && lookahead(parser, context, isLexical))) {
+ variableStatement = parseVariableStatement(parser, (context & ~Context.AllowIn) | Context.BlockScope, false);
+ }
+ else if (token === 33566791 /* VarKeyword */) {
+ variableStatement = parseVariableStatement(parser, context & ~Context.AllowIn, false);
+ }
+ else if (token !== 17825809 /* Semicolon */) {
+ sequencePos = getLocation(parser);
+ init = restoreExpressionCoverGrammar(parser, (context & ~Context.AllowIn) | Context.DisallowEscapedKeyword, parseAssignmentExpression);
+ }
+ if (consume(parser, context, 69746 /* OfKeyword */)) {
+ type = 'ForOfStatement';
+ if (init) {
+ if (!(parser.flags & Flags.AllowDestructuring) || init.type === 'AssignmentExpression') {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ right = parseAssignmentExpression(parser, context | Context.AllowIn);
+ }
+ else if (consume(parser, context, 167786289 /* InKeyword */)) {
+ if (init) {
+ if (!(parser.flags & Flags.AllowDestructuring))
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ type = 'ForInStatement';
+ right = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ }
+ else {
+ if (parser.token === 16777234 /* Comma */)
+ init = parseSequenceExpression(parser, context, init, sequencePos);
+ if (variableStatement)
+ init = variableStatement;
+ expect(parser, context, 17825809 /* Semicolon */);
+ test = parser.token !== 17825809 /* Semicolon */
+ ? parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn)
+ : null;
+ expect(parser, context, 17825809 /* Semicolon */);
+ update = parser.token !== 16 /* RightParen */
+ ? parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn)
+ : null;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, type === 'ForOfStatement'
+ ? {
+ type,
+ body,
+ left: init,
+ right,
+ await: awaitToken
+ }
+ : right
+ ? {
+ type: type,
+ body,
+ left: init,
+ right
+ }
+ : {
+ type: type,
+ body,
+ init,
+ test,
+ update
+ });
+} + +// 15.2 Modules
+/**
+ * Parse module item list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItemList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleItemList(parser, context) {
+ // Prime the scanner
+ nextToken(parser, context);
+ const statements = [];
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ statements.push(parser.token === 33554435 /* StringLiteral */ ?
+ parseDirective(parser, context) :
+ parseModuleItem(parser, context | Context.AllowIn));
+ }
+ return statements;
+}
+/**
+ * Parse module item
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleItem(parser, context) {
+ switch (parser.token) {
+ // @decorator
+ case 120 /* At */:
+ return parseDecorators(parser, context);
+ // ExportDeclaration
+ case 12371 /* ExportKeyword */:
+ return parseExportDeclaration(parser, context);
+ // ImportDeclaration
+ case 33566810 /* ImportKeyword */:
+ // 'Dynamic Import' or meta property disallowed here
+ if (!(context & Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod))) {
+ return parseImportDeclaration(parser, context);
+ }
+ // falls through
+ default:
+ return parseStatementListItem(parser, context);
+ }
+}
+/**
+ * Parse export declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ const specifiers = [];
+ let source = null;
+ let declaration = null;
+ expect(parser, context | Context.DisallowEscapedKeyword, 12371 /* ExportKeyword */);
+ switch (parser.token) {
+ // export * FromClause ;
+ case 167774771 /* Multiply */:
+ return parseExportAllDeclaration(parser, context, pos);
+ case 12368 /* DefaultKeyword */:
+ return parseExportDefault(parser, context, pos);
+ case 41943052 /* LeftBrace */:
+ {
+ // export ExportClause FromClause ;
+ // export ExportClause ;
+ expect(parser, context, 41943052 /* LeftBrace */);
+ let hasReservedWord = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token !== 69743 /* GetKeyword */ && parser.token & 12288 /* Reserved */) {
+ hasReservedWord = true;
+ setPendingError(parser);
+ }
+ specifiers.push(parseNamedExportDeclaration(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context | Context.DisallowEscapedKeyword, 17825807 /* RightBrace */);
+ if (parser.token === 69745 /* FromKeyword */) {
+ source = parseModuleSpecifier(parser, context);
+ // The left hand side can't be a keyword where there is no
+ // 'from' keyword since it references a local binding.
+ }
+ else if (hasReservedWord)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ consumeSemicolon(parser, context);
+ break;
+ }
+ // export ClassDeclaration
+ case 33566797 /* ClassKeyword */:
+ declaration = (parseClassDeclaration(parser, context));
+ break;
+ // export LexicalDeclaration
+ case 33574984 /* LetKeyword */:
+ case 33566793 /* ConstKeyword */:
+ declaration = parseVariableStatement(parser, context | Context.BlockScope);
+ break;
+ // export VariableDeclaration
+ case 33566791 /* VarKeyword */:
+ declaration = parseVariableStatement(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ declaration = parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context);
+ break;
+ }
+ // Falls through
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportNamedDeclaration',
+ source,
+ specifiers,
+ declaration,
+ });
+}
+/**
+ * Parse export all declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseExportAllDeclaration(parser, context, pos) {
+ expect(parser, context, 167774771 /* Multiply */);
+ const source = parseModuleSpecifier(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExportAllDeclaration',
+ source,
+ });
+}
+/**
+ * Parse named export declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNamedExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ // ExportSpecifier :
+ // IdentifierName
+ // IdentifierName as IdentifierName
+ const local = parseIdentifierName(parser, context | Context.DisallowEscapedKeyword, parser.token);
+ const exported = consume(parser, context, 167843947 /* AsKeyword */)
+ ? parseIdentifierName(parser, context, parser.token)
+ : local;
+ return finishNode(context, parser, pos, {
+ type: 'ExportSpecifier',
+ local,
+ exported,
+ });
+}
+/**
+ * Parse export default
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+function parseExportDefault(parser, context, pos) {
+ expect(parser, context | Context.DisallowEscapedKeyword, 12368 /* DefaultKeyword */);
+ let declaration;
+ switch (parser.token) {
+ // export default HoistableDeclaration[Default]
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context | Context.RequireIdentifier);
+ break;
+ // export default ClassDeclaration[Default]
+ // export default @decl ClassDeclaration[Default]
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ declaration = parseClassDeclaration(parser, context & ~Context.AllowIn | Context.RequireIdentifier);
+ break;
+ // export default HoistableDeclaration[Default]
+ case 594028 /* AsyncKeyword */:
+ declaration = parseAsyncFunctionOrAssignmentExpression(parser, context | Context.RequireIdentifier);
+ break;
+ default:
+ // export default [lookahead ∉ {function, class}] AssignmentExpression[In] ;
+ declaration = parseAssignmentExpression(parser, context | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportDefaultDeclaration',
+ declaration,
+ });
+}
+/**
+ * Parse import declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566810 /* ImportKeyword */);
+ let source;
+ let specifiers = [];
+ // 'import' ModuleSpecifier ';'
+ if (parser.token === 33554435 /* StringLiteral */) {
+ source = parseLiteral(parser, context);
+ }
+ else {
+ specifiers = parseImportClause(parser, context | Context.DisallowEscapedKeyword);
+ source = parseModuleSpecifier(parser, context);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ImportDeclaration',
+ specifiers,
+ source,
+ });
+}
+/**
+ * Parse import clause
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportClause(parser, context) {
+ const specifiers = [];
+ switch (parser.token) {
+ // 'import' ModuleSpecifier ';'
+ case 33685505 /* Identifier */:
+ {
+ specifiers.push(parseImportDefaultSpecifier(parser, context));
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ switch (parser.token) {
+ // import a, * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ // import a, {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ default:
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ break;
+ }
+ // import {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ // import * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return specifiers;
+}
+/**
+ * Parse named imports
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NamedImports)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNamedImports(parser, context, specifiers) {
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ specifiers.push(parseImportSpecifier(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+}
+/**
+ * Parse import specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportSpecifier(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const imported = parseIdentifierName(parser, context | Context.DisallowEscapedKeyword, token);
+ let local;
+ if (consume(parser, context, 167843947 /* AsKeyword */)) {
+ local = parseBindingIdentifier(parser, context);
+ }
+ else {
+ // An import name that is a keyword is a syntax error if it is not followed
+ // by the keyword 'as'.
+ if (hasBit(token, 12288 /* Reserved */))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ if (hasBit(token, 4194304 /* IsEvalOrArguments */))
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ local = imported;
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ImportSpecifier',
+ local,
+ imported,
+ });
+}
+/**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NameSpaceImport)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseNameSpaceImport(parser, context, specifiers) {
+ // NameSpaceImport:
+ // * as ImportedBinding
+ const pos = getLocation(parser);
+ expect(parser, context, 167774771 /* Multiply */);
+ expect(parser, context, 167843947 /* AsKeyword */, 82 /* AsAfterImportStart */);
+ const local = parseBindingIdentifier(parser, context);
+ specifiers.push(finishNode(context, parser, pos, {
+ type: 'ImportNamespaceSpecifier',
+ local,
+ }));
+}
+/**
+ * Parse module specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseModuleSpecifier(parser, context) {
+ // ModuleSpecifier :
+ // StringLiteral
+ expect(parser, context, 69745 /* FromKeyword */);
+ if (parser.token !== 33554435 /* StringLiteral */)
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseLiteral(parser, context);
+}
+/**
+ * Parse import default specifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseImportDefaultSpecifier(parser, context) {
+ return finishNode(context, parser, getLocation(parser), {
+ type: 'ImportDefaultSpecifier',
+ local: parseIdentifier(parser, context),
+ });
+}
+/**
+ * Parses either async function or assignment expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+function parseAsyncFunctionOrAssignmentExpression(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context | Context.RequireIdentifier) :
+ parseAssignmentExpression(parser, context | Context.AllowIn);
+} + +/**
+ * Creates the parser object
+ *
+ * @param source The source coode to parser
+ * @param sourceFile Optional source file info to be attached in every node
+ */
+function createParser(source, sourceFile) {
+ return {
+ // The source code to parse
+ source,
+ // Source length
+ length: source.length,
+ // Current position
+ index: 0,
+ // Current line
+ line: 1,
+ // Current column
+ column: 0,
+ // Start position before current token
+ startIndex: 0,
+ // Start position column before current token
+ startColumn: 0,
+ // Start position line before current token
+ startLine: 1,
+ // End position after parsing after current token
+ lastIndex: 0,
+ // End column position after current token
+ lastColumn: 0,
+ // End line position after current token
+ lastLine: 0,
+ // Pending cover grammar errors
+ pendingExpressionError: undefined,
+ // Mutable parser flags. Allows destructuring by default.
+ flags: Flags.AllowDestructuring,
+ // The tokens
+ token: 1048576 /* EndOfSource */,
+ // Misc
+ tokenRaw: '',
+ lastValue: 0,
+ comments: [],
+ sourceFile,
+ tokenRegExp: undefined,
+ tokenValue: undefined,
+ labelSet: undefined,
+ errorLocation: undefined,
+ errors: [],
+ };
+}
+/**
+ * Creating the parser
+ *
+ * @param source The source coode to parser
+ * @param options The parser options
+ * @param context Context masks
+ */
+function parseSource(source, options, /*@internal*/ context) {
+ let sourceFile = '';
+ if (!!options) {
+ // The flag to enable module syntax support
+ if (options.module)
+ context |= Context.Module;
+ // The flag to enable stage 3 support (ESNext)
+ if (options.next)
+ context |= Context.OptionsNext;
+ // The flag to enable React JSX parsing
+ if (options.jsx)
+ context |= Context.OptionsJSX;
+ // The flag to enable start and end offsets to each node
+ if (options.ranges)
+ context |= Context.OptionsRanges;
+ // The flag to enable line/column location information to each node
+ if (options.loc)
+ context |= Context.OptionsLoc;
+ // The flag to attach raw property to each literal node
+ if (options.raw)
+ context |= Context.OptionsRaw;
+ // Attach raw property to each identifier node
+ if (options.rawIdentifier)
+ context |= Context.OptionsRawidentifiers;
+ // The flag to allow return in the global scope
+ if (options.globalReturn)
+ context |= Context.OptionsGlobalReturn;
+ // The flag to allow to skip shebang - '#'
+ if (options.skipShebang)
+ context |= Context.OptionsShebang;
+ // Enable tolerant mode
+ if (options.tolerant)
+ context |= Context.OptionsTolerant;
+ // Set to true to record the source file in every node's loc object when the loc option is set.
+ if (!!options.source)
+ sourceFile = options.source;
+ // Create a top-level comments array containing all comments
+ if (!!options.comments)
+ context |= Context.OptionsComments;
+ // The flag to enable implied strict mode
+ if (options.impliedStrict)
+ context |= Context.Strict;
+ // The flag to enable experimental features
+ if (options.experimental)
+ context |= Context.OptionsExperimental;
+ // The flag to set to bypass methods in Node
+ if (options.node)
+ context |= Context.OptionsNode;
+ // Accepts a callback function to be invoked for each syntax node (as the node is constructed)
+ }
+ const parser = createParser(source, sourceFile);
+ const body = context & Context.Module ?
+ parseModuleItemList(parser, context) :
+ parseStatementList(parser, context);
+ const node = {
+ type: 'Program',
+ sourceType: context & Context.Module ? 'module' : 'script',
+ body: body,
+ };
+ if (context & Context.LocationTracker) {
+ if (context & Context.OptionsRanges) {
+ node.start = 0;
+ node.end = source.length;
+ }
+ if (context & Context.OptionsLoc) {
+ node.loc = {
+ start: { line: 1, column: 0 },
+ end: { line: parser.line, column: parser.column
+ }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ if (context & Context.OptionsComments)
+ node.comments = parser.comments;
+ if (context & Context.OptionsTolerant)
+ node.errors = parser.errors;
+ return node;
+}
+/**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+function parseStatementList(parser, context) {
+ const statements = [];
+ let hasProlog = true; // Parsing directive prologue.
+ // prime the scanner
+ nextToken(parser, context | Context.DisallowEscapedKeyword);
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ if (hasProlog && parser.token !== 33554435 /* StringLiteral */)
+ hasProlog = false;
+ if (hasProlog) {
+ if (!(context & Context.Strict) && parser.tokenRaw.length === 12 && parser.tokenValue === 'use strict') {
+ context |= Context.Strict;
+ }
+ statements.push(parseDirective(parser, context));
+ }
+ else {
+ statements.push(parseStatementListItem(parser, context));
+ }
+ }
+ return statements;
+}
+/**
+ * Parse either script code or module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parse(source, options) {
+ return options && options.module
+ ? parseModule(source, options)
+ : parseScript(source, options);
+}
+/**
+ * Parse script code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parseScript(source, options) {
+ return parseSource(source, options, Context.Empty);
+}
+/**
+ * Parse module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+function parseModule(source, options) {
+ return parseSource(source, options, Context.Strict | Context.Module);
+} + + + +var estree = /*#__PURE__*/Object.freeze({ + +}); + + + +var index = /*#__PURE__*/Object.freeze({ + scanIdentifier: scanIdentifier, + scanMaybeIdentifier: scanMaybeIdentifier, + scanHexIntegerLiteral: scanHexIntegerLiteral, + scanOctalOrBinary: scanOctalOrBinary, + scanImplicitOctalDigits: scanImplicitOctalDigits, + scanSignedInteger: scanSignedInteger, + scanNumericLiteral: scanNumericLiteral, + scanNumericSeparator: scanNumericSeparator, + scanDecimalDigitsOrSeparator: scanDecimalDigitsOrSeparator, + scanDecimalAsSmi: scanDecimalAsSmi, + scanRegularExpression: scanRegularExpression, + scan: scan, + scanEscapeSequence: scanEscapeSequence, + throwStringError: throwStringError, + scanString: scanString, + consumeTemplateBrace: consumeTemplateBrace, + scanTemplate: scanTemplate, + skipSingleHTMLComment: skipSingleHTMLComment, + skipSingleLineComment: skipSingleLineComment, + skipMultiLineComment: skipMultiLineComment, + addComment: addComment, + nextUnicodeChar: nextUnicodeChar, + isIdentifierPart: isIdentifierPart, + escapeInvalidCharacters: escapeInvalidCharacters, + consumeOpt: consumeOpt, + consumeLineFeed: consumeLineFeed, + scanPrivateName: scanPrivateName, + advanceNewline: advanceNewline, + fromCodePoint: fromCodePoint, + readNext: readNext, + toHex: toHex, + advanceOnMaybeAstral: advanceOnMaybeAstral +}); + + + +var parser = /*#__PURE__*/Object.freeze({ + parseClassDeclaration: parseClassDeclaration, + parseFunctionDeclaration: parseFunctionDeclaration, + parseAsyncFunctionOrAsyncGeneratorDeclaration: parseAsyncFunctionOrAsyncGeneratorDeclaration, + parseVariableDeclarationList: parseVariableDeclarationList, + parseExpression: parseExpression, + parseSequenceExpression: parseSequenceExpression, + parseAssignmentExpression: parseAssignmentExpression, + parseRestElement: parseRestElement, + parseLeftHandSideExpression: parseLeftHandSideExpression, + parsePrimaryExpression: parsePrimaryExpression, + parseIdentifier: parseIdentifier, + parseLiteral: parseLiteral, + parseBigIntLiteral: parseBigIntLiteral, + parseIdentifierName: parseIdentifierName, + parseFunctionExpression: parseFunctionExpression, + parseAsyncFunctionOrAsyncGeneratorExpression: parseAsyncFunctionOrAsyncGeneratorExpression, + parsePropertyName: parsePropertyName, + parseObjectLiteral: parseObjectLiteral, + parseFormalListAndBody: parseFormalListAndBody, + parseFunctionBody: parseFunctionBody, + parseFormalParameters: parseFormalParameters, + parseFormalParameterList: parseFormalParameterList, + parseClassBodyAndElementList: parseClassBodyAndElementList, + parseClassElement: parseClassElement, + parseDecorators: parseDecorators, + parseModuleItemList: parseModuleItemList, + parseModuleItem: parseModuleItem, + parseExportDeclaration: parseExportDeclaration, + parseImportDeclaration: parseImportDeclaration, + createParser: createParser, + parseSource: parseSource, + parseStatementList: parseStatementList, + parse: parse, + parseScript: parseScript, + parseModule: parseModule, + parseBindingIdentifierOrPattern: parseBindingIdentifierOrPattern, + parseBindingIdentifier: parseBindingIdentifier, + parseAssignmentRestElement: parseAssignmentRestElement, + parseAssignmentPattern: parseAssignmentPattern, + parseBindingInitializer: parseBindingInitializer, + parseStatementListItem: parseStatementListItem, + parseStatement: parseStatement, + parseEmptyStatement: parseEmptyStatement, + parseContinueStatement: parseContinueStatement, + parseBreakStatement: parseBreakStatement, + parseIfStatement: parseIfStatement, + parseDebuggerStatement: parseDebuggerStatement, + parseTryStatement: parseTryStatement, + parseCatchBlock: parseCatchBlock, + parseThrowStatement: parseThrowStatement, + parseExpressionStatement: parseExpressionStatement, + parseDirective: parseDirective, + parseExpressionOrLabelledStatement: parseExpressionOrLabelledStatement, + parseDoWhileStatement: parseDoWhileStatement, + parseWhileStatement: parseWhileStatement, + parseBlockStatement: parseBlockStatement, + parseReturnStatement: parseReturnStatement, + parseIterationStatement: parseIterationStatement, + parseWithStatement: parseWithStatement, + parseSwitchStatement: parseSwitchStatement, + parseCaseOrDefaultClauses: parseCaseOrDefaultClauses, + parseVariableStatement: parseVariableStatement, + parseJSXRootElement: parseJSXRootElement, + parseJSXOpeningElement: parseJSXOpeningElement, + nextJSXToken: nextJSXToken, + scanJSXToken: scanJSXToken, + parseJSXText: parseJSXText, + parseJSXAttributes: parseJSXAttributes, + parseJSXSpreadAttribute: parseJSXSpreadAttribute, + parseJSXNamespacedName: parseJSXNamespacedName, + parseJSXAttributeName: parseJSXAttributeName, + parseJSXAttribute: parseJSXAttribute, + parseJSXEmptyExpression: parseJSXEmptyExpression, + parseJSXSpreadChild: parseJSXSpreadChild, + parseJSXExpressionContainer: parseJSXExpressionContainer, + parseJSXExpression: parseJSXExpression, + parseJSXClosingFragment: parseJSXClosingFragment, + parseJSXClosingElement: parseJSXClosingElement, + parseJSXIdentifier: parseJSXIdentifier, + parseJSXMemberExpression: parseJSXMemberExpression, + parseJSXElementName: parseJSXElementName, + scanJSXIdentifier: scanJSXIdentifier +}); + +// tslint:disable-next-line:variable-name
+const Parser = parser; + +const version = '1.6.9'; + +export { version, estree as ESTree, index as Scanner, parse, parseSource, parseModule, parseScript, characterType, errorMessages, constructError, report, tolerant, tokenDesc, descKeyword, Parser, isValidIdentifierPart, isValidIdentifierStart, mustEscape, Context, Flags, Labels, NumericState, ScannerState, ModifierState, CoverParenthesizedState, Escape, RegexFlags, CoverCallState, RegexState, ObjectState, validateBreakOrContinueLabel, addLabel, popLabel, hasLabel, finishNode, expect, consume, nextToken, hasBit, consumeSemicolon, parseExpressionCoverGrammar, restoreExpressionCoverGrammar, swapContext, validateParams, reinterpret, lookahead, isValidSimpleAssignmentTarget, getLocation, isValidIdentifier, isLexical, isEndOfCaseOrDefaultClauses, nextTokenIsLeftParenOrPeriod, nextTokenisIdentifierOrParen, nextTokenIsLeftParen, nextTokenIsFuncKeywordOnSameLine, isPropertyWithPrivateFieldKey, parseAndClassifyIdentifier, nameIsArgumentsOrEval, setPendingError, isEqualTagNames, isInstanceField, validateUpdateExpression, setPendingExpressionError, validateCoverParenthesizedExpression, validateAsyncArgumentList, isInOrOf }; diff --git a/node_modules/cherow/dist/native-modules/cherow.min.js b/node_modules/cherow/dist/native-modules/cherow.min.js new file mode 100644 index 0000000..2cb3f74 --- /dev/null +++ b/node_modules/cherow/dist/native-modules/cherow.min.js @@ -0,0 +1 @@ +const keywordDescTable=["end of source","identifier","number","string","regular expression","false","true","null","template continuation","template end","=>","(","{",".","...","}",")",";",",","[","]",":","?","'",'"',"</","/>","++","--","=","<<=",">>=",">>>=","**=","+=","-=","*=","/=","%=","^=","|=","&=","typeof","delete","void","!","~","+","-","in","instanceof","*","%","/","**","&&","||","===","!==","==","!=","<=",">=","<",">","<<",">>",">>>","&","|","^","var","let","const","break","case","catch","class","continue","debugger","default","do","else","export","extends","finally","for","function","if","import","new","return","super","switch","this","throw","try","while","with","implements","interface","package","private","protected","public","static","yield","as","async","await","constructor","get","set","from","of","#","eval","arguments","enum","BigInt","@","JSXText","KeyOf","ReadOnly","is","unique","declare","type","namespace","abstract","module","global","require","target"];function tokenDesc(e){return keywordDescTable[255&e]}const descKeywordTable=Object.create(null,{this:{value:33566815},function:{value:33566808},if:{value:12377},return:{value:12380},var:{value:33566791},else:{value:12370},for:{value:12374},new:{value:33566811},in:{value:167786289},typeof:{value:302002218},while:{value:12386},case:{value:12363},break:{value:12362},try:{value:12385},catch:{value:12364},delete:{value:302002219},throw:{value:302002272},switch:{value:33566814},continue:{value:12366},default:{value:12368},instanceof:{value:167786290},do:{value:12369},void:{value:302002220},finally:{value:12373},arguments:{value:37879925},keyof:{value:131194},readonly:{value:131195},unique:{value:131197},declare:{value:131198},async:{value:594028},await:{value:34017389},class:{value:33566797},const:{value:33566793},constructor:{value:69742},debugger:{value:12367},enum:{value:12406},eval:{value:37879924},export:{value:12371},extends:{value:12372},false:{value:33566725},from:{value:69745},get:{value:69743},implements:{value:20579},import:{value:33566810},interface:{value:20580},let:{value:33574984},null:{value:33566727},of:{value:69746},package:{value:20581},private:{value:20582},protected:{value:20583},public:{value:20584},set:{value:69744},static:{value:20585},super:{value:33566813},true:{value:33566726},with:{value:12387},yield:{value:1107316842},is:{value:131196},type:{value:131199},namespace:{value:131200},abstract:{value:131201},as:{value:167843947},module:{value:131202},global:{value:131203},require:{value:131204},target:{value:131205}});function descKeyword(e){return 0|descKeywordTable[e]}const characterType=[0,0,0,0,0,0,0,0,0,16,48,16,16,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0];function isValidIdentifierPart(e){return 0!=(1&convert[0+(e>>>5)]>>>e)}function isValidIdentifierStart(e){return 0!=(1&convert[34816+(e>>>5)]>>>e)}function mustEscape(e){return 0!=(1&convert[69632+(e>>>5)]>>>e)}const convert=((e,t)=>{const n=new Uint32Array(104448);let r=0,a=0;for(;r<3392;){const o=e[r++];if(o<0)a-=o;else{let s=e[r++];2&o&&(s=t[s]),1&o?n.fill(s,a,a+=e[r++]):n[a++]=s}}return n})([-1,2,28,2,29,2,5,-1,0,77595648,3,46,2,3,0,14,2,57,2,58,3,0,3,0,3168796671,0,4294956992,2,1,2,0,2,59,3,0,4,0,4294966523,3,0,4,2,15,2,60,2,0,0,4294836735,0,3221225471,0,4294901942,2,61,0,134152192,3,0,2,0,4294951935,3,0,2,0,2683305983,0,2684354047,2,17,2,0,0,4294961151,3,0,2,2,20,2,0,0,608174079,2,0,2,127,2,6,2,62,-1,2,64,2,26,2,1,3,0,3,0,4294901711,2,40,0,4089839103,0,2961209759,0,1342439375,0,4294543342,0,3547201023,0,1577204103,0,4194240,0,4294688750,2,2,0,80831,0,4261478351,0,4294549486,2,2,0,2965387679,0,196559,0,3594373100,0,3288319768,0,8469959,2,171,0,4294828031,0,3825204735,0,123747807,0,65487,2,3,0,4092591615,0,1080049119,0,458703,2,3,2,0,0,2163244511,0,4227923919,0,4236247020,2,68,0,4284449919,0,851904,2,4,2,16,0,67076095,-1,2,69,0,1006628014,0,4093591391,-1,0,50331649,0,3265266687,2,34,0,4294844415,0,4278190047,2,23,2,125,-1,3,0,2,2,33,2,0,2,9,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,10,0,261632,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,2088959,2,31,2,8,0,909311,3,0,2,0,814743551,2,42,0,67057664,3,0,2,2,45,2,0,2,32,2,0,2,18,2,7,0,268374015,2,30,2,51,2,0,2,78,0,134153215,-1,2,6,2,0,2,7,0,2684354559,0,67044351,0,1073676416,-2,3,0,2,2,43,0,1046528,3,0,3,2,8,2,0,2,41,0,4294960127,2,9,2,39,2,10,0,4294377472,2,21,3,0,7,0,4227858431,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-1,2,122,0,1048577,2,84,2,12,-1,2,12,0,131042,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,1046559,2,0,2,13,2,0,0,2147516671,2,24,3,88,2,2,0,-16,2,89,0,524222462,2,4,2,0,0,4269801471,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,2,119,2,0,0,3220242431,3,0,3,2,20,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,2,0,2,27,2,0,2,8,3,0,2,0,67043391,0,3909091327,2,0,2,25,2,8,2,23,3,0,2,0,67076097,2,7,2,0,2,24,0,67059711,0,4236247039,3,0,2,0,939524103,0,8191999,2,97,2,98,2,14,2,95,3,0,3,0,67057663,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,3774349439,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,2,19,0,1638399,2,169,2,104,3,0,3,2,23,2,28,2,29,2,5,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-3,2,146,-4,2,23,2,0,2,37,0,1,2,0,2,63,2,32,2,16,2,9,2,0,2,109,-1,3,0,4,2,9,2,33,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277137519,0,2269118463,-1,3,23,2,-1,2,34,2,38,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,48,-14,2,23,2,44,2,37,-5,3,0,2,2,38,0,2147549120,2,0,2,16,2,17,2,130,2,0,2,52,0,4294901872,0,5242879,3,0,2,0,402595359,-1,2,118,0,1090519039,-2,2,120,2,39,2,0,2,55,2,40,0,4226678271,0,3766565279,0,2039759,-4,3,0,2,0,1140787199,-1,3,0,2,0,67043519,-5,2,0,0,4282384383,0,1056964609,-1,3,0,2,0,67043345,-1,2,0,2,41,2,42,-1,2,10,2,43,-6,2,0,2,16,-3,3,0,2,0,2147484671,-8,2,0,2,7,2,44,2,0,0,603979727,-1,2,0,2,45,-8,2,54,2,46,0,67043329,2,123,2,47,0,8388351,-2,2,124,0,3028287487,2,48,2,126,0,33259519,2,42,-9,2,24,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,2,42,-2,2,17,2,51,2,0,2,24,0,67043343,2,128,2,19,-21,3,0,2,-4,3,0,2,0,4294901791,2,7,2,164,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,0,1677656575,-166,0,4161266656,0,4071,0,15360,-4,0,28,-13,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,0,4294954999,2,0,-16,2,0,2,90,2,0,0,2105343,0,4160749584,0,65534,-42,0,4194303871,0,2011,-62,3,0,6,0,8323103,-1,3,0,2,2,55,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-22583,3,0,7,2,19,-6130,3,5,2,-1,0,69207040,3,46,2,3,0,14,2,57,2,58,-3,0,3168731136,0,4294956864,2,1,2,0,2,59,3,0,4,0,4294966275,3,0,4,2,15,2,60,2,0,2,35,-1,2,17,2,61,-1,2,0,2,62,0,4294885376,3,0,2,0,3145727,0,2617294944,0,4294770688,2,19,2,63,3,0,2,0,131135,2,94,0,70256639,0,71303167,0,272,2,45,2,62,-1,2,64,-2,2,96,0,603979775,0,4278255616,0,4294836227,0,4294549473,0,600178175,0,2952806400,0,268632067,0,4294543328,0,57540095,0,1577058304,0,1835008,0,4294688736,2,65,2,66,0,33554435,2,121,2,65,2,147,0,131075,0,3594373096,0,67094296,2,66,-1,2,67,0,603979263,2,156,0,3,0,4294828001,0,602930687,2,180,0,393219,2,67,0,671088639,0,2154840064,0,4227858435,0,4236247008,2,68,2,38,-1,2,4,0,917503,2,38,-1,2,69,0,537783470,0,4026531935,-1,0,1,-1,2,34,2,70,0,7936,-3,2,0,0,2147485695,0,1010761728,0,4292984930,0,16387,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,16,-1,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,253951,3,20,2,0,122879,2,0,2,8,0,276824064,-2,3,0,2,2,45,2,0,0,4294903295,2,0,2,18,2,7,-1,2,17,2,51,2,0,2,78,2,42,-1,2,24,2,0,2,31,-2,0,128,-2,2,79,2,8,0,4064,-1,2,117,0,4227907585,2,0,2,116,2,0,2,50,2,196,2,9,2,39,2,10,-1,0,6544896,3,0,6,-2,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-3,2,84,2,12,-3,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,817183,2,0,2,13,2,0,0,33023,2,24,3,88,2,-17,2,89,0,524157950,2,4,2,0,2,90,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,0,3072,2,0,0,2147516415,2,9,3,0,2,2,19,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,0,4294965179,0,7,2,0,2,8,2,92,2,8,-1,0,1761345536,2,94,2,95,2,38,2,23,2,96,2,36,2,162,0,2080440287,2,0,2,35,2,138,0,3296722943,2,0,0,1046675455,0,939524101,0,1837055,2,97,2,98,2,14,2,95,3,0,3,0,7,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,2700607615,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,-3,2,104,3,0,3,2,23,-1,3,5,2,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-8,2,23,2,0,2,37,-1,2,0,2,63,2,32,2,18,2,9,2,0,2,109,-1,3,0,4,2,9,2,17,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277075969,2,18,-1,3,23,2,-1,2,34,2,139,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,50,-14,2,23,2,44,2,116,-5,2,117,2,41,-2,2,117,2,19,2,17,2,35,2,117,2,38,0,4294901776,0,4718591,2,117,2,36,0,335544350,-1,2,118,2,119,-2,2,120,2,39,2,7,-1,2,121,2,65,0,3758161920,0,3,-4,2,0,2,31,2,174,-1,2,0,2,19,0,176,-5,2,0,2,49,2,182,-1,2,0,2,19,2,194,-1,2,0,2,62,-2,2,16,-7,2,0,2,119,-3,3,0,2,2,122,-8,0,4294965249,0,67633151,0,4026597376,2,0,0,536871887,-1,2,0,2,45,-8,2,54,2,49,0,1,2,123,2,19,-3,2,124,2,37,2,125,2,126,0,16778239,-10,2,36,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,-3,2,17,2,127,2,0,2,19,2,50,2,128,2,19,-21,3,0,2,-4,3,0,2,0,65567,-1,2,26,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,2,130,-187,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,2,138,-129,3,0,6,2,139,-1,3,0,2,2,50,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-28719,2,0,0,1,-1,2,122,2,0,0,8193,-21,0,50331648,0,10255,0,4,-11,2,66,2,168,-1,0,71680,-1,2,157,0,4292900864,0,805306431,-5,2,146,-1,2,176,-1,0,6144,-2,2,123,-1,2,150,-1,2,153,2,147,2,161,2,0,0,3223322624,2,36,0,4,-4,2,188,0,205128192,0,1333757536,0,2147483696,0,423953,0,747766272,0,2717763192,0,4286578751,0,278545,2,148,0,4294886464,0,33292336,0,417809,2,148,0,1329579616,0,4278190128,0,700594195,0,1006647527,0,4286497336,0,4160749631,2,149,0,469762560,0,4171219488,0,16711728,2,149,0,202375680,0,3214918176,0,4294508592,0,139280,-1,0,983584,2,190,0,58720275,0,3489923072,0,10517376,0,4293066815,0,1,0,2013265920,2,175,2,0,0,17816169,0,3288339281,0,201375904,2,0,-2,0,256,0,122880,0,16777216,2,146,0,4160757760,2,0,-6,2,163,-11,0,3263218176,-1,0,49664,0,2160197632,0,8388802,-1,0,12713984,-1,2,150,2,155,2,158,-2,2,159,-20,0,3758096385,-2,2,151,0,4292878336,2,22,2,166,0,4294057984,-2,2,160,2,152,2,172,-2,2,151,-1,2,179,-1,2,167,2,122,0,4026593280,0,14,0,4292919296,-1,2,154,0,939588608,-1,0,805306368,-1,2,122,0,1610612736,2,152,2,153,3,0,2,-2,2,154,2,155,-3,0,267386880,-1,2,156,0,7168,-1,0,65024,2,150,2,157,2,158,-7,2,165,-8,2,159,-1,0,1426112704,2,160,-1,2,185,0,271581216,0,2149777408,2,19,2,157,2,122,0,851967,0,3758129152,-1,2,19,2,178,-4,2,154,-20,2,192,2,161,-56,0,3145728,2,184,-1,2,191,2,122,-1,2,162,2,122,-4,0,32505856,-1,2,163,-1,0,2147385088,2,22,1,2155905152,2,-3,2,164,2,0,2,165,-2,2,166,-6,2,167,0,4026597375,0,1,-1,0,1,-1,2,168,-3,2,139,2,66,-2,2,162,2,177,-1,2,173,2,122,-6,2,122,-213,2,167,-657,2,17,-36,2,169,-1,2,186,-10,0,4294963200,-5,2,170,-5,2,158,2,0,2,24,-1,0,4227919872,-1,2,170,-2,0,4227874752,-3,0,2146435072,2,155,-2,0,1006649344,2,122,-1,2,22,0,201375744,-3,0,134217720,2,22,0,4286677377,0,32896,-1,2,171,-3,2,172,-349,2,173,2,174,2,175,3,0,264,-11,2,176,-2,2,158,2,0,0,520617856,0,2692743168,0,36,-3,0,524284,-11,2,19,-1,2,183,-1,2,181,0,3221291007,2,158,-1,0,524288,0,2158720,-3,2,155,0,1,-4,2,122,0,3808625411,0,3489628288,0,4096,0,1207959680,0,3221274624,2,0,-3,2,177,0,120,0,7340032,-2,0,4026564608,2,4,2,19,2,160,3,0,4,2,155,-1,2,178,2,175,-1,0,8176,2,179,2,177,2,180,-1,0,4290773232,2,0,-4,2,160,2,187,0,15728640,2,175,-1,2,157,-1,0,4294934512,3,0,4,-9,2,22,2,167,2,181,3,0,4,0,704,0,1849688064,0,4194304,-1,2,122,0,4294901887,2,0,0,130547712,0,1879048192,0,2080374784,3,0,2,-1,2,182,2,183,-1,0,17829776,0,2025848832,0,4261477888,-2,2,0,-1,0,4286580608,-1,0,29360128,2,184,0,16252928,0,3791388672,2,39,3,0,2,-2,2,193,2,0,-1,2,26,-1,0,66584576,-1,2,189,3,0,9,2,122,3,0,4,-1,2,157,2,158,3,0,5,-2,0,245760,0,2147418112,-1,2,146,2,199,0,4227923456,-1,2,185,2,186,2,22,-2,2,176,0,4292870145,0,262144,2,122,3,0,2,0,1073758848,2,187,-1,0,4227921920,2,188,0,68289024,0,528402016,0,4292927536,3,0,4,-2,0,2483027968,2,0,-2,2,189,3,0,5,-1,2,184,2,160,2,0,-2,0,4227923936,2,63,-1,2,170,2,94,2,0,2,150,2,154,3,0,6,-1,2,175,3,0,3,-2,0,2146959360,3,0,8,-2,2,157,-1,2,190,2,117,-1,2,151,3,0,8,2,191,0,8388608,2,171,2,169,2,183,0,4286578944,3,0,2,0,1152,0,1266679808,2,189,0,576,0,4261707776,2,94,3,0,9,2,151,3,0,8,-28,2,158,3,0,3,-3,0,4292902912,-6,2,96,3,0,85,-33,2,164,3,0,126,-18,2,192,3,0,269,-17,2,151,2,122,0,4294917120,3,0,2,2,19,0,4290822144,-2,0,67174336,0,520093700,2,17,3,0,21,-2,2,177,3,0,3,-2,0,65504,2,122,2,49,3,0,2,2,92,-191,2,123,-23,2,26,3,0,296,-8,2,122,3,0,2,2,19,-11,2,175,3,0,72,-3,0,3758159872,0,201391616,3,0,155,-7,2,167,-1,0,384,-1,0,133693440,-3,2,193,-2,2,30,3,0,4,2,166,-2,2,22,2,151,3,0,4,-2,2,185,-1,2,146,0,335552923,2,194,-1,0,538974272,0,2214592512,0,132e3,-10,0,192,-8,0,12288,-21,0,134213632,0,4294901761,3,0,42,0,100663424,0,4294965284,3,0,62,-6,0,4286578784,2,0,-2,0,1006696448,3,0,24,2,37,-1,2,195,3,0,10,2,194,0,4110942569,0,1432950139,0,2701658217,0,4026532864,0,4026532881,2,0,2,47,3,0,8,-1,2,154,-2,2,166,0,98304,0,65537,2,167,2,169,-2,2,154,-1,2,63,2,0,2,116,2,197,2,175,0,4294770176,2,30,3,0,4,-30,2,195,2,196,-3,2,166,-2,2,151,2,0,2,154,-1,2,189,-1,2,157,2,198,3,0,2,2,154,2,122,-1,0,193331200,-1,0,4227923960,2,197,-1,3,0,3,2,198,3,0,44,-1334,2,22,2,0,-129,2,195,-6,2,160,-180,2,199,-233,2,4,3,0,96,-16,2,160,3,0,22583,-7,2,17,3,0,6128],[4294967295,4294967291,4092460543,4294828015,4294967294,134217726,268435455,2147483647,1048575,1073741823,3892314111,1061158911,536805376,4294910143,4160749567,4294901759,134217727,4294901760,4194303,65535,262143,67108863,4286578688,536870911,8388607,4294918143,4294443008,255,67043328,2281701374,4294967232,2097151,4294903807,4294902783,4294967039,511,524287,131071,127,4294902271,4294549487,16777215,1023,67047423,4294901888,33554431,4286578687,4294770687,67043583,32767,15,2047999,4292870143,4294934527,4294966783,67045375,4294967279,262083,20511,4290772991,41943039,493567,2047,4294959104,1071644671,602799615,65536,4294828e3,805044223,4277151126,8191,1031749119,4294917631,2134769663,4286578493,4282253311,4294942719,33540095,4294905855,4294967264,2868854591,1608515583,265232348,534519807,2147614720,1060109444,4093640016,17376,2139062143,224,4169138175,4294909951,4294967292,4294965759,4294966272,4294901823,4294967280,8289918,4294934399,4294901775,4294965375,1602223615,4294967259,268369920,4292804608,486341884,4294963199,3087007615,1073692671,4128527,4279238655,4294902015,4294966591,2445279231,3670015,3238002687,63,4294967288,4294705151,4095,3221208447,4294549472,2147483648,4294705152,4294966143,64,4294966719,16383,3774873592,536807423,67043839,3758096383,3959414372,3755993023,2080374783,4294835295,4294967103,4160749565,4087,31,184024726,2862017156,1593309078,268434431,268434414,4294901763,536870912,2952790016,202506752,139264,402653184,4261412864,4227922944,2147532800,61440,3758096384,117440512,65280,4227858432,3233808384,3221225472,4294965248,32768,57152,4294934528,67108864,4293918720,4290772992,25165824,57344,4278190080,65472,4227907584,65520,1920,4026531840,49152,4160749568,4294836224,63488,1073741824,4294967040,251658240,196608,12582912,2097152,65408,64512,417808,4227923712,48,512,4294967168,4294966784,16,4292870144,4227915776,65528,4294950912,65532]);function nextUnicodeChar(e){const{index:t}=e,n=e.source.charCodeAt(t);if(n<55296||n>56319)return n;const r=e.source.charCodeAt(t+1);return r<56320||r>57343?n:65536+((1023&n)<<10)|1023&r}const isIdentifierPart=e=>0!=(1&characterType[e])||isValidIdentifierPart(e);function escapeInvalidCharacters(e){switch(e){case 0:return"\\0";case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:return mustEscape(e)?e<16?`\\x0${e.toString(16)}`:e<256?`\\x${e.toString(16)}`:e<4096?`\\u0${e.toString(16)}`:e<65536?`\\u${e.toString(16)}`:`\\u{${e.toString(16)}}`:fromCodePoint(e)}}function consumeOpt(e,t){return e.source.charCodeAt(e.index)===t&&(e.index++,e.column++,!0)}function consumeLineFeed(e,t){e.flags|=Flags.NewLine,e.index++,0==(t&ScannerState.LastIsCR)&&(e.column=0,e.line++)}function scanPrivateName(e,t){return t&Context.InClass&&isValidIdentifierStart(e.source.charCodeAt(e.index))||report(e,1,tokenDesc(e.token)),115}function advanceNewline(e){e.flags|=Flags.NewLine,e.index++,e.column=0,e.line++}const fromCodePoint=e=>e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023));function readNext(e){return e.index++,e.column++,e.index>=e.source.length&&report(e,14),nextUnicodeChar(e)}function toHex(e){return e<48?-1:e<=57?e-48:e<65?-1:e<=70?e-65+10:e<97?-1:e<=102?e-97+10:-1}function advanceOnMaybeAstral(e,t){e.index++,e.column++,t>65535&&e.index++}function scanEscapeSequence(e,t,n){switch(n){case 98:return 8;case 102:return 12;case 114:return 13;case 110:return 10;case 116:return 9;case 118:return 11;case 13:case 10:case 8232:case 8233:return e.column=-1,e.line++,Escape.Empty;case 48:case 49:case 50:case 51:{let r=n-48,a=e.index+1,o=e.column+1,s=e.source.charCodeAt(a);if(s<48||s>55){if(0!==r||56===s||57===s){if(t&Context.Strict)return Escape.StrictOctal;e.flags|=Flags.HasOctal}}else{if(t&Context.Strict)return Escape.StrictOctal;e.flags|=Flags.HasOctal,e.lastValue=s,r=8*r+(s-48),a++,o++,(s=e.source.charCodeAt(a))>=48&&s<=55&&(e.lastValue=s,r=8*r+(s-48),a++,o++),e.index=a-1,e.column=o-1}return r}case 52:case 53:case 54:case 55:{if(t&Context.Strict)return Escape.StrictOctal;let r=n-48;const a=e.index+1,o=e.column+1,s=e.source.charCodeAt(a);return s>=48&&s<=55&&(r=8*r+(s-48),e.lastValue=s,e.index=a,e.column=o),r}case 56:case 57:return Escape.EightOrNine;case 120:{const t=toHex(e.lastValue=readNext(e));if(t<0)return Escape.InvalidHex;const n=toHex(e.lastValue=readNext(e));return n<0?Escape.InvalidHex:t<<4|n}case 117:{let t=e.lastValue=readNext(e);if(123===t){let n=toHex(t=e.lastValue=readNext(e));if(n<0)return Escape.InvalidHex;for(t=e.lastValue=readNext(e);125!==t;){const r=toHex(t);if(r<0)return Escape.InvalidHex;if((n=16*n+r)>1114111)return Escape.OutOfRange;t=e.lastValue=readNext(e)}return n}{let n=toHex(t);if(n<0)return Escape.InvalidHex;for(let r=0;r<3;r++){const r=toHex(t=e.lastValue=readNext(e));if(r<0)return Escape.InvalidHex;n=16*n+r}return n}}default:return e.source.charCodeAt(e.index)}}function throwStringError(e,t,n){switch(n){case Escape.Empty:return;case Escape.StrictOctal:report(e,t&Context.TaggedTemplate?76:11);case Escape.EightOrNine:report(e,13);case Escape.InvalidHex:report(e,75,"hexadecimal");case Escape.OutOfRange:report(e,14)}}function scanString(e,t,n){const{index:r,lastValue:a}=e;let o="";e.index++,e.column++;let s=e.source.charCodeAt(e.index);for(;s!==n;){switch(s){case 13:case 10:report(e,6);case 92:if((s=readNext(e))>128)o+=fromCodePoint(s);else{e.lastValue=s;const n=scanEscapeSequence(e,t,s);n>=0?o+=fromCodePoint(n):throwStringError(e,t,n),s=e.lastValue}break;default:o+=fromCodePoint(s)}s=readNext(e)}return e.index++,e.column++,e.tokenRaw=e.source.slice(r,e.index),e.tokenValue=o,e.lastValue=a,33554435}function consumeTemplateBrace(e,t){return e.index>=e.length&&report(e,9),e.index--,e.column--,scanTemplate(e,t)}function scanTemplate(e,t){const{index:n,lastValue:r}=e;let a=!0,o="",s=readNext(e);e:for(;96!==s;){switch(s){case 36:{const t=e.index+1;if(t<e.length&&123===e.source.charCodeAt(t)){e.index=t,e.column++,a=!1;break e}o+="$";break}case 92:if((s=readNext(e))>=128)o+=fromCodePoint(s);else{e.lastValue=s;const n=scanEscapeSequence(e,t|Context.Strict,s);if(n>=0)o+=fromCodePoint(n);else{if(n!==Escape.Empty&&t&Context.TaggedTemplate){o=void 0,(s=scanLooserTemplateSegment(e,e.lastValue))<0&&(a=!1);break e}throwStringError(e,t|Context.TaggedTemplate,n)}s=e.lastValue}break;case 13:case 10:case 8232:case 8233:e.column=-1,e.line++;default:null!=o&&(o+=fromCodePoint(s))}s=readNext(e)}return e.index++,e.column++,e.tokenValue=o,e.lastValue=r,a?(e.tokenRaw=e.source.slice(n+1,e.index-1),33554441):(e.tokenRaw=e.source.slice(n+1,e.index-2),33554440)}function scanLooserTemplateSegment(e,t){for(;96!==t;){if(36===t&&123===e.source.charCodeAt(e.index+1))return e.index++,e.column++,-t;t=readNext(e)}return t}function scanHexIntegerLiteral(e,t){e.index++,e.column++;let n=NumericState.None,r=toHex(e.source.charCodeAt(e.index));for(r<0&&report(e,0),e.index++,e.column++;e.index<e.length;){const a=e.source.charCodeAt(e.index);if(t&Context.OptionsNext&&95===a){n=scanNumericSeparator(e,n);continue}n&=~NumericState.SeenSeparator;const o=toHex(a);if(o<0)break;r=16*r+o,e.index++,e.column++}return n&NumericState.SeenSeparator&&report(e,59),assembleNumericLiteral(e,t,r,consumeOpt(e,110))}function scanOctalOrBinary(e,t,n){e.index++,e.column++;let r,a=0,o=0,s=NumericState.None;for(;e.index<e.length;){if(r=e.source.charCodeAt(e.index),t&Context.OptionsNext&&95===r){s=scanNumericSeparator(e,s);continue}s&=~NumericState.SeenSeparator;const i=r-48;if(!(r>=48&&r<=57)||i>=n)break;o=o*n+i,e.index++,e.column++,a++}return 0===a&&report(e,0),s&NumericState.SeenSeparator&&report(e,59),assembleNumericLiteral(e,t,o,consumeOpt(e,110))}function scanImplicitOctalDigits(e,t){switch(e.source.charCodeAt(e.index)){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:{t&Context.Strict&&report(e,0);let n=e.index,r=e.column,a=0;for(e.flags|=Flags.HasOctal;n<e.length;){const o=e.source.charCodeAt(n);if(95===o)report(e,60);else{if(o<48||o>55)return scanNumericLiteral(e,t);a=8*a+(o-48),n++,r++}}return e.index=n,e.column=r,assembleNumericLiteral(e,t,a,consumeOpt(e,110))}case 56:case 57:e.flags|=Flags.HasOctal;default:return t&Context.OptionsNext&&95===e.source.charCodeAt(e.index)&&report(e,60),scanNumericLiteral(e,t)}}function scanSignedInteger(e,t){let n=e.source.charCodeAt(e.index);43!==n&&45!==n||(e.index++,e.column++,n=e.source.charCodeAt(e.index)),n>=48&&n<=57||report(e,0);const r=e.index,a=scanDecimalDigitsOrSeparator(e);return e.source.substring(t,r)+a}function scanNumericLiteral(e,t,n=NumericState.None){let r=n&NumericState.Float?0:scanDecimalAsSmi(e,t);const a=e.source.charCodeAt(e.index);if(46!==a&&95!==a&&!isValidIdentifierStart(a))return assembleNumericLiteral(e,t,r);consumeOpt(e,46)&&(t&Context.OptionsNext&&95===e.source.charCodeAt(e.index)&&report(e,60),n|=NumericState.Float,r=`${r}.${scanDecimalDigitsOrSeparator(e)}`);const o=e.index;return consumeOpt(e,110)&&(n&NumericState.Float&&report(e,0),n|=NumericState.BigInt),(consumeOpt(e,101)||consumeOpt(e,69))&&(n|=NumericState.Float,r+=scanSignedInteger(e,o)),isValidIdentifierStart(e.source.charCodeAt(e.index))&&report(e,0),assembleNumericLiteral(e,t,n&NumericState.Float?parseFloat(r):parseInt(r,10),!!(n&NumericState.BigInt))}function scanNumericSeparator(e,t){return e.index++,e.column++,t&NumericState.SeenSeparator&&report(e,59),t|=NumericState.SeenSeparator}function scanDecimalDigitsOrSeparator(e){let t=e.index,n=NumericState.None,r="";e:for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 95:const a=e.index;n=scanNumericSeparator(e,n),r+=e.source.substring(t,a),t=e.index;continue;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:n&=~NumericState.SeenSeparator,e.index++,e.column++;break;default:break e}return n&NumericState.SeenSeparator&&report(e,59),r+e.source.substring(t,e.index)}function scanDecimalAsSmi(e,t){let n=NumericState.None,r=0,a=e.source.charCodeAt(e.index);for(;a>=48&&a<=57||95===a;)t&Context.OptionsNext&&95===a?(n=scanNumericSeparator(e,n),a=e.source.charCodeAt(e.index)):(n&=~NumericState.SeenSeparator,r=10*r+(a-48),e.index++,e.column++,a=e.source.charCodeAt(e.index));return n&NumericState.SeenSeparator&&report(e,59),r}function assembleNumericLiteral(e,t,n,r=!1){return e.tokenValue=n,t&Context.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),r?33554551:33554434}function scanIdentifier(e,t,n){let r=e.index,a="",o=!1;n&&advanceOnMaybeAstral(e,n);e:for(;e.index<e.length;){const t=e.index;let n=e.source.charCodeAt(t);switch(n){case 92:a+=e.source.slice(r,t),a+=scanUnicodeCodePointEscape(e),r=e.index,o=!0;break;default:if(n>=55296&&n<=56319){n=(1023&n)<<10|1023&e.source.charCodeAt(t+1)|65536}if(!isIdentifierPart(n))break e;advanceOnMaybeAstral(e,n)}}r<e.index&&(a+=e.source.slice(r,e.index)),e.tokenValue=a;const s=a.length;if(s>=2&&s<=11){const n=descKeyword(a);if(n>0)return o&&(t&Context.DisallowEscapedKeyword&&tolerant(e,t,3),e.flags|=Flags.EscapedKeyword),n}return t&Context.OptionsRawidentifiers&&(e.tokenRaw=e.source.slice(r,e.index)),33685505}function scanMaybeIdentifier(e,t,n){return isValidIdentifierStart(n=nextUnicodeChar(e))||report(e,10,escapeInvalidCharacters(n)),scanIdentifier(e,t,n)}function scanUnicodeCodePointEscape(e){const{index:t}=e;if(t+5<e.length){117!==e.source.charCodeAt(t+1)&&report(e,0),e.index+=2,e.column+=2;const n=scanIdentifierUnicodeEscape(e);return n>=55296&&n<=56319&&report(e,74),isIdentifierPart(n)||report(e,75,"unicode"),fromCodePoint(n)}report(e,0)}function scanIdentifierUnicodeEscape(e){let t=e.source.charCodeAt(e.index),n=0;if(123===t){let r=toHex(t=readNext(e));for(;r>=0;)(n=n<<4|r)>1114111&&report(e,89),e.index++,e.column++,r=toHex(e.source.charCodeAt(e.index));125!==e.source.charCodeAt(e.index)&&report(e,75,"unicode"),consumeOpt(e,125)}else for(let r=0;r<4;r++){const r=toHex(t=e.source.charCodeAt(e.index));r<0&&report(e,75,"unicode"),n=n<<4|r,e.index++,e.column++}return n}function skipSingleHTMLComment(e,t,n,r){return t&Context.Module&&report(e,90),skipSingleLineComment(e,t,n,r)}function skipSingleLineComment(e,t,n,r){const a=e.index,o=!!(t&Context.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 13:return advanceNewline(e),e.index<e.length&&10===e.source.charCodeAt(e.index)&&e.index++,n|ScannerState.NewLine;case 10:case 8232:case 8233:return advanceNewline(e),o&&addComment(e,t,r,a),n|ScannerState.NewLine;default:e.index++,e.column++}return o&&addComment(e,t,r,a),n}function skipMultiLineComment(e,t,n){const r=e.index,a=!!(t&Context.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 42:if(e.index++,e.column++,n&=~ScannerState.LastIsCR,consumeOpt(e,47))return a&&addComment(e,t,"MultiLine",r),n;break;case 13:n|=ScannerState.NewLine|ScannerState.LastIsCR,advanceNewline(e);break;case 10:consumeLineFeed(e,n),n=n&~ScannerState.LastIsCR|ScannerState.NewLine;break;case 8232:case 8233:n=n&~ScannerState.LastIsCR|ScannerState.NewLine,advanceNewline(e);break;default:n&=~ScannerState.LastIsCR,e.index++,e.column++}tolerant(e,t,8)}function addComment(e,t,n,r){const{index:a,startIndex:o,startLine:s,startColumn:i,lastLine:c,lastColumn:l}=e,p={type:n,value:e.source.slice(r,"MultiLine"===n?a-2:a),start:o,end:a};t&Context.OptionsLoc&&(p.loc={start:{line:s,column:i},end:{line:c,column:l}}),e.comments.push(p)}function scan(e,t){e.flags&=~Flags.NewLine|Flags.EscapedKeyword;const n=0===e.index;let r=ScannerState.None;for(;e.index<e.length;){n||(e.startIndex=e.index,e.startColumn=e.column,e.startLine=e.line);const a=e.source.charCodeAt(e.index);if(a>128)switch(a){case 8232:case 8233:r=r&~ScannerState.LastIsCR|ScannerState.NewLine,advanceNewline(e);break;case 65519:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:case 8205:e.index++,e.column++;break;default:return scanMaybeIdentifier(e,t,a)}else switch(a){case 13:r|=ScannerState.NewLine|ScannerState.LastIsCR,advanceNewline(e);break;case 10:consumeLineFeed(e,r),r=r&~ScannerState.LastIsCR|ScannerState.NewLine;break;case 9:case 11:case 12:case 32:e.index++,e.column++;break;case 40:return e.index++,e.column++,50331659;case 41:return e.index++,e.column++,16;case 44:return e.index++,e.column++,16777234;case 58:return e.index++,e.column++,16777237;case 59:return e.index++,e.column++,17825809;case 63:return e.index++,e.column++,22;case 93:return e.index++,e.column++,20;case 123:return e.index++,e.column++,41943052;case 125:return e.index++,e.column++,17825807;case 126:return e.index++,e.column++,301989934;case 91:return e.index++,e.column++,41943059;case 64:return e.index++,e.column++,120;case 47:if(e.index++,e.column++,e.index>=e.length)return 167774773;switch(e.source.charCodeAt(e.index)){case 47:e.index++,e.column++,r=skipSingleLineComment(e,t,r,"SingleLine");continue;case 42:e.index++,e.column++,r=skipMultiLineComment(e,t,r);continue;case 61:return e.index++,e.column++,100663333;default:return 167774773}case 45:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 45:if(e.index++,e.column++,(r&ScannerState.NewLine||n)&&consumeOpt(e,62)){r=skipSingleHTMLComment(e,t,r,"HTMLClose");continue}return 570425372;case 61:return e.index++,e.column++,67108899;default:return 436209968}case 60:if(e.index++,e.column++,consumeOpt(e,33)&&consumeOpt(e,45)&&consumeOpt(e,45)){r=skipSingleHTMLComment(e,t,r,"HTMLOpen");continue}switch(e.source.charCodeAt(e.index)){case 60:return e.index++,e.column++,consumeOpt(e,61)?67108894:167774273;case 61:return e.index++,e.column++,167774013;case 47:{if(!(t&Context.OptionsJSX))break;const n=e.index+1;if(n<e.length){const t=e.source.charCodeAt(n);if(42===t||47===t)break}return e.index++,e.column++,25}default:return 167774015}case 33:return e.index++,e.column++,consumeOpt(e,61)?consumeOpt(e,61)?167773754:167773756:301989933;case 39:case 34:return scanString(e,t,a);case 37:return e.index++,e.column++,consumeOpt(e,61)?67108902:167774772;case 38:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 38===t?(e.index++,e.column++,169869879):61===t?(e.index++,e.column++,67108905):167773508}case 42:{if(e.index++,e.column++,e.index>=e.length)return 167774771;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,67108900):42!==t?167774771:(e.index++,e.column++,consumeOpt(e,61)?67108897:167775030)}case 43:{if(e.index++,e.column++,e.index>=e.length)return 436209967;const t=e.source.charCodeAt(e.index);return 43===t?(e.index++,e.column++,570425371):61===t?(e.index++,e.column++,67108898):436209967}case 92:return scanIdentifier(e,t);case 61:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,consumeOpt(e,61)?167773753:167773755):62===t?(e.index++,e.column++,10):83886109}case 62:{if(e.index++,e.column++,e.index>=e.length)return 167774016;if(t&Context.InJSXChild)return 167774016;let n=e.source.charCodeAt(e.index);return 61===n?(e.index++,e.column++,167774014):62!==n?167774016:(e.index++,e.column++,62===(n=e.source.charCodeAt(e.index))?(e.index++,e.column++,consumeOpt(e,61)?67108896:167774275):61===n?(e.index++,e.column++,67108895):167774274)}case 94:return e.index++,e.column++,consumeOpt(e,61)?67108903:167773254;case 96:return scanTemplate(e,t);case 124:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 124===t?(e.index++,e.column++,169869624):61===t?(e.index++,e.column++,67108904):167772997}case 46:{let n=e.index+1;const r=e.source.charCodeAt(n);return r>=48&&r<=57?(scanNumericLiteral(e,t,NumericState.Float),33554434):46===r&&++n<e.length&&46===e.source.charCodeAt(n)?(e.index=n+1,e.column+=3,14):(e.index++,e.column++,16777229)}case 35:{e.index++,e.column++;const r=e.index,a=e.source.charCodeAt(r);if(t&Context.OptionsShebang&&n&&33===a){e.index=r+1,skipSingleLineComment(e,t,ScannerState.None,"SheBang");continue}return scanPrivateName(e,t)}case 48:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 88:case 120:return scanHexIntegerLiteral(e,t);case 66:case 98:return scanOctalOrBinary(e,t,2);case 79:case 111:return scanOctalOrBinary(e,t,8);default:return scanImplicitOctalDigits(e,t)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return scanNumericLiteral(e,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 36:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:default:return scanIdentifier(e,t,a)}}return 1048576}function scanRegularExpression(e,t){const n=e.index;let r=RegexState.Empty;e:for(;;){const t=e.source.charCodeAt(e.index);if(e.index++,e.column++,r&RegexState.Escape)r&=~RegexState.Escape;else switch(t){case 47:if(r)break;break e;case 92:r|=RegexState.Escape;break;case 91:r|=RegexState.Class;break;case 93:r&=RegexState.Escape;break;case 13:case 10:case 8232:case 8233:report(e,7)}e.index>=e.source.length&&report(e,7)}const a=e.index-1;let o=RegexFlags.Empty;const{index:s}=e;e:for(;e.index<e.source.length;){const n=e.source.charCodeAt(e.index);switch(n){case 103:o&RegexFlags.Global&&tolerant(e,t,15,"g"),o|=RegexFlags.Global;break;case 105:o&RegexFlags.IgnoreCase&&tolerant(e,t,15,"i"),o|=RegexFlags.IgnoreCase;break;case 109:o&RegexFlags.Multiline&&tolerant(e,t,15,"m"),o|=RegexFlags.Multiline;break;case 117:o&RegexFlags.Unicode&&tolerant(e,t,15,"u"),o|=RegexFlags.Unicode;break;case 121:o&RegexFlags.Sticky&&tolerant(e,t,15,"y"),o|=RegexFlags.Sticky;break;case 115:o&RegexFlags.DotAll&&tolerant(e,t,15,"s"),o|=RegexFlags.DotAll;break;default:if(!isIdentifierPart(n))break e;report(e,16,fromCodePoint(n))}e.index++,e.column++}const i=e.source.slice(s,e.index),c=e.source.slice(n,a);return e.tokenRegExp={pattern:c,flags:i},t&Context.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),e.tokenValue=validate(e,t,c,i),33554436}function validate(e,t,n,r){Context.OptionsNode;try{return new RegExp(n,r)}catch(e){return null}}function parseBindingIdentifierOrPattern(e,t,n=[]){const{token:r}=e;return 8388608&r?41943052===r?parserObjectAssignmentPattern(e,t):parseArrayAssignmentPattern(e,t,n):(1074003968&r&&(262144&r&&t&(Context.Async|Context.Module)?tolerant(e,t,48):1073741824&r&&t&(Context.Yield|Context.Strict)&&tolerant(e,t,49)),n.push(e.tokenValue),parseBindingIdentifier(e,t))}function parseBindingIdentifier(e,t){const{token:n}=e;4194304&n?(t&Context.Strict&&tolerant(e,t,17),e.flags|=Flags.StrictEvalArguments):t&Context.BlockScope&&33574984===n?tolerant(e,t,27):hasBit(n,20480)?(t&Context.Strict&&tolerant(e,t,1,tokenDesc(n)),e.flags|=Flags.StrictFunctionName):isValidIdentifier(t,n)||tolerant(e,t,1,tokenDesc(n));const r=getLocation(e),a=e.tokenValue;return nextToken(e,t),finishNode(t,e,r,{type:"Identifier",name:a})}function parseAssignmentRestElement(e,t,n){const r=getLocation(e);expect(e,t,14);const a=parseBindingIdentifierOrPattern(e,t,n);return 16777234===e.token&&tolerant(e,t,88),finishNode(t,e,r,{type:"RestElement",argument:a})}function AssignmentRestProperty(e,t){const n=getLocation(e);expect(e,t,14);const{token:r}=e,a=parseBindingIdentifierOrPattern(e,t);return hasBit(r,8388608)&&tolerant(e,t,94),16777234===e.token&&tolerant(e,t,88),finishNode(t,e,n,{type:"RestElement",argument:a})}function parseArrayAssignmentPattern(e,t,n){const r=getLocation(e);nextToken(e,t);const a=[];for(;20!==e.token;)if(consume(e,t,16777234))a.push(null);else{if(14===e.token){a.push(parseAssignmentRestElement(e,t,n));break}a.push(parseExpressionCoverGrammar(e,t|Context.AllowIn,parseBindingInitializer)),20!==e.token&&expect(e,t,16777234)}return expect(e,t,20),finishNode(t,e,r,{type:"ArrayPattern",elements:a})}function parserObjectAssignmentPattern(e,t){const n=getLocation(e),r=[];for(expect(e,t,41943052);17825807!==e.token;){if(14===e.token){r.push(AssignmentRestProperty(e,t));break}r.push(parseAssignmentProperty(e,t)),17825807!==e.token&&expect(e,t,16777234)}return expect(e,t,17825807),finishNode(t,e,n,{type:"ObjectPattern",properties:r})}function parseAssignmentPattern(e,t,n,r){return finishNode(t,e,r,{type:"AssignmentPattern",left:n,right:parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression)})}function parseBindingInitializer(e,t){const n=getLocation(e),r=parseBindingIdentifierOrPattern(e,t);return consume(e,t,83886109)?finishNode(t,e,n,{type:"AssignmentPattern",left:r,right:parseAssignmentExpression(e,t|Context.AllowIn)}):r}function parseAssignmentProperty(e,t){const n=getLocation(e),{token:r}=e;let a,o,s=!1,i=!1;if(135168&r)if(a=parseIdentifier(e,t),i=!consume(e,t,16777237)){const s=consume(e,t,83886109);t&Context.Yield&&1073741824&r&&tolerant(e,t,49),isValidIdentifier(t,r)||tolerant(e,t,46),o=s?parseAssignmentPattern(e,t,a,n):a}else o=parseBindingInitializer(e,t);else s=41943059===r,a=parsePropertyName(e,t),expect(e,t,16777237),o=parseExpressionCoverGrammar(e,t,parseBindingInitializer);return finishNode(t,e,n,{type:"Property",kind:"init",key:a,computed:s,value:o,method:!1,shorthand:i})}function parseJSXRootElement(e,t){const n=getLocation(e);let r,a=[],o=null,s=!1;expect(e,t,167774015);const i=167774016===e.token;if(i)r=parseJSXOpeningFragment(e,t,n);else{r=parseJSXOpeningElement(e,t,parseJSXElementName(e,t),parseJSXAttributes(e,t),s=consume(e,t,167774773),n)}if(i)return parseJSXFragment(e,t,r,n);if(!s){a=parseJSXChildren(e,t),o=parseJSXClosingElement(e,t);const n=isEqualTagNames(r.name),s=isEqualTagNames(o.name);n!==s&&report(e,85,s)}return finishNode(t,e,n,{type:"JSXElement",children:a,openingElement:r,closingElement:o})}function parseJSXOpeningElement(e,t,n,r,a,o){return t&Context.InJSXChild&&a?expect(e,t,167774016):nextJSXToken(e),finishNode(t,e,o,{type:"JSXOpeningElement",name:n,attributes:r,selfClosing:a})}function parseJSXFragment(e,t,n,r){return finishNode(t,e,r,{type:"JSXFragment",children:parseJSXChildren(e,t),openingElement:n,closingFragment:parseJSXClosingFragment(e,t)})}function parseJSXOpeningFragment(e,t,n){return nextJSXToken(e),finishNode(t,e,n,{type:"JSXOpeningFragment"})}function nextJSXToken(e){return e.token=scanJSXToken(e)}function scanJSXToken(e){if(e.index>=e.source.length)return 1048576;e.lastIndex=e.startIndex=e.index;const t=e.source.charCodeAt(e.index);if(60===t)return e.index++,e.column++,consumeOpt(e,47)?25:167774015;if(123===t)return e.index++,e.column++,41943052;for(;e.index<e.source.length;){e.index++,e.column++;const t=e.source.charCodeAt(e.index);if(123===t||60===t)break}return 121}function parseJSXChildren(e,t){const n=[];for(;25!==e.token;)n.push(parseJSXChild(e,t));return n}function parseJSXText(e,t){const n=getLocation(e),r=e.source.slice(e.startIndex,e.index);e.token=scanJSXToken(e);const a=finishNode(t,e,n,{type:"JSXText",value:r});return t&Context.OptionsRaw&&(a.raw=r),a}function parseJSXChild(e,t){switch(e.token){case 33685505:case 121:return parseJSXText(e,t);case 41943052:return parseJSXExpression(e,t&~Context.InJSXChild);case 167774015:return parseJSXRootElement(e,t&~Context.InJSXChild);default:report(e,0)}}function parseJSXAttributes(e,t){const n=[];for(;e.index<e.source.length&&167774773!==e.token&&167774016!==e.token;)n.push(parseJSXAttribute(e,t));return n}function parseJSXSpreadAttribute(e,t){const n=getLocation(e);expect(e,t,41943052),expect(e,t,14);const r=parseExpressionCoverGrammar(e,t&~Context.InJSXChild,parseAssignmentExpression);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXSpreadAttribute",argument:r})}function parseJSXNamespacedName(e,t,n,r){return expect(e,t,16777237),finishNode(t,e,r,{type:"JSXNamespacedName",namespace:n,name:parseJSXIdentifier(e,t)})}function parseJSXAttributeName(e,t){const n=getLocation(e),r=parseJSXIdentifier(e,t);return 16777237===e.token?parseJSXNamespacedName(e,t,r,n):r}function parseJSXAttributeValue(e,t){switch(scanJSXAttributeValue(e,t)){case 33554435:return parseLiteral(e,t);case 41943052:return parseJSXExpressionContainer(e,t|Context.InJSXChild);case 167774015:return parseJSXRootElement(e,t|Context.InJSXChild);default:return void tolerant(e,t,87)}}function parseJSXAttribute(e,t){const n=getLocation(e);if(41943052===e.token)return parseJSXSpreadAttribute(e,t);scanJSXIdentifier(e);const r=parseJSXAttributeName(e,t);return finishNode(t,e,n,{type:"JSXAttribute",value:83886109===e.token?parseJSXAttributeValue(e,t):null,name:r})}function scanJSXAttributeValue(e,t){e.lastIndex=e.index;const n=e.source.charCodeAt(e.index);switch(n){case 34:case 39:return scanJSXString(e,t,n);default:return nextToken(e,t)}}function scanJSXString(e,t,n){const r=e.index;e.index++,e.column++;let a="",o=e.source.charCodeAt(e.index);for(;o!==n;)a+=fromCodePoint(o),e.index++,e.column++,o=e.source.charCodeAt(e.index),e.index>=e.source.length&&report(e,6);return e.index++,e.column++,t&Context.OptionsRaw&&(e.tokenRaw=e.source.slice(r,e.index)),e.tokenValue=a,33554435}function parseJSXEmptyExpression(e,t){return finishNode(t,e,getLocation(e),{type:"JSXEmptyExpression"})}function parseJSXSpreadChild(e,t){const n=getLocation(e);expect(e,t,14);const r=parseExpression(e,t);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXSpreadChild",expression:r})}function parseJSXExpressionContainer(e,t){const n=getLocation(e);expect(e,t,41943052),17825807===e.token&&tolerant(e,t,84);const r=parseExpressionCoverGrammar(e,t&~Context.InJSXChild,parseAssignmentExpression);return expect(e,t,17825807),finishNode(t,e,n,{type:"JSXExpressionContainer",expression:r})}function parseJSXExpression(e,t){const n=getLocation(e);if(expect(e,t,41943052),14===e.token)return parseJSXSpreadChild(e,t);const r=17825807===e.token?parseJSXEmptyExpression(e,t):parseExpressionCoverGrammar(e,t,parseAssignmentExpression);return nextJSXToken(e),finishNode(t,e,n,{type:"JSXExpressionContainer",expression:r})}function parseJSXClosingFragment(e,t){const n=getLocation(e);return expect(e,t,25),expect(e,t,167774016),finishNode(t,e,n,{type:"JSXClosingFragment"})}function parseJSXClosingElement(e,t){const n=getLocation(e);expect(e,t,25);const r=parseJSXElementName(e,t);return t&Context.InJSXChild?expect(e,t,167774016):nextJSXToken(e),finishNode(t,e,n,{type:"JSXClosingElement",name:r})}function parseJSXIdentifier(e,t){const{token:n,tokenValue:r,tokenRaw:a}=e;135168&n||tolerant(e,t,1,tokenDesc(e.token));const o=getLocation(e);nextToken(e,t);const s=finishNode(t,e,o,{type:"JSXIdentifier",name:r});return t&Context.OptionsRawidentifiers&&(s.raw=a),s}function parseJSXMemberExpression(e,t,n,r){return scanJSXIdentifier(e),finishNode(t,e,r,{type:"JSXMemberExpression",object:n,property:parseJSXIdentifier(e,t)})}function parseJSXElementName(e,t){const n=getLocation(e);scanJSXIdentifier(e);let r=parseJSXIdentifier(e,t);if(16777237===e.token)return parseJSXNamespacedName(e,t,r,n);for(;consume(e,t,16777229);)r=parseJSXMemberExpression(e,t,r,n);return r}function scanJSXIdentifier(e){const{token:t}=e;if(135168&t){const t=e.index;let n=e.source.charCodeAt(e.index);for(;e.index<e.source.length&&(45===n||isValidIdentifierPart(n));)n=readNext(e);e.tokenValue+=e.source.substr(t,e.index-t)}return e.token}function parseExpression(e,t){const n=getLocation(e),r=parseExpressionCoverGrammar(e,t,parseAssignmentExpression);return 16777234===e.token?parseSequenceExpression(e,t,r,n):r}function parseSequenceExpression(e,t,n,r){const a=[n];for(;consume(e,t,16777234);)a.push(parseExpressionCoverGrammar(e,t,parseAssignmentExpression));return finishNode(t,e,r,{type:"SequenceExpression",expressions:a})}function parseYieldExpression(e,t,n){t&Context.InParameter&&tolerant(e,t,51),expect(e,t,1107316842);let r=null,a=!1;return e.flags&Flags.NewLine||((a=consume(e,t,167774771))||33554432&e.token)&&(r=parseAssignmentExpression(e,t)),finishNode(t,e,n,{type:"YieldExpression",argument:r,delegate:a})}function parseAssignmentExpression(e,t){const n=getLocation(e);let{token:r}=e;if(t&Context.Yield&&1073741824&r)return parseYieldExpression(e,t,n);let a=524288&r&&lookahead(e,t,nextTokenisIdentifierOrParen)?parserCoverCallExpressionAndAsyncArrowHead(e,t):parseConditionalExpression(e,t,n);if(10===e.token)return 135168&r&&(4214784&r&&(20480&r&&(e.flags|=Flags.HasStrictReserved),4194304&r&&(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments)),a=[a]),parseArrowFunction(e,t&=~Context.Async,n,a);if(hasBit(e.token,67108864)){r=e.token,t&Context.Strict&&nameIsArgumentsOrEval(a.name)?tolerant(e,t,17):consume(e,t,83886109)?(e.flags&Flags.AllowDestructuring||tolerant(e,t,73),t&Context.InParameter||reinterpret(e,t,a),t&Context.InParen&&(e.flags|=Flags.SimpleParameterList),262144&e.token?(setPendingError(e),e.flags|=Flags.HasAwait):t&Context.InParen&&t&(Context.Strict|Context.Yield)&&1073741824&e.token&&(setPendingError(e),e.flags|=Flags.HasYield)):(isValidSimpleAssignmentTarget(a)||tolerant(e,t,5),e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),nextToken(e,t));const o=parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression);return e.pendingExpressionError=null,finishNode(t,e,n,{type:"AssignmentExpression",left:a,operator:tokenDesc(r),right:o})}return a}function parseConditionalExpression(e,t,n){const r=parseBinaryExpression(e,t,0,n);if(!consume(e,t,22))return r;const a=parseExpressionCoverGrammar(e,t&~Context.AllowDecorator|Context.AllowIn,parseAssignmentExpression);return expect(e,t,16777237),finishNode(t,e,n,{type:"ConditionalExpression",test:r,consequent:a,alternate:parseExpressionCoverGrammar(e,t,parseAssignmentExpression)})}function parseBinaryExpression(e,t,n,r,a=parseUnaryExpression(e,t)){const o=t&Context.AllowIn^Context.AllowIn;for(;hasBit(e.token,167772160);){const s=e.token,i=3840&s;if(o&&167786289===s)break;if(i+((167775030===s)<<8)<=n)break;nextToken(e,t),a=finishNode(t,e,r,{type:2097152&s?"LogicalExpression":"BinaryExpression",left:a,right:parseBinaryExpression(e,t&~Context.AllowIn,i,getLocation(e)),operator:tokenDesc(s)})}return a}function parseAwaitExpression(e,t,n){return t&Context.InParameter&&tolerant(e,t,52),expect(e,t,34017389),finishNode(t,e,n,{type:"AwaitExpression",argument:parseUnaryExpression(e,t)})}function parseUnaryExpression(e,t){const n=getLocation(e),{token:r}=e;if(hasBit(r,301989888)){nextToken(e,t),e.flags&Flags.EscapedKeyword&&tolerant(e,t,3);const a=parseExpressionCoverGrammar(e,t,parseUnaryExpression);return 167775030===e.token&&tolerant(e,t,1,tokenDesc(e.token)),t&Context.Strict&&302002219===r&&("Identifier"===a.type?tolerant(e,t,43):isPropertyWithPrivateFieldKey(a)&&tolerant(e,t,44)),finishNode(t,e,n,{type:"UnaryExpression",operator:tokenDesc(r),argument:a,prefix:!0})}return t&Context.Async&&262144&r?parseAwaitExpression(e,t,n):parseUpdateExpression(e,t,n)}function parseUpdateExpression(e,t,n){const{token:r}=e;if(hasBit(e.token,570425344)){nextToken(e,t);const a=parseLeftHandSideExpression(e,t,n);return validateUpdateExpression(e,t,a,"Prefix"),finishNode(t,e,n,{type:"UpdateExpression",argument:a,operator:tokenDesc(r),prefix:!0})}if(t&Context.OptionsJSX&&167774015===r)return parseJSXRootElement(e,t|Context.InJSXChild);const a=parseLeftHandSideExpression(e,t,n);if(hasBit(e.token,570425344)&&!(e.flags&Flags.NewLine)){validateUpdateExpression(e,t,a,"Postfix");const r=e.token;return nextToken(e,t),finishNode(t,e,n,{type:"UpdateExpression",argument:a,operator:tokenDesc(r),prefix:!1})}return a}function parseRestElement(e,t,n=[]){const r=getLocation(e);return expect(e,t,14),t&Context.InParen&&262144&e.token&&(e.flags|=Flags.HasAwait),finishNode(t,e,r,{type:"RestElement",argument:parseBindingIdentifierOrPattern(e,t,n)})}function parseSpreadElement(e,t){const n=getLocation(e);return expect(e,t,14),finishNode(t,e,n,{type:"SpreadElement",argument:restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression)})}function parseLeftHandSideExpression(e,t,n){const r=t&Context.OptionsNext&&33566810===e.token?parseCallImportOrMetaProperty(e,t|Context.AllowIn):parseMemberExpression(e,t|Context.AllowIn,n);return parseCallExpression(e,t|Context.AllowIn,n,r)}function parseMemberExpression(e,t,n,r=parsePrimaryExpression(e,t)){for(;;)switch(e.token){case 16777229:consume(e,t,16777229),e.flags=e.flags&~Flags.AllowBinding|Flags.AllowDestructuring,r=finishNode(t,e,n,{type:"MemberExpression",object:r,computed:!1,property:parseIdentifierNameOrPrivateName(e,t)});continue;case 41943059:{consume(e,t,41943059),e.flags=e.flags&~Flags.AllowBinding|Flags.AllowDestructuring;const a=parseExpression(e,t);expect(e,t,20),r=finishNode(t,e,n,{type:"MemberExpression",object:r,computed:!0,property:a});continue}case 33554441:r=finishNode(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:parseTemplateLiteral(e,t)});continue;case 33554440:r=finishNode(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:parseTemplate(e,t|Context.TaggedTemplate)});continue;default:return r}}function parseCallExpression(e,t,n,r){for(;;){if(r=parseMemberExpression(e,t,n,r),50331659!==e.token)return r;r=finishNode(t,e,n,{type:"CallExpression",callee:r,arguments:parseArgumentList(e,t&~Context.AllowDecorator)})}}function parserCoverCallExpressionAndAsyncArrowHead(e,t){const n=getLocation(e);let r=parseMemberExpression(e,t|Context.AllowIn,n);if(135168&e.token)return 262144&e.token&&tolerant(e,t,40),parseAsyncArrowFunction(e,t,ModifierState.Await,n,[parseAndClassifyIdentifier(e,t)]);for(e.flags&Flags.NewLine&&tolerant(e,t,36,"async");50331659===e.token;){r=parseMemberExpression(e,t,n,r);const a=parseAsyncArgumentList(e,t);if(10===e.token){r=parseAsyncArrowFunction(e,t,ModifierState.Await,n,a);break}r=finishNode(t,e,n,{type:"CallExpression",callee:r,arguments:a})}return r}function parseArgumentList(e,t){expect(e,t,50331659);const n=[];for(;16!==e.token;)14===e.token?n.push(parseSpreadElement(e,t)):(t&Context.Yield&&hasBit(e.token,1073741824)&&(e.flags|=Flags.HasYield,setPendingError(e)),n.push(parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression))),16!==e.token&&expect(e,t,16777234);return expect(e,t,16),n}function parseAsyncArgumentList(e,t){expect(e,t,50331659);const n=[];let{token:r}=e,a=CoverCallState.Empty;for(;16!==e.token&&(14===e.token?(e.flags|=Flags.SimpleParameterList,n.push(parseSpreadElement(e,t)),a=CoverCallState.HasSpread):(r=e.token,a=validateAsyncArgumentList(e,t,a),n.push(restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression))),consume(e,t,16777234)&&(e.flags&=~Flags.AllowDestructuring,a&CoverCallState.HasSpread&&(a=CoverCallState.SeenSpread)),16!==e.token););return expect(e,t,16),10===e.token&&(a&CoverCallState.SeenSpread?tolerant(e,t,78):a&CoverCallState.EvalOrArguments?(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments):a&CoverCallState.Yield?(t&Context.Strict&&tolerant(e,t,51),e.flags|=Flags.HasStrictReserved):e.flags&Flags.HasYield?tolerant(e,t,51):(a&CoverCallState.Await||e.flags&Flags.HasAwait)&&tolerant(e,t,52)),n}function parsePrimaryExpression(e,t){switch(e.token){case 33685505:return parseIdentifier(e,t);case 33554434:case 33554435:return parseLiteral(e,t);case 594028:return parseAsyncFunctionOrIdentifier(e,t);case 50331659:return parseParenthesizedExpression(e,t|Context.InParen);case 41943059:return restoreExpressionCoverGrammar(e,t,parseArrayLiteral);case 41943052:return restoreExpressionCoverGrammar(e,t,parseObjectLiteral);case 33566808:return parseFunctionExpression(e,t);case 33566727:case 33566726:case 33566725:return parseNullOrTrueOrFalseLiteral(e,t);case 120:case 33566797:return parseClassExpression(e,t);case 33566811:return parseNewExpressionOrMetaProperty(e,t);case 33566813:return parseSuperProperty(e,t);case 33554551:return parseBigIntLiteral(e,t);case 33566815:return parseThisExpression(e,t);case 115:return parseIdentifierNameOrPrivateName(e,t);case 167774773:case 100663333:return scanRegularExpression(e,t),parseRegularExpressionLiteral(e,t);case 33554441:return parseTemplateLiteral(e,t);case 33554440:return parseTemplate(e,t);case 33574984:return parseLetAsIdentifier(e,t);case 12369:if(t&Context.OptionsExperimental)return parseDoExpression(e,t);default:return parseAndClassifyIdentifier(e,t)}}function parseDoExpression(e,t){const n=getLocation(e);return expect(e,t,12369),finishNode(t,e,n,{type:"DoExpression",body:parseBlockStatement(e,t)})}function parseLetAsIdentifier(e,t){t&Context.Strict&&tolerant(e,t,50);const n=getLocation(e),r=e.tokenValue;return nextToken(e,t),e.flags&Flags.NewLine&&41943059===e.token&&tolerant(e,t,1,"let"),finishNode(t,e,n,{type:"Identifier",name:r})}function parseAsyncFunctionOrIdentifier(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorExpression(e,t):parseIdentifier(e,t)}function parseIdentifier(e,t){const n=getLocation(e),r=e.tokenValue;nextToken(e,t|Context.TaggedTemplate);const a=finishNode(t,e,n,{type:"Identifier",name:r});return t&Context.OptionsRawidentifiers&&(a.raw=e.tokenRaw),a}function parseRegularExpressionLiteral(e,t){const n=getLocation(e),{tokenRegExp:r,tokenValue:a,tokenRaw:o}=e;nextToken(e,t);const s=finishNode(t,e,n,{type:"Literal",value:a,regex:r});return t&Context.OptionsRaw&&(s.raw=o),s}function parseLiteral(e,t){const n=getLocation(e),r=e.tokenValue;t&Context.Strict&&e.flags&Flags.HasOctal&&tolerant(e,t,61),nextToken(e,t);const a=finishNode(t,e,n,{type:"Literal",value:r});return t&Context.OptionsRaw&&(a.raw=e.tokenRaw),a}function parseBigIntLiteral(e,t){const n=getLocation(e),{tokenValue:r,tokenRaw:a}=e;nextToken(e,t);const o=finishNode(t,e,n,{type:"Literal",value:r,bigint:a});return t&Context.OptionsRaw&&(o.raw=e.tokenRaw),o}function parseNullOrTrueOrFalseLiteral(e,t){const n=getLocation(e),{token:r}=e,a=tokenDesc(r);e.flags&Flags.EscapedKeyword&&tolerant(e,t,3),nextToken(e,t);const o=finishNode(t,e,n,{type:"Literal",value:33566727===r?null:"true"===a});return t&Context.OptionsRaw&&(o.raw=a),o}function parseThisExpression(e,t){e.flags&Flags.EscapedKeyword&&tolerant(e,t,3);const n=getLocation(e);return nextToken(e,t|Context.DisallowEscapedKeyword),finishNode(t,e,n,{type:"ThisExpression"})}function parseIdentifierName(e,t,n){return 135168&n||tolerant(e,t,4,tokenDesc(n)),parseIdentifier(e,t)}function parseIdentifierNameOrPrivateName(e,t){if(!consume(e,t,115))return parseIdentifierName(e,t,e.token);const{tokenValue:n}=e,r=getLocation(e),a=n;return nextToken(e,t),finishNode(t,e,r,{type:"PrivateName",name:a})}function parseArrayLiteral(e,t){const n=getLocation(e);expect(e,t,41943059);const r=[];for(;20!==e.token;)consume(e,t,16777234)?r.push(null):14===e.token?(r.push(parseSpreadElement(e,t)),20!==e.token&&(e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),expect(e,t,16777234))):(r.push(restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression)),20!==e.token&&expect(e,t,16777234));return expect(e,t,20),finishNode(t,e,n,{type:"ArrayExpression",elements:r})}function parseParenthesizedExpression(e,t){if(expect(e,t,50331659),consume(e,t,16)){if(e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),10===e.token)return[]}else if(14===e.token){const n=[parseRestElement(e,t)];return expect(e,t,16),e.flags=e.flags&~(Flags.AllowDestructuring|Flags.AllowBinding)|Flags.SimpleParameterList,10!==e.token&&tolerant(e,t,1,tokenDesc(e.token)),n}const n=getLocation(e);let r=validateCoverParenthesizedExpression(e,CoverParenthesizedState.None),a=restoreExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression);if(16777234===e.token){r|=CoverParenthesizedState.SequenceExpression;const o=[a];for(;consume(e,t|Context.DisallowEscapedKeyword,16777234);){if(14===e.token){e.flags&Flags.AllowBinding||tolerant(e,t,77),e.flags|=Flags.SimpleParameterList;const n=parseRestElement(e,t);return expect(e,t,16),10!==e.token&&tolerant(e,t,78),o.push(n),o}if(consume(e,t,16))return 10!==e.token&&tolerant(e,t,1,tokenDesc(e.token)),o;r=validateCoverParenthesizedExpression(e,r),o.push(restoreExpressionCoverGrammar(e,t,parseAssignmentExpression))}a=finishNode(t,e,n,{type:"SequenceExpression",expressions:o})}return expect(e,t,16),10===e.token?(r&CoverParenthesizedState.HasEvalOrArguments?(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments):r&CoverParenthesizedState.HasReservedWords?(t&Context.Strict&&tolerant(e,t,50),e.flags|=Flags.HasStrictReserved):e.flags&Flags.AllowBinding?e.flags&Flags.HasYield?tolerant(e,t,51):t&Context.Async&&e.flags&Flags.HasAwait&&tolerant(e,t,52):tolerant(e,t,77),e.flags&=~(Flags.AllowBinding|Flags.HasAwait|Flags.HasYield),r&CoverParenthesizedState.SequenceExpression?a.expressions:[a]):(e.flags&=~(Flags.HasAwait|Flags.HasYield|Flags.AllowBinding),isValidSimpleAssignmentTarget(a)||(e.flags&=~Flags.AllowDestructuring),a)}function parseFunctionExpression(e,t){const n=getLocation(e);expect(e,t,33566808);const r=consume(e,t,167774771)?ModifierState.Generator:ModifierState.None;let a=null;const{token:o}=e;135168&o&&(4194304&o&&(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments),1073741824&e.token&&r&ModifierState.Generator&&tolerant(e,t,49),a=parseBindingIdentifier(e,t));const{params:s,body:i}=swapContext(e,t&~(Context.Method|Context.AllowSuperProperty),r,parseFormalListAndBody);return finishNode(t,e,n,{type:"FunctionExpression",params:s,body:i,async:!1,generator:!!(r&ModifierState.Generator),expression:!1,id:a})}function parseAsyncFunctionOrAsyncGeneratorExpression(e,t){const n=getLocation(e);expect(e,t,594028),expect(e,t,33566808);const r=consume(e,t,167774771)?ModifierState.Generator:ModifierState.None,a=ModifierState.Await;let o=null;const{token:s}=e;135168&s&&(4194304&s&&((t&Context.Strict||a&ModifierState.Await)&&tolerant(e,t,47),e.flags|=Flags.StrictFunctionName),262144&s&&tolerant(e,t,48),1073741824&e.token&&r&ModifierState.Generator&&tolerant(e,t,49),o=parseBindingIdentifier(e,t));const{params:i,body:c}=swapContext(e,t&~(Context.Method|Context.AllowSuperProperty),r|a,parseFormalListAndBody);return finishNode(t,e,n,{type:"FunctionExpression",params:i,body:c,async:!0,generator:!!(r&ModifierState.Generator),expression:!1,id:o})}function parseComputedPropertyName(e,t){expect(e,t,41943059);const n=parseAssignmentExpression(e,t|Context.AllowIn);return expect(e,t,20),n}function parsePropertyName(e,t){switch(e.token){case 33554434:case 33554435:return parseLiteral(e,t);case 41943059:return parseComputedPropertyName(e,t);default:return parseIdentifier(e,t)}}function parseSpreadProperties(e,t){const n=getLocation(e);return expect(e,t,14),8388608&e.token&&(e.flags&=~Flags.AllowDestructuring),finishNode(t,e,n,{type:"SpreadElement",argument:parseAssignmentExpression(e,t|Context.AllowIn)})}function parseObjectLiteral(e,t){const n=getLocation(e);expect(e,t,41943052);const r=[];for(;17825807!==e.token;)r.push(14===e.token?parseSpreadProperties(e,t):parsePropertyDefinition(e,t)),17825807!==e.token&&expect(e,t,16777234);return expect(e,t,17825807),e.flags&=~Flags.HasProtoField,finishNode(t,e,n,{type:"ObjectExpression",properties:r})}function parsePropertyDefinition(e,t){const n=getLocation(e),r=e.flags;let a,o=consume(e,t,167774771)?ObjectState.Generator|ObjectState.Method:ObjectState.Method;const s=e.token;let i=parsePropertyName(e,t);return 16777216&e.token||(r&Flags.EscapedKeyword?tolerant(e,t,3):o&ObjectState.Generator||!(524288&s)||e.flags&Flags.NewLine?69743===s?(o=o&~ObjectState.Method|ObjectState.Getter,i=parsePropertyName(e,t)):69744===s&&(o=o&~ObjectState.Method|ObjectState.Setter,i=parsePropertyName(e,t)):(o|=consume(e,t,167774771)?ObjectState.Generator|ObjectState.Async:ObjectState.Async,i=parsePropertyName(e,t)),o&(ObjectState.Getter|ObjectState.Setter)&&o&ObjectState.Generator&&tolerant(e,t,1,tokenDesc(e.token))),50331659===e.token?a=parseMethodDeclaration(e,t,o):(o&=~ObjectState.Method,16777237===e.token?(o&(ObjectState.Async|ObjectState.Generator)?tolerant(e,t,1,tokenDesc(e.token)):41943059!==s&&"__proto__"===e.tokenValue&&(e.flags&Flags.HasProtoField?setPendingExpressionError(e,63):e.flags|=Flags.HasProtoField),expect(e,t,16777237),262144&e.token&&(e.flags|=Flags.HasAwait),a=restoreExpressionCoverGrammar(e,t,parseAssignmentExpression)):(o&(ObjectState.Generator|ObjectState.Async)||!isValidIdentifier(t,s)?tolerant(e,t,1,tokenDesc(s)):t&(Context.Strict|Context.Yield)&&1073741824&s&&(setPendingError(e),e.flags|=Flags.HasYield),o|=ObjectState.Shorthand,83886109===e.token?(t&Context.Strict&&4194304&s?report(e,47):setPendingExpressionError(e,91),expect(e,t,83886109),t&(Context.Strict|Context.Yield|Context.Async)&&1074003968&e.token&&(setPendingError(e),e.flags|=1073741824&e.token?Flags.HasYield:Flags.HasAwait),a=parseAssignmentPattern(e,t,i,n)):(262144&s&&(t&Context.Async&&tolerant(e,t,46),setPendingError(e),e.flags|=Flags.HasAwait),a=i))),finishNode(t,e,n,{type:"Property",key:i,value:a,kind:o&ObjectState.Getter|o&ObjectState.Setter?o&ObjectState.Setter?"set":"get":"init",computed:41943059===s,method:!!(o&ObjectState.Method),shorthand:!!(o&ObjectState.Shorthand)})}function parseMethodDeclaration(e,t,n){const r=getLocation(e),a=n&ObjectState.Generator?ModifierState.Generator:ModifierState.None,o=n&ObjectState.Async?ModifierState.Await:ModifierState.None,{params:s,body:i}=swapContext(e,t|Context.Method,a|o,parseFormalListAndBody,n);return finishNode(t,e,r,{type:"FunctionExpression",params:s,body:i,async:!!(n&ObjectState.Async),generator:!!(n&ObjectState.Generator),expression:!1,id:null})}function parseArrowFunction(e,t,n,r){return e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),e.flags&Flags.NewLine&&tolerant(e,t,36,"=>"),expect(e,t,10),parseArrowBody(e,t&~Context.Async,r,n,ModifierState.None)}function parseAsyncArrowFunction(e,t,n,r,a){return e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),e.flags&Flags.NewLine&&tolerant(e,t,36,"async"),expect(e,t,10),parseArrowBody(e,t|Context.Async,a,r,n)}function parseArrowBody(e,t,n,r,a){e.pendingExpressionError=null;for(const r in n)reinterpret(e,t|Context.InParameter,n[r]);const o=41943052!==e.token;return finishNode(t,e,r,{type:"ArrowFunctionExpression",body:o?parseExpressionCoverGrammar(e,t&~(Context.Yield|Context.InParameter),parseAssignmentExpression):swapContext(e,t&~(Context.Yield|Context.AllowDecorator)|Context.InFunctionBody,a,parseFunctionBody),params:n,id:null,async:!!(a&ModifierState.Await),generator:!1,expression:o})}function parseFormalListAndBody(e,t,n){const r=parseFormalParameters(e,t|Context.InParameter,n),a=r.args;return{params:r.params,body:parseFunctionBody(e,t&~Context.AllowDecorator|Context.InFunctionBody,a)}}function parseFunctionBody(e,t,n){const r=getLocation(e);expect(e,t|Context.DisallowEscapedKeyword,41943052);const a=[];for(;33554435===e.token;){const{tokenRaw:n,tokenValue:r}=e;a.push(parseDirective(e,t)),12===n.length&&"use strict"===r&&(e.flags&Flags.SimpleParameterList?tolerant(e,t,64):e.flags&(Flags.HasStrictReserved|Flags.StrictFunctionName)?tolerant(e,t,50):e.flags&Flags.StrictEvalArguments&&tolerant(e,t,47),t|=Context.Strict)}t&Context.Strict&&validateParams(e,t,n);const{labelSet:o}=e;e.labelSet={};const s=e.flags;for(e.flags=e.flags&~(Flags.StrictFunctionName|Flags.StrictEvalArguments|Flags.InSwitchStatement|Flags.InIterationStatement)|Flags.AllowDestructuring;17825807!==e.token;)a.push(parseStatementListItem(e,t));return s&Flags.InIterationStatement&&(e.flags|=Flags.InIterationStatement),s&Flags.InSwitchStatement&&(e.flags|=Flags.InSwitchStatement),e.labelSet=o,expect(e,t,17825807),finishNode(t,e,r,{type:"BlockStatement",body:a})}function parseFormalParameters(e,t,n){expect(e,t,50331659),e.flags&=~(Flags.SimpleParameterList|Flags.HasStrictReserved);const r=[],a=[];for(;16!==e.token;){if(14===e.token){n&ObjectState.Setter&&tolerant(e,t,67),e.flags|=Flags.SimpleParameterList,a.push(parseRestElement(e,t,r));break}if(a.push(parseFormalParameterList(e,t,r)),!consume(e,t,16777234))break;if(16===e.token)break}return n&ObjectState.Setter&&1!==a.length&&tolerant(e,t,66,"Setter","one",""),n&ObjectState.Getter&&a.length>0&&tolerant(e,t,66,"Getter","no","s"),expect(e,t,16),{params:a,args:r}}function parseFormalParameterList(e,t,n){const r=getLocation(e);135168&e.token?(hasBit(e.token,20480)&&(t&Context.Strict&&tolerant(e,t,50),e.flags|=Flags.StrictFunctionName),hasBit(e.token,4194304)&&(t&Context.Strict&&tolerant(e,t,47),e.flags|=Flags.StrictEvalArguments)):e.flags|=Flags.SimpleParameterList;const a=parseBindingIdentifierOrPattern(e,t,n);return consume(e,t,83886109)?(1074003968&e.token&&t&(Context.Yield|Context.Async)&&tolerant(e,t,262144&e.token?52:51),e.flags|=Flags.SimpleParameterList,finishNode(t,e,r,{type:"AssignmentPattern",left:a,right:parseExpressionCoverGrammar(e,t,parseAssignmentExpression)})):a}function parseClassExpression(e,t){const n=getLocation(e);let r=[];t&Context.OptionsExperimental&&(r=parseDecorators(e,t)),expect(e,t|Context.DisallowEscapedKeyword,33566797);const{token:a}=e;let o=ObjectState.None,s=null,i=null;41943052!==a&&12372!==a&&(t&Context.Async&&262144&a&&tolerant(e,t,48),s=parseBindingIdentifier(e,t|Context.Strict)),consume(e,t,12372)&&(i=parseLeftHandSideExpression(e,t|Context.Strict,n),o|=ObjectState.Heritage);const c=parseClassBodyAndElementList(e,t|Context.Strict,o);return finishNode(t,e,n,t&Context.OptionsExperimental?{type:"ClassExpression",id:s,superClass:i,body:c,decorators:r}:{type:"ClassExpression",id:s,superClass:i,body:c})}function parseClassBodyAndElementList(e,t,n){const r=getLocation(e);expect(e,t,41943052);const a=[];let o=[];for(;17825807!==e.token;)consume(e,t,17825809)||(t&Context.OptionsExperimental&&(o=parseDecorators(e,t),17825807===e.token&&report(e,92),0!==o.length&&"constructor"===e.tokenValue&&report(e,93)),a.push(t&Context.OptionsNext&&115===e.token?parsePrivateFields(e,t,o):parseClassElement(e,t,n,o)));return e.flags&=~Flags.HasConstructor,expect(e,t,17825807),finishNode(t,e,r,{type:"ClassBody",body:a})}function parseClassElement(e,t,n,r){const a=getLocation(e);let{tokenValue:o,token:s}=e;const i=e.flags;consume(e,t,167774771)&&(n|=ObjectState.Generator),41943059===e.token&&(n|=ObjectState.Computed),"constructor"===e.tokenValue&&(n&ObjectState.Generator?tolerant(e,t,45,"generator"):n&ObjectState.Heritage&&(t|=Context.AllowSuperProperty),n|=ObjectState.Constructor);let c,l=parsePropertyName(e,t);if(!(16777216&e.token)){if(i&Flags.EscapedKeyword&&tolerant(e,t,3),20585===s&&(s=e.token,consume(e,t,167774771)&&(n|=ObjectState.Generator),o=e.tokenValue,41943059===e.token&&(n|=ObjectState.Computed),"prototype"===e.tokenValue&&tolerant(e,t,65),n|=ObjectState.Static,l=parsePropertyName(e,t),t&Context.OptionsNext&&isInstanceField(e)))return"constructor"===o&&tolerant(e,t,1,tokenDesc(e.token)),parseFieldDefinition(e,t,l,n,a,r);50331659!==e.token&&(!(524288&s)||n&ObjectState.Generator||e.flags&Flags.NewLine?69743!==s&&69744!==s||(n|=69743===s?ObjectState.Getter:ObjectState.Setter,o=e.tokenValue,41943059===e.token&&(n|=ObjectState.Computed),l=parsePropertyName(e,t&~Context.Strict)):(s=e.token,o=e.tokenValue,n|=ObjectState.Async,consume(e,t,167774771)&&(n|=ObjectState.Generator),41943059===e.token&&(n|=ObjectState.Computed),l=parsePropertyName(e,t)),"prototype"===o?tolerant(e,t,65):n&ObjectState.Static||"constructor"!==o||tolerant(e,t,45,"accessor"))}if(50331659===e.token)!(n&ObjectState.Computed)&&n&ObjectState.Constructor&&(e.flags&Flags.HasConstructor?report(e,12):e.flags|=Flags.HasConstructor),c=parseMethodDeclaration(e,t,n);else{if(t&Context.OptionsNext)return parseFieldDefinition(e,t,l,n,a,r);tolerant(e,t,1,tokenDesc(s))}const p=n&ObjectState.Constructor?"constructor":n&ObjectState.Getter?"get":n&ObjectState.Setter?"set":"method";return finishNode(t,e,a,t&Context.OptionsExperimental?{type:"MethodDefinition",kind:p,static:!!(n&ObjectState.Static),computed:!!(n&ObjectState.Computed),key:l,value:c,decorators:r}:{type:"MethodDefinition",kind:p,static:!!(n&ObjectState.Static),computed:!!(n&ObjectState.Computed),key:l,value:c})}function parseFieldDefinition(e,t,n,r,a,o){r&ObjectState.Constructor&&tolerant(e,t,0);let s=null;return r&(ObjectState.Async|ObjectState.Generator)&&tolerant(e,t,0),consume(e,t,83886109)&&(4194304&e.token&&tolerant(e,t,47),s=parseAssignmentExpression(e,t)),consume(e,t,16777234),finishNode(t,e,a,t&Context.OptionsExperimental?{type:"FieldDefinition",key:n,value:s,computed:!!(r&ObjectState.Computed),static:!!(r&ObjectState.Static),decorators:o}:{type:"FieldDefinition",key:n,value:s,computed:!!(r&ObjectState.Computed),static:!!(r&ObjectState.Static)})}function parsePrivateName(e,t,n){const r=e.tokenValue;return nextToken(e,t),finishNode(t,e,n,{type:"PrivateName",name:r})}function parsePrivateFields(e,t,n){const r=getLocation(e);expect(e,t|Context.InClass,115),"constructor"===e.tokenValue&&tolerant(e,t,41);const a=parsePrivateName(e,t,r);if(50331659===e.token)return parsePrivateMethod(e,t,a,r,n);let o=null;return consume(e,t,83886109)&&(4194304&e.token&&tolerant(e,t,47),o=parseAssignmentExpression(e,t)),consume(e,t,16777234),finishNode(t,e,r,t&Context.OptionsExperimental?{type:"FieldDefinition",key:a,value:o,computed:!1,static:!1,decorators:n}:{type:"FieldDefinition",key:a,value:o,computed:!1,static:!1})}function parsePrivateMethod(e,t,n,r,a){const o=parseMethodDeclaration(e,t|Context.Strict,ObjectState.None);return e.flags&=~(Flags.AllowDestructuring|Flags.AllowBinding),finishNode(t,e,r,t&Context.OptionsExperimental?{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:o,decorators:a}:{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:o})}function parseCallImportOrMetaProperty(e,t){const n=getLocation(e),r=parseIdentifier(e,t);if(consume(e,t,16777229)){if(t&Context.Module&&"meta"===e.tokenValue)return parseMetaProperty(e,t,r,n);tolerant(e,t,1,tokenDesc(e.token))}let a=parseImportExpression(e,t,n);expect(e,t,50331659);const o=parseExpressionCoverGrammar(e,t|Context.AllowIn,parseAssignmentExpression);return expect(e,t,16),a=finishNode(t,e,n,{type:"CallExpression",callee:a,arguments:[o]})}function parseImportExpression(e,t,n){return finishNode(t,e,n,{type:"Import"})}function parseMetaProperty(e,t,n,r){return finishNode(t,e,r,{meta:n,type:"MetaProperty",property:parseIdentifier(e,t)})}function parseNewExpressionOrMetaProperty(e,t){const n=getLocation(e),r=parseIdentifier(e,t);return consume(e,t|Context.DisallowEscapedKeyword,16777229)?("target"===e.tokenValue&&t&(Context.InParameter|Context.InFunctionBody)||tolerant(e,t,53),parseMetaProperty(e,t,r,n)):finishNode(t,e,n,{type:"NewExpression",callee:parseImportOrMemberExpression(e,t,n),arguments:50331659===e.token?parseArgumentList(e,t):[]})}function parseImportOrMemberExpression(e,t,n){const{token:r}=e;return t&Context.OptionsNext&&33566810===r?(lookahead(e,t,nextTokenIsLeftParen)&&tolerant(e,t,1,tokenDesc(r)),parseCallImportOrMetaProperty(e,t)):parseMemberExpression(e,t,n)}function parseSuperProperty(e,t){const n=getLocation(e);switch(expect(e,t,33566813),e.token){case 50331659:t&Context.AllowSuperProperty||tolerant(e,t,54);break;case 41943059:case 16777229:t&Context.Method||tolerant(e,t,55);break;default:tolerant(e,t,56)}return finishNode(t,e,n,{type:"Super"})}function parseTemplateLiteral(e,t){return finishNode(t,e,getLocation(e),{type:"TemplateLiteral",expressions:[],quasis:[parseTemplateSpans(e,t)]})}function parseTemplateHead(e,t,n=null,r,a){return e.token=consumeTemplateBrace(e,t),finishNode(t,e,a,{type:"TemplateElement",value:{cooked:n,raw:r},tail:!1})}function parseTemplate(e,t,n=[],r=[]){const a=getLocation(e),{tokenValue:o,tokenRaw:s}=e;expect(e,t,33554440),n.push(parseExpression(e,t));const i=getLocation(e);return r.push(parseTemplateHead(e,t,o,s,a)),33554441===e.token?r.push(parseTemplateSpans(e,t,i)):parseTemplate(e,t,n,r),finishNode(t,e,a,{type:"TemplateLiteral",expressions:n,quasis:r})}function parseTemplateSpans(e,t,n=getLocation(e)){const{tokenValue:r,tokenRaw:a}=e;return expect(e,t,33554441),finishNode(t,e,n,{type:"TemplateElement",value:{cooked:r,raw:a},tail:!0})}function parseDecoratorList(e,t){const n=getLocation(e);return finishNode(t,e,n,{type:"Decorator",expression:parseLeftHandSideExpression(e,t,n)})}function parseDecorators(e,t){const n=[];for(;consume(e,t,120);)n.push(parseDecoratorList(e,t|Context.AllowDecorator));return n}var Context,Flags,Labels,NumericState,ScannerState,ModifierState,CoverParenthesizedState,Escape,RegexFlags,CoverCallState,RegexState,ObjectState;function validateBreakOrContinueLabel(e,t,n,r){const a=hasLabel(e,n);a||tolerant(e,t,32,n),!r||a&Labels.Nested||tolerant(e,t,31,n)}function addLabel(e,t){void 0===e.labelSet&&(e.labelSet={}),e.labelSet[`$${t}`]=isIterationStatement(e.token)?Labels.Nested:Labels.NotNested}function popLabel(e,t){e.labelSet[`$${t}`]=Labels.None}function hasLabel(e,t){return e.labelSet?e.labelSet[`$${t}`]:Labels.None}function finishNode(e,t,n,r){const{lastIndex:a,lastLine:o,lastColumn:s,sourceFile:i,index:c}=t;return e&Context.LocationTracker&&(e&Context.OptionsRanges&&(r.start=n.index,r.end=a),e&Context.OptionsLoc&&(r.loc={start:{line:n.line,column:n.column},end:{line:o,column:s}},i&&(r.loc.source=i))),r}function expect(e,t,n,r=1){return e.token!==n&&report(e,r,tokenDesc(e.token)),nextToken(e,t),!0}function consume(e,t,n){return e.token===n&&(nextToken(e,t),!0)}function nextToken(e,t){return e.lastIndex=e.index,e.lastLine=e.line,e.lastColumn=e.column,e.token=scan(e,t)}!function(e){e[e.Empty=0]="Empty",e[e.OptionsNext=1]="OptionsNext",e[e.OptionsRanges=2]="OptionsRanges",e[e.OptionsJSX=4]="OptionsJSX",e[e.OptionsRaw=8]="OptionsRaw",e[e.OptionsLoc=16]="OptionsLoc",e[e.OptionsGlobalReturn=32]="OptionsGlobalReturn",e[e.OptionsComments=64]="OptionsComments",e[e.OptionsShebang=128]="OptionsShebang",e[e.OptionsRawidentifiers=256]="OptionsRawidentifiers",e[e.OptionsTolerant=512]="OptionsTolerant",e[e.OptionsNode=1024]="OptionsNode",e[e.OptionsExperimental=2048]="OptionsExperimental",e[e.Strict=4096]="Strict",e[e.Module=8192]="Module",e[e.TaggedTemplate=16384]="TaggedTemplate",e[e.InClass=32768]="InClass",e[e.AllowIn=65536]="AllowIn",e[e.Async=131072]="Async",e[e.Yield=262144]="Yield",e[e.InParameter=524288]="InParameter",e[e.InFunctionBody=1048576]="InFunctionBody",e[e.AllowSingleStatement=2097152]="AllowSingleStatement",e[e.BlockScope=4194304]="BlockScope",e[e.ForStatement=8388608]="ForStatement",e[e.RequireIdentifier=16777216]="RequireIdentifier",e[e.Method=33554432]="Method",e[e.AllowSuperProperty=67108864]="AllowSuperProperty",e[e.InParen=134217728]="InParen",e[e.InJSXChild=268435456]="InJSXChild",e[e.DisallowEscapedKeyword=536870912]="DisallowEscapedKeyword",e[e.AllowDecorator=1073741824]="AllowDecorator",e[e.LocationTracker=18]="LocationTracker"}(Context||(Context={})),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.AllowBinding=2]="AllowBinding",e[e.AllowDestructuring=4]="AllowDestructuring",e[e.SimpleParameterList=8]="SimpleParameterList",e[e.InSwitchStatement=16]="InSwitchStatement",e[e.InIterationStatement=32]="InIterationStatement",e[e.HasStrictReserved=64]="HasStrictReserved",e[e.HasOctal=128]="HasOctal",e[e.SimpleAssignmentTarget=256]="SimpleAssignmentTarget",e[e.HasProtoField=512]="HasProtoField",e[e.StrictFunctionName=1024]="StrictFunctionName",e[e.StrictEvalArguments=2048]="StrictEvalArguments",e[e.InFunctionBody=4096]="InFunctionBody",e[e.HasAwait=8192]="HasAwait",e[e.HasYield=16384]="HasYield",e[e.EscapedKeyword=32768]="EscapedKeyword",e[e.HasConstructor=65536]="HasConstructor"}(Flags||(Flags={})),function(e){e[e.None=0]="None",e[e.NotNested=1]="NotNested",e[e.Nested=2]="Nested"}(Labels||(Labels={})),function(e){e[e.None=0]="None",e[e.SeenSeparator=1]="SeenSeparator",e[e.EigthOrNine=2]="EigthOrNine",e[e.Float=4]="Float",e[e.BigInt=8]="BigInt"}(NumericState||(NumericState={})),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.LastIsCR=2]="LastIsCR"}(ScannerState||(ScannerState={})),function(e){e[e.None=0]="None",e[e.Generator=1]="Generator",e[e.Await=2]="Await"}(ModifierState||(ModifierState={})),function(e){e[e.None=0]="None",e[e.SequenceExpression=1]="SequenceExpression",e[e.HasEvalOrArguments=2]="HasEvalOrArguments",e[e.HasReservedWords=4]="HasReservedWords",e[e.HasYield=8]="HasYield",e[e.HasBinding=16]="HasBinding"}(CoverParenthesizedState||(CoverParenthesizedState={})),function(e){e[e.Empty=-1]="Empty",e[e.StrictOctal=-2]="StrictOctal",e[e.EightOrNine=-3]="EightOrNine",e[e.InvalidHex=-4]="InvalidHex",e[e.OutOfRange=-5]="OutOfRange"}(Escape||(Escape={})),function(e){e[e.Empty=0]="Empty",e[e.IgnoreCase=1]="IgnoreCase",e[e.Global=2]="Global",e[e.Multiline=4]="Multiline",e[e.Unicode=8]="Unicode",e[e.Sticky=16]="Sticky",e[e.DotAll=32]="DotAll"}(RegexFlags||(RegexFlags={})),function(e){e[e.Empty=0]="Empty",e[e.SeenSpread=1]="SeenSpread",e[e.HasSpread=2]="HasSpread",e[e.SimpleParameter=4]="SimpleParameter",e[e.EvalOrArguments=8]="EvalOrArguments",e[e.Yield=16]="Yield",e[e.Await=32]="Await"}(CoverCallState||(CoverCallState={})),function(e){e[e.Empty=0]="Empty",e[e.Escape=1]="Escape",e[e.Class=2]="Class"}(RegexState||(RegexState={})),function(e){e[e.None=0]="None",e[e.Async=1]="Async",e[e.Generator=2]="Generator",e[e.Getter=4]="Getter",e[e.Setter=8]="Setter",e[e.Computed=16]="Computed",e[e.Method=32]="Method",e[e.Shorthand=64]="Shorthand",e[e.Static=128]="Static",e[e.Constructor=256]="Constructor",e[e.Heritage=512]="Heritage"}(ObjectState||(ObjectState={}));const hasBit=(e,t)=>(e&t)===t;function consumeSemicolon(e,t){return 1048576&e.token||e.flags&Flags.NewLine?consume(e,t,17825809):report(e,!(t&Context.Async)&&262144&e.token?38:1,tokenDesc(e.token))}function parseExpressionCoverGrammar(e,t,n){const{flags:r,pendingExpressionError:a}=e;e.flags|=Flags.AllowBinding|Flags.AllowDestructuring,e.pendingExpressionError=void 0;const o=n(e,t);if(e.pendingExpressionError){const{error:n,line:r,column:a,index:o}=e.pendingExpressionError;constructError(e,t,o,r,a,n)}return e.flags&=~(Flags.AllowBinding|Flags.AllowDestructuring),r&Flags.AllowBinding&&(e.flags|=Flags.AllowBinding),r&Flags.AllowDestructuring&&(e.flags|=Flags.AllowDestructuring),e.pendingExpressionError=a,o}function restoreExpressionCoverGrammar(e,t,n){const{flags:r,pendingExpressionError:a}=e;e.flags|=Flags.AllowBinding|Flags.AllowDestructuring,e.pendingExpressionError=void 0;const o=n(e,t);return e.flags&Flags.AllowBinding&&r&Flags.AllowBinding||(e.flags&=~Flags.AllowBinding),e.flags&Flags.AllowDestructuring&&r&Flags.AllowDestructuring||(e.flags&=~Flags.AllowDestructuring),e.pendingExpressionError=a||e.pendingExpressionError,o}function swapContext(e,t,n,r,a=ObjectState.None){return t&=~(Context.Async|Context.Yield|Context.InParameter),n&ModifierState.Generator&&(t|=Context.Yield),n&ModifierState.Await&&(t|=Context.Async),r(e,t,a)}function validateParams(e,t,n){const r=new Map;for(let a=0;a<n.length;a++){const o=`@${n[a]}`;r.get(o)?tolerant(e,t,81):r.set(o,!0)}}const reinterpret=(e,t,n)=>{switch(n.type){case"Identifier":t&Context.Strict&&nameIsArgumentsOrEval(n.name)&&report(e,3);case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":case"RestElement":case"MetaProperty":return;case"ArrayExpression":n.type="ArrayPattern";for(let r=0;r<n.elements.length;++r)null!==n.elements[r]&&reinterpret(e,t,n.elements[r]);return;case"ObjectExpression":n.type="ObjectPattern";for(let r=0;r<n.properties.length;r++)reinterpret(e,t,n.properties[r]);return;case"Property":return void reinterpret(e,t,n.value);case"SpreadElement":n.type="RestElement","ArrayExpression"===n.argument.type||"ObjectExpression"===n.argument.type||isValidSimpleAssignmentTarget(n.argument)||tolerant(e,t,71),reinterpret(e,t,n.argument);break;case"AssignmentExpression":return n.type="AssignmentPattern",delete n.operator,void reinterpret(e,t,n.left);case"MemberExpression":if(!(t&Context.InParameter))return;default:tolerant(e,t,t&Context.InParameter?77:73,n.type)}};function lookahead(e,t,n){const{tokenValue:r,flags:a,line:o,column:s,startColumn:i,index:c,lastColumn:l,startLine:p,lastLine:u,lastIndex:d,startIndex:m,tokenRaw:x,token:f,lastValue:g,tokenRegExp:S,labelSet:C,errors:k,errorLocation:E,pendingExpressionError:h}=e,y=n(e,t);return e.index=c,e.token=f,e.tokenValue=r,e.tokenValue=r,e.flags=a,e.line=o,e.column=s,e.tokenRaw=x,e.lastValue=g,e.startColumn=i,e.lastColumn=l,e.startLine=p,e.lastLine=u,e.lastIndex=d,e.startIndex=m,e.tokenRegExp=S,e.labelSet=C,e.errors=k,e.errorLocation=E,e.tokenRegExp=S,e.pendingExpressionError=h,y}function isValidSimpleAssignmentTarget(e){return"Identifier"===e.type||"MemberExpression"===e.type}function getLocation(e){return{line:e.startLine,column:e.startColumn,index:e.startIndex}}function isValidIdentifier(e,t){return e&Context.Strict?!(e&Context.Module&&262144&t)&&(!(1073741824&t)&&(131072==(131072&t)||69632==(69632&t))):131072==(131072&t)||69632==(69632&t)||20480==(20480&t)}function isLexical(e,t){nextToken(e,t);const{token:n}=e;return!!(1082523648&n||33574984===n||69632==(69632&n))}function isEndOfCaseOrDefaultClauses(e){return 12368===e.token||17825807===e.token||12363===e.token}function nextTokenIsLeftParenOrPeriod(e,t){return nextToken(e,t),50331659===e.token||16777229===e.token}function nextTokenisIdentifierOrParen(e,t){nextToken(e,t);const{token:n}=e;return 1073872896&n||50331659===n}function nextTokenIsLeftParen(e,t){return nextToken(e,t),50331659===e.token}function nextTokenIsFuncKeywordOnSameLine(e,t){return nextToken(e,t),!(e.flags&Flags.NewLine)&&33566808===e.token}function isPropertyWithPrivateFieldKey(e){return!!e.property&&"PrivateName"===e.property.type}function parseAndClassifyIdentifier(e,t){const{token:n,tokenValue:r}=e;if(t&Context.Strict){if(t&Context.Module&&262144&n&&tolerant(e,t,40,tokenDesc(e.token)),1073741824&n&&tolerant(e,t,40,tokenDesc(e.token)),131072==(131072&n)||69632==(69632&n))return parseIdentifier(e,t);report(e,1,tokenDesc(e.token))}if(t&Context.Yield&&1073741824&n&&tolerant(e,t,40,tokenDesc(e.token)),t&Context.Async&&262144&n&&tolerant(e,t,40,tokenDesc(e.token)),131072==(131072&n)||69632==(69632&n)||20480==(20480&n))return parseIdentifier(e,t);report(e,1,tokenDesc(e.token))}function nameIsArgumentsOrEval(e){return"eval"===e||"arguments"===e}function setPendingError(e){e.errorLocation={line:e.startLine,column:e.startColumn,index:e.startIndex}}function isEqualTagNames(e){switch(e.type){case"JSXIdentifier":return e.name;case"JSXNamespacedName":return`${isEqualTagNames(e.namespace)}:${isEqualTagNames(e.name)}`;case"JSXMemberExpression":return`${isEqualTagNames(e.object)}.${isEqualTagNames(e.property)}`}}function isInstanceField(e){const{token:t}=e;return 17825807===t||17825809===t||83886109===t}function validateUpdateExpression(e,t,n,r){t&Context.Strict&&nameIsArgumentsOrEval(n.name)&&tolerant(e,t,68,r),isValidSimpleAssignmentTarget(n)||tolerant(e,t,5)}function setPendingExpressionError(e,t){e.pendingExpressionError={error:errorMessages[t],line:e.line,column:e.column,index:e.index}}function validateCoverParenthesizedExpression(e,t){const{token:n}=e;return 8388608&n?e.flags|=Flags.SimpleParameterList:4194304==(4194304&n)?(setPendingError(e),t|=CoverParenthesizedState.HasEvalOrArguments):20480==(20480&n)?(setPendingError(e),t|=CoverParenthesizedState.HasReservedWords):262144==(262144&n)&&(setPendingError(e),e.flags|=Flags.HasAwait),t}function validateAsyncArgumentList(e,t,n){const{token:r}=e;return e.flags&Flags.AllowBinding?8388608&r?e.flags|=Flags.SimpleParameterList:4194304==(4194304&r)?(setPendingError(e),n|=CoverCallState.EvalOrArguments):262144==(262144&r)?(setPendingError(e),n|=CoverCallState.Await):1073741824==(1073741824&r)&&(setPendingError(e),n|=CoverCallState.Yield):tolerant(e,t,77),n}function isIterationStatement(e){return 12369===e||12386===e||12374===e}function isInOrOf(e){return 69746===e||167786289===e}const errorMessages={0:"Unexpected token",1:"Unexpected token '%0'",2:"Expected token '%0'",3:"Keyword must not contain escaped characters",4:"Keyword '%0' is reserved",5:"Invalid left-hand side in assignment",6:"Unterminated string literal",7:"Unterminated regular expression literal",8:"Unterminated MultiLineComment",9:"Unterminated template literal",10:"Invalid character '%0'",11:"Octal escapes are not allowed in strict mode",13:"Escapes \\8 or \\9 are not syntactically valid escapes",14:"Unicode escape code point out of range",15:"Duplicate regular expression flag '%0'",16:"Unexpected regular expression flag '%0'",17:"Eval or arguments can't be assigned to in strict mode code",18:"Illegal return statement",19:"In strict mode code, functions can only be declared at top level or inside a block",20:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",21:"%0 can't appear in single-statement context",22:"Generators can only be declared at the top level or inside a block",23:"'for await' loop should be used with 'of'",24:"Missing initializer in %0 declaration",25:"'for-%0' loop variable declaration may not have an initializer",26:"Invalid left-hand side in for-%0 loop: Must have a single binding.",27:"let is disallowed as a lexically bound name",28:"Lexical declaration cannot appear in a single-statement context",29:"Label '%0' has already been declared",30:"%0 statement must be nested within an iteration statement",31:"Illegal continue statement: '%0' does not denote an iteration statement",32:"Undefined label '%0'",33:"More than one default clause in switch statement",34:"%0 declarations may only appear at top level of a module",35:"Async functions can only be declared at the top level or inside a block",36:"No line break is allowed after '%0'",37:"Strict mode code may not include a with statement",38:"Await is only valid in async functions",39:"Function declaration must have a name in this context",12:"Duplicate constructor method in class",40:"'%0' may not be used as an identifier in this context",43:"Delete of an unqualified identifier in strict mode",44:"Private fields can not be deleted",41:"Classes may not have a private field named '#constructor'",42:"Classes may not have a field named 'constructor'",45:"Class constructor may not be a '%0'",46:"Unexpected reserved word",47:"Unexpected eval or arguments in strict mode",48:"'await' is not a valid identifier inside an async function",49:"'yield' is not a valid identifier inside an generator function",50:"Unexpected strict mode reserved word",52:"Await expression not allowed in formal parameter",51:"Yield expression not allowed in formal parameter",53:"new.target only allowed within functions",54:"super() is not allowed in this context",55:"Member access from super not allowed in this context",56:'Only "(" or "." or "[" are allowed after \'super\'',57:"'yield' is a reserved keyword within generator function bodies",58:"Only one underscore is allowed as numeric separator",59:"Numeric separators are not allowed at the end of numeric literals",60:"Numeric separator can not be used after leading 0.",61:"Legacy octal literals are not allowed in strict mode",62:"Invalid left-hand side in assignment",63:"Property name __proto__ appears more than once in object literal",64:"Illegal 'use strict' directive in function with non-simple parameter list",65:"Classes may not have a static property named 'prototype'",66:"%0 functions must have %1 argument%2",67:"Setter function argument must not be a rest parameter",68:"%0 increment/decrement may not have eval or arguments operand in strict mode",69:"Elision not allowed in object property list",70:"Rest element must be last element",72:"Spread element must be last element",71:"Rest parameter may not have a default initializer",73:"Invalid destructuring assignment target",74:"Unexpected surrogate pair",75:"Malformed %0 character escape sequence",76:"Template literals may not contain octal escape sequences",77:"Invalid binding pattern",78:"Rest parameter must be last formal parameter",79:"Missing catch or finally after try",80:"Illegal newline after throw",81:"Duplicate parameter name not allowed in this context",82:"Missing keyword 'as' after import *",83:"Labels must be followed by a ':'",84:"JSX attributes must only be assigned a non-empty 'expression'",85:"Expected corresponding JSX closing tag for %0",86:"Adjacent JSX elements must be wrapped in an enclosing tag",87:"Invalid JSX attribute value",88:"Rest element may not have a trailing comma",89:"Undefined Unicode code-point",90:"HTML comments are not allowed in modules",91:"Invalid shorthand property initializer",92:"Trailing decorator may be followed by method",93:"Decorators can't be used with a constructor",94:"`...` must be followed by an identifier in declaration contexts"};function constructError(e,t,n,r,a,o){const s=new SyntaxError(`Line ${r}, column ${a}: ${o}`);if(s.index=n,s.line=r,s.column=a,s.description=o,!(t&Context.OptionsTolerant))throw s;e.errors.push(s)}function getErrorLocation(e){let{index:t,startLine:n,startColumn:r}=e;const a=e.errorLocation;return a&&(t=a.index,n=a.line,r=a.column),{index:t,line:n,column:r}}function report(e,t,...n){const{index:r,line:a,column:o}=getErrorLocation(e),s=errorMessages[t].replace(/%(\d+)/g,(e,t)=>n[t]);constructError(e,Context.Empty,r,a,o,s)}function tolerant(e,t,n,...r){const{index:a,line:o,column:s}=getErrorLocation(e);constructError(e,t,a,o,s,errorMessages[n].replace(/%(\d+)/g,(e,t)=>r[t]))}function parseClassDeclaration(e,t){const n=getLocation(e);let r=[];t&Context.OptionsExperimental&&(r=parseDecorators(e,t)),expect(e,t|Context.DisallowEscapedKeyword,33566797);const a=t&Context.RequireIdentifier&&33685505!==e.token?null:parseBindingIdentifier(e,t|Context.Strict|Context.DisallowEscapedKeyword);let o=ObjectState.None,s=null;consume(e,t,12372)&&(s=parseLeftHandSideExpression(e,t|Context.Strict,n),o|=ObjectState.Heritage);const i=parseClassBodyAndElementList(e,t&~Context.RequireIdentifier|Context.Strict|Context.InClass,o);return finishNode(t,e,n,t&Context.OptionsExperimental?{type:"ClassDeclaration",id:a,superClass:s,body:i,decorators:r}:{type:"ClassDeclaration",id:a,superClass:s,body:i})}function parseFunctionDeclaration(e,t){const n=getLocation(e);expect(e,t,33566808);let r=ModifierState.None;return consume(e,t,167774771)&&(t&Context.AllowSingleStatement&&!(t&Context.InFunctionBody)&&tolerant(e,t,22),r=ModifierState.Generator),parseFunctionDeclarationBody(e,t,r,n)}function parseFunctionDeclarationBody(e,t,n,r){const{token:a}=e;let o=null;t&Context.Yield&&1073741824&a&&tolerant(e,t,49),t&Context.Async&&262144&a&&tolerant(e,t,48),50331659!==a?o=parseBindingIdentifier(e,t):t&Context.RequireIdentifier||tolerant(e,t,39);const{params:s,body:i}=swapContext(e,t&~(Context.Method|Context.AllowSuperProperty|Context.RequireIdentifier),n,parseFormalListAndBody);return finishNode(t,e,r,{type:"FunctionDeclaration",params:s,body:i,async:!!(n&ModifierState.Await),generator:!!(n&ModifierState.Generator),expression:!1,id:o})}function parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t){const n=getLocation(e);expect(e,t,594028),expect(e,t,33566808);const r=ModifierState.Await;return parseFunctionDeclarationBody(e,t,(consume(e,t,167774771)?ModifierState.Generator:ModifierState.None)|r,n)}function parseVariableDeclaration(e,t,n){const r=getLocation(e),a=0!=(8388608&e.token),o=parseBindingIdentifierOrPattern(e,t);let s=null;return consume(e,t|Context.DisallowEscapedKeyword,83886109)?(s=parseExpressionCoverGrammar(e,t&~(Context.BlockScope|Context.ForStatement),parseAssignmentExpression),isInOrOf(e.token)&&(t&Context.ForStatement||a)&&(167786289===e.token?(t&(Context.BlockScope|Context.Strict|Context.Async)||a)&&tolerant(e,t,25,tokenDesc(e.token)):tolerant(e,t,25,tokenDesc(e.token)))):isInOrOf(e.token)||!n&&!a||tolerant(e,t,24,n?"const":"destructuring"),finishNode(t,e,r,{type:"VariableDeclarator",init:s,id:o})}function parseVariableDeclarationList(e,t,n){const r=[parseVariableDeclaration(e,t,n)];for(;consume(e,t,16777234);)r.push(parseVariableDeclaration(e,t,n));return t&Context.ForStatement&&isInOrOf(e.token)&&1!==r.length&&tolerant(e,t,26,tokenDesc(e.token)),r}function parseStatementListItem(e,t){switch(e.token){case 33566808:return parseFunctionDeclaration(e,t);case 120:case 33566797:return parseClassDeclaration(e,t);case 33574984:return parseLetOrExpressionStatement(e,t|Context.AllowIn);case 33566793:return parseVariableStatement(e,t|Context.BlockScope|Context.AllowIn);case 594028:return parseAsyncFunctionDeclarationOrStatement(e,t);case 33566810:if(t&Context.OptionsNext&&lookahead(e,t,nextTokenIsLeftParenOrPeriod))return parseExpressionStatement(e,t|Context.AllowIn);case 12371:t&Context.Module&&tolerant(e,t,34,tokenDesc(e.token));default:return parseStatement(e,t|Context.AllowSingleStatement)}}function parseStatement(e,t){switch(e.token){case 33566791:return parseVariableStatement(e,t|Context.AllowIn);case 17825809:return parseEmptyStatement(e,t);case 33566814:return parseSwitchStatement(e,t);case 41943052:return parseBlockStatement(e,t);case 12380:return parseReturnStatement(e,t);case 12377:return parseIfStatement(e,t);case 12369:return parseDoWhileStatement(e,t);case 12386:return parseWhileStatement(e,t);case 12387:return parseWithStatement(e,t);case 12362:return parseBreakStatement(e,t);case 12366:return parseContinueStatement(e,t);case 12367:return parseDebuggerStatement(e,t);case 302002272:return parseThrowStatement(e,t);case 12385:return parseTryStatement(e,t|Context.DisallowEscapedKeyword);case 12374:return parseForStatement(e,t|Context.ForStatement);case 594028:return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)&&tolerant(e,t,35),parseExpressionOrLabelledStatement(e,t|Context.AllowSingleStatement);case 33566808:tolerant(e,t,t&Context.Strict?19:20);case 33566797:tolerant(e,t,21,tokenDesc(e.token));default:return parseExpressionOrLabelledStatement(e,t)}}function parseEmptyStatement(e,t){const n=getLocation(e);return nextToken(e,t),finishNode(t,e,n,{type:"EmptyStatement"})}function parseContinueStatement(e,t){const n=getLocation(e);nextToken(e,t),e.flags&(Flags.InSwitchStatement|Flags.InIterationStatement)||tolerant(e,t,30,tokenDesc(e.token));let r=null;if(!(e.flags&Flags.NewLine)&&135168&e.token){const{tokenValue:n}=e;r=parseIdentifier(e,t),validateBreakOrContinueLabel(e,t,n,!0)}return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ContinueStatement",label:r})}function parseBreakStatement(e,t){const n=getLocation(e);nextToken(e,t);let r=null;if(!(e.flags&Flags.NewLine)&&135168&e.token){const{tokenValue:n}=e;r=parseIdentifier(e,t),validateBreakOrContinueLabel(e,t,n,!1)}else e.flags&(Flags.InSwitchStatement|Flags.InIterationStatement)||tolerant(e,t,30,"break");return consumeSemicolon(e,t),finishNode(t,e,n,{type:"BreakStatement",label:r})}function parseIfStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"IfStatement",test:r,consequent:parseConsequentOrAlternate(e,t|Context.DisallowEscapedKeyword),alternate:consume(e,t,12370)?parseConsequentOrAlternate(e,t):null})}function parseConsequentOrAlternate(e,t){return t&Context.Strict||33566808!==e.token?parseStatement(e,t&~Context.AllowSingleStatement):parseFunctionDeclaration(e,t)}function parseDebuggerStatement(e,t){const n=getLocation(e);return nextToken(e,t),consumeSemicolon(e,t),finishNode(t,e,n,{type:"DebuggerStatement"})}function parseTryStatement(e,t){const n=getLocation(e);nextToken(e,t);const r=parseBlockStatement(e,t),a=12364===e.token?parseCatchBlock(e,t):null,o=consume(e,t,12373)?parseBlockStatement(e,t):null;return a||o||tolerant(e,t,79),finishNode(t,e,n,{type:"TryStatement",block:r,handler:a,finalizer:o})}function parseCatchBlock(e,t){const n=getLocation(e);nextToken(e,t);let r=null;if(consume(e,t,50331659)){const n=[];r=parseBindingIdentifierOrPattern(e,t,n),validateParams(e,t,n),expect(e,t,16)}return finishNode(t,e,n,{type:"CatchClause",param:r,body:parseBlockStatement(e,t)})}function parseThrowStatement(e,t){const n=getLocation(e);nextToken(e,t),e.flags&Flags.NewLine&&tolerant(e,t,80);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ThrowStatement",argument:r})}function parseExpressionStatement(e,t){const n=getLocation(e),r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:r})}function parseDirective(e,t){const n=getLocation(e),r=e.tokenRaw.slice(1,-1),a=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:a,directive:r})}function parseExpressionOrLabelledStatement(e,t){const n=getLocation(e),{tokenValue:r,token:a}=e,o=parseExpression(e,t&~(Context.AllowSingleStatement|Context.AllowDecorator)|Context.AllowIn);if(135168&a&&16777237===e.token){t&Context.Yield&&1073741824&a&&tolerant(e,t,57),expect(e,t,16777237,83),hasLabel(e,r)&&tolerant(e,t,29,r),addLabel(e,r);const s=!(t&Context.Strict)&&t&Context.AllowSingleStatement&&33566808===e.token?parseFunctionDeclaration(e,t):parseStatement(e,t);return popLabel(e,r),finishNode(t,e,n,{type:"LabeledStatement",label:o,body:s})}return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExpressionStatement",expression:o})}function parseDoWhileStatement(e,t){const n=getLocation(e);nextToken(e,t);const r=parseIterationStatement(e,t);expect(e,t,12386),expect(e,t,50331659);const a=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),consume(e,t,17825809),finishNode(t,e,n,{type:"DoWhileStatement",body:r,test:a})}function parseWhileStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"WhileStatement",test:r,body:parseIterationStatement(e,t)})}function parseBlockStatement(e,t){const n=getLocation(e),r=[];for(expect(e,t,41943052);17825807!==e.token;)r.push(parseStatementListItem(e,t));return expect(e,t,17825807),finishNode(t,e,n,{type:"BlockStatement",body:r})}function parseReturnStatement(e,t){const n=getLocation(e);t&(Context.OptionsGlobalReturn|Context.InFunctionBody)||tolerant(e,t,18),e.flags&Flags.EscapedKeyword&&tolerant(e,t,3),nextToken(e,t);const r=1048576&e.token||e.flags&Flags.NewLine?null:parseExpression(e,t&~(Context.InFunctionBody|Context.AllowDecorator)|Context.AllowIn);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ReturnStatement",argument:r})}function parseIterationStatement(e,t){const n=e.flags;e.flags|=Flags.InIterationStatement|Flags.AllowDestructuring;const r=parseStatement(e,t&~Context.AllowSingleStatement|Context.DisallowEscapedKeyword);return e.flags=n,r}function parseWithStatement(e,t){t&Context.Strict&&tolerant(e,t,37);const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);return expect(e,t,16),finishNode(t,e,n,{type:"WithStatement",object:r,body:parseStatement(e,t&~Context.AllowSingleStatement)})}function parseSwitchStatement(e,t){const n=getLocation(e);nextToken(e,t),expect(e,t,50331659);const r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn);expect(e,t,16),expect(e,t|Context.DisallowEscapedKeyword,41943052);const a=[],o=e.flags;e.flags|=Flags.InSwitchStatement;let s=!1;for(;17825807!==e.token;){const n=parseCaseOrDefaultClauses(e,t);a.push(n),null===n.test&&(s&&tolerant(e,t,33),s=!0)}return e.flags=o,expect(e,t,17825807),finishNode(t,e,n,{type:"SwitchStatement",discriminant:r,cases:a})}function parseCaseOrDefaultClauses(e,t){const n=getLocation(e);let r=null;consume(e,t,12363)?r=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn):expect(e,t,12368),expect(e,t,16777237);const a=[];for(;!isEndOfCaseOrDefaultClauses(e);)a.push(parseStatementListItem(e,t|Context.AllowIn));return finishNode(t,e,n,{type:"SwitchCase",test:r,consequent:a})}function parseVariableStatement(e,t,n=!0){const r=getLocation(e),{token:a}=e,o=33566793===a;nextToken(e,t);const s=parseVariableDeclarationList(e,t,o);return n&&consumeSemicolon(e,t),finishNode(t,e,r,{type:"VariableDeclaration",kind:tokenDesc(a),declarations:s})}function parseLetOrExpressionStatement(e,t,n=!0){return lookahead(e,t,isLexical)?parseVariableStatement(e,t|Context.BlockScope,n):parseExpressionOrLabelledStatement(e,t)}function parseAsyncFunctionDeclarationOrStatement(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t):parseStatement(e,t)}function parseForStatement(e,t){const n=getLocation(e);expect(e,t,12374);const r=!!(t&Context.Async&&consume(e,t,34017389));expect(e,t|Context.DisallowEscapedKeyword,50331659);const{token:a}=e;let o,s=null,i=null,c=null,l="ForStatement",p=null,u=null;33566793===a||33574984===a&&lookahead(e,t,isLexical)?c=parseVariableStatement(e,t&~Context.AllowIn|Context.BlockScope,!1):33566791===a?c=parseVariableStatement(e,t&~Context.AllowIn,!1):17825809!==a&&(i=getLocation(e),s=restoreExpressionCoverGrammar(e,t&~Context.AllowIn|Context.DisallowEscapedKeyword,parseAssignmentExpression)),consume(e,t,69746)?(l="ForOfStatement",s?(e.flags&Flags.AllowDestructuring&&"AssignmentExpression"!==s.type||tolerant(e,t,73),reinterpret(e,t,s)):s=c,o=parseAssignmentExpression(e,t|Context.AllowIn)):consume(e,t,167786289)?(s?(e.flags&Flags.AllowDestructuring||tolerant(e,t,73),reinterpret(e,t,s)):s=c,l="ForInStatement",o=parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn)):(16777234===e.token&&(s=parseSequenceExpression(e,t,s,i)),c&&(s=c),expect(e,t,17825809),p=17825809!==e.token?parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn):null,expect(e,t,17825809),u=16!==e.token?parseExpression(e,t&~Context.AllowDecorator|Context.AllowIn):null),expect(e,t,16);const d=parseIterationStatement(e,t);return finishNode(t,e,n,"ForOfStatement"===l?{type:l,body:d,left:s,right:o,await:r}:o?{type:l,body:d,left:s,right:o}:{type:l,body:d,init:s,test:p,update:u})}function parseModuleItemList(e,t){nextToken(e,t);const n=[];for(;1048576!==e.token;)n.push(33554435===e.token?parseDirective(e,t):parseModuleItem(e,t|Context.AllowIn));return n}function parseModuleItem(e,t){switch(e.token){case 120:return parseDecorators(e,t);case 12371:return parseExportDeclaration(e,t);case 33566810:if(!(t&Context.OptionsNext&&lookahead(e,t,nextTokenIsLeftParenOrPeriod)))return parseImportDeclaration(e,t);default:return parseStatementListItem(e,t)}}function parseExportDeclaration(e,t){const n=getLocation(e),r=[];let a=null,o=null;switch(expect(e,t|Context.DisallowEscapedKeyword,12371),e.token){case 167774771:return parseExportAllDeclaration(e,t,n);case 12368:return parseExportDefault(e,t,n);case 41943052:{expect(e,t,41943052);let n=!1;for(;17825807!==e.token;)69743!==e.token&&12288&e.token&&(n=!0,setPendingError(e)),r.push(parseNamedExportDeclaration(e,t)),17825807!==e.token&&expect(e,t,16777234);expect(e,t|Context.DisallowEscapedKeyword,17825807),69745===e.token?a=parseModuleSpecifier(e,t):n&&tolerant(e,t,46),consumeSemicolon(e,t);break}case 33566797:o=parseClassDeclaration(e,t);break;case 33574984:case 33566793:o=parseVariableStatement(e,t|Context.BlockScope);break;case 33566791:o=parseVariableStatement(e,t);break;case 33566808:o=parseFunctionDeclaration(e,t);break;case 594028:if(lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)){o=parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t);break}default:report(e,1,tokenDesc(e.token))}return finishNode(t,e,n,{type:"ExportNamedDeclaration",source:a,specifiers:r,declaration:o})}function parseExportAllDeclaration(e,t,n){expect(e,t,167774771);const r=parseModuleSpecifier(e,t);return consumeSemicolon(e,t),finishNode(t,e,n,{type:"ExportAllDeclaration",source:r})}function parseNamedExportDeclaration(e,t){const n=getLocation(e),r=parseIdentifierName(e,t|Context.DisallowEscapedKeyword,e.token);return finishNode(t,e,n,{type:"ExportSpecifier",local:r,exported:consume(e,t,167843947)?parseIdentifierName(e,t,e.token):r})}function parseExportDefault(e,t,n){let r;switch(expect(e,t|Context.DisallowEscapedKeyword,12368),e.token){case 33566808:r=parseFunctionDeclaration(e,t|Context.RequireIdentifier);break;case 120:case 33566797:r=parseClassDeclaration(e,t&~Context.AllowIn|Context.RequireIdentifier);break;case 594028:r=parseAsyncFunctionOrAssignmentExpression(e,t|Context.RequireIdentifier);break;default:r=parseAssignmentExpression(e,t|Context.AllowIn),consumeSemicolon(e,t)}return finishNode(t,e,n,{type:"ExportDefaultDeclaration",declaration:r})}function parseImportDeclaration(e,t){const n=getLocation(e);let r;expect(e,t,33566810);let a=[];return 33554435===e.token?r=parseLiteral(e,t):(a=parseImportClause(e,t|Context.DisallowEscapedKeyword),r=parseModuleSpecifier(e,t)),consumeSemicolon(e,t),finishNode(t,e,n,{type:"ImportDeclaration",specifiers:a,source:r})}function parseImportClause(e,t){const n=[];switch(e.token){case 33685505:if(n.push(parseImportDefaultSpecifier(e,t)),consume(e,t,16777234))switch(e.token){case 167774771:parseNameSpaceImport(e,t,n);break;case 41943052:parseNamedImports(e,t,n);break;default:tolerant(e,t,1,tokenDesc(e.token))}break;case 41943052:parseNamedImports(e,t,n);break;case 167774771:parseNameSpaceImport(e,t,n);break;default:report(e,1,tokenDesc(e.token))}return n}function parseNamedImports(e,t,n){for(expect(e,t,41943052);17825807!==e.token;)n.push(parseImportSpecifier(e,t)),17825807!==e.token&&expect(e,t,16777234);expect(e,t,17825807)}function parseImportSpecifier(e,t){const n=getLocation(e),{token:r}=e,a=parseIdentifierName(e,t|Context.DisallowEscapedKeyword,r);let o;return consume(e,t,167843947)?o=parseBindingIdentifier(e,t):(hasBit(r,12288)&&tolerant(e,t,46),hasBit(r,4194304)&&tolerant(e,t,47),o=a),finishNode(t,e,n,{type:"ImportSpecifier",local:o,imported:a})}function parseNameSpaceImport(e,t,n){const r=getLocation(e);expect(e,t,167774771),expect(e,t,167843947,82);const a=parseBindingIdentifier(e,t);n.push(finishNode(t,e,r,{type:"ImportNamespaceSpecifier",local:a}))}function parseModuleSpecifier(e,t){return expect(e,t,69745),33554435!==e.token&&report(e,1,tokenDesc(e.token)),parseLiteral(e,t)}function parseImportDefaultSpecifier(e,t){return finishNode(t,e,getLocation(e),{type:"ImportDefaultSpecifier",local:parseIdentifier(e,t)})}function parseAsyncFunctionOrAssignmentExpression(e,t){return lookahead(e,t,nextTokenIsFuncKeywordOnSameLine)?parseAsyncFunctionOrAsyncGeneratorDeclaration(e,t|Context.RequireIdentifier):parseAssignmentExpression(e,t|Context.AllowIn)}function createParser(e,t){return{source:e,length:e.length,index:0,line:1,column:0,startIndex:0,startColumn:0,startLine:1,lastIndex:0,lastColumn:0,lastLine:0,pendingExpressionError:void 0,flags:Flags.AllowDestructuring,token:1048576,tokenRaw:"",lastValue:0,comments:[],sourceFile:t,tokenRegExp:void 0,tokenValue:void 0,labelSet:void 0,errorLocation:void 0,errors:[]}}function parseSource(e,t,n){let r="";t&&(t.module&&(n|=Context.Module),t.next&&(n|=Context.OptionsNext),t.jsx&&(n|=Context.OptionsJSX),t.ranges&&(n|=Context.OptionsRanges),t.loc&&(n|=Context.OptionsLoc),t.raw&&(n|=Context.OptionsRaw),t.rawIdentifier&&(n|=Context.OptionsRawidentifiers),t.globalReturn&&(n|=Context.OptionsGlobalReturn),t.skipShebang&&(n|=Context.OptionsShebang),t.tolerant&&(n|=Context.OptionsTolerant),t.source&&(r=t.source),t.comments&&(n|=Context.OptionsComments),t.impliedStrict&&(n|=Context.Strict),t.experimental&&(n|=Context.OptionsExperimental),t.node&&(n|=Context.OptionsNode));const a=createParser(e,r),o=n&Context.Module?parseModuleItemList(a,n):parseStatementList(a,n),s={type:"Program",sourceType:n&Context.Module?"module":"script",body:o};return n&Context.LocationTracker&&(n&Context.OptionsRanges&&(s.start=0,s.end=e.length),n&Context.OptionsLoc&&(s.loc={start:{line:1,column:0},end:{line:a.line,column:a.column}},r&&(s.loc.source=r))),n&Context.OptionsComments&&(s.comments=a.comments),n&Context.OptionsTolerant&&(s.errors=a.errors),s}function parseStatementList(e,t){const n=[];let r=!0;for(nextToken(e,t|Context.DisallowEscapedKeyword);1048576!==e.token;)r&&33554435!==e.token&&(r=!1),r?(t&Context.Strict||12!==e.tokenRaw.length||"use strict"!==e.tokenValue||(t|=Context.Strict),n.push(parseDirective(e,t))):n.push(parseStatementListItem(e,t));return n}function parse(e,t){return t&&t.module?parseModule(e,t):parseScript(e,t)}function parseScript(e,t){return parseSource(e,t,Context.Empty)}function parseModule(e,t){return parseSource(e,t,Context.Strict|Context.Module)}var estree=Object.freeze({}),index=Object.freeze({scanIdentifier:scanIdentifier,scanMaybeIdentifier:scanMaybeIdentifier,scanHexIntegerLiteral:scanHexIntegerLiteral,scanOctalOrBinary:scanOctalOrBinary,scanImplicitOctalDigits:scanImplicitOctalDigits,scanSignedInteger:scanSignedInteger,scanNumericLiteral:scanNumericLiteral,scanNumericSeparator:scanNumericSeparator,scanDecimalDigitsOrSeparator:scanDecimalDigitsOrSeparator,scanDecimalAsSmi:scanDecimalAsSmi,scanRegularExpression:scanRegularExpression,scan:scan,scanEscapeSequence:scanEscapeSequence,throwStringError:throwStringError,scanString:scanString,consumeTemplateBrace:consumeTemplateBrace,scanTemplate:scanTemplate,skipSingleHTMLComment:skipSingleHTMLComment,skipSingleLineComment:skipSingleLineComment,skipMultiLineComment:skipMultiLineComment,addComment:addComment,nextUnicodeChar:nextUnicodeChar,isIdentifierPart:isIdentifierPart,escapeInvalidCharacters:escapeInvalidCharacters,consumeOpt:consumeOpt,consumeLineFeed:consumeLineFeed,scanPrivateName:scanPrivateName,advanceNewline:advanceNewline,fromCodePoint:fromCodePoint,readNext:readNext,toHex:toHex,advanceOnMaybeAstral:advanceOnMaybeAstral}),parser=Object.freeze({parseClassDeclaration:parseClassDeclaration,parseFunctionDeclaration:parseFunctionDeclaration,parseAsyncFunctionOrAsyncGeneratorDeclaration:parseAsyncFunctionOrAsyncGeneratorDeclaration,parseVariableDeclarationList:parseVariableDeclarationList,parseExpression:parseExpression,parseSequenceExpression:parseSequenceExpression,parseAssignmentExpression:parseAssignmentExpression,parseRestElement:parseRestElement,parseLeftHandSideExpression:parseLeftHandSideExpression,parsePrimaryExpression:parsePrimaryExpression,parseIdentifier:parseIdentifier,parseLiteral:parseLiteral,parseBigIntLiteral:parseBigIntLiteral,parseIdentifierName:parseIdentifierName,parseFunctionExpression:parseFunctionExpression,parseAsyncFunctionOrAsyncGeneratorExpression:parseAsyncFunctionOrAsyncGeneratorExpression,parsePropertyName:parsePropertyName,parseObjectLiteral:parseObjectLiteral,parseFormalListAndBody:parseFormalListAndBody,parseFunctionBody:parseFunctionBody,parseFormalParameters:parseFormalParameters,parseFormalParameterList:parseFormalParameterList,parseClassBodyAndElementList:parseClassBodyAndElementList,parseClassElement:parseClassElement,parseDecorators:parseDecorators,parseModuleItemList:parseModuleItemList,parseModuleItem:parseModuleItem,parseExportDeclaration:parseExportDeclaration,parseImportDeclaration:parseImportDeclaration,createParser:createParser,parseSource:parseSource,parseStatementList:parseStatementList,parse:parse,parseScript:parseScript,parseModule:parseModule,parseBindingIdentifierOrPattern:parseBindingIdentifierOrPattern,parseBindingIdentifier:parseBindingIdentifier,parseAssignmentRestElement:parseAssignmentRestElement,parseAssignmentPattern:parseAssignmentPattern,parseBindingInitializer:parseBindingInitializer,parseStatementListItem:parseStatementListItem,parseStatement:parseStatement,parseEmptyStatement:parseEmptyStatement,parseContinueStatement:parseContinueStatement,parseBreakStatement:parseBreakStatement,parseIfStatement:parseIfStatement,parseDebuggerStatement:parseDebuggerStatement,parseTryStatement:parseTryStatement,parseCatchBlock:parseCatchBlock,parseThrowStatement:parseThrowStatement,parseExpressionStatement:parseExpressionStatement,parseDirective:parseDirective,parseExpressionOrLabelledStatement:parseExpressionOrLabelledStatement,parseDoWhileStatement:parseDoWhileStatement,parseWhileStatement:parseWhileStatement,parseBlockStatement:parseBlockStatement,parseReturnStatement:parseReturnStatement,parseIterationStatement:parseIterationStatement,parseWithStatement:parseWithStatement,parseSwitchStatement:parseSwitchStatement,parseCaseOrDefaultClauses:parseCaseOrDefaultClauses,parseVariableStatement:parseVariableStatement,parseJSXRootElement:parseJSXRootElement,parseJSXOpeningElement:parseJSXOpeningElement,nextJSXToken:nextJSXToken,scanJSXToken:scanJSXToken,parseJSXText:parseJSXText,parseJSXAttributes:parseJSXAttributes,parseJSXSpreadAttribute:parseJSXSpreadAttribute,parseJSXNamespacedName:parseJSXNamespacedName,parseJSXAttributeName:parseJSXAttributeName,parseJSXAttribute:parseJSXAttribute,parseJSXEmptyExpression:parseJSXEmptyExpression,parseJSXSpreadChild:parseJSXSpreadChild,parseJSXExpressionContainer:parseJSXExpressionContainer,parseJSXExpression:parseJSXExpression,parseJSXClosingFragment:parseJSXClosingFragment,parseJSXClosingElement:parseJSXClosingElement,parseJSXIdentifier:parseJSXIdentifier,parseJSXMemberExpression:parseJSXMemberExpression,parseJSXElementName:parseJSXElementName,scanJSXIdentifier:scanJSXIdentifier});const Parser=parser,version="1.6.9";export{version,estree as ESTree,index as Scanner,parse,parseSource,parseModule,parseScript,characterType,errorMessages,constructError,report,tolerant,tokenDesc,descKeyword,Parser,isValidIdentifierPart,isValidIdentifierStart,mustEscape,Context,Flags,Labels,NumericState,ScannerState,ModifierState,CoverParenthesizedState,Escape,RegexFlags,CoverCallState,RegexState,ObjectState,validateBreakOrContinueLabel,addLabel,popLabel,hasLabel,finishNode,expect,consume,nextToken,hasBit,consumeSemicolon,parseExpressionCoverGrammar,restoreExpressionCoverGrammar,swapContext,validateParams,reinterpret,lookahead,isValidSimpleAssignmentTarget,getLocation,isValidIdentifier,isLexical,isEndOfCaseOrDefaultClauses,nextTokenIsLeftParenOrPeriod,nextTokenisIdentifierOrParen,nextTokenIsLeftParen,nextTokenIsFuncKeywordOnSameLine,isPropertyWithPrivateFieldKey,parseAndClassifyIdentifier,nameIsArgumentsOrEval,setPendingError,isEqualTagNames,isInstanceField,validateUpdateExpression,setPendingExpressionError,validateCoverParenthesizedExpression,validateAsyncArgumentList,isInOrOf}; diff --git a/node_modules/cherow/dist/system/cherow.js b/node_modules/cherow/dist/system/cherow.js new file mode 100644 index 0000000..b360863 --- /dev/null +++ b/node_modules/cherow/dist/system/cherow.js @@ -0,0 +1,7346 @@ +System.register('cherow', [], function (exports, module) { + 'use strict'; + return { + execute: function () { + + exports({ + parse: parse, + parseSource: parseSource, + parseModule: parseModule, + parseScript: parseScript, + constructError: constructError, + report: report, + tolerant: tolerant, + tokenDesc: tokenDesc, + descKeyword: descKeyword, + isValidIdentifierPart: isValidIdentifierPart, + isValidIdentifierStart: isValidIdentifierStart, + mustEscape: mustEscape, + Context: void 0, + Flags: void 0, + Labels: void 0, + NumericState: void 0, + ScannerState: void 0, + ModifierState: void 0, + CoverParenthesizedState: void 0, + Escape: void 0, + RegexFlags: void 0, + CoverCallState: void 0, + RegexState: void 0, + ObjectState: void 0, + validateBreakOrContinueLabel: validateBreakOrContinueLabel, + addLabel: addLabel, + popLabel: popLabel, + hasLabel: hasLabel, + finishNode: finishNode, + expect: expect, + consume: consume, + nextToken: nextToken, + consumeSemicolon: consumeSemicolon, + parseExpressionCoverGrammar: parseExpressionCoverGrammar, + restoreExpressionCoverGrammar: restoreExpressionCoverGrammar, + swapContext: swapContext, + validateParams: validateParams, + lookahead: lookahead, + isValidSimpleAssignmentTarget: isValidSimpleAssignmentTarget, + getLocation: getLocation, + isValidIdentifier: isValidIdentifier, + isLexical: isLexical, + isEndOfCaseOrDefaultClauses: isEndOfCaseOrDefaultClauses, + nextTokenIsLeftParenOrPeriod: nextTokenIsLeftParenOrPeriod, + nextTokenisIdentifierOrParen: nextTokenisIdentifierOrParen, + nextTokenIsLeftParen: nextTokenIsLeftParen, + nextTokenIsFuncKeywordOnSameLine: nextTokenIsFuncKeywordOnSameLine, + isPropertyWithPrivateFieldKey: isPropertyWithPrivateFieldKey, + parseAndClassifyIdentifier: parseAndClassifyIdentifier, + nameIsArgumentsOrEval: nameIsArgumentsOrEval, + setPendingError: setPendingError, + isEqualTagNames: isEqualTagNames, + isInstanceField: isInstanceField, + validateUpdateExpression: validateUpdateExpression, + setPendingExpressionError: setPendingExpressionError, + validateCoverParenthesizedExpression: validateCoverParenthesizedExpression, + validateAsyncArgumentList: validateAsyncArgumentList, + isInOrOf: isInOrOf + }); + + // Note: this *must* be kept in sync with the enum's order.
+ //
+ // It exploits the enum value ordering, and it's necessarily a complete and
+ // utter hack.
+ //
+ // All to lower it to a single monomorphic array access.
+ const keywordDescTable = [
+ 'end of source',
+ /* Constants/Bindings */
+ 'identifier', 'number', 'string', 'regular expression',
+ 'false', 'true', 'null',
+ /* Template nodes */
+ 'template continuation', 'template end',
+ /* Punctuators */
+ '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '</', '/>',
+ /* Update operators */
+ '++', '--',
+ /* Assign operators */
+ '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
+ '&=',
+ /* Unary/binary operators */
+ 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
+ '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
+ /* Variable declaration kinds */
+ 'var', 'let', 'const',
+ /* Other reserved words */
+ 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
+ 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
+ 'this', 'throw', 'try', 'while', 'with',
+ /* Strict mode reserved words */
+ 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
+ /* Contextual keywords */
+ 'as', 'async', 'await', 'constructor', 'get', 'set', 'from', 'of',
+ '#',
+ 'eval', 'arguments', 'enum', 'BigInt', '@', 'JSXText',
+ /** TS */
+ 'KeyOf', 'ReadOnly', 'is', 'unique', 'declare', 'type', 'namespace', 'abstract', 'module',
+ 'global', 'require', 'target'
+ ];
+ /**
+ * The conversion function between token and its string description/representation.
+ */
+ function tokenDesc(token) {
+ return keywordDescTable[token & 255 /* Type */];
+ }
+ // Used `Object.create(null)` to avoid potential `Object.prototype`
+ // interference.
+ const descKeywordTable = Object.create(null, {
+ this: { value: 33566815 /* ThisKeyword */ },
+ function: { value: 33566808 /* FunctionKeyword */ },
+ if: { value: 12377 /* IfKeyword */ },
+ return: { value: 12380 /* ReturnKeyword */ },
+ var: { value: 33566791 /* VarKeyword */ },
+ else: { value: 12370 /* ElseKeyword */ },
+ for: { value: 12374 /* ForKeyword */ },
+ new: { value: 33566811 /* NewKeyword */ },
+ in: { value: 167786289 /* InKeyword */ },
+ typeof: { value: 302002218 /* TypeofKeyword */ },
+ while: { value: 12386 /* WhileKeyword */ },
+ case: { value: 12363 /* CaseKeyword */ },
+ break: { value: 12362 /* BreakKeyword */ },
+ try: { value: 12385 /* TryKeyword */ },
+ catch: { value: 12364 /* CatchKeyword */ },
+ delete: { value: 302002219 /* DeleteKeyword */ },
+ throw: { value: 302002272 /* ThrowKeyword */ },
+ switch: { value: 33566814 /* SwitchKeyword */ },
+ continue: { value: 12366 /* ContinueKeyword */ },
+ default: { value: 12368 /* DefaultKeyword */ },
+ instanceof: { value: 167786290 /* InstanceofKeyword */ },
+ do: { value: 12369 /* DoKeyword */ },
+ void: { value: 302002220 /* VoidKeyword */ },
+ finally: { value: 12373 /* FinallyKeyword */ },
+ arguments: { value: 37879925 /* Arguments */ },
+ keyof: { value: 131194 /* KeyOfKeyword */ },
+ readonly: { value: 131195 /* ReadOnlyKeyword */ },
+ unique: { value: 131197 /* UniqueKeyword */ },
+ declare: { value: 131198 /* DeclareKeyword */ },
+ async: { value: 594028 /* AsyncKeyword */ },
+ await: { value: 34017389 /* AwaitKeyword */ },
+ class: { value: 33566797 /* ClassKeyword */ },
+ const: { value: 33566793 /* ConstKeyword */ },
+ constructor: { value: 69742 /* ConstructorKeyword */ },
+ debugger: { value: 12367 /* DebuggerKeyword */ },
+ enum: { value: 12406 /* EnumKeyword */ },
+ eval: { value: 37879924 /* Eval */ },
+ export: { value: 12371 /* ExportKeyword */ },
+ extends: { value: 12372 /* ExtendsKeyword */ },
+ false: { value: 33566725 /* FalseKeyword */ },
+ from: { value: 69745 /* FromKeyword */ },
+ get: { value: 69743 /* GetKeyword */ },
+ implements: { value: 20579 /* ImplementsKeyword */ },
+ import: { value: 33566810 /* ImportKeyword */ },
+ interface: { value: 20580 /* InterfaceKeyword */ },
+ let: { value: 33574984 /* LetKeyword */ },
+ null: { value: 33566727 /* NullKeyword */ },
+ of: { value: 69746 /* OfKeyword */ },
+ package: { value: 20581 /* PackageKeyword */ },
+ private: { value: 20582 /* PrivateKeyword */ },
+ protected: { value: 20583 /* ProtectedKeyword */ },
+ public: { value: 20584 /* PublicKeyword */ },
+ set: { value: 69744 /* SetKeyword */ },
+ static: { value: 20585 /* StaticKeyword */ },
+ super: { value: 33566813 /* SuperKeyword */ },
+ true: { value: 33566726 /* TrueKeyword */ },
+ with: { value: 12387 /* WithKeyword */ },
+ yield: { value: 1107316842 /* YieldKeyword */ },
+ is: { value: 131196 /* IsKeyword */ },
+ type: { value: 131199 /* TypeKeyword */ },
+ namespace: { value: 131200 /* NameSpaceKeyword */ },
+ abstract: { value: 131201 /* AbstractKeyword */ },
+ as: { value: 167843947 /* AsKeyword */ },
+ module: { value: 131202 /* ModuleKeyword */ },
+ global: { value: 131203 /* GlobalKeyword */ },
+ require: { value: 131204 /* RequireKeyword */ },
+ target: { value: 131205 /* TargetKeyword */ },
+ });
+ function descKeyword(value) {
+ return (descKeywordTable[value] | 0);
+ } + + /*@internal*/
+ const characterType = exports('characterType', [
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 16 /* Space */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ ]); + + // Unicode v. 11 support
+ // tslint:disable
+ function isValidIdentifierPart(code) {
+ return (convert[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
+ }
+ function isValidIdentifierStart(code) {
+ return (convert[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
+ }
+ function mustEscape(code) {
+ return (convert[(code >>> 5) + 69632] >>> code & 31 & 1) !== 0;
+ }
+ const convert = ((compressed, lookup) => {
+ const result = new Uint32Array(104448);
+ let index = 0;
+ let subIndex = 0;
+ while (index < 3392) {
+ const inst = compressed[index++];
+ if (inst < 0) {
+ subIndex -= inst;
+ }
+ else {
+ let code = compressed[index++];
+ if (inst & 2)
+ code = lookup[code];
+ if (inst & 1) {
+ result.fill(code, subIndex, subIndex += compressed[index++]);
+ }
+ else {
+ result[subIndex++] = code;
+ }
+ }
+ }
+ return result;
+ })([-1, 2, 28, 2, 29, 2, 5, -1, 0, 77595648, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 15, 2, 60, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 61, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 20, 2, 0, 0, 608174079, 2, 0, 2, 127, 2, 6, 2, 62, -1, 2, 64, 2, 26, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2965387679, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 2, 171, 0, 4294828031, 0, 3825204735, 0, 123747807, 0, 65487, 2, 3, 0, 4092591615, 0, 1080049119, 0, 458703, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247020, 2, 68, 0, 4284449919, 0, 851904, 2, 4, 2, 16, 0, 67076095, -1, 2, 69, 0, 1006628014, 0, 4093591391, -1, 0, 50331649, 0, 3265266687, 2, 34, 0, 4294844415, 0, 4278190047, 2, 23, 2, 125, -1, 3, 0, 2, 2, 33, 2, 0, 2, 9, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 10, 0, 261632, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 2088959, 2, 31, 2, 8, 0, 909311, 3, 0, 2, 0, 814743551, 2, 42, 0, 67057664, 3, 0, 2, 2, 45, 2, 0, 2, 32, 2, 0, 2, 18, 2, 7, 0, 268374015, 2, 30, 2, 51, 2, 0, 2, 78, 0, 134153215, -1, 2, 6, 2, 0, 2, 7, 0, 2684354559, 0, 67044351, 0, 1073676416, -2, 3, 0, 2, 2, 43, 0, 1046528, 3, 0, 3, 2, 8, 2, 0, 2, 41, 0, 4294960127, 2, 9, 2, 39, 2, 10, 0, 4294377472, 2, 21, 3, 0, 7, 0, 4227858431, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -1, 2, 122, 0, 1048577, 2, 84, 2, 12, -1, 2, 12, 0, 131042, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 1046559, 2, 0, 2, 13, 2, 0, 0, 2147516671, 2, 24, 3, 88, 2, 2, 0, -16, 2, 89, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 2, 119, 2, 0, 0, 3220242431, 3, 0, 3, 2, 20, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 2, 0, 2, 27, 2, 0, 2, 8, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 25, 2, 8, 2, 23, 3, 0, 2, 0, 67076097, 2, 7, 2, 0, 2, 24, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 3774349439, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, 2, 19, 0, 1638399, 2, 169, 2, 104, 3, 0, 3, 2, 23, 2, 28, 2, 29, 2, 5, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -3, 2, 146, -4, 2, 23, 2, 0, 2, 37, 0, 1, 2, 0, 2, 63, 2, 32, 2, 16, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 33, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277137519, 0, 2269118463, -1, 3, 23, 2, -1, 2, 34, 2, 38, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 48, -14, 2, 23, 2, 44, 2, 37, -5, 3, 0, 2, 2, 38, 0, 2147549120, 2, 0, 2, 16, 2, 17, 2, 130, 2, 0, 2, 52, 0, 4294901872, 0, 5242879, 3, 0, 2, 0, 402595359, -1, 2, 118, 0, 1090519039, -2, 2, 120, 2, 39, 2, 0, 2, 55, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, -4, 3, 0, 2, 0, 1140787199, -1, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 41, 2, 42, -1, 2, 10, 2, 43, -6, 2, 0, 2, 16, -3, 3, 0, 2, 0, 2147484671, -8, 2, 0, 2, 7, 2, 44, 2, 0, 0, 603979727, -1, 2, 0, 2, 45, -8, 2, 54, 2, 46, 0, 67043329, 2, 123, 2, 47, 0, 8388351, -2, 2, 124, 0, 3028287487, 2, 48, 2, 126, 0, 33259519, 2, 42, -9, 2, 24, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, 2, 42, -2, 2, 17, 2, 51, 2, 0, 2, 24, 0, 67043343, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 4294901791, 2, 7, 2, 164, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 0, 1677656575, -166, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 90, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -42, 0, 4194303871, 0, 2011, -62, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 55, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -22583, 3, 0, 7, 2, 19, -6130, 3, 5, 2, -1, 0, 69207040, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 15, 2, 60, 2, 0, 2, 35, -1, 2, 17, 2, 61, -1, 2, 0, 2, 62, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 19, 2, 63, 3, 0, 2, 0, 131135, 2, 94, 0, 70256639, 0, 71303167, 0, 272, 2, 45, 2, 62, -1, 2, 64, -2, 2, 96, 0, 603979775, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 65, 2, 66, 0, 33554435, 2, 121, 2, 65, 2, 147, 0, 131075, 0, 3594373096, 0, 67094296, 2, 66, -1, 2, 67, 0, 603979263, 2, 156, 0, 3, 0, 4294828001, 0, 602930687, 2, 180, 0, 393219, 2, 67, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 68, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 69, 0, 537783470, 0, 4026531935, -1, 0, 1, -1, 2, 34, 2, 70, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 16, -1, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 253951, 3, 20, 2, 0, 122879, 2, 0, 2, 8, 0, 276824064, -2, 3, 0, 2, 2, 45, 2, 0, 0, 4294903295, 2, 0, 2, 18, 2, 7, -1, 2, 17, 2, 51, 2, 0, 2, 78, 2, 42, -1, 2, 24, 2, 0, 2, 31, -2, 0, 128, -2, 2, 79, 2, 8, 0, 4064, -1, 2, 117, 0, 4227907585, 2, 0, 2, 116, 2, 0, 2, 50, 2, 196, 2, 9, 2, 39, 2, 10, -1, 0, 6544896, 3, 0, 6, -2, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -3, 2, 84, 2, 12, -3, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 817183, 2, 0, 2, 13, 2, 0, 0, 33023, 2, 24, 3, 88, 2, -17, 2, 89, 0, 524157950, 2, 4, 2, 0, 2, 90, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 19, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 0, 4294965179, 0, 7, 2, 0, 2, 8, 2, 92, 2, 8, -1, 0, 1761345536, 2, 94, 2, 95, 2, 38, 2, 23, 2, 96, 2, 36, 2, 162, 0, 2080440287, 2, 0, 2, 35, 2, 138, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 7, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 2700607615, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, -3, 2, 104, 3, 0, 3, 2, 23, -1, 3, 5, 2, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -8, 2, 23, 2, 0, 2, 37, -1, 2, 0, 2, 63, 2, 32, 2, 18, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 17, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277075969, 2, 18, -1, 3, 23, 2, -1, 2, 34, 2, 139, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 50, -14, 2, 23, 2, 44, 2, 116, -5, 2, 117, 2, 41, -2, 2, 117, 2, 19, 2, 17, 2, 35, 2, 117, 2, 38, 0, 4294901776, 0, 4718591, 2, 117, 2, 36, 0, 335544350, -1, 2, 118, 2, 119, -2, 2, 120, 2, 39, 2, 7, -1, 2, 121, 2, 65, 0, 3758161920, 0, 3, -4, 2, 0, 2, 31, 2, 174, -1, 2, 0, 2, 19, 0, 176, -5, 2, 0, 2, 49, 2, 182, -1, 2, 0, 2, 19, 2, 194, -1, 2, 0, 2, 62, -2, 2, 16, -7, 2, 0, 2, 119, -3, 3, 0, 2, 2, 122, -8, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871887, -1, 2, 0, 2, 45, -8, 2, 54, 2, 49, 0, 1, 2, 123, 2, 19, -3, 2, 124, 2, 37, 2, 125, 2, 126, 0, 16778239, -10, 2, 36, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, -3, 2, 17, 2, 127, 2, 0, 2, 19, 2, 50, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 65567, -1, 2, 26, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 2, 130, -187, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 2, 138, -129, 3, 0, 6, 2, 139, -1, 3, 0, 2, 2, 50, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -28719, 2, 0, 0, 1, -1, 2, 122, 2, 0, 0, 8193, -21, 0, 50331648, 0, 10255, 0, 4, -11, 2, 66, 2, 168, -1, 0, 71680, -1, 2, 157, 0, 4292900864, 0, 805306431, -5, 2, 146, -1, 2, 176, -1, 0, 6144, -2, 2, 123, -1, 2, 150, -1, 2, 153, 2, 147, 2, 161, 2, 0, 0, 3223322624, 2, 36, 0, 4, -4, 2, 188, 0, 205128192, 0, 1333757536, 0, 2147483696, 0, 423953, 0, 747766272, 0, 2717763192, 0, 4286578751, 0, 278545, 2, 148, 0, 4294886464, 0, 33292336, 0, 417809, 2, 148, 0, 1329579616, 0, 4278190128, 0, 700594195, 0, 1006647527, 0, 4286497336, 0, 4160749631, 2, 149, 0, 469762560, 0, 4171219488, 0, 16711728, 2, 149, 0, 202375680, 0, 3214918176, 0, 4294508592, 0, 139280, -1, 0, 983584, 2, 190, 0, 58720275, 0, 3489923072, 0, 10517376, 0, 4293066815, 0, 1, 0, 2013265920, 2, 175, 2, 0, 0, 17816169, 0, 3288339281, 0, 201375904, 2, 0, -2, 0, 256, 0, 122880, 0, 16777216, 2, 146, 0, 4160757760, 2, 0, -6, 2, 163, -11, 0, 3263218176, -1, 0, 49664, 0, 2160197632, 0, 8388802, -1, 0, 12713984, -1, 2, 150, 2, 155, 2, 158, -2, 2, 159, -20, 0, 3758096385, -2, 2, 151, 0, 4292878336, 2, 22, 2, 166, 0, 4294057984, -2, 2, 160, 2, 152, 2, 172, -2, 2, 151, -1, 2, 179, -1, 2, 167, 2, 122, 0, 4026593280, 0, 14, 0, 4292919296, -1, 2, 154, 0, 939588608, -1, 0, 805306368, -1, 2, 122, 0, 1610612736, 2, 152, 2, 153, 3, 0, 2, -2, 2, 154, 2, 155, -3, 0, 267386880, -1, 2, 156, 0, 7168, -1, 0, 65024, 2, 150, 2, 157, 2, 158, -7, 2, 165, -8, 2, 159, -1, 0, 1426112704, 2, 160, -1, 2, 185, 0, 271581216, 0, 2149777408, 2, 19, 2, 157, 2, 122, 0, 851967, 0, 3758129152, -1, 2, 19, 2, 178, -4, 2, 154, -20, 2, 192, 2, 161, -56, 0, 3145728, 2, 184, -1, 2, 191, 2, 122, -1, 2, 162, 2, 122, -4, 0, 32505856, -1, 2, 163, -1, 0, 2147385088, 2, 22, 1, 2155905152, 2, -3, 2, 164, 2, 0, 2, 165, -2, 2, 166, -6, 2, 167, 0, 4026597375, 0, 1, -1, 0, 1, -1, 2, 168, -3, 2, 139, 2, 66, -2, 2, 162, 2, 177, -1, 2, 173, 2, 122, -6, 2, 122, -213, 2, 167, -657, 2, 17, -36, 2, 169, -1, 2, 186, -10, 0, 4294963200, -5, 2, 170, -5, 2, 158, 2, 0, 2, 24, -1, 0, 4227919872, -1, 2, 170, -2, 0, 4227874752, -3, 0, 2146435072, 2, 155, -2, 0, 1006649344, 2, 122, -1, 2, 22, 0, 201375744, -3, 0, 134217720, 2, 22, 0, 4286677377, 0, 32896, -1, 2, 171, -3, 2, 172, -349, 2, 173, 2, 174, 2, 175, 3, 0, 264, -11, 2, 176, -2, 2, 158, 2, 0, 0, 520617856, 0, 2692743168, 0, 36, -3, 0, 524284, -11, 2, 19, -1, 2, 183, -1, 2, 181, 0, 3221291007, 2, 158, -1, 0, 524288, 0, 2158720, -3, 2, 155, 0, 1, -4, 2, 122, 0, 3808625411, 0, 3489628288, 0, 4096, 0, 1207959680, 0, 3221274624, 2, 0, -3, 2, 177, 0, 120, 0, 7340032, -2, 0, 4026564608, 2, 4, 2, 19, 2, 160, 3, 0, 4, 2, 155, -1, 2, 178, 2, 175, -1, 0, 8176, 2, 179, 2, 177, 2, 180, -1, 0, 4290773232, 2, 0, -4, 2, 160, 2, 187, 0, 15728640, 2, 175, -1, 2, 157, -1, 0, 4294934512, 3, 0, 4, -9, 2, 22, 2, 167, 2, 181, 3, 0, 4, 0, 704, 0, 1849688064, 0, 4194304, -1, 2, 122, 0, 4294901887, 2, 0, 0, 130547712, 0, 1879048192, 0, 2080374784, 3, 0, 2, -1, 2, 182, 2, 183, -1, 0, 17829776, 0, 2025848832, 0, 4261477888, -2, 2, 0, -1, 0, 4286580608, -1, 0, 29360128, 2, 184, 0, 16252928, 0, 3791388672, 2, 39, 3, 0, 2, -2, 2, 193, 2, 0, -1, 2, 26, -1, 0, 66584576, -1, 2, 189, 3, 0, 9, 2, 122, 3, 0, 4, -1, 2, 157, 2, 158, 3, 0, 5, -2, 0, 245760, 0, 2147418112, -1, 2, 146, 2, 199, 0, 4227923456, -1, 2, 185, 2, 186, 2, 22, -2, 2, 176, 0, 4292870145, 0, 262144, 2, 122, 3, 0, 2, 0, 1073758848, 2, 187, -1, 0, 4227921920, 2, 188, 0, 68289024, 0, 528402016, 0, 4292927536, 3, 0, 4, -2, 0, 2483027968, 2, 0, -2, 2, 189, 3, 0, 5, -1, 2, 184, 2, 160, 2, 0, -2, 0, 4227923936, 2, 63, -1, 2, 170, 2, 94, 2, 0, 2, 150, 2, 154, 3, 0, 6, -1, 2, 175, 3, 0, 3, -2, 0, 2146959360, 3, 0, 8, -2, 2, 157, -1, 2, 190, 2, 117, -1, 2, 151, 3, 0, 8, 2, 191, 0, 8388608, 2, 171, 2, 169, 2, 183, 0, 4286578944, 3, 0, 2, 0, 1152, 0, 1266679808, 2, 189, 0, 576, 0, 4261707776, 2, 94, 3, 0, 9, 2, 151, 3, 0, 8, -28, 2, 158, 3, 0, 3, -3, 0, 4292902912, -6, 2, 96, 3, 0, 85, -33, 2, 164, 3, 0, 126, -18, 2, 192, 3, 0, 269, -17, 2, 151, 2, 122, 0, 4294917120, 3, 0, 2, 2, 19, 0, 4290822144, -2, 0, 67174336, 0, 520093700, 2, 17, 3, 0, 21, -2, 2, 177, 3, 0, 3, -2, 0, 65504, 2, 122, 2, 49, 3, 0, 2, 2, 92, -191, 2, 123, -23, 2, 26, 3, 0, 296, -8, 2, 122, 3, 0, 2, 2, 19, -11, 2, 175, 3, 0, 72, -3, 0, 3758159872, 0, 201391616, 3, 0, 155, -7, 2, 167, -1, 0, 384, -1, 0, 133693440, -3, 2, 193, -2, 2, 30, 3, 0, 4, 2, 166, -2, 2, 22, 2, 151, 3, 0, 4, -2, 2, 185, -1, 2, 146, 0, 335552923, 2, 194, -1, 0, 538974272, 0, 2214592512, 0, 132000, -10, 0, 192, -8, 0, 12288, -21, 0, 134213632, 0, 4294901761, 3, 0, 42, 0, 100663424, 0, 4294965284, 3, 0, 62, -6, 0, 4286578784, 2, 0, -2, 0, 1006696448, 3, 0, 24, 2, 37, -1, 2, 195, 3, 0, 10, 2, 194, 0, 4110942569, 0, 1432950139, 0, 2701658217, 0, 4026532864, 0, 4026532881, 2, 0, 2, 47, 3, 0, 8, -1, 2, 154, -2, 2, 166, 0, 98304, 0, 65537, 2, 167, 2, 169, -2, 2, 154, -1, 2, 63, 2, 0, 2, 116, 2, 197, 2, 175, 0, 4294770176, 2, 30, 3, 0, 4, -30, 2, 195, 2, 196, -3, 2, 166, -2, 2, 151, 2, 0, 2, 154, -1, 2, 189, -1, 2, 157, 2, 198, 3, 0, 2, 2, 154, 2, 122, -1, 0, 193331200, -1, 0, 4227923960, 2, 197, -1, 3, 0, 3, 2, 198, 3, 0, 44, -1334, 2, 22, 2, 0, -129, 2, 195, -6, 2, 160, -180, 2, 199, -233, 2, 4, 3, 0, 96, -16, 2, 160, 3, 0, 22583, -7, 2, 17, 3, 0, 6128], [4294967295, 4294967291, 4092460543, 4294828015, 4294967294, 134217726, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 1061158911, 536805376, 4294910143, 4160749567, 4294901759, 134217727, 4294901760, 4194303, 65535, 262143, 67108863, 4286578688, 536870911, 8388607, 4294918143, 4294443008, 255, 67043328, 2281701374, 4294967232, 2097151, 4294903807, 4294902783, 4294967039, 511, 524287, 131071, 127, 4294902271, 4294549487, 16777215, 1023, 67047423, 4294901888, 33554431, 4286578687, 4294770687, 67043583, 32767, 15, 2047999, 4292870143, 4294934527, 4294966783, 67045375, 4294967279, 262083, 20511, 4290772991, 41943039, 493567, 2047, 4294959104, 1071644671, 602799615, 65536, 4294828000, 805044223, 4277151126, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 4294967264, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4294967292, 4294965759, 4294966272, 4294901823, 4294967280, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 268369920, 4292804608, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4294966591, 2445279231, 3670015, 3238002687, 63, 4294967288, 4294705151, 4095, 3221208447, 4294549472, 2147483648, 4294705152, 4294966143, 64, 4294966719, 16383, 3774873592, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4087, 31, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 536870912, 2952790016, 202506752, 139264, 402653184, 4261412864, 4227922944, 2147532800, 61440, 3758096384, 117440512, 65280, 4227858432, 3233808384, 3221225472, 4294965248, 32768, 57152, 4294934528, 67108864, 4293918720, 4290772992, 25165824, 57344, 4278190080, 65472, 4227907584, 65520, 1920, 4026531840, 49152, 4160749568, 4294836224, 63488, 1073741824, 4294967040, 251658240, 196608, 12582912, 2097152, 65408, 64512, 417808, 4227923712, 48, 512, 4294967168, 4294966784, 16, 4292870144, 4227915776, 65528, 4294950912, 65532]); + + /**
+ * Return the next unicodechar in the stream
+ *
+ * @param parser Parser object
+ */
+ function nextUnicodeChar(parser) {
+ const { index } = parser;
+ const hi = parser.source.charCodeAt(index);
+ if (hi < 55296 /* LeadSurrogateMin */ || hi > 56319 /* LeadSurrogateMax */)
+ return hi;
+ const lo = parser.source.charCodeAt(index + 1);
+ if (lo < 56320 /* TrailSurrogateMin */ || lo > 57343 /* TrailSurrogateMax */)
+ return hi;
+ return 65536 /* NonBMPMin */ + ((hi & 0x3FF) << 10) | lo & 0x3FF;
+ }
+ /**
+ * Returns true if this is a valid identifier part
+ *
+ * @param code Codepoint
+ */
+ const isIdentifierPart = (code) => (characterType[code] & 1 /* IdentifierStart */) !== 0 || isValidIdentifierPart(code);
+ function escapeInvalidCharacters(code) {
+ switch (code) {
+ case 0 /* Null */:
+ return '\\0';
+ case 8 /* Backspace */:
+ return '\\b';
+ case 9 /* Tab */:
+ return '\\t';
+ case 10 /* LineFeed */:
+ return '\\n';
+ case 11 /* VerticalTab */:
+ return '\\v';
+ case 12 /* FormFeed */:
+ return '\\f';
+ case 13 /* CarriageReturn */:
+ return '\\r';
+ default:
+ if (!mustEscape(code))
+ return fromCodePoint(code);
+ if (code < 0x10)
+ return `\\x0${code.toString(16)}`;
+ if (code < 0x100)
+ return `\\x${code.toString(16)}`;
+ if (code < 0x1000)
+ return `\\u0${code.toString(16)}`;
+ if (code < 0x10000)
+ return `\\u${code.toString(16)}`;
+ return `\\u{${code.toString(16)}}`;
+ }
+ }
+ /**
+ * Consume an token in the scanner on match. This is an equalent to
+ * 'consume' used in the parser code itself.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function consumeOpt(parser, code) {
+ if (parser.source.charCodeAt(parser.index) !== code)
+ return false;
+ parser.index++;
+ parser.column++;
+ return true;
+ }
+ /**
+ * Consumes line feed
+ *
+ * @param parser Parser object
+ * @param state Scanner state
+ */
+ function consumeLineFeed(parser, state) {
+ parser.flags |= Flags.NewLine;
+ parser.index++;
+ if ((state & ScannerState.LastIsCR) === 0) {
+ parser.column = 0;
+ parser.line++;
+ }
+ }
+ /**
+ * Scans private name. Stage 3 proposal related
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanPrivateName(parser, context) {
+ if (!(context & Context.InClass) || !isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return 115 /* Hash */;
+ }
+ /**
+ * Advance to new line
+ *
+ * @param parser Parser object
+ */
+ function advanceNewline(parser) {
+ parser.flags |= Flags.NewLine;
+ parser.index++;
+ parser.column = 0;
+ parser.line++;
+ }
+ const fromCodePoint = (code) => {
+ return code <= 0xFFFF ?
+ String.fromCharCode(code) :
+ String.fromCharCode(((code - 65536 /* NonBMPMin */) >> 10) + 55296 /* LeadSurrogateMin */, ((code - 65536 /* NonBMPMin */) & (1024 - 1)) + 56320 /* TrailSurrogateMin */);
+ };
+ function readNext(parser) {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.source.length)
+ report(parser, 14 /* UnicodeOutOfRange */);
+ return nextUnicodeChar(parser);
+ }
+ function toHex(code) {
+ if (code < 48 /* Zero */)
+ return -1;
+ if (code <= 57 /* Nine */)
+ return code - 48 /* Zero */;
+ if (code < 65 /* UpperA */)
+ return -1;
+ if (code <= 70 /* UpperF */)
+ return code - 65 /* UpperA */ + 10;
+ if (code < 97 /* LowerA */)
+ return -1;
+ if (code <= 102 /* LowerF */)
+ return code - 97 /* LowerA */ + 10;
+ return -1;
+ }
+ function advanceOnMaybeAstral(parser, ch) {
+ parser.index++;
+ parser.column++;
+ if (ch > 0xFFFF)
+ parser.index++;
+ } + + /**
+ * Scan escape sequence
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanEscapeSequence(parser, context, first) {
+ switch (first) {
+ case 98 /* LowerB */:
+ return 8 /* Backspace */;
+ case 102 /* LowerF */:
+ return 12 /* FormFeed */;
+ case 114 /* LowerR */:
+ return 13 /* CarriageReturn */;
+ case 110 /* LowerN */:
+ return 10 /* LineFeed */;
+ case 116 /* LowerT */:
+ return 9 /* Tab */;
+ case 118 /* LowerV */:
+ return 11 /* VerticalTab */;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ return Escape.Empty;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ {
+ // 1 to 3 octal digits
+ let code = first - 48 /* Zero */;
+ let index = parser.index + 1;
+ let column = parser.column + 1;
+ let next = parser.source.charCodeAt(index);
+ if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ // Strict mode code allows only \0, then a non-digit.
+ if (code !== 0 || next === 56 /* Eight */ || next === 57 /* Nine */) {
+ if (context & Context.Strict)
+ return Escape.StrictOctal;
+ parser.flags |= Flags.HasOctal;
+ }
+ }
+ else if (context & Context.Strict) {
+ return Escape.StrictOctal;
+ }
+ else {
+ parser.flags |= Flags.HasOctal;
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ parser.index = index - 1;
+ parser.column = column - 1;
+ }
+ return code;
+ }
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ // 1 to 2 octal digits
+ if (context & Context.Strict)
+ return Escape.StrictOctal;
+ let code = first - 48 /* Zero */;
+ const index = parser.index + 1;
+ const column = parser.column + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ code = code * 8 + (next - 48 /* Zero */);
+ parser.lastValue = next;
+ parser.index = index;
+ parser.column = column;
+ }
+ return code;
+ }
+ // `8`, `9` (invalid escapes)
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return Escape.EightOrNine;
+ // ASCII escapes
+ case 120 /* LowerX */:
+ {
+ const ch1 = parser.lastValue = readNext(parser);
+ const hi = toHex(ch1);
+ if (hi < 0)
+ return Escape.InvalidHex;
+ const ch2 = parser.lastValue = readNext(parser);
+ const lo = toHex(ch2);
+ if (lo < 0)
+ return Escape.InvalidHex;
+ return hi << 4 | lo;
+ }
+ // UCS-2/Unicode escapes
+ case 117 /* LowerU */:
+ {
+ let ch = parser.lastValue = readNext(parser);
+ if (ch === 123 /* LeftBrace */) {
+ ch = parser.lastValue = readNext(parser);
+ let code = toHex(ch);
+ if (code < 0)
+ return Escape.InvalidHex;
+ ch = parser.lastValue = readNext(parser);
+ while (ch !== 125 /* RightBrace */) {
+ const digit = toHex(ch);
+ if (digit < 0)
+ return Escape.InvalidHex;
+ code = code * 16 + digit;
+ // Code point out of bounds
+ if (code > 1114111 /* NonBMPMax */)
+ return Escape.OutOfRange;
+ ch = parser.lastValue = readNext(parser);
+ }
+ return code;
+ }
+ else {
+ // \uNNNN
+ let codePoint = toHex(ch);
+ if (codePoint < 0)
+ return Escape.InvalidHex;
+ for (let i = 0; i < 3; i++) {
+ ch = parser.lastValue = readNext(parser);
+ const digit = toHex(ch);
+ if (digit < 0)
+ return Escape.InvalidHex;
+ codePoint = codePoint * 16 + digit;
+ }
+ return codePoint;
+ }
+ }
+ default:
+ return parser.source.charCodeAt(parser.index);
+ }
+ }
+ /**
+ * Throws a string error for either string or template literal
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function throwStringError(parser, context, code) {
+ switch (code) {
+ case Escape.Empty:
+ return;
+ case Escape.StrictOctal:
+ report(parser, context & Context.TaggedTemplate ?
+ 76 /* TemplateOctalLiteral */ :
+ 11 /* StrictOctalEscape */);
+ case Escape.EightOrNine:
+ report(parser, 13 /* InvalidEightAndNine */);
+ case Escape.InvalidHex:
+ report(parser, 75 /* MalformedEscape */, 'hexadecimal');
+ case Escape.OutOfRange:
+ report(parser, 14 /* UnicodeOutOfRange */);
+ /* istanbul ignore next */
+ default:
+ // ignore
+ }
+ }
+ /**
+ * Scan a string literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote codepoint
+ */
+ function scanString(parser, context, quote) {
+ const { index: start, lastValue } = parser;
+ let ret = '';
+ parser.index++;
+ parser.column++; // consume quote
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ switch (ch) {
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ report(parser, 6 /* UnterminatedString */);
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch > 128 /* MaxAsciiCharacter */) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ const code = scanEscapeSequence(parser, context, ch);
+ if (code >= 0)
+ ret += fromCodePoint(code);
+ else
+ throwStringError(parser, context, code);
+ ch = parser.lastValue;
+ }
+ break;
+ default:
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++; // consume quote
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ return 33554435 /* StringLiteral */;
+ } + + /**
+ * Consumes template brace
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function consumeTemplateBrace(parser, context) {
+ if (parser.index >= parser.length)
+ report(parser, 9 /* UnterminatedTemplate */);
+ // Upon reaching a '}', consume it and rewind the scanner state
+ parser.index--;
+ parser.column--;
+ return scanTemplate(parser, context);
+ }
+ /**
+ * Scan template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param first Codepoint
+ */
+ function scanTemplate(parser, context) {
+ const { index: start, lastValue } = parser;
+ let tail = true;
+ let ret = '';
+ let ch = readNext(parser);
+ loop: while (ch !== 96 /* Backtick */) {
+ switch (ch) {
+ // Break after a literal `${` (thus the dedicated code path).
+ case 36 /* Dollar */:
+ {
+ const index = parser.index + 1;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 123 /* LeftBrace */) {
+ parser.index = index;
+ parser.column++;
+ tail = false;
+ break loop;
+ }
+ ret += '$';
+ break;
+ }
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch >= 128) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ // Because octals are forbidden in escaped template sequences and the fact that
+ // both string and template scanning uses the same method - 'scanEscapeSequence',
+ // we set the strict context mask.
+ const code = scanEscapeSequence(parser, context | Context.Strict, ch);
+ if (code >= 0) {
+ ret += fromCodePoint(code);
+ }
+ else if (code !== Escape.Empty && context & Context.TaggedTemplate) {
+ ret = undefined;
+ ch = scanLooserTemplateSegment(parser, parser.lastValue);
+ if (ch < 0) {
+ tail = false;
+ }
+ break loop;
+ }
+ else {
+ throwStringError(parser, context | Context.TaggedTemplate, code);
+ }
+ ch = parser.lastValue;
+ }
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ // falls through
+ default:
+ if (ret != null)
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++;
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ if (tail) {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 1);
+ return 33554441 /* TemplateTail */;
+ }
+ else {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 2);
+ return 33554440 /* TemplateCont */;
+ }
+ }
+ /**
+ * Scan looser template segment
+ *
+ * @param parser Parser object
+ * @param ch codepoint
+ */
+ function scanLooserTemplateSegment(parser, ch) {
+ while (ch !== 96 /* Backtick */) {
+ if (ch === 36 /* Dollar */ && parser.source.charCodeAt(parser.index + 1) === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return -ch;
+ }
+ // Skip '\' and continue to scan the template token to search
+ // for the end, without validating any escape sequences
+ ch = readNext(parser);
+ }
+ return ch;
+ } + + // 11.8.3 Numeric Literals
+ /**
+ * Scans hex integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HexIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanHexIntegerLiteral(parser, context) {
+ parser.index++;
+ parser.column++;
+ let state = NumericState.None;
+ let value = toHex(parser.source.charCodeAt(parser.index));
+ if (value < 0)
+ report(parser, 0 /* Unexpected */);
+ parser.index++;
+ parser.column++;
+ while (parser.index < parser.length) {
+ const next = parser.source.charCodeAt(parser.index);
+ if (context & Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ const digit = toHex(next);
+ if (digit < 0)
+ break;
+ value = value * 16 + digit;
+ parser.index++;
+ parser.column++;
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+ }
+ /**
+ * Scans binary and octal integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalIntegerLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BinaryIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanOctalOrBinary(parser, context, base) {
+ parser.index++;
+ parser.column++;
+ let digits = 0;
+ let ch;
+ let value = 0;
+ let state = NumericState.None;
+ while (parser.index < parser.length) {
+ ch = parser.source.charCodeAt(parser.index);
+ if (context & Context.OptionsNext && ch === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ const converted = ch - 48 /* Zero */;
+ if (!(ch >= 48 /* Zero */ && ch <= 57 /* Nine */) || converted >= base)
+ break;
+ value = value * base + converted;
+ parser.index++;
+ parser.column++;
+ digits++;
+ }
+ if (digits === 0)
+ report(parser, 0 /* Unexpected */);
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+ }
+ /**
+ * Scans implicit octal digits
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalDigits)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanImplicitOctalDigits(parser, context) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ if (context & Context.Strict)
+ report(parser, 0 /* Unexpected */);
+ let index = parser.index;
+ let column = parser.column;
+ let code = 0;
+ parser.flags |= Flags.HasOctal;
+ // Implicit octal, unless there is a non-octal digit.
+ // (Annex B.1.1 on Numeric Literals)
+ while (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ else if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ return scanNumericLiteral(parser, context);
+ }
+ else {
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ }
+ parser.index = index;
+ parser.column = column;
+ return assembleNumericLiteral(parser, context, code, consumeOpt(parser, 110 /* LowerN */));
+ }
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ parser.flags |= Flags.HasOctal;
+ default:
+ if (context & Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ return scanNumericLiteral(parser, context);
+ }
+ }
+ /**
+ * Scans signed integer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SignedInteger)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanSignedInteger(parser, end) {
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */ || next === 45 /* Hyphen */) {
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (!(next >= 48 /* Zero */ && next <= 57 /* Nine */)) {
+ report(parser, 0 /* Unexpected */);
+ }
+ const preNumericPart = parser.index;
+ const finalFragment = scanDecimalDigitsOrSeparator(parser);
+ return parser.source.substring(end, preNumericPart) + finalFragment;
+ }
+ /**
+ * Scans numeric literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanNumericLiteral(parser, context, state = NumericState.None) {
+ let value = state & NumericState.Float ?
+ 0 :
+ scanDecimalAsSmi(parser, context);
+ const next = parser.source.charCodeAt(parser.index);
+ // I know I'm causing a bug here. The question is - will anyone figure this out?
+ if (next !== 46 /* Period */ && next !== 95 /* Underscore */ && !isValidIdentifierStart(next)) {
+ return assembleNumericLiteral(parser, context, value);
+ }
+ if (consumeOpt(parser, 46 /* Period */)) {
+ if (context & Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ state |= NumericState.Float;
+ value = `${value}.${scanDecimalDigitsOrSeparator(parser)}`;
+ }
+ const end = parser.index;
+ if (consumeOpt(parser, 110 /* LowerN */)) {
+ if (state & NumericState.Float)
+ report(parser, 0 /* Unexpected */);
+ state |= NumericState.BigInt;
+ }
+ if (consumeOpt(parser, 101 /* LowerE */) || consumeOpt(parser, 69 /* UpperE */)) {
+ state |= NumericState.Float;
+ value += scanSignedInteger(parser, end);
+ }
+ if (isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 0 /* Unexpected */);
+ }
+ return assembleNumericLiteral(parser, context, state & NumericState.Float ? parseFloat(value) : parseInt(value, 10), !!(state & NumericState.BigInt));
+ }
+ /**
+ * Internal helper function for scanning numeric separators.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state NumericState state
+ */
+ function scanNumericSeparator(parser, state) {
+ parser.index++;
+ parser.column++;
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ state |= NumericState.SeenSeparator;
+ return state;
+ }
+ /**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanDecimalDigitsOrSeparator(parser) {
+ let start = parser.index;
+ let state = NumericState.None;
+ let ret = '';
+ loop: while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 95 /* Underscore */:
+ const preUnderscoreIndex = parser.index;
+ state = scanNumericSeparator(parser, state);
+ ret += parser.source.substring(start, preUnderscoreIndex);
+ start = parser.index;
+ continue;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ state = state & ~NumericState.SeenSeparator;
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ break loop;
+ }
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return ret + parser.source.substring(start, parser.index);
+ }
+ /**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanDecimalAsSmi(parser, context) {
+ let state = NumericState.None;
+ let value = 0;
+ let next = parser.source.charCodeAt(parser.index);
+ while (next >= 48 /* Zero */ && next <= 57 /* Nine */ || next === 95 /* Underscore */) {
+ if (context & Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ next = parser.source.charCodeAt(parser.index);
+ continue;
+ }
+ state &= ~NumericState.SeenSeparator;
+ value = value * 10 + (next - 48 /* Zero */);
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (state & NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return value;
+ }
+ /**
+ * Internal helper function that assamble the number scanning parts and return
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param value The numeric value
+ */
+ function assembleNumericLiteral(parser, context, value, isBigInt = false) {
+ parser.tokenValue = value;
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ return isBigInt ? 33554551 /* BigIntLiteral */ : 33554434 /* NumericLiteral */;
+ } + + /**
+ * Scan identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function scanIdentifier(parser, context, first) {
+ let start = parser.index;
+ let ret = '';
+ let isEscaped = false;
+ if (first)
+ advanceOnMaybeAstral(parser, first);
+ loop: while (parser.index < parser.length) {
+ const index = parser.index;
+ let ch = parser.source.charCodeAt(index);
+ switch (ch) {
+ case 92 /* Backslash */:
+ ret += parser.source.slice(start, index);
+ ret += scanUnicodeCodePointEscape(parser);
+ start = parser.index;
+ isEscaped = true;
+ break;
+ default:
+ if (ch >= 0xD800 && ch <= 0xDBFF) {
+ const lo = parser.source.charCodeAt(index + 1);
+ ch = (ch & 0x3FF) << 10 | lo & 0x3FF | 0x10000;
+ }
+ if (!isIdentifierPart(ch))
+ break loop;
+ advanceOnMaybeAstral(parser, ch);
+ }
+ }
+ if (start < parser.index)
+ ret += parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ const len = ret.length;
+ // Keywords are between 2 and 11 characters long and start with a lowercase letter
+ // https://tc39.github.io/ecma262/#sec-keywords
+ if (len >= 2 && len <= 11) {
+ const token = descKeyword(ret);
+ if (token > 0) {
+ if (isEscaped) {
+ if (context & Context.DisallowEscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ // Here we fall back to a mutual parser flag if the escaped keyword isn't disallowed through
+ // context masks. This is similiar to how V8 does it - they are using an
+ // 'escaped_keyword' token.
+ // - J.K. Thomas
+ parser.flags |= Flags.EscapedKeyword;
+ }
+ return token;
+ }
+ }
+ if (context & Context.OptionsRawidentifiers)
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ return 33685505 /* Identifier */;
+ }
+ /**
+ * Scanning chars in the range 0...127, and treat them as an possible
+ * identifier. This allows subsequent checking to be faster.
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param first Code point
+ */
+ function scanMaybeIdentifier(parser, context, first) {
+ first = nextUnicodeChar(parser);
+ if (!isValidIdentifierStart(first)) {
+ report(parser, 10 /* UnexpectedChar */, escapeInvalidCharacters(first));
+ }
+ return scanIdentifier(parser, context, first);
+ }
+ /**
+ * Scan unicode codepoint escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function scanUnicodeCodePointEscape(parser) {
+ const { index } = parser;
+ if (index + 5 < parser.length) {
+ if (parser.source.charCodeAt(index + 1) !== 117 /* LowerU */) {
+ report(parser, 0 /* Unexpected */);
+ }
+ parser.index += 2;
+ parser.column += 2;
+ const code = scanIdentifierUnicodeEscape(parser);
+ if (code >= 55296 /* LeadSurrogateMin */ && code <= 56319 /* LeadSurrogateMax */) {
+ report(parser, 74 /* UnexpectedSurrogate */);
+ }
+ if (!isIdentifierPart(code)) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ return fromCodePoint(code);
+ }
+ report(parser, 0 /* Unexpected */);
+ }
+ /**
+ * Scan identifier unicode escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function scanIdentifierUnicodeEscape(parser) {
+ // Accept both \uxxxx and \u{xxxxxx}. In the latter case, the number of
+ // hex digits between { } is arbitrary. \ and u have already been read.
+ let ch = parser.source.charCodeAt(parser.index);
+ let codePoint = 0;
+ // '\u{DDDDDDDD}'
+ if (ch === 123 /* LeftBrace */) { // {
+ ch = readNext(parser);
+ let digit = toHex(ch);
+ while (digit >= 0) {
+ codePoint = (codePoint << 4) | digit;
+ if (codePoint > 1114111 /* NonBMPMax */) {
+ report(parser, 89 /* UndefinedUnicodeCodePoint */);
+ }
+ parser.index++;
+ parser.column++;
+ digit = toHex(parser.source.charCodeAt(parser.index));
+ }
+ if (parser.source.charCodeAt(parser.index) !== 125 /* RightBrace */) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ consumeOpt(parser, 125 /* RightBrace */);
+ // '\uDDDD'
+ }
+ else {
+ for (let i = 0; i < 4; i++) {
+ ch = parser.source.charCodeAt(parser.index);
+ const digit = toHex(ch);
+ if (digit < 0)
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ codePoint = (codePoint << 4) | digit;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ return codePoint;
+ } + + // 11.4 Comments
+ /**
+ * Skips single HTML comments. Same behavior as in V8.
+ *
+ * @param parser Parser Object
+ * @param context Context masks.
+ * @param state Scanner state
+ * @param type Comment type
+ */
+ function skipSingleHTMLComment(parser, context, state, type) {
+ if (context & Context.Module)
+ report(parser, 90 /* HtmlCommentInModule */);
+ return skipSingleLineComment(parser, context, state, type);
+ }
+ /**
+ * Skips SingleLineComment, SingleLineHTMLCloseComment and SingleLineHTMLOpenComment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SingleLineComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLOpenComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLCloseComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ * @param type Comment type
+ */
+ function skipSingleLineComment(parser, context, state, type) {
+ const start = parser.index;
+ const collectable = !!(context & Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 13 /* CarriageReturn */:
+ advanceNewline(parser);
+ if ((parser.index < parser.length) && parser.source.charCodeAt(parser.index) === 10 /* LineFeed */)
+ parser.index++;
+ return state | ScannerState.NewLine;
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ advanceNewline(parser);
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state | ScannerState.NewLine;
+ default:
+ parser.index++;
+ parser.column++;
+ }
+ }
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state;
+ }
+ /**
+ * Skips multiline comment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-MultiLineComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ */
+ function skipMultiLineComment(parser, context, state) {
+ const start = parser.index;
+ const collectable = !!(context & Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 42 /* Asterisk */:
+ parser.index++;
+ parser.column++;
+ state &= ~ScannerState.LastIsCR;
+ if (consumeOpt(parser, 47 /* Slash */)) {
+ if (collectable)
+ addComment(parser, context, 'MultiLine', start);
+ return state;
+ }
+ break;
+ // Mark multiline comments containing linebreaks as new lines
+ // so we can perfectly handle edge cases like: '1/*\n*/--> a comment'
+ case 13 /* CarriageReturn */:
+ state |= ScannerState.NewLine | ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ break;
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ default:
+ state &= ~ScannerState.LastIsCR;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ // Unterminated multi-line comment.
+ tolerant(parser, context, 8 /* UnterminatedComment */);
+ }
+ /**
+ * Add comments
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param type Comment type
+ * @param commentStart Start position of comment
+ */
+ function addComment(parser, context, type, commentStart) {
+ const { index, startIndex: start, startLine, startColumn, lastLine, lastColumn } = parser;
+ const comment = {
+ type,
+ value: parser.source.slice(commentStart, type === 'MultiLine' ? index - 2 : index),
+ start,
+ end: index,
+ };
+ if (context & Context.OptionsLoc) {
+ comment.loc = {
+ start: { line: startLine, column: startColumn },
+ end: { line: lastLine, column: lastColumn },
+ };
+ }
+ parser.comments.push(comment);
+ } + + /**
+ * Scan
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-punctuatorss)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scan(parser, context) {
+ parser.flags &= ~Flags.NewLine | Flags.EscapedKeyword;
+ const lineStart = parser.index === 0;
+ let state = ScannerState.None;
+ while (parser.index < parser.length) {
+ if (!lineStart) {
+ parser.startIndex = parser.index;
+ parser.startColumn = parser.column;
+ parser.startLine = parser.line;
+ }
+ const first = parser.source.charCodeAt(parser.index);
+ if (first > 128 /* MaxAsciiCharacter */) {
+ switch (first) {
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ case 65519 /* ByteOrderMark */:
+ case 160 /* NonBreakingSpace */:
+ case 5760 /* Ogham */:
+ case 8192 /* EnQuad */:
+ case 8193 /* EmQuad */:
+ case 8194 /* EnSpace */:
+ case 8195 /* EmSpace */:
+ case 8196 /* ThreePerEmSpace */:
+ case 8197 /* FourPerEmSpace */:
+ case 8198 /* SixPerEmSpace */:
+ case 8199 /* FigureSpace */:
+ case 8200 /* PunctuationSpace */:
+ case 8201 /* ThinSpace */:
+ case 8202 /* HairSpace */:
+ case 8239 /* NarrowNoBreakSpace */:
+ case 8287 /* MathematicalSpace */:
+ case 12288 /* IdeographicSpace */:
+ case 65279 /* Zwnbs */:
+ case 8205 /* Zwj */:
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ return scanMaybeIdentifier(parser, context, first);
+ }
+ }
+ else {
+ // Note: Here we first get rid of LT and WS, then we make sure that the lookup time
+ // for the single punctuator char is short as possible. A single punctuator
+ // char is a valid token that cannot also be a prefix of a combination
+ // of long tokens - e.g. '(', ')' and '=' is valid. '==' is not.
+ switch (first) {
+ case 13 /* CarriageReturn */:
+ state |= ScannerState.NewLine | ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~ScannerState.LastIsCR | ScannerState.NewLine;
+ break;
+ case 9 /* Tab */:
+ case 11 /* VerticalTab */:
+ case 12 /* FormFeed */:
+ case 32 /* Space */:
+ parser.index++;
+ parser.column++;
+ break;
+ // `(`
+ case 40 /* LeftParen */:
+ parser.index++;
+ parser.column++;
+ return 50331659 /* LeftParen */;
+ // `)`
+ case 41 /* RightParen */:
+ parser.index++;
+ parser.column++;
+ return 16 /* RightParen */;
+ // `,`
+ case 44 /* Comma */:
+ parser.index++;
+ parser.column++;
+ return 16777234 /* Comma */;
+ // `:`
+ case 58 /* Colon */:
+ parser.index++;
+ parser.column++;
+ return 16777237 /* Colon */;
+ // `;`
+ case 59 /* Semicolon */:
+ parser.index++;
+ parser.column++;
+ return 17825809 /* Semicolon */;
+ // `?`
+ case 63 /* QuestionMark */:
+ parser.index++;
+ parser.column++;
+ return 22 /* QuestionMark */;
+ // `]`
+ case 93 /* RightBracket */:
+ parser.index++;
+ parser.column++;
+ return 20 /* RightBracket */;
+ // `{`
+ case 123 /* LeftBrace */:
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ // `}`
+ case 125 /* RightBrace */:
+ parser.index++;
+ parser.column++;
+ return 17825807 /* RightBrace */;
+ // `~`
+ case 126 /* Tilde */:
+ parser.index++;
+ parser.column++;
+ return 301989934 /* Complement */;
+ // `[`
+ case 91 /* LeftBracket */:
+ parser.index++;
+ parser.column++;
+ return 41943059 /* LeftBracket */;
+ // `@`
+ case 64 /* At */:
+ parser.index++;
+ parser.column++;
+ return 120 /* At */;
+ // `/`, `/=`, `/>`
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774773 /* Divide */;
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipSingleLineComment(parser, context, state, 'SingleLine');
+ continue;
+ }
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipMultiLineComment(parser, context, state);
+ continue;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 100663333 /* DivideAssign */;
+ }
+ default:
+ return 167774773 /* Divide */;
+ }
+ }
+ // `-`, `--`, `-=`
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++; // skip `-`
+ const next = parser.source.charCodeAt(parser.index);
+ switch (next) {
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++;
+ if ((state & ScannerState.NewLine || lineStart) &&
+ consumeOpt(parser, 62 /* GreaterThan */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLClose');
+ continue;
+ }
+ return 570425372 /* Decrement */;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 67108899 /* SubtractAssign */;
+ }
+ default:
+ return 436209968 /* Subtract */;
+ }
+ }
+ // `<`, `<=`, `<<`, `<<=`, `</`, <!--
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++; // skip `<`
+ if (consumeOpt(parser, 33 /* Exclamation */) &&
+ consumeOpt(parser, 45 /* Hyphen */) &&
+ consumeOpt(parser, 45 /* Hyphen */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLOpen');
+ continue;
+ }
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 61 /* EqualSign */) ?
+ 67108894 /* ShiftLeftAssign */ :
+ 167774273 /* ShiftLeft */;
+ case 61 /* EqualSign */:
+ parser.index++;
+ parser.column++;
+ return 167774013 /* LessThanOrEqual */;
+ case 47 /* Slash */:
+ {
+ if (!(context & Context.OptionsJSX))
+ break;
+ const index = parser.index + 1;
+ // Check that it's not a comment start.
+ if (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 42 /* Asterisk */ || next === 47 /* Slash */)
+ break;
+ }
+ parser.index++;
+ parser.column++;
+ return 25 /* JSXClose */;
+ }
+ default: // ignore
+ return 167774015 /* LessThan */;
+ }
+ // `!`, `!=`, `!==`
+ case 33 /* Exclamation */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 301989933 /* Negate */;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773756 /* LooseNotEqual */;
+ return 167773754 /* StrictNotEqual */;
+ // `'string'`, `"string"`
+ case 39 /* SingleQuote */:
+ case 34 /* DoubleQuote */:
+ return scanString(parser, context, first);
+ // `%`, `%=`
+ case 37 /* Percent */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167774772 /* Modulo */;
+ return 67108902 /* ModuloAssign */;
+ // `&`, `&&`, `&=`
+ case 38 /* Ampersand */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 38 /* Ampersand */) {
+ parser.index++;
+ parser.column++;
+ return 169869879 /* LogicalAnd */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108905 /* BitwiseAndAssign */;
+ }
+ return 167773508 /* BitwiseAnd */;
+ }
+ // `*`, `**`, `*=`, `**=`
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774771 /* Multiply */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108900 /* MultiplyAssign */;
+ }
+ if (next !== 42 /* Asterisk */)
+ return 167774771 /* Multiply */;
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167775030 /* Exponentiate */;
+ return 67108897 /* ExponentiateAssign */;
+ }
+ // `+`, `++`, `+=`
+ case 43 /* Plus */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 436209967 /* Add */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */) {
+ parser.index++;
+ parser.column++;
+ return 570425371 /* Increment */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108898 /* AddAssign */;
+ }
+ return 436209967 /* Add */;
+ }
+ // `\\u{N}var`
+ case 92 /* Backslash */:
+ return scanIdentifier(parser, context);
+ // `=`, `==`, `===`, `=>`
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 167773753 /* StrictEqual */;
+ }
+ else {
+ return 167773755 /* LooseEqual */;
+ }
+ }
+ else if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ return 10 /* Arrow */;
+ }
+ return 83886109 /* Assign */;
+ }
+ // `>`, `>=`, `>>`, `>>>`, `>>=`, `>>>=`
+ case 62 /* GreaterThan */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774016 /* GreaterThan */;
+ if (context & Context.InJSXChild)
+ return 167774016 /* GreaterThan */;
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 167774014 /* GreaterThanOrEqual */;
+ }
+ if (next !== 62 /* GreaterThan */)
+ return 167774016 /* GreaterThan */;
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 67108896 /* LogicalShiftRightAssign */;
+ }
+ else {
+ return 167774275 /* LogicalShiftRight */;
+ }
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108895 /* ShiftRightAssign */;
+ }
+ return 167774274 /* ShiftRight */;
+ }
+ // `^`, `^=`
+ case 94 /* Caret */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773254 /* BitwiseXor */;
+ return 67108903 /* BitwiseXorAssign */;
+ // ``string``
+ case 96 /* Backtick */:
+ return scanTemplate(parser, context);
+ // `|`, `||`, `|=`
+ case 124 /* VerticalBar */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 124 /* VerticalBar */) {
+ parser.index++;
+ parser.column++;
+ return 169869624 /* LogicalOr */;
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108904 /* BitwiseOrAssign */;
+ }
+ return 167772997 /* BitwiseOr */;
+ }
+ // `.`, `...`, `.123` (numeric literal)
+ case 46 /* Period */:
+ {
+ let index = parser.index + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 57 /* Nine */) {
+ scanNumericLiteral(parser, context, NumericState.Float);
+ return 33554434 /* NumericLiteral */;
+ }
+ else if (next === 46 /* Period */) {
+ index++;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 46 /* Period */) {
+ parser.index = index + 1;
+ parser.column += 3;
+ return 14 /* Ellipsis */;
+ }
+ }
+ parser.index++;
+ parser.column++;
+ return 16777229 /* Period */;
+ }
+ // `#`
+ case 35 /* Hash */:
+ {
+ parser.index++;
+ parser.column++;
+ const index = parser.index;
+ const next = parser.source.charCodeAt(index);
+ if (context & Context.OptionsShebang &&
+ lineStart &&
+ next === 33 /* Exclamation */) {
+ parser.index = index + 1;
+ skipSingleLineComment(parser, context, ScannerState.None, 'SheBang');
+ continue;
+ }
+ return scanPrivateName(parser, context);
+ }
+ // `0`...`9`
+ case 48 /* Zero */:
+ {
+ parser.index++;
+ parser.column++;
+ switch (parser.source.charCodeAt(parser.index)) {
+ // Hex number - '0x', '0X'
+ case 88 /* UpperX */:
+ case 120 /* LowerX */:
+ return scanHexIntegerLiteral(parser, context);
+ // Binary number - '0b', '0B'
+ case 66 /* UpperB */:
+ case 98 /* LowerB */:
+ return scanOctalOrBinary(parser, context, 2);
+ // Octal number - '0o', '0O'
+ case 79 /* UpperO */:
+ case 111 /* LowerO */:
+ return scanOctalOrBinary(parser, context, 8);
+ default:
+ // Implicit octal digits startign with '0'
+ return scanImplicitOctalDigits(parser, context);
+ }
+ }
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return scanNumericLiteral(parser, context);
+ // `a`...`z`, `A`...`Z`, `_var`, `$var`
+ case 65 /* UpperA */:
+ case 66 /* UpperB */:
+ case 67 /* UpperC */:
+ case 68 /* UpperD */:
+ case 69 /* UpperE */:
+ case 70 /* UpperF */:
+ case 71 /* UpperG */:
+ case 72 /* UpperH */:
+ case 73 /* UpperI */:
+ case 74 /* UpperJ */:
+ case 75 /* UpperK */:
+ case 76 /* UpperL */:
+ case 77 /* UpperM */:
+ case 78 /* UpperN */:
+ case 79 /* UpperO */:
+ case 80 /* UpperP */:
+ case 81 /* UpperQ */:
+ case 82 /* UpperR */:
+ case 83 /* UpperS */:
+ case 84 /* UpperT */:
+ case 85 /* UpperU */:
+ case 86 /* UpperV */:
+ case 87 /* UpperW */:
+ case 88 /* UpperX */:
+ case 89 /* UpperY */:
+ case 90 /* UpperZ */:
+ case 36 /* Dollar */:
+ case 95 /* Underscore */:
+ case 97 /* LowerA */:
+ case 98 /* LowerB */:
+ case 99 /* LowerC */:
+ case 100 /* LowerD */:
+ case 101 /* LowerE */:
+ case 102 /* LowerF */:
+ case 103 /* LowerG */:
+ case 104 /* LowerH */:
+ case 105 /* LowerI */:
+ case 106 /* LowerJ */:
+ case 107 /* LowerK */:
+ case 108 /* LowerL */:
+ case 109 /* LowerM */:
+ case 110 /* LowerN */:
+ case 111 /* LowerO */:
+ case 112 /* LowerP */:
+ case 113 /* LowerQ */:
+ case 114 /* LowerR */:
+ case 115 /* LowerS */:
+ case 116 /* LowerT */:
+ case 117 /* LowerU */:
+ case 118 /* LowerV */:
+ case 119 /* LowerW */:
+ case 120 /* LowerX */:
+ case 121 /* LowerY */:
+ case 122 /* LowerZ */:
+ default:
+ return scanIdentifier(parser, context, first);
+ }
+ }
+ }
+ return 1048576 /* EndOfSource */;
+ } + + /**
+ * Scans regular expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanRegularExpression(parser, context) {
+ const bodyStart = parser.index;
+ let preparseState = RegexState.Empty;
+ loop: while (true) {
+ const ch = parser.source.charCodeAt(parser.index);
+ parser.index++;
+ parser.column++;
+ if (preparseState & RegexState.Escape) {
+ preparseState &= ~RegexState.Escape;
+ }
+ else {
+ switch (ch) {
+ case 47 /* Slash */:
+ if (!preparseState)
+ break loop;
+ else
+ break;
+ case 92 /* Backslash */:
+ preparseState |= RegexState.Escape;
+ break;
+ case 91 /* LeftBracket */:
+ preparseState |= RegexState.Class;
+ break;
+ case 93 /* RightBracket */:
+ preparseState &= RegexState.Escape;
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ report(parser, 7 /* UnterminatedRegExp */);
+ default: // ignore
+ }
+ }
+ if (parser.index >= parser.source.length) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ const bodyEnd = parser.index - 1;
+ let mask = RegexFlags.Empty;
+ const { index: flagStart } = parser;
+ loop: while (parser.index < parser.source.length) {
+ const code = parser.source.charCodeAt(parser.index);
+ switch (code) {
+ case 103 /* LowerG */:
+ if (mask & RegexFlags.Global)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'g');
+ mask |= RegexFlags.Global;
+ break;
+ case 105 /* LowerI */:
+ if (mask & RegexFlags.IgnoreCase)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'i');
+ mask |= RegexFlags.IgnoreCase;
+ break;
+ case 109 /* LowerM */:
+ if (mask & RegexFlags.Multiline)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'm');
+ mask |= RegexFlags.Multiline;
+ break;
+ case 117 /* LowerU */:
+ if (mask & RegexFlags.Unicode)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'u');
+ mask |= RegexFlags.Unicode;
+ break;
+ case 121 /* LowerY */:
+ if (mask & RegexFlags.Sticky)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'y');
+ mask |= RegexFlags.Sticky;
+ break;
+ case 115 /* LowerS */:
+ if (mask & RegexFlags.DotAll)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 's');
+ mask |= RegexFlags.DotAll;
+ break;
+ default:
+ if (!isIdentifierPart(code))
+ break loop;
+ report(parser, 16 /* UnexpectedTokenRegExpFlag */, fromCodePoint(code));
+ }
+ parser.index++;
+ parser.column++;
+ }
+ const flags = parser.source.slice(flagStart, parser.index);
+ const pattern = parser.source.slice(bodyStart, bodyEnd);
+ parser.tokenRegExp = { pattern, flags };
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ parser.tokenValue = validate(parser, context, pattern, flags);
+ return 33554436 /* RegularExpression */;
+ }
+ /**
+ * Validates regular expressions
+ *
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param pattern Regexp body
+ * @param flags Regexp flags
+ */
+ function validate(parser, context, pattern, flags) {
+ if (!(context & Context.OptionsNode)) {
+ try {
+ }
+ catch (e) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ try {
+ return new RegExp(pattern, flags);
+ }
+ catch (e) {
+ return null;
+ }
+ } + + // 12.15.5 Destructuring Assignment
+ /**
+ * Parses either a binding identifier or binding pattern
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBindingIdentifierOrPattern(parser, context, args = []) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ return token === 41943052 /* LeftBrace */ ?
+ parserObjectAssignmentPattern(parser, context) :
+ parseArrayAssignmentPattern(parser, context, args);
+ }
+ else if (token & (262144 /* IsAwait */ | 1073741824 /* IsYield */)) {
+ if (token & 262144 /* IsAwait */ && (context & (Context.Async | Context.Module))) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ else if (token & 1073741824 /* IsYield */ && (context & (Context.Yield | Context.Strict))) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ }
+ args.push(parser.tokenValue);
+ return parseBindingIdentifier(parser, context);
+ }
+ /**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BindingIdentifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBindingIdentifier(parser, context) {
+ const { token } = parser;
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (context & Context.BlockScope && token === 33574984 /* LetKeyword */) {
+ // let is disallowed as a lexically bound name
+ tolerant(parser, context, 27 /* LetInLexicalBinding */);
+ }
+ else if (hasBit(token, 20480 /* FutureReserved */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ else if (!isValidIdentifier(context, token)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ }
+ /**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAssignmentRestElement(parser, context, args) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+ }
+ /**
+ * Parse rest property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ // tslint:disable-next-line:function-name
+ function AssignmentRestProperty(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const { token } = parser;
+ const argument = parseBindingIdentifierOrPattern(parser, context);
+ if (hasBit(token, 8388608 /* IsBindingPattern */))
+ tolerant(parser, context, 94 /* InvalidRestBindingPattern */);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+ }
+ /**
+ * ArrayAssignmentPattern[Yield] :
+ * [ Elisionopt AssignmentRestElement[?Yield]opt ]
+ * [ AssignmentElementList[?Yield] ]
+ * [ AssignmentElementList[?Yield] , Elisionopt AssignmentRestElement[?Yield]opt ]
+ *
+ * AssignmentRestElement[Yield] :
+ * ... DestructuringAssignmentTarget[?Yield]
+ *
+ * AssignmentElementList[Yield] :
+ * AssignmentElisionElement[?Yield]
+ * AssignmentElementList[?Yield] , AssignmentElisionElement[?Yield]
+ *
+ * AssignmentElisionElement[Yield] :
+ * Elisionopt AssignmentElement[?Yield]
+ *
+ * AssignmentElement[Yield] :
+ * DestructuringAssignmentTarget[?Yield] Initializer[In,?Yield]opt
+ *
+ * DestructuringAssignmentTarget[Yield] :
+ * LeftHandSideExpression[?Yield]
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param Parser object
+ * @param Context masks
+ */
+ function parseArrayAssignmentPattern(parser, context, args) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else {
+ if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseAssignmentRestElement(parser, context, args));
+ break;
+ }
+ else {
+ elements.push(parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseBindingInitializer));
+ }
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ // tslint:disable-next-line:no-object-literal-type-assertion
+ return finishNode(context, parser, pos, {
+ type: 'ArrayPattern',
+ elements,
+ });
+ }
+ /**
+ * Parse object assignment pattern
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parserObjectAssignmentPattern(parser, context) {
+ const pos = getLocation(parser);
+ const properties = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ properties.push(AssignmentRestProperty(parser, context));
+ break;
+ }
+ properties.push(parseAssignmentProperty(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ObjectPattern',
+ properties,
+ });
+ }
+ /** Parse assignment pattern
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param left LHS of assignment pattern
+ * @param pos Location
+ */
+ function parseAssignmentPattern(parser, context, left, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression),
+ });
+ }
+ /**
+ * Parse binding initializer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBindingInitializer(parser, context) {
+ const pos = getLocation(parser);
+ const left = parseBindingIdentifierOrPattern(parser, context);
+ return !consume(parser, context, 83886109 /* Assign */) ?
+ left :
+ finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseAssignmentExpression(parser, context | Context.AllowIn),
+ });
+ }
+ /**
+ * Parse assignment property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAssignmentProperty(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ let key;
+ let value;
+ let computed = false;
+ let shorthand = false;
+ // single name binding
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ key = parseIdentifier(parser, context);
+ shorthand = !consume(parser, context, 16777237 /* Colon */);
+ if (shorthand) {
+ const hasInitializer = consume(parser, context, 83886109 /* Assign */);
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (!isValidIdentifier(context, token))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ value = hasInitializer ? parseAssignmentPattern(parser, context, key, pos) : key;
+ }
+ else
+ value = parseBindingInitializer(parser, context);
+ }
+ else {
+ computed = token === 41943059 /* LeftBracket */;
+ key = parsePropertyName(parser, context);
+ expect(parser, context, 16777237 /* Colon */);
+ value = parseExpressionCoverGrammar(parser, context, parseBindingInitializer);
+ }
+ // Note! The specs specifically state that this is "assignment property", but
+ // nothing in ESTree specs explains the difference between this "property" and the "property" for object literals.
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ kind: 'init',
+ key,
+ computed,
+ value,
+ method: false,
+ shorthand,
+ });
+ } + + // JSX Specification
+ // https://facebook.github.io/jsx/
+ /**
+ * Parses JSX element or JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXRootElement(parser, context) {
+ const pos = getLocation(parser);
+ let children = [];
+ let closingElement = null;
+ let selfClosing = false;
+ let openingElement;
+ expect(parser, context, 167774015 /* LessThan */);
+ const isFragment = parser.token === 167774016 /* GreaterThan */;
+ if (isFragment) {
+ openingElement = parseJSXOpeningFragment(parser, context, pos);
+ }
+ else {
+ const name = parseJSXElementName(parser, context);
+ const attributes = parseJSXAttributes(parser, context);
+ selfClosing = consume(parser, context, 167774773 /* Divide */);
+ openingElement = parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos);
+ }
+ if (isFragment)
+ return parseJSXFragment(parser, context, openingElement, pos);
+ if (!selfClosing) {
+ children = parseJSXChildren(parser, context);
+ closingElement = parseJSXClosingElement(parser, context);
+ const open = isEqualTagNames(openingElement.name);
+ const close = isEqualTagNames(closingElement.name);
+ if (open !== close)
+ report(parser, 85 /* ExpectedJSXClosingTag */, close);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'JSXElement',
+ children,
+ openingElement,
+ closingElement,
+ });
+ }
+ /**
+ * Parses JSX opening element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param name Element name
+ * @param attributes Element attributes
+ * @param selfClosing True if this is a selfclosing JSX Element
+ * @param pos Line / Column tracking
+ */
+ function parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos) {
+ if (context & Context.InJSXChild && selfClosing)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningElement',
+ name,
+ attributes,
+ selfClosing,
+ });
+ }
+ /**
+ * Parse JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param openingElement Opening fragment
+ * @param pos Line / Column location
+ */
+ function parseJSXFragment(parser, context, openingElement, pos) {
+ const children = parseJSXChildren(parser, context);
+ const closingFragment = parseJSXClosingFragment(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXFragment',
+ children,
+ openingElement,
+ closingFragment,
+ });
+ }
+ /**
+ * Parse JSX opening fragmentD
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXOpeningFragment(parser, context, pos) {
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningFragment',
+ });
+ }
+ /**
+ * Prime the scanner and advance to the next JSX token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextJSXToken(parser) {
+ return parser.token = scanJSXToken(parser);
+ }
+ /**
+ * Mini scanner
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanJSXToken(parser) {
+ if (parser.index >= parser.source.length)
+ return 1048576 /* EndOfSource */;
+ parser.lastIndex = parser.startIndex = parser.index;
+ const char = parser.source.charCodeAt(parser.index);
+ if (char === 60 /* LessThan */) {
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 47 /* Slash */) ? 25 /* JSXClose */ : 167774015 /* LessThan */;
+ }
+ else if (char === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ }
+ while (parser.index < parser.source.length) {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 123 /* LeftBrace */ || next === 60 /* LessThan */)
+ break;
+ }
+ return 121 /* JSXText */;
+ }
+ /**
+ * Parses JSX children
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXChildren(parser, context) {
+ const children = [];
+ while (parser.token !== 25 /* JSXClose */) {
+ children.push(parseJSXChild(parser, context));
+ }
+ return children;
+ }
+ /**
+ * Parses JSX Text
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXText(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.source.slice(parser.startIndex, parser.index);
+ parser.token = scanJSXToken(parser);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXText',
+ value,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = value;
+ return node;
+ }
+ /**
+ * Parses JSX Child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXChild(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ case 121 /* JSXText */:
+ return parseJSXText(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpression(parser, context & ~Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context & ~Context.InJSXChild);
+ default:
+ report(parser, 0 /* Unexpected */);
+ }
+ return undefined; // note: get rid of this
+ }
+ /**
+ * Parses JSX attributes
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttributes(parser, context) {
+ const attributes = [];
+ while (parser.index < parser.source.length) {
+ if (parser.token === 167774773 /* Divide */ || parser.token === 167774016 /* GreaterThan */)
+ break;
+ attributes.push(parseJSXAttribute(parser, context));
+ }
+ return attributes;
+ }
+ /**
+ * Parses JSX spread attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXSpreadAttribute(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadAttribute',
+ argument: expression,
+ });
+ }
+ /**
+ * Parses JSX namespace name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param namespace Identifier
+ * @param pos Line / Column location
+ */
+ function parseJSXNamespacedName(parser, context, namespace, pos) {
+ expect(parser, context, 16777237 /* Colon */);
+ const name = parseJSXIdentifier(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXNamespacedName',
+ namespace,
+ name,
+ });
+ }
+ /**
+ * Parses JSX attribute name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttributeName(parser, context) {
+ const pos = getLocation(parser);
+ const identifier = parseJSXIdentifier(parser, context);
+ return parser.token === 16777237 /* Colon */ ?
+ parseJSXNamespacedName(parser, context, identifier, pos) :
+ identifier;
+ }
+ /**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttributeValue(parser, context) {
+ switch (scanJSXAttributeValue(parser, context)) {
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpressionContainer(parser, context | Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context | Context.InJSXChild);
+ default:
+ tolerant(parser, context, 87 /* InvalidJSXAttributeValue */);
+ return undefined; // note: get rid of this
+ }
+ }
+ /**
+ * Parses JSX Attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttribute(parser, context) {
+ const pos = getLocation(parser);
+ if (parser.token === 41943052 /* LeftBrace */)
+ return parseJSXSpreadAttribute(parser, context);
+ scanJSXIdentifier(parser);
+ const attrName = parseJSXAttributeName(parser, context);
+ const value = parser.token === 83886109 /* Assign */ ? parseJSXAttributeValue(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'JSXAttribute',
+ value: value,
+ name: attrName,
+ });
+ }
+ /**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanJSXAttributeValue(parser, context) {
+ parser.lastIndex = parser.index;
+ const ch = parser.source.charCodeAt(parser.index);
+ switch (ch) {
+ case 34 /* DoubleQuote */:
+ case 39 /* SingleQuote */:
+ return scanJSXString(parser, context, ch);
+ default:
+ return nextToken(parser, context);
+ }
+ }
+ /**
+ * Parses JSX String
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote Code point
+ */
+ function scanJSXString(parser, context, quote) {
+ const rawStart = parser.index;
+ parser.index++;
+ parser.column++;
+ let ret = '';
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ ret += fromCodePoint(ch);
+ parser.index++;
+ parser.column++;
+ ch = parser.source.charCodeAt(parser.index);
+ if (parser.index >= parser.source.length)
+ report(parser, 6 /* UnterminatedString */);
+ }
+ parser.index++;
+ parser.column++; // skip the quote
+ // raw
+ if (context & Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(rawStart, parser.index);
+ parser.tokenValue = ret;
+ return 33554435 /* StringLiteral */;
+ }
+ /**
+ * Parses JJSX Empty Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXEmptyExpression(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXEmptyExpression',
+ });
+ }
+ /**
+ * Parses JSX Spread child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXSpreadChild(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpression(parser, context);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadChild',
+ expression,
+ });
+ }
+ /**
+ * Parses JSX Expression container
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXExpressionContainer(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ // Note: JSX Expressions can't be empty
+ if (parser.token === 17825807 /* RightBrace */)
+ tolerant(parser, context, 84 /* NonEmptyJSXExpression */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+ }
+ /**
+ * Parses JSX Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ if (parser.token === 14 /* Ellipsis */)
+ return parseJSXSpreadChild(parser, context);
+ const expression = parser.token === 17825807 /* RightBrace */ ?
+ parseJSXEmptyExpression(parser, context) :
+ parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+ }
+ /**
+ * Parses JSX Closing fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXClosingFragment(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ expect(parser, context, 167774016 /* GreaterThan */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingFragment',
+ });
+ }
+ /**
+ * Parses JSX Closing Element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXClosingElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ const name = parseJSXElementName(parser, context);
+ if (context & Context.InJSXChild)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingElement',
+ name,
+ });
+ }
+ /**
+ * Parses JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXIdentifier(parser, context) {
+ const { token, tokenValue: name, tokenRaw: raw } = parser;
+ if (!(token & (131072 /* IsIdentifier */ | 4096 /* Keyword */))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXIdentifier',
+ name,
+ });
+ if (context & Context.OptionsRawidentifiers)
+ node.raw = raw;
+ return node;
+ }
+ /**
+ * Parses JSX Member expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXMemberExpression(parser, context, expr, pos) {
+ // Note: In order to be able to parse cases like ''<A.B.C.D.E.foo-bar />', where the dash is located at the
+ // end, we must rescan for the JSX Identifier now. This because JSX identifiers differ from normal identifiers
+ scanJSXIdentifier(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXMemberExpression',
+ object: expr,
+ property: parseJSXIdentifier(parser, context),
+ });
+ }
+ /**
+ * Parses JSX Element name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXElementName(parser, context) {
+ const pos = getLocation(parser);
+ scanJSXIdentifier(parser);
+ let elementName = parseJSXIdentifier(parser, context);
+ if (parser.token === 16777237 /* Colon */)
+ return parseJSXNamespacedName(parser, context, elementName, pos);
+ while (consume(parser, context, 16777229 /* Period */)) {
+ elementName = parseJSXMemberExpression(parser, context, elementName, pos);
+ }
+ return elementName;
+ }
+ /**
+ * Scans JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanJSXIdentifier(parser) {
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const firstCharPosition = parser.index;
+ let ch = parser.source.charCodeAt(parser.index);
+ while ((parser.index < parser.source.length) && (ch === 45 /* Hyphen */ || (isValidIdentifierPart(ch)))) {
+ ch = readNext(parser);
+ }
+ parser.tokenValue += parser.source.substr(firstCharPosition, parser.index - firstCharPosition);
+ }
+ return parser.token;
+ } + + /**
+ * Expression :
+ * AssignmentExpression
+ * Expression , AssignmentExpression
+ *
+ * ExpressionNoIn :
+ * AssignmentExpressionNoIn
+ * ExpressionNoIn , AssignmentExpressionNoIn
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Expression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExpression(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ return parser.token === 16777234 /* Comma */ ?
+ parseSequenceExpression(parser, context, expr, pos) :
+ expr;
+ }
+ /**
+ * Parse secuence expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSequenceExpression(parser, context, left, pos) {
+ const expressions = [left];
+ while (consume(parser, context, 16777234 /* Comma */)) {
+ expressions.push(parseExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ /**
+ * Parse yield expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-YieldExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseYieldExpression(parser, context, pos) {
+ // YieldExpression[In] :
+ // yield
+ // yield [no LineTerminator here] AssignmentExpression[?In, Yield]
+ // yield [no LineTerminator here] * AssignmentExpression[?In, Yield]
+ // https://tc39.github.io/ecma262/#sec-generator-function-definitions-static-semantics-early-errors
+ if (context & Context.InParameter)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ expect(parser, context, 1107316842 /* YieldKeyword */);
+ let argument = null;
+ let delegate = false;
+ if (!(parser.flags & Flags.NewLine)) {
+ delegate = consume(parser, context, 167774771 /* Multiply */);
+ // 'Token.IsExpressionStart' bitmask contains the complete set of
+ // tokens that can appear after an AssignmentExpression, and none of them
+ // can start an AssignmentExpression.
+ if (delegate || parser.token & 33554432 /* IsExpressionStart */) {
+ argument = parseAssignmentExpression(parser, context);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'YieldExpression',
+ argument,
+ delegate,
+ });
+ }
+ /**
+ * AssignmentExpression :
+ * ConditionalExpression
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpression
+ * LeftHandSideExpression AssignmentOperator AssignmentExpression
+ *
+ * AssignmentExpressionNoIn :
+ * ConditionalExpressionNoIn
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpressionNoIn
+ * LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAssignmentExpression(parser, context) {
+ const pos = getLocation(parser);
+ let { token } = parser;
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ return parseYieldExpression(parser, context, pos);
+ let expr = token & 524288 /* IsAsync */ && lookahead(parser, context, nextTokenisIdentifierOrParen)
+ ? parserCoverCallExpressionAndAsyncArrowHead(parser, context)
+ : parseConditionalExpression(parser, context, pos);
+ if (parser.token === 10 /* Arrow */) {
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & (20480 /* FutureReserved */ | 4194304 /* IsEvalOrArguments */)) {
+ // Invalid: ' yield => { 'use strict'; 0 };'
+ if (token & 20480 /* FutureReserved */) {
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ }
+ expr = [expr];
+ }
+ return parseArrowFunction(parser, context &= ~Context.Async, pos, expr);
+ }
+ if (hasBit(parser.token, 67108864 /* IsAssignOp */)) {
+ token = parser.token;
+ if (context & Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ }
+ else if (consume(parser, context, 83886109 /* Assign */)) {
+ if (!(parser.flags & Flags.AllowDestructuring)) {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ // Only re-interpret if not inside a formal parameter list
+ if (!(context & Context.InParameter))
+ reinterpret(parser, context, expr);
+ if (context & Context.InParen)
+ parser.flags |= Flags.SimpleParameterList;
+ if (parser.token & 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ else if (context & Context.InParen &&
+ context & (Context.Strict | Context.Yield) &&
+ parser.token & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasYield;
+ }
+ }
+ else {
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ nextToken(parser, context);
+ }
+ const right = parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ parser.pendingExpressionError = null;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentExpression',
+ left: expr,
+ operator: tokenDesc(token),
+ right,
+ });
+ }
+ return expr;
+ }
+ /**
+ * Parse conditional expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ConditionalExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseConditionalExpression(parser, context, pos) {
+ const test = parseBinaryExpression(parser, context, 0, pos);
+ if (!consume(parser, context, 22 /* QuestionMark */))
+ return test;
+ const consequent = parseExpressionCoverGrammar(parser, context & ~Context.AllowDecorator | Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16777237 /* Colon */);
+ return finishNode(context, parser, pos, {
+ type: 'ConditionalExpression',
+ test,
+ consequent,
+ alternate: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+ }
+ /**
+ * Parse binary expression.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-exp-operator)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-additive-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-bitwise-shift-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-equality-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-relational-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-multiplicative-operators)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param minPrec Minimum precedence value
+ * @param pos Line / Column info
+ * @param Left Left hand side of the binary expression
+ */
+ function parseBinaryExpression(parser, context, minPrec, pos, left = parseUnaryExpression(parser, context)) {
+ // Shift-reduce parser for the binary operator part of the JS expression
+ // syntax.
+ const bit = context & Context.AllowIn ^ Context.AllowIn;
+ while (hasBit(parser.token, 167772160 /* IsBinaryOp */)) {
+ const t = parser.token;
+ const prec = t & 3840 /* Precedence */;
+ const delta = (t === 167775030 /* Exponentiate */) << 8 /* PrecStart */;
+ if (bit && t === 167786289 /* InKeyword */)
+ break;
+ // When the next token is no longer a binary operator, it's potentially the
+ // start of an expression, so we break the loop
+ if (prec + delta <= minPrec)
+ break;
+ nextToken(parser, context);
+ left = finishNode(context, parser, pos, {
+ type: t & 2097152 /* IsLogical */ ? 'LogicalExpression' : 'BinaryExpression',
+ left,
+ right: parseBinaryExpression(parser, context & ~Context.AllowIn, prec, getLocation(parser)),
+ operator: tokenDesc(t),
+ });
+ }
+ return left;
+ }
+ /**
+ * Parse await expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AwaitExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ */
+ function parseAwaitExpression(parser, context, pos) {
+ if (context & Context.InParameter)
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ expect(parser, context, 34017389 /* AwaitKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'AwaitExpression',
+ argument: parseUnaryExpression(parser, context),
+ });
+ }
+ /**
+ * Parses unary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UnaryExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseUnaryExpression(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ if (hasBit(token, 301989888 /* IsUnaryOp */)) {
+ nextToken(parser, context);
+ if (parser.flags & Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ const argument = parseExpressionCoverGrammar(parser, context, parseUnaryExpression);
+ if (parser.token === 167775030 /* Exponentiate */) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & Context.Strict && token === 302002219 /* DeleteKeyword */) {
+ if (argument.type === 'Identifier') {
+ tolerant(parser, context, 43 /* StrictDelete */);
+ }
+ else if (isPropertyWithPrivateFieldKey(argument)) {
+ tolerant(parser, context, 44 /* DeletePrivateField */);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'UnaryExpression',
+ operator: tokenDesc(token),
+ argument,
+ prefix: true,
+ });
+ }
+ return context & Context.Async && token & 262144 /* IsAwait */
+ ? parseAwaitExpression(parser, context, pos)
+ : parseUpdateExpression(parser, context, pos);
+ }
+ /**
+ * Parses update expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UpdateExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseUpdateExpression(parser, context, pos) {
+ const { token } = parser;
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */)) {
+ nextToken(parser, context);
+ const expr = parseLeftHandSideExpression(parser, context, pos);
+ validateUpdateExpression(parser, context, expr, 'Prefix');
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expr,
+ operator: tokenDesc(token),
+ prefix: true,
+ });
+ }
+ else if (context & Context.OptionsJSX && token === 167774015 /* LessThan */) {
+ return parseJSXRootElement(parser, context | Context.InJSXChild);
+ }
+ const expression = parseLeftHandSideExpression(parser, context, pos);
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */) && !(parser.flags & Flags.NewLine)) {
+ validateUpdateExpression(parser, context, expression, 'Postfix');
+ const operator = parser.token;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expression,
+ operator: tokenDesc(operator),
+ prefix: false,
+ });
+ }
+ return expression;
+ }
+ /**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseRestElement(parser, context, args = []) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (context & Context.InParen && parser.token & 262144 /* IsAwait */)
+ parser.flags |= Flags.HasAwait;
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+ }
+ /**
+ * Parse spread element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SpreadElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSpreadElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+ }
+ /**
+ * Parse left hand side expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LeftHandSideExpression)
+ *
+ * @param Parser Parer instance
+ * @param Context Contextmasks
+ * @param pos Location info
+ */
+ function parseLeftHandSideExpression(parser, context, pos) {
+ const expr = context & Context.OptionsNext && parser.token === 33566810 /* ImportKeyword */
+ ? parseCallImportOrMetaProperty(parser, context | Context.AllowIn)
+ : parseMemberExpression(parser, context | Context.AllowIn, pos);
+ return parseCallExpression(parser, context | Context.AllowIn, pos, expr);
+ }
+ /**
+ * Parse member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ * @param expr Expression
+ */
+ function parseMemberExpression(parser, context, pos, expr = parsePrimaryExpression(parser, context)) {
+ while (true) {
+ switch (parser.token) {
+ case 16777229 /* Period */: {
+ consume(parser, context, 16777229 /* Period */);
+ parser.flags = parser.flags & ~Flags.AllowBinding | Flags.AllowDestructuring;
+ const property = parseIdentifierNameOrPrivateName(parser, context);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: false,
+ property,
+ });
+ continue;
+ }
+ case 41943059 /* LeftBracket */: {
+ consume(parser, context, 41943059 /* LeftBracket */);
+ parser.flags = parser.flags & ~Flags.AllowBinding | Flags.AllowDestructuring;
+ const property = parseExpression(parser, context);
+ expect(parser, context, 20 /* RightBracket */);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: true,
+ property,
+ });
+ continue;
+ }
+ case 33554441 /* TemplateTail */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplateLiteral(parser, context),
+ });
+ continue;
+ }
+ case 33554440 /* TemplateCont */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplate(parser, context | Context.TaggedTemplate),
+ });
+ continue;
+ }
+ default:
+ return expr;
+ }
+ }
+ }
+ /**
+ * Parse call expression
+ *
+ * @param parser Parer instance
+ * @param context Context masks
+ * @param pos Line / Colum info
+ * @param expr Expression
+ */
+ function parseCallExpression(parser, context, pos, expr) {
+ while (true) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ if (parser.token !== 50331659 /* LeftParen */)
+ return expr;
+ const args = parseArgumentList(parser, context & ~Context.AllowDecorator);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ }
+ /**
+ * Parse cover call expression and async arrow head
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CoverCallExpressionAndAsyncArrowHead)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parserCoverCallExpressionAndAsyncArrowHead(parser, context) {
+ const pos = getLocation(parser);
+ let expr = parseMemberExpression(parser, context | Context.AllowIn, pos);
+ // Here we jump right into it and parse a simple, faster sub-grammar for
+ // async arrow / async identifier + call expression. This could have been done different
+ // but ESTree sucks!
+ //
+ // - J.K. Thomas
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (parser.token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */);
+ return parseAsyncArrowFunction(parser, context, ModifierState.Await, pos, [parseAndClassifyIdentifier(parser, context)]);
+ }
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ while (parser.token === 50331659 /* LeftParen */) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ const args = parseAsyncArgumentList(parser, context);
+ if (parser.token === 10 /* Arrow */) {
+ expr = parseAsyncArrowFunction(parser, context, ModifierState.Await, pos, args);
+ break;
+ }
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ return expr;
+ }
+ /**
+ * Parse argument list
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parseArgumentList(parser, context) {
+ // ArgumentList :
+ // AssignmentOrSpreadExpression
+ // ArgumentList , AssignmentOrSpreadExpression
+ //
+ // AssignmentOrSpreadExpression :
+ // ... AssignmentExpression
+ // AssignmentExpression
+ expect(parser, context, 50331659 /* LeftParen */);
+ const expressions = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ expressions.push(parseSpreadElement(parser, context));
+ }
+ else {
+ if (context & Context.Yield && hasBit(parser.token, 1073741824 /* IsYield */)) {
+ parser.flags |= Flags.HasYield;
+ setPendingError(parser);
+ }
+ expressions.push(parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ }
+ if (parser.token !== 16 /* RightParen */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return expressions;
+ }
+ /**
+ * Parse argument list for async arrow / async call expression
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parseAsyncArgumentList(parser, context) {
+ // Here we are parsing an "extended" argument list tweaked to handle async arrows. This is
+ // done here to avoid overhead and possible performance loss if we only
+ // parse out a simple call expression - E.g 'async(foo, bar)' or 'async(foo, bar)()';
+ //
+ // - J.K. Thomas
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = [];
+ let { token } = parser;
+ let state = CoverCallState.Empty;
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ parser.flags |= Flags.SimpleParameterList;
+ args.push(parseSpreadElement(parser, context));
+ state = CoverCallState.HasSpread;
+ }
+ else {
+ token = parser.token;
+ state = validateAsyncArgumentList(parser, context, state);
+ args.push(restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ }
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ parser.flags &= ~Flags.AllowDestructuring;
+ if (state & CoverCallState.HasSpread)
+ state = CoverCallState.SeenSpread;
+ }
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & CoverCallState.SeenSpread) {
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ }
+ else if (state & CoverCallState.EvalOrArguments) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (state & CoverCallState.Yield) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ else if (parser.flags & Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (state & CoverCallState.Await || parser.flags & Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ }
+ return args;
+ }
+ /**
+ * Parse primary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PrimaryExpression)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parsePrimaryExpression(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ return parseIdentifier(parser, context);
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionOrIdentifier(parser, context);
+ case 50331659 /* LeftParen */:
+ return parseParenthesizedExpression(parser, context | Context.InParen);
+ case 41943059 /* LeftBracket */:
+ return restoreExpressionCoverGrammar(parser, context, parseArrayLiteral);
+ case 41943052 /* LeftBrace */:
+ return restoreExpressionCoverGrammar(parser, context, parseObjectLiteral);
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionExpression(parser, context);
+ case 33566727 /* NullKeyword */:
+ case 33566726 /* TrueKeyword */:
+ case 33566725 /* FalseKeyword */:
+ return parseNullOrTrueOrFalseLiteral(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassExpression(parser, context);
+ case 33566811 /* NewKeyword */:
+ return parseNewExpressionOrMetaProperty(parser, context);
+ case 33566813 /* SuperKeyword */:
+ return parseSuperProperty(parser, context);
+ case 33554551 /* BigIntLiteral */:
+ return parseBigIntLiteral(parser, context);
+ case 33566815 /* ThisKeyword */:
+ return parseThisExpression(parser, context);
+ case 115 /* Hash */:
+ return parseIdentifierNameOrPrivateName(parser, context);
+ case 167774773 /* Divide */:
+ case 100663333 /* DivideAssign */:
+ scanRegularExpression(parser, context);
+ return parseRegularExpressionLiteral(parser, context);
+ case 33554441 /* TemplateTail */:
+ return parseTemplateLiteral(parser, context);
+ case 33554440 /* TemplateCont */:
+ return parseTemplate(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetAsIdentifier(parser, context);
+ case 12369 /* DoKeyword */:
+ if (context & Context.OptionsExperimental)
+ return parseDoExpression(parser, context);
+ default:
+ return parseAndClassifyIdentifier(parser, context);
+ }
+ }
+ /**
+ * Parse do expression (*experimental*)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDoExpression(parser, context) {
+ // AssignmentExpression ::
+ // do '{' StatementList '}'
+ const pos = getLocation(parser);
+ expect(parser, context, 12369 /* DoKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'DoExpression',
+ body: parseBlockStatement(parser, context)
+ });
+ }
+ /**
+ * Parse 'let' as identifier in 'sloppy mode', and throws
+ * in 'strict mode' / 'module code'. We also avoid a lookahead on the
+ * ASI restictions while checking this after parsing out the 'let' keyword
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+ function parseLetAsIdentifier(parser, context) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ if (parser.flags & Flags.NewLine) {
+ if (parser.token === 41943059 /* LeftBracket */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, 'let');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ }
+ /**
+ * Parse either async function expression or identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+ function parseAsyncFunctionOrIdentifier(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) :
+ parseIdentifier(parser, context);
+ }
+ /**
+ * Parses identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIdentifier(parser, context) {
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context | Context.TaggedTemplate);
+ const node = finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ if (context & Context.OptionsRawidentifiers)
+ node.raw = parser.tokenRaw;
+ return node;
+ }
+ /**
+ * Parse regular expression literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseRegularExpressionLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenRegExp, tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ regex: tokenRegExp,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = tokenRaw;
+ return node;
+ }
+ /**
+ * Parses string and number literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StringLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.tokenValue;
+ if (context & Context.Strict && parser.flags & Flags.HasOctal) {
+ tolerant(parser, context, 61 /* StrictOctalLiteral */);
+ }
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+ }
+ /**
+ * Parses BigInt literal (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/proposal-bigint/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBigIntLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ bigint: tokenRaw,
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+ }
+ /**
+ * Parses either null or boolean literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BooleanLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNullOrTrueOrFalseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const raw = tokenDesc(token);
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: token === 33566727 /* NullKeyword */ ? null : raw === 'true',
+ });
+ if (context & Context.OptionsRaw)
+ node.raw = raw;
+ return node;
+ }
+ /**
+ * Parse this expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseThisExpression(parser, context) {
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ const pos = getLocation(parser);
+ nextToken(parser, context | Context.DisallowEscapedKeyword);
+ return finishNode(context, parser, pos, {
+ type: 'ThisExpression',
+ });
+ }
+ /**
+ * Parse identifier name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-IdentifierName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t token
+ */
+ function parseIdentifierName(parser, context, t) {
+ if (!(t & (131072 /* IsIdentifier */ | 4096 /* Keyword */)))
+ tolerant(parser, context, 4 /* UnexpectedKeyword */, tokenDesc(t));
+ return parseIdentifier(parser, context);
+ }
+ /**
+ * Parse identifier name or private name (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIdentifierNameOrPrivateName(parser, context) {
+ if (!consume(parser, context, 115 /* Hash */))
+ return parseIdentifierName(parser, context, parser.token);
+ const { tokenValue } = parser;
+ const pos = getLocation(parser);
+ const name = tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+ }
+ /**
+ * Parse array literal
+ *
+ * ArrayLiteral :
+ * [ Elisionopt ]
+ * [ ElementList ]
+ * [ ElementList , Elisionopt ]
+ *
+ * ElementList :
+ * Elisionopt AssignmentExpression
+ * Elisionopt ... AssignmentExpression
+ * ElementList , Elisionopt AssignmentExpression
+ * ElementList , Elisionopt SpreadElement
+ *
+ * Elision :
+ * ,
+ * Elision ,
+ *
+ * SpreadElement :
+ * ... AssignmentExpression
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseArrayLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseSpreadElement(parser, context));
+ if (parser.token !== 20 /* RightBracket */) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ else {
+ elements.push(restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression));
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ return finishNode(context, parser, pos, {
+ type: 'ArrayExpression',
+ elements,
+ });
+ }
+ /**
+ * Parses cover parenthesized expression and arrow parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-parseCoverParenthesizedExpressionAndArrowParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseParenthesizedExpression(parser, context) {
+ expect(parser, context, 50331659 /* LeftParen */);
+ if (consume(parser, context, 16 /* RightParen */)) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.token === 10 /* Arrow */)
+ return [];
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ const restExpr = [parseRestElement(parser, context)];
+ expect(parser, context, 16 /* RightParen */);
+ parser.flags = parser.flags & ~(Flags.AllowDestructuring | Flags.AllowBinding) | Flags.SimpleParameterList;
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return restExpr;
+ }
+ // Record the sequence position
+ const sequencepos = getLocation(parser);
+ let state = validateCoverParenthesizedExpression(parser, CoverParenthesizedState.None);
+ let expr = restoreExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ // Sequence expression
+ if (parser.token === 16777234 /* Comma */) {
+ state |= CoverParenthesizedState.SequenceExpression;
+ const expressions = [expr];
+ while (consume(parser, context | Context.DisallowEscapedKeyword, 16777234 /* Comma */)) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (!(parser.flags & Flags.AllowBinding))
+ tolerant(parser, context, 77 /* NotBindable */);
+ parser.flags |= Flags.SimpleParameterList;
+ const restElement = parseRestElement(parser, context);
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ expressions.push(restElement);
+ return expressions;
+ }
+ else if (consume(parser, context, 16 /* RightParen */)) {
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return expressions;
+ }
+ else {
+ state = validateCoverParenthesizedExpression(parser, state);
+ expressions.push(restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ }
+ expr = finishNode(context, parser, sequencepos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & CoverParenthesizedState.HasEvalOrArguments) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ else if (state & CoverParenthesizedState.HasReservedWords) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= Flags.HasStrictReserved;
+ }
+ else if (!(parser.flags & Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (parser.flags & Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (context & Context.Async && parser.flags & Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ parser.flags &= ~(Flags.AllowBinding | Flags.HasAwait | Flags.HasYield);
+ return (state & CoverParenthesizedState.SequenceExpression ? expr.expressions : [expr]);
+ }
+ parser.flags &= ~(Flags.HasAwait | Flags.HasYield | Flags.AllowBinding);
+ if (!isValidSimpleAssignmentTarget(expr))
+ parser.flags &= ~Flags.AllowDestructuring;
+ return expr;
+ }
+ /**
+ * Parses function expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFunctionExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & ModifierState.Generator) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty), isGenerator, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: false,
+ generator: !!(isGenerator & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+ }
+ /**
+ * Parses async function or async generator expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ const isAwait = ModifierState.Await;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & Context.Strict || isAwait & ModifierState.Await)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ if (token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & ModifierState.Generator)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty), isGenerator | isAwait, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: true,
+ generator: !!(isGenerator & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+ }
+ /**
+ * Parse computed property names
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ComputedPropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseComputedPropertyName(parser, context) {
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const key = parseAssignmentExpression(parser, context | Context.AllowIn);
+ expect(parser, context, 20 /* RightBracket */);
+ return key;
+ }
+ /**
+ * Parse property name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePropertyName(parser, context) {
+ switch (parser.token) {
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943059 /* LeftBracket */:
+ return parseComputedPropertyName(parser, context);
+ default:
+ return parseIdentifier(parser, context);
+ }
+ }
+ /**
+ * Parse object spread properties
+ *
+ * @see [Link](https://tc39.github.io/proposal-object-rest-spread/#Spread)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSpreadProperties(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (parser.token & 8388608 /* IsBindingPattern */)
+ parser.flags &= ~Flags.AllowDestructuring;
+ const argument = parseAssignmentExpression(parser, context | Context.AllowIn);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+ }
+ /**
+ * Parses object literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ObjectLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseObjectLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const properties = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ properties.push(parser.token === 14 /* Ellipsis */ ?
+ parseSpreadProperties(parser, context) :
+ parsePropertyDefinition(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ parser.flags &= ~Flags.HasProtoField;
+ return finishNode(context, parser, pos, {
+ type: 'ObjectExpression',
+ properties,
+ });
+ }
+ /**
+ * Parse property definition
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyDefinition)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePropertyDefinition(parser, context) {
+ const pos = getLocation(parser);
+ const flags = parser.flags;
+ let value;
+ let state = consume(parser, context, 167774771 /* Multiply */) ? ObjectState.Generator | ObjectState.Method : ObjectState.Method;
+ const t = parser.token;
+ let key = parsePropertyName(parser, context);
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ else if (!(state & ObjectState.Generator) && t & 524288 /* IsAsync */ && !(parser.flags & Flags.NewLine)) {
+ state |= consume(parser, context, 167774771 /* Multiply */) ? ObjectState.Generator | ObjectState.Async : ObjectState.Async;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69743 /* GetKeyword */) {
+ state = state & ~ObjectState.Method | ObjectState.Getter;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69744 /* SetKeyword */) {
+ state = state & ~ObjectState.Method | ObjectState.Setter;
+ key = parsePropertyName(parser, context);
+ }
+ if (state & (ObjectState.Getter | ObjectState.Setter)) {
+ if (state & ObjectState.Generator)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ state &= ~ObjectState.Method;
+ if (parser.token === 16777237 /* Colon */) {
+ if ((state & (ObjectState.Async | ObjectState.Generator))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ else if (t !== 41943059 /* LeftBracket */ && parser.tokenValue === '__proto__') {
+ if (parser.flags & Flags.HasProtoField) {
+ // Record the error and put it on hold until we've determined
+ // whether or not we're destructuring
+ setPendingExpressionError(parser, 63 /* DuplicateProto */);
+ }
+ else
+ parser.flags |= Flags.HasProtoField;
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ // Invalid: 'async ({a: await}) => 1'
+ if (parser.token & 262144 /* IsAwait */)
+ parser.flags |= Flags.HasAwait;
+ value = restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ }
+ else {
+ if ((state & (ObjectState.Generator | ObjectState.Async)) || !isValidIdentifier(context, t)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(t));
+ }
+ else if (context & (Context.Strict | Context.Yield) && t & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasYield;
+ }
+ state |= ObjectState.Shorthand;
+ if (parser.token === 83886109 /* Assign */) {
+ if (context & Context.Strict && t & 4194304 /* IsEvalOrArguments */) {
+ report(parser, 47 /* StrictEvalArguments */);
+ }
+ else
+ setPendingExpressionError(parser, 91 /* InvalidCoverInitializedName */);
+ expect(parser, context, 83886109 /* Assign */);
+ if (context & (Context.Strict | Context.Yield | Context.Async) && parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */)) {
+ setPendingError(parser);
+ parser.flags |= parser.token & 1073741824 /* IsYield */ ? Flags.HasYield : Flags.HasAwait;
+ }
+ value = parseAssignmentPattern(parser, context, key, pos);
+ }
+ else {
+ if (t & 262144 /* IsAwait */) {
+ if (context & Context.Async)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ value = key;
+ }
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ key,
+ value,
+ kind: !(state & ObjectState.Getter | state & ObjectState.Setter) ? 'init' : (state & ObjectState.Setter) ? 'set' : 'get',
+ computed: t === 41943059 /* LeftBracket */,
+ method: !!(state & ObjectState.Method),
+ shorthand: !!(state & ObjectState.Shorthand),
+ });
+ }
+ /**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseMethodDeclaration(parser, context, state) {
+ const pos = getLocation(parser);
+ const isGenerator = state & ObjectState.Generator ? ModifierState.Generator : ModifierState.None;
+ const isAsync = state & ObjectState.Async ? ModifierState.Await : ModifierState.None;
+ const { params, body } = swapContext(parser, context | Context.Method, isGenerator | isAsync, parseFormalListAndBody, state);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: !!(state & ObjectState.Async),
+ generator: !!(state & ObjectState.Generator),
+ expression: false,
+ id: null,
+ });
+ }
+ /**
+ * Parse arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseArrowFunction(parser, context, pos, params) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, '=>');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context & ~Context.Async, params, pos, ModifierState.None);
+ }
+ /**
+ * Parse async arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncArrowFunction(parser, context, state, pos, params) {
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context | Context.Async, params, pos, state);
+ }
+ /**
+ * Shared helper function for both async arrow and arrows
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ // https://tc39.github.io/ecma262/#prod-AsyncArrowFunction
+ function parseArrowBody(parser, context, params, pos, state) {
+ parser.pendingExpressionError = null;
+ for (const i in params)
+ reinterpret(parser, context | Context.InParameter, params[i]);
+ const expression = parser.token !== 41943052 /* LeftBrace */;
+ const body = expression ? parseExpressionCoverGrammar(parser, context & ~(Context.Yield | Context.InParameter), parseAssignmentExpression) :
+ swapContext(parser, context & ~(Context.Yield | Context.AllowDecorator) | Context.InFunctionBody, state, parseFunctionBody);
+ return finishNode(context, parser, pos, {
+ type: 'ArrowFunctionExpression',
+ body,
+ params,
+ id: null,
+ async: !!(state & ModifierState.Await),
+ generator: false,
+ expression,
+ });
+ }
+ /**
+ * Parses formal parameters and function body.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFormalListAndBody(parser, context, state) {
+ const paramList = parseFormalParameters(parser, context | Context.InParameter, state);
+ const args = paramList.args;
+ const params = paramList.params;
+ const body = parseFunctionBody(parser, context & ~Context.AllowDecorator | Context.InFunctionBody, args);
+ return { params, body };
+ }
+ /**
+ * Parse funciton body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFunctionBody(parser, context, params) {
+ // Note! The 'params' has an 'any' type now because it's really shouldn't be there. This should have been
+ // on the parser object instead. So for now the 'params' arg are only used within the
+ // 'parseFormalListAndBody' method, and not within the arrow function body.
+ const pos = getLocation(parser);
+ expect(parser, context | Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const body = [];
+ while (parser.token === 33554435 /* StringLiteral */) {
+ const { tokenRaw, tokenValue } = parser;
+ body.push(parseDirective(parser, context));
+ if (tokenRaw.length === /* length of prologue*/ 12 && tokenValue === 'use strict') {
+ if (parser.flags & Flags.SimpleParameterList) {
+ tolerant(parser, context, 64 /* IllegalUseStrict */);
+ }
+ else if (parser.flags & (Flags.HasStrictReserved | Flags.StrictFunctionName)) {
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ }
+ else if (parser.flags & Flags.StrictEvalArguments) {
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ }
+ context |= Context.Strict;
+ }
+ }
+ if (context & Context.Strict) {
+ validateParams(parser, context, params);
+ }
+ const { labelSet } = parser;
+ parser.labelSet = {};
+ const savedFlags = parser.flags;
+ parser.flags = parser.flags & ~(Flags.StrictFunctionName | Flags.StrictEvalArguments | Flags.InSwitchStatement | Flags.InIterationStatement) | Flags.AllowDestructuring;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ if (savedFlags & Flags.InIterationStatement)
+ parser.flags |= Flags.InIterationStatement;
+ if (savedFlags & Flags.InSwitchStatement)
+ parser.flags |= Flags.InSwitchStatement;
+ parser.labelSet = labelSet;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body,
+ });
+ }
+ /**
+ * Parse formal parameters
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param Parser object
+ * @param Context masks
+ * @param Optional objectstate. Default to none
+ */
+ function parseFormalParameters(parser, context, state) {
+ // FormalParameterList :
+ // [empty]
+ // FunctionRestParameter
+ // FormalsList
+ // FormalsList , FunctionRestParameter
+ //
+ // FunctionRestParameter :
+ // ... BindingIdentifier
+ //
+ // FormalsList :
+ // FormalParameter
+ // FormalsList , FormalParameter
+ //
+ // FormalParameter :
+ // BindingElement
+ //
+ // BindingElement :
+ // SingleNameBinding
+ // BindingPattern Initializeropt
+ expect(parser, context, 50331659 /* LeftParen */);
+ parser.flags &= ~(Flags.SimpleParameterList | Flags.HasStrictReserved);
+ const args = [];
+ const params = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (state & ObjectState.Setter)
+ tolerant(parser, context, 67 /* BadSetterRestParameter */);
+ parser.flags |= Flags.SimpleParameterList;
+ params.push(parseRestElement(parser, context, args));
+ break;
+ }
+ params.push(parseFormalParameterList(parser, context, args));
+ if (!consume(parser, context, 16777234 /* Comma */))
+ break;
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ if (state & ObjectState.Setter && params.length !== 1) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Setter', 'one', '');
+ }
+ if (state & ObjectState.Getter && params.length > 0) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Getter', 'no', 's');
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return { params, args };
+ }
+ /**
+ * Parse formal parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFormalParameterList(parser, context, args) {
+ const pos = getLocation(parser);
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (hasBit(parser.token, 20480 /* FutureReserved */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= Flags.StrictFunctionName;
+ }
+ if (hasBit(parser.token, 4194304 /* IsEvalOrArguments */)) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= Flags.StrictEvalArguments;
+ }
+ }
+ else {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ const left = parseBindingIdentifierOrPattern(parser, context, args);
+ if (!consume(parser, context, 83886109 /* Assign */))
+ return left;
+ if (parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */) && context & (Context.Yield | Context.Async)) {
+ tolerant(parser, context, parser.token & 262144 /* IsAwait */ ? 52 /* AwaitInParameter */ : 51 /* YieldInParameter */);
+ }
+ parser.flags |= Flags.SimpleParameterList;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+ }
+ /**
+ * Parse class expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassExpression(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const { token } = parser;
+ let state = ObjectState.None;
+ let id = null;
+ let superClass = null;
+ if ((token !== 41943052 /* LeftBrace */ && token !== 12372 /* ExtendsKeyword */)) {
+ if (context & Context.Async && token & 262144 /* IsAwait */) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context | Context.Strict);
+ }
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | Context.Strict, pos);
+ state |= ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context | Context.Strict, state);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ });
+ }
+ /**
+ * Parse class body and element list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElementList)
+ *
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassBodyAndElementList(parser, context, state) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const body = [];
+ let decorators = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (!consume(parser, context, 17825809 /* Semicolon */)) {
+ if (context & Context.OptionsExperimental) {
+ decorators = parseDecorators(parser, context);
+ if (parser.token === 17825807 /* RightBrace */)
+ report(parser, 92 /* TrailingDecorators */);
+ if (decorators.length !== 0 && parser.tokenValue === 'constructor') {
+ report(parser, 93 /* GeneratorConstructor */);
+ }
+ }
+ body.push(context & Context.OptionsNext && parser.token === 115 /* Hash */
+ ? parsePrivateFields(parser, context, decorators)
+ : parseClassElement(parser, context, state, decorators));
+ }
+ }
+ parser.flags &= ~Flags.HasConstructor;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ClassBody',
+ body,
+ });
+ }
+ /**
+ * Parse class element and class public instance fields & private instance fields
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElement)
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassElement(parser, context, state, decorators) {
+ const pos = getLocation(parser);
+ let { tokenValue, token } = parser;
+ const flags = parser.flags;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ state |= ObjectState.Generator;
+ }
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ if (parser.tokenValue === 'constructor') {
+ if (state & ObjectState.Generator)
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'generator');
+ else if (state & ObjectState.Heritage)
+ context |= Context.AllowSuperProperty;
+ state |= ObjectState.Constructor;
+ }
+ let key = parsePropertyName(parser, context);
+ let value;
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ if (token === 20585 /* StaticKeyword */) {
+ token = parser.token;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= ObjectState.Generator;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ if (parser.tokenValue === 'prototype')
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ state |= ObjectState.Static;
+ key = parsePropertyName(parser, context);
+ if (context & Context.OptionsNext && isInstanceField(parser)) {
+ if (tokenValue === 'constructor')
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ }
+ }
+ if (parser.token !== 50331659 /* LeftParen */) {
+ if (token & 524288 /* IsAsync */ && !(state & ObjectState.Generator) && !(parser.flags & Flags.NewLine)) {
+ token = parser.token;
+ tokenValue = parser.tokenValue;
+ state |= ObjectState.Async;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= ObjectState.Generator;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ key = parsePropertyName(parser, context);
+ }
+ else if ((token === 69743 /* GetKeyword */ || token === 69744 /* SetKeyword */)) {
+ state |= token === 69743 /* GetKeyword */ ? ObjectState.Getter : ObjectState.Setter;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= ObjectState.Computed;
+ key = parsePropertyName(parser, context & ~Context.Strict);
+ }
+ if (tokenValue === 'prototype') {
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ }
+ else if (!(state & ObjectState.Static) && tokenValue === 'constructor') {
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'accessor');
+ }
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ if (!(state & ObjectState.Computed) && state & ObjectState.Constructor) {
+ if (parser.flags & Flags.HasConstructor)
+ report(parser, 12 /* DuplicateConstructor */);
+ else
+ parser.flags |= Flags.HasConstructor;
+ }
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ if (context & Context.OptionsNext)
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const kind = (state & ObjectState.Constructor) ? 'constructor' : (state & ObjectState.Getter) ? 'get' :
+ (state & ObjectState.Setter) ? 'set' : 'method';
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & ObjectState.Static),
+ computed: !!(state & ObjectState.Computed),
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & ObjectState.Static),
+ computed: !!(state & ObjectState.Computed),
+ key,
+ value,
+ });
+ }
+ /**
+ * Parses field definition.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFieldDefinition(parser, context, key, state, pos, decorators) {
+ if (state & ObjectState.Constructor)
+ tolerant(parser, context, 0 /* Unexpected */);
+ let value = null;
+ if (state & (ObjectState.Async | ObjectState.Generator))
+ tolerant(parser, context, 0 /* Unexpected */);
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & ObjectState.Computed),
+ static: !!(state & ObjectState.Static),
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & ObjectState.Computed),
+ static: !!(state & ObjectState.Static),
+ });
+ }
+ /**
+ * Parse private name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePrivateName(parser, context, pos) {
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+ }
+ /**
+ * Parses private instance fields
+ *
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePrivateFields(parser, context, decorators) {
+ const pos = getLocation(parser);
+ expect(parser, context | Context.InClass, 115 /* Hash */);
+ if (parser.tokenValue === 'constructor')
+ tolerant(parser, context, 41 /* PrivateFieldConstructor */);
+ const key = parsePrivateName(parser, context, pos);
+ if (parser.token === 50331659 /* LeftParen */)
+ return parsePrivateMethod(parser, context, key, pos, decorators);
+ let value = null;
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ });
+ }
+ function parsePrivateMethod(parser, context, key, pos, decorators) {
+ const value = parseMethodDeclaration(parser, context | Context.Strict, ObjectState.None);
+ parser.flags &= ~(Flags.AllowDestructuring | Flags.AllowBinding);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ });
+ }
+ /**
+ * Parse either call expression or import expressions
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseCallImportOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ // Import.meta - Stage 3 proposal
+ if (consume(parser, context, 16777229 /* Period */)) {
+ if (context & Context.Module && parser.tokenValue === 'meta')
+ return parseMetaProperty(parser, context, id, pos);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ let expr = parseImportExpression(parser, context, pos);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = parseExpressionCoverGrammar(parser, context | Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16 /* RightParen */);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: [args],
+ });
+ return expr;
+ }
+ /**
+ * Parse Import() expression. (Stage 3 proposal)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+ function parseImportExpression(parser, context, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'Import',
+ });
+ }
+ /**
+ * Parse meta property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Identifier
+ * @param pos Location
+ */
+ function parseMetaProperty(parser, context, meta, pos) {
+ return finishNode(context, parser, pos, {
+ meta,
+ type: 'MetaProperty',
+ property: parseIdentifier(parser, context),
+ });
+ }
+ /**
+ * Parse new expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NewExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNewExpressionOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ if (consume(parser, context | Context.DisallowEscapedKeyword, 16777229 /* Period */)) {
+ if (parser.tokenValue !== 'target' ||
+ !(context & (Context.InParameter | Context.InFunctionBody)))
+ tolerant(parser, context, 53 /* MetaNotInFunctionBody */);
+ return parseMetaProperty(parser, context, id, pos);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'NewExpression',
+ callee: parseImportOrMemberExpression(parser, context, pos),
+ arguments: parser.token === 50331659 /* LeftParen */ ? parseArgumentList(parser, context) : [],
+ });
+ }
+ /**
+ * Parse either import or member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportOrMemberExpression(parser, context, pos) {
+ const { token } = parser;
+ if (context & Context.OptionsNext && token === 33566810 /* ImportKeyword */) {
+ // Invalid: '"new import(x)"'
+ if (lookahead(parser, context, nextTokenIsLeftParen))
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ // Fixes cases like ''new import.meta','
+ return parseCallImportOrMetaProperty(parser, context);
+ }
+ return parseMemberExpression(parser, context, pos);
+ }
+ /**
+ * Parse super property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SuperProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSuperProperty(parser, context) {
+ // SuperProperty[Yield, Await]:
+ // super[Expression[+In, ?Yield, ?Await]]
+ // super.IdentifierName
+ const pos = getLocation(parser);
+ expect(parser, context, 33566813 /* SuperKeyword */);
+ switch (parser.token) {
+ case 50331659 /* LeftParen */:
+ // The super property has to be within a class constructor
+ if (!(context & Context.AllowSuperProperty))
+ tolerant(parser, context, 54 /* BadSuperCall */);
+ break;
+ case 41943059 /* LeftBracket */:
+ case 16777229 /* Period */:
+ if (!(context & Context.Method))
+ tolerant(parser, context, 55 /* UnexpectedSuper */);
+ break;
+ default:
+ tolerant(parser, context, 56 /* LoneSuper */);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Super',
+ });
+ }
+ /**
+ * Parse template literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseTemplateLiteral(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions: [],
+ quasis: [parseTemplateSpans(parser, context)],
+ });
+ }
+ /**
+ * Parse template head
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param cooked Cooked template value
+ * @param raw Raw template value
+ * @param pos Current location
+ */
+ function parseTemplateHead(parser, context, cooked = null, raw, pos) {
+ parser.token = consumeTemplateBrace(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked,
+ raw,
+ },
+ tail: false,
+ });
+ }
+ /**
+ * Parse template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expression Expression AST node
+ * @param quasis Array of Template elements
+ */
+ function parseTemplate(parser, context, expressions = [], quasis = []) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554440 /* TemplateCont */);
+ expressions.push(parseExpression(parser, context));
+ const t = getLocation(parser);
+ quasis.push(parseTemplateHead(parser, context, tokenValue, tokenRaw, pos));
+ if (parser.token === 33554441 /* TemplateTail */) {
+ quasis.push(parseTemplateSpans(parser, context, t));
+ }
+ else {
+ parseTemplate(parser, context, expressions, quasis);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions,
+ quasis,
+ });
+ }
+ /**
+ * Parse template spans
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateSpans)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param loc Current AST node location
+ */
+ function parseTemplateSpans(parser, context, pos = getLocation(parser)) {
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554441 /* TemplateTail */);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked: tokenValue,
+ raw: tokenRaw,
+ },
+ tail: true,
+ });
+ }
+ /**
+ * Parses decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDecoratorList(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'Decorator',
+ expression: parseLeftHandSideExpression(parser, context, pos)
+ });
+ }
+ /**
+ * Parses a list of decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDecorators(parser, context) {
+ const decoratorList = [];
+ while (consume(parser, context, 120 /* At */)) {
+ decoratorList.push(parseDecoratorList(parser, context | Context.AllowDecorator));
+ }
+ return decoratorList;
+ } + + // Context masks
+ var Context;
+ (function (Context) {
+ Context[Context["Empty"] = 0] = "Empty";
+ Context[Context["OptionsNext"] = 1] = "OptionsNext";
+ Context[Context["OptionsRanges"] = 2] = "OptionsRanges";
+ Context[Context["OptionsJSX"] = 4] = "OptionsJSX";
+ Context[Context["OptionsRaw"] = 8] = "OptionsRaw";
+ Context[Context["OptionsLoc"] = 16] = "OptionsLoc";
+ Context[Context["OptionsGlobalReturn"] = 32] = "OptionsGlobalReturn";
+ Context[Context["OptionsComments"] = 64] = "OptionsComments";
+ Context[Context["OptionsShebang"] = 128] = "OptionsShebang";
+ Context[Context["OptionsRawidentifiers"] = 256] = "OptionsRawidentifiers";
+ Context[Context["OptionsTolerant"] = 512] = "OptionsTolerant";
+ Context[Context["OptionsNode"] = 1024] = "OptionsNode";
+ Context[Context["OptionsExperimental"] = 2048] = "OptionsExperimental";
+ Context[Context["Strict"] = 4096] = "Strict";
+ Context[Context["Module"] = 8192] = "Module";
+ Context[Context["TaggedTemplate"] = 16384] = "TaggedTemplate";
+ Context[Context["InClass"] = 32768] = "InClass";
+ Context[Context["AllowIn"] = 65536] = "AllowIn";
+ Context[Context["Async"] = 131072] = "Async";
+ Context[Context["Yield"] = 262144] = "Yield";
+ Context[Context["InParameter"] = 524288] = "InParameter";
+ Context[Context["InFunctionBody"] = 1048576] = "InFunctionBody";
+ Context[Context["AllowSingleStatement"] = 2097152] = "AllowSingleStatement";
+ Context[Context["BlockScope"] = 4194304] = "BlockScope";
+ Context[Context["ForStatement"] = 8388608] = "ForStatement";
+ Context[Context["RequireIdentifier"] = 16777216] = "RequireIdentifier";
+ Context[Context["Method"] = 33554432] = "Method";
+ Context[Context["AllowSuperProperty"] = 67108864] = "AllowSuperProperty";
+ Context[Context["InParen"] = 134217728] = "InParen";
+ Context[Context["InJSXChild"] = 268435456] = "InJSXChild";
+ Context[Context["DisallowEscapedKeyword"] = 536870912] = "DisallowEscapedKeyword";
+ Context[Context["AllowDecorator"] = 1073741824] = "AllowDecorator";
+ Context[Context["LocationTracker"] = 18] = "LocationTracker";
+ })(Context || (Context = exports('Context', {})));
+ // Mutual parser flags
+ var Flags;
+ (function (Flags) {
+ Flags[Flags["None"] = 0] = "None";
+ Flags[Flags["NewLine"] = 1] = "NewLine";
+ Flags[Flags["AllowBinding"] = 2] = "AllowBinding";
+ Flags[Flags["AllowDestructuring"] = 4] = "AllowDestructuring";
+ Flags[Flags["SimpleParameterList"] = 8] = "SimpleParameterList";
+ Flags[Flags["InSwitchStatement"] = 16] = "InSwitchStatement";
+ Flags[Flags["InIterationStatement"] = 32] = "InIterationStatement";
+ Flags[Flags["HasStrictReserved"] = 64] = "HasStrictReserved";
+ Flags[Flags["HasOctal"] = 128] = "HasOctal";
+ Flags[Flags["SimpleAssignmentTarget"] = 256] = "SimpleAssignmentTarget";
+ Flags[Flags["HasProtoField"] = 512] = "HasProtoField";
+ Flags[Flags["StrictFunctionName"] = 1024] = "StrictFunctionName";
+ Flags[Flags["StrictEvalArguments"] = 2048] = "StrictEvalArguments";
+ Flags[Flags["InFunctionBody"] = 4096] = "InFunctionBody";
+ Flags[Flags["HasAwait"] = 8192] = "HasAwait";
+ Flags[Flags["HasYield"] = 16384] = "HasYield";
+ Flags[Flags["EscapedKeyword"] = 32768] = "EscapedKeyword";
+ Flags[Flags["HasConstructor"] = 65536] = "HasConstructor";
+ })(Flags || (Flags = exports('Flags', {})));
+ // Label tracking state
+ var Labels;
+ (function (Labels) {
+ Labels[Labels["None"] = 0] = "None";
+ Labels[Labels["NotNested"] = 1] = "NotNested";
+ Labels[Labels["Nested"] = 2] = "Nested";
+ })(Labels || (Labels = exports('Labels', {})));
+ var NumericState;
+ (function (NumericState) {
+ NumericState[NumericState["None"] = 0] = "None";
+ NumericState[NumericState["SeenSeparator"] = 1] = "SeenSeparator";
+ NumericState[NumericState["EigthOrNine"] = 2] = "EigthOrNine";
+ NumericState[NumericState["Float"] = 4] = "Float";
+ NumericState[NumericState["BigInt"] = 8] = "BigInt";
+ })(NumericState || (NumericState = exports('NumericState', {})));
+ var ScannerState;
+ (function (ScannerState) {
+ ScannerState[ScannerState["None"] = 0] = "None";
+ ScannerState[ScannerState["NewLine"] = 1] = "NewLine";
+ ScannerState[ScannerState["LastIsCR"] = 2] = "LastIsCR";
+ })(ScannerState || (ScannerState = exports('ScannerState', {})));
+ var ModifierState;
+ (function (ModifierState) {
+ ModifierState[ModifierState["None"] = 0] = "None";
+ ModifierState[ModifierState["Generator"] = 1] = "Generator";
+ ModifierState[ModifierState["Await"] = 2] = "Await";
+ })(ModifierState || (ModifierState = exports('ModifierState', {})));
+ var CoverParenthesizedState;
+ (function (CoverParenthesizedState) {
+ CoverParenthesizedState[CoverParenthesizedState["None"] = 0] = "None";
+ CoverParenthesizedState[CoverParenthesizedState["SequenceExpression"] = 1] = "SequenceExpression";
+ CoverParenthesizedState[CoverParenthesizedState["HasEvalOrArguments"] = 2] = "HasEvalOrArguments";
+ CoverParenthesizedState[CoverParenthesizedState["HasReservedWords"] = 4] = "HasReservedWords";
+ CoverParenthesizedState[CoverParenthesizedState["HasYield"] = 8] = "HasYield";
+ CoverParenthesizedState[CoverParenthesizedState["HasBinding"] = 16] = "HasBinding";
+ })(CoverParenthesizedState || (CoverParenthesizedState = exports('CoverParenthesizedState', {})));
+ var Escape;
+ (function (Escape) {
+ Escape[Escape["Empty"] = -1] = "Empty";
+ Escape[Escape["StrictOctal"] = -2] = "StrictOctal";
+ Escape[Escape["EightOrNine"] = -3] = "EightOrNine";
+ Escape[Escape["InvalidHex"] = -4] = "InvalidHex";
+ Escape[Escape["OutOfRange"] = -5] = "OutOfRange";
+ })(Escape || (Escape = exports('Escape', {})));
+ var RegexFlags;
+ (function (RegexFlags) {
+ RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
+ RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
+ RegexFlags[RegexFlags["Global"] = 2] = "Global";
+ RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
+ RegexFlags[RegexFlags["Unicode"] = 8] = "Unicode";
+ RegexFlags[RegexFlags["Sticky"] = 16] = "Sticky";
+ RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
+ })(RegexFlags || (RegexFlags = exports('RegexFlags', {})));
+ var CoverCallState;
+ (function (CoverCallState) {
+ CoverCallState[CoverCallState["Empty"] = 0] = "Empty";
+ CoverCallState[CoverCallState["SeenSpread"] = 1] = "SeenSpread";
+ CoverCallState[CoverCallState["HasSpread"] = 2] = "HasSpread";
+ CoverCallState[CoverCallState["SimpleParameter"] = 4] = "SimpleParameter";
+ CoverCallState[CoverCallState["EvalOrArguments"] = 8] = "EvalOrArguments";
+ CoverCallState[CoverCallState["Yield"] = 16] = "Yield";
+ CoverCallState[CoverCallState["Await"] = 32] = "Await";
+ })(CoverCallState || (CoverCallState = exports('CoverCallState', {})));
+ var RegexState;
+ (function (RegexState) {
+ RegexState[RegexState["Empty"] = 0] = "Empty";
+ RegexState[RegexState["Escape"] = 1] = "Escape";
+ RegexState[RegexState["Class"] = 2] = "Class";
+ })(RegexState || (RegexState = exports('RegexState', {})));
+ // Shared between class expr / decl & object literal
+ var ObjectState;
+ (function (ObjectState) {
+ ObjectState[ObjectState["None"] = 0] = "None";
+ ObjectState[ObjectState["Async"] = 1] = "Async";
+ ObjectState[ObjectState["Generator"] = 2] = "Generator";
+ ObjectState[ObjectState["Getter"] = 4] = "Getter";
+ ObjectState[ObjectState["Setter"] = 8] = "Setter";
+ ObjectState[ObjectState["Computed"] = 16] = "Computed";
+ ObjectState[ObjectState["Method"] = 32] = "Method";
+ ObjectState[ObjectState["Shorthand"] = 64] = "Shorthand";
+ ObjectState[ObjectState["Static"] = 128] = "Static";
+ ObjectState[ObjectState["Constructor"] = 256] = "Constructor";
+ ObjectState[ObjectState["Heritage"] = 512] = "Heritage";
+ })(ObjectState || (ObjectState = exports('ObjectState', {})));
+ /**
+ * Validate break and continue statement
+ *
+ * @param parser Parser object
+ * @param label label
+ * @param isContinue true if validation continue statement
+ */
+ function validateBreakOrContinueLabel(parser, context, label, isContinue) {
+ const state = hasLabel(parser, label);
+ if (!state)
+ tolerant(parser, context, 32 /* UnknownLabel */, label);
+ if (isContinue && !(state & Labels.Nested))
+ tolerant(parser, context, 31 /* IllegalContinue */, label);
+ }
+ /**
+ * Add label to the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+ function addLabel(parser, label) {
+ if (parser.labelSet === undefined)
+ parser.labelSet = {};
+ parser.labelSet[`$${label}`] = isIterationStatement(parser.token) ? Labels.Nested : Labels.NotNested;
+ }
+ /**
+ * Remove label from the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+ function popLabel(parser, label) {
+ parser.labelSet[`$${label}`] = Labels.None;
+ }
+ /**
+ * Returns either true or false. Depends if the label exist.
+ *
+ * @param parser Parser object
+ * @param label Label
+ */
+ function hasLabel(parser, label) {
+ return !parser.labelSet ? Labels.None : parser.labelSet[`$${label}`];
+ }
+ /**
+ * Finish each the node for each parse. Set line / and column on the node if the
+ * options are set for it
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Line / column
+ * @param node AST node
+ */
+ function finishNode(context, parser, meta, node) {
+ const { lastIndex, lastLine, lastColumn, sourceFile, index } = parser;
+ if (context & Context.LocationTracker) {
+ if (context & Context.OptionsRanges) {
+ node.start = meta.index;
+ node.end = lastIndex;
+ }
+ if (context & Context.OptionsLoc) {
+ node.loc = {
+ start: { line: meta.line, column: meta.column },
+ end: { line: lastLine, column: lastColumn }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ return node;
+ }
+ /**
+ * Consumes the next token. If the consumed token is not of the expected type
+ * then report an error and return null. Otherwise return true.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ * @param Err Optionally error message to be thrown
+ */
+ function expect(parser, context, token, err = 1 /* UnexpectedToken */) {
+ if (parser.token !== token)
+ report(parser, err, tokenDesc(parser.token));
+ nextToken(parser, context);
+ return true;
+ }
+ /**
+ * If the next token matches the given token, this consumes the token
+ * and returns true. Otherwise return false.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ */
+ function consume(parser, context, token) {
+ if (parser.token !== token)
+ return false;
+ nextToken(parser, context);
+ return true;
+ }
+ /**
+ * Advance and return the next token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextToken(parser, context) {
+ parser.lastIndex = parser.index;
+ parser.lastLine = parser.line;
+ parser.lastColumn = parser.column;
+ return (parser.token = scan(parser, context));
+ }
+ const hasBit = exports('hasBit', (mask, flags) => (mask & flags) === flags);
+ /**
+ * Automatic Semicolon Insertion
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function consumeSemicolon(parser, context) {
+ return parser.token & 1048576 /* ASI */ || parser.flags & Flags.NewLine
+ ? consume(parser, context, 17825809 /* Semicolon */)
+ : report(parser, !(context & Context.Async) && parser.token & 262144 /* IsAwait */ ? 38 /* AwaitOutsideAsync */ : 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ /**
+ * Bit fiddle current grammar state and keep track of the state during the parse and restore
+ * it back to original state after finish parsing or throw.
+ *
+ * Ideas for this is basicly from V8 and SM, but also the Esprima parser does this in a similar way.
+ *
+ * However this implementation is an major improvement over similiar implementations, and
+ * does not require additonal bitmasks to be set / unset during the parsing outside this function.
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ * @param errMsg Optional error message
+ */
+ function parseExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= Flags.AllowBinding | Flags.AllowDestructuring;
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // If there exist an pending expression error, we throw an error at
+ // the same location it was recorded
+ if (!!parser.pendingExpressionError) {
+ const { error, line, column, index } = parser.pendingExpressionError;
+ constructError(parser, context, index, line, column, error);
+ }
+ // Here we - just in case - disallow both binding and destructuring
+ // and only set the bitmaks if the previous flags (before the callback)
+ // is positive.
+ // Note that this bitmasks may have been turned off during parsing
+ // the callback
+ parser.flags &= ~(Flags.AllowBinding | Flags.AllowDestructuring);
+ if (flags & Flags.AllowBinding)
+ parser.flags |= Flags.AllowBinding;
+ if (flags & Flags.AllowDestructuring)
+ parser.flags |= Flags.AllowDestructuring;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+ }
+ /**
+ * Restor current grammar to previous state, or unset necessary bitmasks
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ */
+ function restoreExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= Flags.AllowBinding | Flags.AllowDestructuring;
+ // Clear pending expression error
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // Both the previous bitmasks and bitmasks set during parsing the callback
+ // has to be positive for us to allow further binding or destructuring.
+ // Note that we allow both before the callback, so this is the only thing
+ // we need to check for.
+ if (!(parser.flags & Flags.AllowBinding) || !(flags & Flags.AllowBinding)) {
+ parser.flags &= ~Flags.AllowBinding;
+ }
+ if (!(parser.flags & Flags.AllowDestructuring) || !(flags & Flags.AllowDestructuring)) {
+ parser.flags &= ~Flags.AllowDestructuring;
+ }
+ // Here we either
+ // 1) restore to previous pending expression error
+ // or
+ // 2) if a pending expression error have been set during the parse (*only in object literal*)
+ // we overwrite previous error, and keep the new one
+ parser.pendingExpressionError = pendingExpressionError || parser.pendingExpressionError;
+ return res;
+ }
+ /**
+ * Set / unset yield / await context masks based on the
+ * ModifierState masks before invoking the callback and
+ * returning it's content
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Modifier state
+ * @param callback Callback function to be invoked
+ * @param methodState Optional Objectstate.
+ */
+ function swapContext(parser, context, state, callback, methodState = ObjectState.None) {
+ context &= ~(Context.Async | Context.Yield | Context.InParameter);
+ if (state & ModifierState.Generator)
+ context |= Context.Yield;
+ if (state & ModifierState.Await)
+ context |= Context.Async;
+ return callback(parser, context, methodState);
+ }
+ /**
+ * Validates function params
+ *
+ * Note! In case anyone want to enable full scoping, replace 'paramSet' with an similiar
+ * object on the parser object itself. Then push / set the tokenValue to
+ * it an use an bitmask to mark it as an 'variable' not 'blockscope'. Then when
+ * implementing lexical scoping, you can use that for validation.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param params Array of token values
+ */
+ function validateParams(parser, context, params) {
+ const paramSet = new Map();
+ for (let i = 0; i < params.length; i++) {
+ const key = `@${params[i]}`;
+ if (paramSet.get(key)) {
+ tolerant(parser, context, 81 /* ParamDupe */);
+ }
+ else
+ paramSet.set(key, true);
+ }
+ }
+ /**
+ * Reinterpret various expressions as pattern
+ * This is only used for assignment and arrow parameter list
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param node AST node
+ */
+ const reinterpret = exports('reinterpret', (parser, context, node) => {
+ switch (node.type) {
+ case 'Identifier':
+ if (context & Context.Strict && nameIsArgumentsOrEval(node.name))
+ report(parser, 3 /* InvalidEscapedReservedWord */);
+ case 'ArrayPattern':
+ case 'AssignmentPattern':
+ case 'ObjectPattern':
+ case 'RestElement':
+ case 'MetaProperty':
+ return;
+ case 'ArrayExpression':
+ node.type = 'ArrayPattern';
+ for (let i = 0; i < node.elements.length; ++i) {
+ // skip holes in pattern
+ if (node.elements[i] !== null) {
+ reinterpret(parser, context, node.elements[i]);
+ }
+ }
+ return;
+ case 'ObjectExpression':
+ node.type = 'ObjectPattern';
+ for (let i = 0; i < node.properties.length; i++) {
+ reinterpret(parser, context, node.properties[i]);
+ }
+ return;
+ case 'Property':
+ reinterpret(parser, context, node.value);
+ return;
+ case 'SpreadElement':
+ node.type = 'RestElement';
+ if (node.argument.type !== 'ArrayExpression' &&
+ node.argument.type !== 'ObjectExpression' &&
+ !isValidSimpleAssignmentTarget(node.argument)) {
+ tolerant(parser, context, 71 /* RestDefaultInitializer */);
+ }
+ reinterpret(parser, context, node.argument);
+ break;
+ case 'AssignmentExpression':
+ node.type = 'AssignmentPattern';
+ delete node.operator; // operator is not relevant for assignment pattern
+ reinterpret(parser, context, node.left); // recursive descent
+ return;
+ case 'MemberExpression':
+ if (!(context & Context.InParameter))
+ return;
+ // Fall through
+ default:
+ tolerant(parser, context, context & Context.InParameter ? 77 /* NotBindable */ : 73 /* InvalidDestructuringTarget */, node.type);
+ }
+ });
+ /**
+ * Does a lookahead.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param callback Callback function to be invoked
+ */
+ function lookahead(parser, context, callback) {
+ const { tokenValue, flags, line, column, startColumn, index, lastColumn, startLine, lastLine, lastIndex, startIndex, tokenRaw, token, lastValue, tokenRegExp, labelSet, errors, errorLocation, pendingExpressionError } = parser;
+ const res = callback(parser, context);
+ parser.index = index;
+ parser.token = token;
+ parser.tokenValue = tokenValue;
+ parser.tokenValue = tokenValue;
+ parser.flags = flags;
+ parser.line = line;
+ parser.column = column;
+ parser.tokenRaw = tokenRaw;
+ parser.lastValue = lastValue;
+ parser.startColumn = startColumn;
+ parser.lastColumn = lastColumn;
+ parser.startLine = startLine;
+ parser.lastLine = lastLine;
+ parser.lastIndex = lastIndex;
+ parser.startIndex = startIndex;
+ parser.tokenRegExp = tokenRegExp;
+ parser.labelSet = labelSet;
+ parser.errors = errors;
+ parser.errorLocation = errorLocation;
+ parser.tokenRegExp = tokenRegExp;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+ }
+ /**
+ * Returns true if this an valid simple assignment target
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function isValidSimpleAssignmentTarget(node) {
+ return node.type === 'Identifier' || node.type === 'MemberExpression' ? true : false;
+ }
+ /**
+ * Get current node location
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function getLocation(parser) {
+ return {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+ }
+ /**
+ * Returns true if this is an valid identifier
+ *
+ * @param context Context masks
+ * @param t Token
+ */
+ function isValidIdentifier(context, t) {
+ if (context & Context.Strict) {
+ if (context & Context.Module && t & 262144 /* IsAwait */)
+ return false;
+ if (t & 1073741824 /* IsYield */)
+ return false;
+ return (t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (t & 69632 /* Contextual */) === 69632 /* Contextual */;
+ }
+ return ((t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (t & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (t & 20480 /* FutureReserved */) === 20480 /* FutureReserved */);
+ }
+ /**
+ * Returns true if this an valid lexical binding and not an identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function isLexical(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return !!(token & (131072 /* IsIdentifier */ | 8388608 /* IsBindingPattern */ | 1073741824 /* IsYield */ | 262144 /* IsAwait */) ||
+ token === 33574984 /* LetKeyword */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */);
+ }
+ /**
+ * Returns true if this is end of case or default clauses
+ *
+ * @param parser Parser object
+ */
+ function isEndOfCaseOrDefaultClauses(parser) {
+ return (parser.token === 12368 /* DefaultKeyword */ || parser.token === 17825807 /* RightBrace */ || parser.token === 12363 /* CaseKeyword */);
+ }
+ /**
+ * Validates if the next token in the stream is a left paren or a period
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenIsLeftParenOrPeriod(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */ || parser.token === 16777229 /* Period */;
+ }
+ /**
+ * Validates if the next token in the stream is a identifier or left paren
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenisIdentifierOrParen(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return token & (131072 /* IsIdentifier */ | 1073741824 /* IsYield */) || token === 50331659 /* LeftParen */;
+ }
+ /**
+ * Validates if the next token in the stream is left parenthesis.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenIsLeftParen(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */;
+ }
+ /**
+ * Validates if the next token in the stream is a function keyword on the same line.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenIsFuncKeywordOnSameLine(parser, context) {
+ nextToken(parser, context);
+ return !(parser.flags & Flags.NewLine) && parser.token === 33566808 /* FunctionKeyword */;
+ }
+ /**
+ * Checks if the property has any private field key
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function isPropertyWithPrivateFieldKey(expr) {
+ return !expr.property ? false : expr.property.type === 'PrivateName';
+ }
+ /**
+ * Parse and classify itendifier - similar method as in V8
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAndClassifyIdentifier(parser, context) {
+ const { token, tokenValue: name } = parser;
+ if (context & Context.Strict) {
+ if (context & Context.Module && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (token & 69632 /* Contextual */) === 69632 /* Contextual */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (context & Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ function nameIsArgumentsOrEval(value) {
+ return value === 'eval' || value === 'arguments';
+ }
+ /**
+ * Records an error from current position. If we report an error later, we'll do it from
+ * this position.
+ *
+ * @param parser Parser object
+ */
+ function setPendingError(parser) {
+ parser.errorLocation = {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+ }
+ /**
+ * Returns tagName for JSX element
+ *
+ * @param elementName JSX Element name
+ */
+ function isEqualTagNames(elementName) {
+ // tslint:disable-next-line:switch-default | this switch is exhaustive
+ switch (elementName.type) {
+ case 'JSXIdentifier':
+ return elementName.name;
+ case 'JSXNamespacedName':
+ return `${isEqualTagNames(elementName.namespace)}:${isEqualTagNames(elementName.name)}`;
+ case 'JSXMemberExpression':
+ return `${isEqualTagNames(elementName.object)}.${isEqualTagNames(elementName.property)}`;
+ }
+ }
+ /**
+ * Returns true if this is an instance field ( stage 3 proposal)
+ *
+ * @param parser Parser object
+ */
+ function isInstanceField(parser) {
+ const { token } = parser;
+ return token === 17825807 /* RightBrace */ || token === 17825809 /* Semicolon */ || token === 83886109 /* Assign */;
+ }
+ /**
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expr AST expressions
+ * @param prefix prefix
+ */
+ function validateUpdateExpression(parser, context, expr, prefix) {
+ if (context & Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 68 /* StrictLHSPrefixPostFix */, prefix);
+ }
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ }
+ /**
+ * Record expression error
+ *
+ * @param parser Parser object
+ * @param error Error message
+ */
+ function setPendingExpressionError(parser, type) {
+ parser.pendingExpressionError = {
+ error: errorMessages[type],
+ line: parser.line,
+ column: parser.column,
+ index: parser.index
+ };
+ }
+ /**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+ function validateCoverParenthesizedExpression(parser, state) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= CoverParenthesizedState.HasEvalOrArguments;
+ }
+ else if ((token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ setPendingError(parser);
+ state |= CoverParenthesizedState.HasReservedWords;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= Flags.HasAwait;
+ }
+ }
+ return state;
+ }
+ /**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+ function validateAsyncArgumentList(parser, context, state) {
+ const { token } = parser;
+ if (!(parser.flags & Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= CoverCallState.EvalOrArguments;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ state |= CoverCallState.Await;
+ }
+ else if ((token & 1073741824 /* IsYield */) === 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ state |= CoverCallState.Yield;
+ }
+ }
+ return state;
+ }
+ /**
+ * Returns true if iteration statement. Otherwise return false,
+ *
+ * @param t Token
+ */
+ function isIterationStatement(t) {
+ return t === 12369 /* DoKeyword */ || t === 12386 /* WhileKeyword */ || t === 12374 /* ForKeyword */;
+ }
+ /**
+ * Returns true if in or of token. Otherwise return false,
+ *
+ * @param t Token
+ */
+ function isInOrOf(t) {
+ return t === 69746 /* OfKeyword */ || t === 167786289 /* InKeyword */;
+ } + + /*@internal*/
+ const errorMessages = exports('errorMessages', {
+ [0 /* Unexpected */]: 'Unexpected token',
+ [1 /* UnexpectedToken */]: 'Unexpected token \'%0\'',
+ [2 /* ExpectedToken */]: 'Expected token \'%0\'',
+ [3 /* InvalidEscapedReservedWord */]: 'Keyword must not contain escaped characters',
+ [4 /* UnexpectedKeyword */]: 'Keyword \'%0\' is reserved',
+ [5 /* InvalidLHSInAssignment */]: 'Invalid left-hand side in assignment',
+ [6 /* UnterminatedString */]: 'Unterminated string literal',
+ [7 /* UnterminatedRegExp */]: 'Unterminated regular expression literal',
+ [8 /* UnterminatedComment */]: 'Unterminated MultiLineComment',
+ [9 /* UnterminatedTemplate */]: 'Unterminated template literal',
+ [10 /* UnexpectedChar */]: 'Invalid character \'%0\'',
+ [11 /* StrictOctalEscape */]: 'Octal escapes are not allowed in strict mode',
+ [13 /* InvalidEightAndNine */]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
+ [14 /* UnicodeOutOfRange */]: 'Unicode escape code point out of range',
+ [15 /* DuplicateRegExpFlag */]: 'Duplicate regular expression flag \'%0\'',
+ [16 /* UnexpectedTokenRegExpFlag */]: 'Unexpected regular expression flag \'%0\'',
+ [17 /* StrictLHSAssignment */]: 'Eval or arguments can\'t be assigned to in strict mode code',
+ [18 /* IllegalReturn */]: 'Illegal return statement',
+ [19 /* StrictFunction */]: 'In strict mode code, functions can only be declared at top level or inside a block',
+ [20 /* SloppyFunction */]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
+ [21 /* ForbiddenAsStatement */]: '%0 can\'t appear in single-statement context',
+ [22 /* GeneratorInSingleStatementContext */]: 'Generators can only be declared at the top level or inside a block',
+ [23 /* ForAwaitNotOf */]: '\'for await\' loop should be used with \'of\'',
+ [24 /* DeclarationMissingInitializer */]: 'Missing initializer in %0 declaration',
+ [25 /* ForInOfLoopInitializer */]: '\'for-%0\' loop variable declaration may not have an initializer',
+ [26 /* ForInOfLoopMultiBindings */]: 'Invalid left-hand side in for-%0 loop: Must have a single binding.',
+ [27 /* LetInLexicalBinding */]: 'let is disallowed as a lexically bound name',
+ [28 /* UnexpectedLexicalDeclaration */]: 'Lexical declaration cannot appear in a single-statement context',
+ [29 /* LabelRedeclaration */]: 'Label \'%0\' has already been declared',
+ [30 /* InvalidNestedStatement */]: '%0 statement must be nested within an iteration statement',
+ [31 /* IllegalContinue */]: 'Illegal continue statement: \'%0\' does not denote an iteration statement',
+ [32 /* UnknownLabel */]: 'Undefined label \'%0\'',
+ [33 /* MultipleDefaultsInSwitch */]: 'More than one default clause in switch statement',
+ [34 /* ImportExportDeclAtTopLevel */]: '%0 declarations may only appear at top level of a module',
+ [35 /* AsyncFunctionInSingleStatementContext */]: 'Async functions can only be declared at the top level or inside a block',
+ [36 /* InvalidLineBreak */]: 'No line break is allowed after \'%0\'',
+ [37 /* StrictModeWith */]: 'Strict mode code may not include a with statement',
+ [38 /* AwaitOutsideAsync */]: 'Await is only valid in async functions',
+ [39 /* UnNamedFunctionDecl */]: 'Function declaration must have a name in this context',
+ [12 /* DuplicateConstructor */]: 'Duplicate constructor method in class',
+ [40 /* DisallowedInContext */]: '\'%0\' may not be used as an identifier in this context',
+ [43 /* StrictDelete */]: 'Delete of an unqualified identifier in strict mode',
+ [44 /* DeletePrivateField */]: 'Private fields can not be deleted',
+ [41 /* PrivateFieldConstructor */]: 'Classes may not have a private field named \'#constructor\'',
+ [42 /* PublicFieldConstructor */]: 'Classes may not have a field named \'constructor\'',
+ [45 /* InvalidConstructor */]: 'Class constructor may not be a \'%0\'',
+ [46 /* UnexpectedReserved */]: 'Unexpected reserved word',
+ [47 /* StrictEvalArguments */]: 'Unexpected eval or arguments in strict mode',
+ [48 /* AwaitBindingIdentifier */]: '\'await\' is not a valid identifier inside an async function',
+ [49 /* YieldBindingIdentifier */]: '\'yield\' is not a valid identifier inside an generator function',
+ [50 /* UnexpectedStrictReserved */]: 'Unexpected strict mode reserved word',
+ [52 /* AwaitInParameter */]: 'Await expression not allowed in formal parameter',
+ [51 /* YieldInParameter */]: 'Yield expression not allowed in formal parameter',
+ [53 /* MetaNotInFunctionBody */]: 'new.target only allowed within functions',
+ [54 /* BadSuperCall */]: 'super() is not allowed in this context',
+ [55 /* UnexpectedSuper */]: 'Member access from super not allowed in this context',
+ [56 /* LoneSuper */]: 'Only "(" or "." or "[" are allowed after \'super\'',
+ [57 /* YieldReservedKeyword */]: '\'yield\' is a reserved keyword within generator function bodies',
+ [58 /* ContinuousNumericSeparator */]: 'Only one underscore is allowed as numeric separator',
+ [59 /* TrailingNumericSeparator */]: 'Numeric separators are not allowed at the end of numeric literals',
+ [60 /* ZeroDigitNumericSeparator */]: 'Numeric separator can not be used after leading 0.',
+ [61 /* StrictOctalLiteral */]: 'Legacy octal literals are not allowed in strict mode',
+ [62 /* InvalidLhsInAssignment */]: 'Invalid left-hand side in assignment',
+ [63 /* DuplicateProto */]: 'Property name __proto__ appears more than once in object literal',
+ [64 /* IllegalUseStrict */]: 'Illegal \'use strict\' directive in function with non-simple parameter list',
+ [65 /* StaticPrototype */]: 'Classes may not have a static property named \'prototype\'',
+ [66 /* AccessorWrongArgs */]: '%0 functions must have %1 argument%2',
+ [67 /* BadSetterRestParameter */]: 'Setter function argument must not be a rest parameter',
+ [68 /* StrictLHSPrefixPostFix */]: '%0 increment/decrement may not have eval or arguments operand in strict mode',
+ [69 /* InvalidElisonInObjPropList */]: 'Elision not allowed in object property list',
+ [70 /* ElementAfterRest */]: 'Rest element must be last element',
+ [72 /* ElementAfterSpread */]: 'Spread element must be last element',
+ [71 /* RestDefaultInitializer */]: 'Rest parameter may not have a default initializer',
+ [73 /* InvalidDestructuringTarget */]: 'Invalid destructuring assignment target',
+ [74 /* UnexpectedSurrogate */]: 'Unexpected surrogate pair',
+ [75 /* MalformedEscape */]: 'Malformed %0 character escape sequence',
+ [76 /* TemplateOctalLiteral */]: 'Template literals may not contain octal escape sequences',
+ [77 /* NotBindable */]: 'Invalid binding pattern',
+ [78 /* ParamAfterRest */]: 'Rest parameter must be last formal parameter',
+ [79 /* NoCatchOrFinally */]: 'Missing catch or finally after try',
+ [80 /* NewlineAfterThrow */]: 'Illegal newline after throw',
+ [81 /* ParamDupe */]: 'Duplicate parameter name not allowed in this context',
+ [82 /* AsAfterImportStart */]: 'Missing keyword \'as\' after import *',
+ [83 /* LabelNoColon */]: 'Labels must be followed by a \':\'',
+ [84 /* NonEmptyJSXExpression */]: 'JSX attributes must only be assigned a non-empty \'expression\'',
+ [85 /* ExpectedJSXClosingTag */]: 'Expected corresponding JSX closing tag for %0',
+ [86 /* AdjacentJSXElements */]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
+ [87 /* InvalidJSXAttributeValue */]: 'Invalid JSX attribute value',
+ [88 /* RestWithComma */]: 'Rest element may not have a trailing comma',
+ [89 /* UndefinedUnicodeCodePoint */]: 'Undefined Unicode code-point',
+ [90 /* HtmlCommentInModule */]: 'HTML comments are not allowed in modules',
+ [91 /* InvalidCoverInitializedName */]: 'Invalid shorthand property initializer',
+ [92 /* TrailingDecorators */]: 'Trailing decorator may be followed by method',
+ [93 /* GeneratorConstructor */]: 'Decorators can\'t be used with a constructor',
+ [94 /* InvalidRestBindingPattern */]: '`...` must be followed by an identifier in declaration contexts',
+ });
+ /**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param index The 0-based end index of the error.
+ * @param line The 0-based line position of the error.
+ * @param column The 0-based column position of the error.
+ * @param parser The 0-based end index of the current node.
+ * @param description Error description
+ */
+ /*@internal*/
+ function constructError(parser, context, index, line, column, description) {
+ const error = new SyntaxError(`Line ${line}, column ${column}: ${description}`);
+ error.index = index;
+ error.line = line;
+ error.column = column;
+ error.description = description;
+ if (context & Context.OptionsTolerant) {
+ parser.errors.push(error);
+ }
+ else
+ throw error;
+ }
+ /**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ */
+ function getErrorLocation(parser) {
+ let { index, startLine: line, startColumn: column } = parser;
+ const errorLoc = parser.errorLocation;
+ if (!!errorLoc) {
+ index = errorLoc.index;
+ line = errorLoc.line;
+ column = errorLoc.column;
+ }
+ return { index, line, column };
+ }
+ /**
+ * Throws an error
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+ /*@internal*/
+ function report(parser, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, Context.Empty, index, line, column, errorMessage);
+ }
+ /**
+ * If in tolerant mode, all errors are pushed to a top-level error array containing
+ * otherwise throws
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+ /*@internal*/
+ function tolerant(parser, context, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, context, index, line, column, errorMessage);
+ } + + // Declarations
+ /**
+ * Parses class declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const id = (context & Context.RequireIdentifier && (parser.token !== 33685505 /* Identifier */))
+ ? null :
+ parseBindingIdentifier(parser, context | Context.Strict | Context.DisallowEscapedKeyword);
+ let state = ObjectState.None;
+ let superClass = null;
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | Context.Strict, pos);
+ state |= ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context & ~Context.RequireIdentifier | Context.Strict | Context.InClass, state);
+ return finishNode(context, parser, pos, context & Context.OptionsExperimental ? {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body
+ });
+ }
+ /**
+ * Parses function declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFunctionDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ let isGenerator = ModifierState.None;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ if (context & Context.AllowSingleStatement && !(context & Context.InFunctionBody)) {
+ tolerant(parser, context, 22 /* GeneratorInSingleStatementContext */);
+ }
+ isGenerator = ModifierState.Generator;
+ }
+ return parseFunctionDeclarationBody(parser, context, isGenerator, pos);
+ }
+ /**
+ * Parses out a function declartion body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context mask
+ * @param state Modifier state
+ * @param pos Current location
+ */
+ function parseFunctionDeclarationBody(parser, context, state, pos) {
+ const { token } = parser;
+ let id = null;
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (context & Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (token !== 50331659 /* LeftParen */) {
+ id = parseBindingIdentifier(parser, context);
+ // Unnamed functions are forbidden in statement context.
+ }
+ else if (!(context & Context.RequireIdentifier))
+ tolerant(parser, context, 39 /* UnNamedFunctionDecl */);
+ const { params, body } = swapContext(parser, context & ~(Context.Method | Context.AllowSuperProperty | Context.RequireIdentifier), state, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionDeclaration',
+ params,
+ body,
+ async: !!(state & ModifierState.Await),
+ generator: !!(state & ModifierState.Generator),
+ expression: false,
+ id,
+ });
+ }
+ /**
+ * Parses async function or async generator declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isAwait = ModifierState.Await;
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? ModifierState.Generator : ModifierState.None;
+ return parseFunctionDeclarationBody(parser, context, isGenerator | isAwait, pos);
+ }
+ /**
+ * VariableDeclaration :
+ * BindingIdentifier Initializeropt
+ * BindingPattern Initializer
+ *
+ * VariableDeclarationNoIn :
+ * BindingIdentifier InitializerNoInopt
+ * BindingPattern InitializerNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseVariableDeclaration(parser, context, isConst) {
+ const pos = getLocation(parser);
+ const isBindingPattern = (parser.token & 8388608 /* IsBindingPattern */) !== 0;
+ const id = parseBindingIdentifierOrPattern(parser, context);
+ let init = null;
+ if (consume(parser, context | Context.DisallowEscapedKeyword, 83886109 /* Assign */)) {
+ init = parseExpressionCoverGrammar(parser, context & ~(Context.BlockScope | Context.ForStatement), parseAssignmentExpression);
+ if (isInOrOf(parser.token) && (context & Context.ForStatement || isBindingPattern)) {
+ if (parser.token === 167786289 /* InKeyword */) {
+ // https://github.com/tc39/test262/blob/master/test/annexB/language/statements/for-in/strict-initializer.js
+ if (context & (Context.BlockScope | Context.Strict | Context.Async) || isBindingPattern) {
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ }
+ else
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ // Note: Initializers are required for 'const' and binding patterns
+ }
+ else if (!isInOrOf(parser.token) && (isConst || isBindingPattern)) {
+ tolerant(parser, context, 24 /* DeclarationMissingInitializer */, isConst ? 'const' : 'destructuring');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclarator',
+ init,
+ id,
+ });
+ }
+ /**
+ * Parses variable declaration list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclarationList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseVariableDeclarationList(parser, context, isConst) {
+ const list = [parseVariableDeclaration(parser, context, isConst)];
+ while (consume(parser, context, 16777234 /* Comma */))
+ list.push(parseVariableDeclaration(parser, context, isConst));
+ if (context & Context.ForStatement && isInOrOf(parser.token) && list.length !== 1) {
+ tolerant(parser, context, 26 /* ForInOfLoopMultiBindings */, tokenDesc(parser.token));
+ }
+ return list;
+ } + + // Statements
+ /**
+ * Parses statement list items
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementListItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseStatementListItem(parser, context) {
+ switch (parser.token) {
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionDeclaration(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassDeclaration(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetOrExpressionStatement(parser, context | Context.AllowIn);
+ case 33566793 /* ConstKeyword */:
+ return parseVariableStatement(parser, context | Context.BlockScope | Context.AllowIn);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionDeclarationOrStatement(parser, context);
+ case 33566810 /* ImportKeyword */: {
+ if (context & Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod)) {
+ return parseExpressionStatement(parser, context | Context.AllowIn);
+ }
+ }
+ case 12371 /* ExportKeyword */:
+ if (context & Context.Module) {
+ tolerant(parser, context, 34 /* ImportExportDeclAtTopLevel */, tokenDesc(parser.token));
+ }
+ default:
+ return parseStatement(parser, context | Context.AllowSingleStatement);
+ }
+ }
+ /**
+ * Parses statements
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseStatement(parser, context) {
+ switch (parser.token) {
+ case 33566791 /* VarKeyword */:
+ return parseVariableStatement(parser, context | Context.AllowIn);
+ case 17825809 /* Semicolon */:
+ return parseEmptyStatement(parser, context);
+ case 33566814 /* SwitchKeyword */:
+ return parseSwitchStatement(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseBlockStatement(parser, context);
+ case 12380 /* ReturnKeyword */:
+ return parseReturnStatement(parser, context);
+ case 12377 /* IfKeyword */:
+ return parseIfStatement(parser, context);
+ case 12369 /* DoKeyword */:
+ return parseDoWhileStatement(parser, context);
+ case 12386 /* WhileKeyword */:
+ return parseWhileStatement(parser, context);
+ case 12387 /* WithKeyword */:
+ return parseWithStatement(parser, context);
+ case 12362 /* BreakKeyword */:
+ return parseBreakStatement(parser, context);
+ case 12366 /* ContinueKeyword */:
+ return parseContinueStatement(parser, context);
+ case 12367 /* DebuggerKeyword */:
+ return parseDebuggerStatement(parser, context);
+ case 302002272 /* ThrowKeyword */:
+ return parseThrowStatement(parser, context);
+ case 12385 /* TryKeyword */:
+ return parseTryStatement(parser, context | Context.DisallowEscapedKeyword);
+ case 12374 /* ForKeyword */:
+ return parseForStatement(parser, context | Context.ForStatement);
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ tolerant(parser, context, 35 /* AsyncFunctionInSingleStatementContext */);
+ }
+ return parseExpressionOrLabelledStatement(parser, context | Context.AllowSingleStatement);
+ case 33566808 /* FunctionKeyword */:
+ // V8
+ tolerant(parser, context, context & Context.Strict ? 19 /* StrictFunction */ : 20 /* SloppyFunction */);
+ case 33566797 /* ClassKeyword */:
+ tolerant(parser, context, 21 /* ForbiddenAsStatement */, tokenDesc(parser.token));
+ default:
+ return parseExpressionOrLabelledStatement(parser, context);
+ }
+ }
+ /**
+ * Parses empty statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-EmptyStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseEmptyStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'EmptyStatement'
+ });
+ }
+ /**
+ * Parses the continue statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ContinueStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseContinueStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ // Appearing of continue without an IterationStatement leads to syntax error
+ if (!(parser.flags & (Flags.InSwitchStatement | Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, tokenDesc(parser.token));
+ }
+ let label = null;
+ if (!(parser.flags & Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, true);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ContinueStatement',
+ label
+ });
+ }
+ /**
+ * Parses the break statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BreakStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBreakStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let label = null;
+ if (!(parser.flags & Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, false);
+ }
+ else if (!(parser.flags & (Flags.InSwitchStatement | Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, 'break');
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'BreakStatement',
+ label
+ });
+ }
+ /**
+ * Parses the if statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-if-statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIfStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const consequent = parseConsequentOrAlternate(parser, context | Context.DisallowEscapedKeyword);
+ const alternate = consume(parser, context, 12370 /* ElseKeyword */) ? parseConsequentOrAlternate(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'IfStatement',
+ test,
+ consequent,
+ alternate
+ });
+ }
+ /**
+ * Parse either consequent or alternate. Supports AnnexB.
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseConsequentOrAlternate(parser, context) {
+ return context & Context.Strict || parser.token !== 33566808 /* FunctionKeyword */
+ ? parseStatement(parser, context & ~Context.AllowSingleStatement)
+ : parseFunctionDeclaration(parser, context);
+ }
+ /**
+ * Parses the debugger statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DebuggerStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDebuggerStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'DebuggerStatement'
+ });
+ }
+ /**
+ * Parses try statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TryStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseTryStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const block = parseBlockStatement(parser, context);
+ const handler = parser.token === 12364 /* CatchKeyword */ ? parseCatchBlock(parser, context) : null;
+ const finalizer = consume(parser, context, 12373 /* FinallyKeyword */) ? parseBlockStatement(parser, context) : null;
+ if (!handler && !finalizer)
+ tolerant(parser, context, 79 /* NoCatchOrFinally */);
+ return finishNode(context, parser, pos, {
+ type: 'TryStatement',
+ block,
+ handler,
+ finalizer
+ });
+ }
+ /**
+ * Parses catch block
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Catch)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseCatchBlock(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let param = null;
+ if (consume(parser, context, 50331659 /* LeftParen */)) {
+ const params = [];
+ param = parseBindingIdentifierOrPattern(parser, context, params);
+ validateParams(parser, context, params);
+ expect(parser, context, 16 /* RightParen */);
+ }
+ const body = parseBlockStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'CatchClause',
+ param,
+ body
+ });
+ }
+ /**
+ * Parses throw statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ThrowStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseThrowStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ if (parser.flags & Flags.NewLine)
+ tolerant(parser, context, 80 /* NewlineAfterThrow */);
+ const argument = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ThrowStatement',
+ argument
+ });
+ }
+ /**
+ * Parses expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExpressionStatement(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+ }
+ /**
+ * Parse directive node
+ *
+ * * @see [Link](https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDirective(parser, context) {
+ const pos = getLocation(parser);
+ const directive = parser.tokenRaw.slice(1, -1);
+ const expr = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr,
+ directive
+ });
+ }
+ /**
+ * Parses either expression or labelled statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LabelledStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExpressionOrLabelledStatement(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, token } = parser;
+ const expr = parseExpression(parser, (context & ~(Context.AllowSingleStatement | Context.AllowDecorator)) | Context.AllowIn);
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */) && parser.token === 16777237 /* Colon */) {
+ // If within generator function bodies, we do it like this so we can throw an nice error message
+ if (context & Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 57 /* YieldReservedKeyword */);
+ expect(parser, context, 16777237 /* Colon */, 83 /* LabelNoColon */);
+ if (hasLabel(parser, tokenValue))
+ tolerant(parser, context, 29 /* LabelRedeclaration */, tokenValue);
+ addLabel(parser, tokenValue);
+ const body = !(context & Context.Strict) &&
+ context & Context.AllowSingleStatement &&
+ parser.token === 33566808 /* FunctionKeyword */
+ ? parseFunctionDeclaration(parser, context)
+ : parseStatement(parser, context);
+ popLabel(parser, tokenValue);
+ return finishNode(context, parser, pos, {
+ type: 'LabeledStatement',
+ label: expr,
+ body
+ });
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+ }
+ /**
+ * Parses do while statement
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDoWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const body = parseIterationStatement(parser, context);
+ expect(parser, context, 12386 /* WhileKeyword */);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ consume(parser, context, 17825809 /* Semicolon */);
+ return finishNode(context, parser, pos, {
+ type: 'DoWhileStatement',
+ body,
+ test
+ });
+ }
+ /**
+ * Parses while statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-WhileStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'WhileStatement',
+ test,
+ body
+ });
+ }
+ /**
+ * Parses block statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BlockStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Block)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBlockStatement(parser, context) {
+ const pos = getLocation(parser);
+ const body = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body
+ });
+ }
+ /**
+ * Parses return statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ReturnStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseReturnStatement(parser, context) {
+ const pos = getLocation(parser);
+ if (!(context & (Context.OptionsGlobalReturn | Context.InFunctionBody))) {
+ tolerant(parser, context, 18 /* IllegalReturn */);
+ }
+ if (parser.flags & Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const argument = !(parser.token & 1048576 /* ASI */) && !(parser.flags & Flags.NewLine)
+ ? parseExpression(parser, (context & ~(Context.InFunctionBody | Context.AllowDecorator)) | Context.AllowIn)
+ : null;
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ReturnStatement',
+ argument
+ });
+ }
+ /**
+ * Sets the necessary mutable parser flags. The parser flags will
+ * be unset after done parsing out the statements.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-IterationStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIterationStatement(parser, context) {
+ // Note: We are deviating from the original grammar here beauce the original grammar says that the
+ // 'iterationStatement' should return either'for', 'do' or 'while' statements. We are doing some
+ // bitfiddling before and after to modify the parser state before we let the 'parseStatement'
+ // return the mentioned statements (to match the original grammar).
+ const savedFlags = parser.flags;
+ parser.flags |= Flags.InIterationStatement | Flags.AllowDestructuring;
+ const body = parseStatement(parser, (context & ~Context.AllowSingleStatement) | Context.DisallowEscapedKeyword);
+ parser.flags = savedFlags;
+ return body;
+ }
+ /**
+ * Parses with statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-WithStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseWithStatement(parser, context) {
+ if (context & Context.Strict)
+ tolerant(parser, context, 37 /* StrictModeWith */);
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const object = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseStatement(parser, context & ~Context.AllowSingleStatement);
+ return finishNode(context, parser, pos, {
+ type: 'WithStatement',
+ object,
+ body
+ });
+ }
+ /**
+ * Parses switch statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SwitchStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSwitchStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const discriminant = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ expect(parser, context | Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const cases = [];
+ const savedFlags = parser.flags;
+ parser.flags |= Flags.InSwitchStatement;
+ let seenDefault = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ const clause = parseCaseOrDefaultClauses(parser, context);
+ cases.push(clause);
+ if (clause.test === null) {
+ if (seenDefault)
+ tolerant(parser, context, 33 /* MultipleDefaultsInSwitch */);
+ seenDefault = true;
+ }
+ }
+ parser.flags = savedFlags;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'SwitchStatement',
+ discriminant,
+ cases
+ });
+ }
+ /**
+ * Parses either default clause or case clauses
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CaseClauses)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DefaultClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseCaseOrDefaultClauses(parser, context) {
+ const pos = getLocation(parser);
+ let test = null;
+ if (consume(parser, context, 12363 /* CaseKeyword */)) {
+ test = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ }
+ else {
+ expect(parser, context, 12368 /* DefaultKeyword */);
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ const consequent = [];
+ while (!isEndOfCaseOrDefaultClauses(parser)) {
+ consequent.push(parseStatementListItem(parser, context | Context.AllowIn));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SwitchCase',
+ test,
+ consequent
+ });
+ }
+ /**
+ * Parses variable statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseVariableStatement(parser, context, shouldConsume = true) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const isConst = token === 33566793 /* ConstKeyword */;
+ nextToken(parser, context);
+ const declarations = parseVariableDeclarationList(parser, context, isConst);
+ // Only consume semicolons if not inside the 'ForStatement' production
+ if (shouldConsume)
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclaration',
+ kind: tokenDesc(token),
+ declarations
+ });
+ }
+ /**
+ * Parses either an lexical declaration (let) or an expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-let-and-const-declarations)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseLetOrExpressionStatement(parser, context, shouldConsume = true) {
+ return lookahead(parser, context, isLexical)
+ ? parseVariableStatement(parser, context | Context.BlockScope, shouldConsume)
+ : parseExpressionOrLabelledStatement(parser, context);
+ }
+ /**
+ * Parses either async function declaration or statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionDeclarationOrStatement(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)
+ ? parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context)
+ : parseStatement(parser, context);
+ }
+ /**
+ * Parses either For, ForIn or ForOf statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-statement)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseForStatement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 12374 /* ForKeyword */);
+ const awaitToken = !!(context & Context.Async && consume(parser, context, 34017389 /* AwaitKeyword */));
+ expect(parser, context | Context.DisallowEscapedKeyword, 50331659 /* LeftParen */);
+ const { token } = parser;
+ let init = null;
+ let sequencePos = null;
+ let variableStatement = null;
+ let type = 'ForStatement';
+ let test = null;
+ let update = null;
+ let right;
+ if (token === 33566793 /* ConstKeyword */ || (token === 33574984 /* LetKeyword */ && lookahead(parser, context, isLexical))) {
+ variableStatement = parseVariableStatement(parser, (context & ~Context.AllowIn) | Context.BlockScope, false);
+ }
+ else if (token === 33566791 /* VarKeyword */) {
+ variableStatement = parseVariableStatement(parser, context & ~Context.AllowIn, false);
+ }
+ else if (token !== 17825809 /* Semicolon */) {
+ sequencePos = getLocation(parser);
+ init = restoreExpressionCoverGrammar(parser, (context & ~Context.AllowIn) | Context.DisallowEscapedKeyword, parseAssignmentExpression);
+ }
+ if (consume(parser, context, 69746 /* OfKeyword */)) {
+ type = 'ForOfStatement';
+ if (init) {
+ if (!(parser.flags & Flags.AllowDestructuring) || init.type === 'AssignmentExpression') {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ right = parseAssignmentExpression(parser, context | Context.AllowIn);
+ }
+ else if (consume(parser, context, 167786289 /* InKeyword */)) {
+ if (init) {
+ if (!(parser.flags & Flags.AllowDestructuring))
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ type = 'ForInStatement';
+ right = parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn);
+ }
+ else {
+ if (parser.token === 16777234 /* Comma */)
+ init = parseSequenceExpression(parser, context, init, sequencePos);
+ if (variableStatement)
+ init = variableStatement;
+ expect(parser, context, 17825809 /* Semicolon */);
+ test = parser.token !== 17825809 /* Semicolon */
+ ? parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn)
+ : null;
+ expect(parser, context, 17825809 /* Semicolon */);
+ update = parser.token !== 16 /* RightParen */
+ ? parseExpression(parser, (context & ~Context.AllowDecorator) | Context.AllowIn)
+ : null;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, type === 'ForOfStatement'
+ ? {
+ type,
+ body,
+ left: init,
+ right,
+ await: awaitToken
+ }
+ : right
+ ? {
+ type: type,
+ body,
+ left: init,
+ right
+ }
+ : {
+ type: type,
+ body,
+ init,
+ test,
+ update
+ });
+ } + + // 15.2 Modules
+ /**
+ * Parse module item list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItemList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseModuleItemList(parser, context) {
+ // Prime the scanner
+ nextToken(parser, context);
+ const statements = [];
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ statements.push(parser.token === 33554435 /* StringLiteral */ ?
+ parseDirective(parser, context) :
+ parseModuleItem(parser, context | Context.AllowIn));
+ }
+ return statements;
+ }
+ /**
+ * Parse module item
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseModuleItem(parser, context) {
+ switch (parser.token) {
+ // @decorator
+ case 120 /* At */:
+ return parseDecorators(parser, context);
+ // ExportDeclaration
+ case 12371 /* ExportKeyword */:
+ return parseExportDeclaration(parser, context);
+ // ImportDeclaration
+ case 33566810 /* ImportKeyword */:
+ // 'Dynamic Import' or meta property disallowed here
+ if (!(context & Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod))) {
+ return parseImportDeclaration(parser, context);
+ }
+ // falls through
+ default:
+ return parseStatementListItem(parser, context);
+ }
+ }
+ /**
+ * Parse export declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ const specifiers = [];
+ let source = null;
+ let declaration = null;
+ expect(parser, context | Context.DisallowEscapedKeyword, 12371 /* ExportKeyword */);
+ switch (parser.token) {
+ // export * FromClause ;
+ case 167774771 /* Multiply */:
+ return parseExportAllDeclaration(parser, context, pos);
+ case 12368 /* DefaultKeyword */:
+ return parseExportDefault(parser, context, pos);
+ case 41943052 /* LeftBrace */:
+ {
+ // export ExportClause FromClause ;
+ // export ExportClause ;
+ expect(parser, context, 41943052 /* LeftBrace */);
+ let hasReservedWord = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token !== 69743 /* GetKeyword */ && parser.token & 12288 /* Reserved */) {
+ hasReservedWord = true;
+ setPendingError(parser);
+ }
+ specifiers.push(parseNamedExportDeclaration(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context | Context.DisallowEscapedKeyword, 17825807 /* RightBrace */);
+ if (parser.token === 69745 /* FromKeyword */) {
+ source = parseModuleSpecifier(parser, context);
+ // The left hand side can't be a keyword where there is no
+ // 'from' keyword since it references a local binding.
+ }
+ else if (hasReservedWord)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ consumeSemicolon(parser, context);
+ break;
+ }
+ // export ClassDeclaration
+ case 33566797 /* ClassKeyword */:
+ declaration = (parseClassDeclaration(parser, context));
+ break;
+ // export LexicalDeclaration
+ case 33574984 /* LetKeyword */:
+ case 33566793 /* ConstKeyword */:
+ declaration = parseVariableStatement(parser, context | Context.BlockScope);
+ break;
+ // export VariableDeclaration
+ case 33566791 /* VarKeyword */:
+ declaration = parseVariableStatement(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ declaration = parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context);
+ break;
+ }
+ // Falls through
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportNamedDeclaration',
+ source,
+ specifiers,
+ declaration,
+ });
+ }
+ /**
+ * Parse export all declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExportAllDeclaration(parser, context, pos) {
+ expect(parser, context, 167774771 /* Multiply */);
+ const source = parseModuleSpecifier(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExportAllDeclaration',
+ source,
+ });
+ }
+ /**
+ * Parse named export declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNamedExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ // ExportSpecifier :
+ // IdentifierName
+ // IdentifierName as IdentifierName
+ const local = parseIdentifierName(parser, context | Context.DisallowEscapedKeyword, parser.token);
+ const exported = consume(parser, context, 167843947 /* AsKeyword */)
+ ? parseIdentifierName(parser, context, parser.token)
+ : local;
+ return finishNode(context, parser, pos, {
+ type: 'ExportSpecifier',
+ local,
+ exported,
+ });
+ }
+ /**
+ * Parse export default
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+ function parseExportDefault(parser, context, pos) {
+ expect(parser, context | Context.DisallowEscapedKeyword, 12368 /* DefaultKeyword */);
+ let declaration;
+ switch (parser.token) {
+ // export default HoistableDeclaration[Default]
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context | Context.RequireIdentifier);
+ break;
+ // export default ClassDeclaration[Default]
+ // export default @decl ClassDeclaration[Default]
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ declaration = parseClassDeclaration(parser, context & ~Context.AllowIn | Context.RequireIdentifier);
+ break;
+ // export default HoistableDeclaration[Default]
+ case 594028 /* AsyncKeyword */:
+ declaration = parseAsyncFunctionOrAssignmentExpression(parser, context | Context.RequireIdentifier);
+ break;
+ default:
+ // export default [lookahead ∉ {function, class}] AssignmentExpression[In] ;
+ declaration = parseAssignmentExpression(parser, context | Context.AllowIn);
+ consumeSemicolon(parser, context);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportDefaultDeclaration',
+ declaration,
+ });
+ }
+ /**
+ * Parse import declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566810 /* ImportKeyword */);
+ let source;
+ let specifiers = [];
+ // 'import' ModuleSpecifier ';'
+ if (parser.token === 33554435 /* StringLiteral */) {
+ source = parseLiteral(parser, context);
+ }
+ else {
+ specifiers = parseImportClause(parser, context | Context.DisallowEscapedKeyword);
+ source = parseModuleSpecifier(parser, context);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ImportDeclaration',
+ specifiers,
+ source,
+ });
+ }
+ /**
+ * Parse import clause
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportClause(parser, context) {
+ const specifiers = [];
+ switch (parser.token) {
+ // 'import' ModuleSpecifier ';'
+ case 33685505 /* Identifier */:
+ {
+ specifiers.push(parseImportDefaultSpecifier(parser, context));
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ switch (parser.token) {
+ // import a, * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ // import a, {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ default:
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ break;
+ }
+ // import {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ // import * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return specifiers;
+ }
+ /**
+ * Parse named imports
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NamedImports)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNamedImports(parser, context, specifiers) {
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ specifiers.push(parseImportSpecifier(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ }
+ /**
+ * Parse import specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportSpecifier(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const imported = parseIdentifierName(parser, context | Context.DisallowEscapedKeyword, token);
+ let local;
+ if (consume(parser, context, 167843947 /* AsKeyword */)) {
+ local = parseBindingIdentifier(parser, context);
+ }
+ else {
+ // An import name that is a keyword is a syntax error if it is not followed
+ // by the keyword 'as'.
+ if (hasBit(token, 12288 /* Reserved */))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ if (hasBit(token, 4194304 /* IsEvalOrArguments */))
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ local = imported;
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ImportSpecifier',
+ local,
+ imported,
+ });
+ }
+ /**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NameSpaceImport)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNameSpaceImport(parser, context, specifiers) {
+ // NameSpaceImport:
+ // * as ImportedBinding
+ const pos = getLocation(parser);
+ expect(parser, context, 167774771 /* Multiply */);
+ expect(parser, context, 167843947 /* AsKeyword */, 82 /* AsAfterImportStart */);
+ const local = parseBindingIdentifier(parser, context);
+ specifiers.push(finishNode(context, parser, pos, {
+ type: 'ImportNamespaceSpecifier',
+ local,
+ }));
+ }
+ /**
+ * Parse module specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseModuleSpecifier(parser, context) {
+ // ModuleSpecifier :
+ // StringLiteral
+ expect(parser, context, 69745 /* FromKeyword */);
+ if (parser.token !== 33554435 /* StringLiteral */)
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseLiteral(parser, context);
+ }
+ /**
+ * Parse import default specifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportDefaultSpecifier(parser, context) {
+ return finishNode(context, parser, getLocation(parser), {
+ type: 'ImportDefaultSpecifier',
+ local: parseIdentifier(parser, context),
+ });
+ }
+ /**
+ * Parses either async function or assignment expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionOrAssignmentExpression(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context | Context.RequireIdentifier) :
+ parseAssignmentExpression(parser, context | Context.AllowIn);
+ } + + /**
+ * Creates the parser object
+ *
+ * @param source The source coode to parser
+ * @param sourceFile Optional source file info to be attached in every node
+ */
+ function createParser(source, sourceFile) {
+ return {
+ // The source code to parse
+ source,
+ // Source length
+ length: source.length,
+ // Current position
+ index: 0,
+ // Current line
+ line: 1,
+ // Current column
+ column: 0,
+ // Start position before current token
+ startIndex: 0,
+ // Start position column before current token
+ startColumn: 0,
+ // Start position line before current token
+ startLine: 1,
+ // End position after parsing after current token
+ lastIndex: 0,
+ // End column position after current token
+ lastColumn: 0,
+ // End line position after current token
+ lastLine: 0,
+ // Pending cover grammar errors
+ pendingExpressionError: undefined,
+ // Mutable parser flags. Allows destructuring by default.
+ flags: Flags.AllowDestructuring,
+ // The tokens
+ token: 1048576 /* EndOfSource */,
+ // Misc
+ tokenRaw: '',
+ lastValue: 0,
+ comments: [],
+ sourceFile,
+ tokenRegExp: undefined,
+ tokenValue: undefined,
+ labelSet: undefined,
+ errorLocation: undefined,
+ errors: [],
+ };
+ }
+ /**
+ * Creating the parser
+ *
+ * @param source The source coode to parser
+ * @param options The parser options
+ * @param context Context masks
+ */
+ function parseSource(source, options, /*@internal*/ context) {
+ let sourceFile = '';
+ if (!!options) {
+ // The flag to enable module syntax support
+ if (options.module)
+ context |= Context.Module;
+ // The flag to enable stage 3 support (ESNext)
+ if (options.next)
+ context |= Context.OptionsNext;
+ // The flag to enable React JSX parsing
+ if (options.jsx)
+ context |= Context.OptionsJSX;
+ // The flag to enable start and end offsets to each node
+ if (options.ranges)
+ context |= Context.OptionsRanges;
+ // The flag to enable line/column location information to each node
+ if (options.loc)
+ context |= Context.OptionsLoc;
+ // The flag to attach raw property to each literal node
+ if (options.raw)
+ context |= Context.OptionsRaw;
+ // Attach raw property to each identifier node
+ if (options.rawIdentifier)
+ context |= Context.OptionsRawidentifiers;
+ // The flag to allow return in the global scope
+ if (options.globalReturn)
+ context |= Context.OptionsGlobalReturn;
+ // The flag to allow to skip shebang - '#'
+ if (options.skipShebang)
+ context |= Context.OptionsShebang;
+ // Enable tolerant mode
+ if (options.tolerant)
+ context |= Context.OptionsTolerant;
+ // Set to true to record the source file in every node's loc object when the loc option is set.
+ if (!!options.source)
+ sourceFile = options.source;
+ // Create a top-level comments array containing all comments
+ if (!!options.comments)
+ context |= Context.OptionsComments;
+ // The flag to enable implied strict mode
+ if (options.impliedStrict)
+ context |= Context.Strict;
+ // The flag to enable experimental features
+ if (options.experimental)
+ context |= Context.OptionsExperimental;
+ // The flag to set to bypass methods in Node
+ if (options.node)
+ context |= Context.OptionsNode;
+ // Accepts a callback function to be invoked for each syntax node (as the node is constructed)
+ }
+ const parser = createParser(source, sourceFile);
+ const body = context & Context.Module ?
+ parseModuleItemList(parser, context) :
+ parseStatementList(parser, context);
+ const node = {
+ type: 'Program',
+ sourceType: context & Context.Module ? 'module' : 'script',
+ body: body,
+ };
+ if (context & Context.LocationTracker) {
+ if (context & Context.OptionsRanges) {
+ node.start = 0;
+ node.end = source.length;
+ }
+ if (context & Context.OptionsLoc) {
+ node.loc = {
+ start: { line: 1, column: 0 },
+ end: { line: parser.line, column: parser.column
+ }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ if (context & Context.OptionsComments)
+ node.comments = parser.comments;
+ if (context & Context.OptionsTolerant)
+ node.errors = parser.errors;
+ return node;
+ }
+ /**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function parseStatementList(parser, context) {
+ const statements = [];
+ let hasProlog = true; // Parsing directive prologue.
+ // prime the scanner
+ nextToken(parser, context | Context.DisallowEscapedKeyword);
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ if (hasProlog && parser.token !== 33554435 /* StringLiteral */)
+ hasProlog = false;
+ if (hasProlog) {
+ if (!(context & Context.Strict) && parser.tokenRaw.length === 12 && parser.tokenValue === 'use strict') {
+ context |= Context.Strict;
+ }
+ statements.push(parseDirective(parser, context));
+ }
+ else {
+ statements.push(parseStatementListItem(parser, context));
+ }
+ }
+ return statements;
+ }
+ /**
+ * Parse either script code or module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+ function parse(source, options) {
+ return options && options.module
+ ? parseModule(source, options)
+ : parseScript(source, options);
+ }
+ /**
+ * Parse script code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+ function parseScript(source, options) {
+ return parseSource(source, options, Context.Empty);
+ }
+ /**
+ * Parse module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+ function parseModule(source, options) {
+ return parseSource(source, options, Context.Strict | Context.Module);
+ } + + + + var estree = /*#__PURE__*/Object.freeze({ + + }); + exports('ESTree', estree); + + + + var index = /*#__PURE__*/Object.freeze({ + scanIdentifier: scanIdentifier, + scanMaybeIdentifier: scanMaybeIdentifier, + scanHexIntegerLiteral: scanHexIntegerLiteral, + scanOctalOrBinary: scanOctalOrBinary, + scanImplicitOctalDigits: scanImplicitOctalDigits, + scanSignedInteger: scanSignedInteger, + scanNumericLiteral: scanNumericLiteral, + scanNumericSeparator: scanNumericSeparator, + scanDecimalDigitsOrSeparator: scanDecimalDigitsOrSeparator, + scanDecimalAsSmi: scanDecimalAsSmi, + scanRegularExpression: scanRegularExpression, + scan: scan, + scanEscapeSequence: scanEscapeSequence, + throwStringError: throwStringError, + scanString: scanString, + consumeTemplateBrace: consumeTemplateBrace, + scanTemplate: scanTemplate, + skipSingleHTMLComment: skipSingleHTMLComment, + skipSingleLineComment: skipSingleLineComment, + skipMultiLineComment: skipMultiLineComment, + addComment: addComment, + nextUnicodeChar: nextUnicodeChar, + isIdentifierPart: isIdentifierPart, + escapeInvalidCharacters: escapeInvalidCharacters, + consumeOpt: consumeOpt, + consumeLineFeed: consumeLineFeed, + scanPrivateName: scanPrivateName, + advanceNewline: advanceNewline, + fromCodePoint: fromCodePoint, + readNext: readNext, + toHex: toHex, + advanceOnMaybeAstral: advanceOnMaybeAstral + }); + exports('Scanner', index); + + + + var parser = /*#__PURE__*/Object.freeze({ + parseClassDeclaration: parseClassDeclaration, + parseFunctionDeclaration: parseFunctionDeclaration, + parseAsyncFunctionOrAsyncGeneratorDeclaration: parseAsyncFunctionOrAsyncGeneratorDeclaration, + parseVariableDeclarationList: parseVariableDeclarationList, + parseExpression: parseExpression, + parseSequenceExpression: parseSequenceExpression, + parseAssignmentExpression: parseAssignmentExpression, + parseRestElement: parseRestElement, + parseLeftHandSideExpression: parseLeftHandSideExpression, + parsePrimaryExpression: parsePrimaryExpression, + parseIdentifier: parseIdentifier, + parseLiteral: parseLiteral, + parseBigIntLiteral: parseBigIntLiteral, + parseIdentifierName: parseIdentifierName, + parseFunctionExpression: parseFunctionExpression, + parseAsyncFunctionOrAsyncGeneratorExpression: parseAsyncFunctionOrAsyncGeneratorExpression, + parsePropertyName: parsePropertyName, + parseObjectLiteral: parseObjectLiteral, + parseFormalListAndBody: parseFormalListAndBody, + parseFunctionBody: parseFunctionBody, + parseFormalParameters: parseFormalParameters, + parseFormalParameterList: parseFormalParameterList, + parseClassBodyAndElementList: parseClassBodyAndElementList, + parseClassElement: parseClassElement, + parseDecorators: parseDecorators, + parseModuleItemList: parseModuleItemList, + parseModuleItem: parseModuleItem, + parseExportDeclaration: parseExportDeclaration, + parseImportDeclaration: parseImportDeclaration, + createParser: createParser, + parseSource: parseSource, + parseStatementList: parseStatementList, + parse: parse, + parseScript: parseScript, + parseModule: parseModule, + parseBindingIdentifierOrPattern: parseBindingIdentifierOrPattern, + parseBindingIdentifier: parseBindingIdentifier, + parseAssignmentRestElement: parseAssignmentRestElement, + parseAssignmentPattern: parseAssignmentPattern, + parseBindingInitializer: parseBindingInitializer, + parseStatementListItem: parseStatementListItem, + parseStatement: parseStatement, + parseEmptyStatement: parseEmptyStatement, + parseContinueStatement: parseContinueStatement, + parseBreakStatement: parseBreakStatement, + parseIfStatement: parseIfStatement, + parseDebuggerStatement: parseDebuggerStatement, + parseTryStatement: parseTryStatement, + parseCatchBlock: parseCatchBlock, + parseThrowStatement: parseThrowStatement, + parseExpressionStatement: parseExpressionStatement, + parseDirective: parseDirective, + parseExpressionOrLabelledStatement: parseExpressionOrLabelledStatement, + parseDoWhileStatement: parseDoWhileStatement, + parseWhileStatement: parseWhileStatement, + parseBlockStatement: parseBlockStatement, + parseReturnStatement: parseReturnStatement, + parseIterationStatement: parseIterationStatement, + parseWithStatement: parseWithStatement, + parseSwitchStatement: parseSwitchStatement, + parseCaseOrDefaultClauses: parseCaseOrDefaultClauses, + parseVariableStatement: parseVariableStatement, + parseJSXRootElement: parseJSXRootElement, + parseJSXOpeningElement: parseJSXOpeningElement, + nextJSXToken: nextJSXToken, + scanJSXToken: scanJSXToken, + parseJSXText: parseJSXText, + parseJSXAttributes: parseJSXAttributes, + parseJSXSpreadAttribute: parseJSXSpreadAttribute, + parseJSXNamespacedName: parseJSXNamespacedName, + parseJSXAttributeName: parseJSXAttributeName, + parseJSXAttribute: parseJSXAttribute, + parseJSXEmptyExpression: parseJSXEmptyExpression, + parseJSXSpreadChild: parseJSXSpreadChild, + parseJSXExpressionContainer: parseJSXExpressionContainer, + parseJSXExpression: parseJSXExpression, + parseJSXClosingFragment: parseJSXClosingFragment, + parseJSXClosingElement: parseJSXClosingElement, + parseJSXIdentifier: parseJSXIdentifier, + parseJSXMemberExpression: parseJSXMemberExpression, + parseJSXElementName: parseJSXElementName, + scanJSXIdentifier: scanJSXIdentifier + }); + + // tslint:disable-next-line:variable-name
+ const Parser = exports('Parser', parser); + + const version = exports('version', '1.6.9'); + + } + }; +}); diff --git a/node_modules/cherow/dist/system/cherow.min.js b/node_modules/cherow/dist/system/cherow.min.js new file mode 100644 index 0000000..6afc797 --- /dev/null +++ b/node_modules/cherow/dist/system/cherow.min.js @@ -0,0 +1 @@ +System.register("cherow",[],function(e,t){"use strict";return{execute:function(){e({parse:zn,parseSource:jn,parseModule:_n,parseScript:Wn,constructError:rn,report:an,tolerant:sn,tokenDesc:n,descKeyword:o,isValidIdentifierPart:s,isValidIdentifierStart:i,mustEscape:c,Context:void 0,Flags:void 0,Labels:void 0,NumericState:void 0,ScannerState:void 0,ModifierState:void 0,CoverParenthesizedState:void 0,Escape:void 0,RegexFlags:void 0,CoverCallState:void 0,RegexState:void 0,ObjectState:void 0,validateBreakOrContinueLabel:yt,addLabel:ht,popLabel:At,hasLabel:Et,finishNode:It,expect:bt,consume:vt,nextToken:Ct,consumeSemicolon:Nt,parseExpressionCoverGrammar:Lt,restoreExpressionCoverGrammar:Dt,swapContext:Rt,validateParams:Pt,lookahead:Ft,isValidSimpleAssignmentTarget:Bt,getLocation:Vt,isValidIdentifier:Mt,isLexical:Jt,isEndOfCaseOrDefaultClauses:Tt,nextTokenIsLeftParenOrPeriod:Xt,nextTokenisIdentifierOrParen:Gt,nextTokenIsLeftParen:Kt,nextTokenIsFuncKeywordOnSameLine:Yt,isPropertyWithPrivateFieldKey:qt,parseAndClassifyIdentifier:Ut,nameIsArgumentsOrEval:jt,setPendingError:$t,isEqualTagNames:zt,isInstanceField:Wt,validateUpdateExpression:_t,setPendingExpressionError:Qt,validateCoverParenthesizedExpression:Zt,validateAsyncArgumentList:en,isInOrOf:tn});const t=["end of source","identifier","number","string","regular expression","false","true","null","template continuation","template end","=>","(","{",".","...","}",")",";",",","[","]",":","?","'",'"',"</","/>","++","--","=","<<=",">>=",">>>=","**=","+=","-=","*=","/=","%=","^=","|=","&=","typeof","delete","void","!","~","+","-","in","instanceof","*","%","/","**","&&","||","===","!==","==","!=","<=",">=","<",">","<<",">>",">>>","&","|","^","var","let","const","break","case","catch","class","continue","debugger","default","do","else","export","extends","finally","for","function","if","import","new","return","super","switch","this","throw","try","while","with","implements","interface","package","private","protected","public","static","yield","as","async","await","constructor","get","set","from","of","#","eval","arguments","enum","BigInt","@","JSXText","KeyOf","ReadOnly","is","unique","declare","type","namespace","abstract","module","global","require","target"];function n(e){return t[255&e]}const r=Object.create(null,{this:{value:33566815},function:{value:33566808},if:{value:12377},return:{value:12380},var:{value:33566791},else:{value:12370},for:{value:12374},new:{value:33566811},in:{value:167786289},typeof:{value:302002218},while:{value:12386},case:{value:12363},break:{value:12362},try:{value:12385},catch:{value:12364},delete:{value:302002219},throw:{value:302002272},switch:{value:33566814},continue:{value:12366},default:{value:12368},instanceof:{value:167786290},do:{value:12369},void:{value:302002220},finally:{value:12373},arguments:{value:37879925},keyof:{value:131194},readonly:{value:131195},unique:{value:131197},declare:{value:131198},async:{value:594028},await:{value:34017389},class:{value:33566797},const:{value:33566793},constructor:{value:69742},debugger:{value:12367},enum:{value:12406},eval:{value:37879924},export:{value:12371},extends:{value:12372},false:{value:33566725},from:{value:69745},get:{value:69743},implements:{value:20579},import:{value:33566810},interface:{value:20580},let:{value:33574984},null:{value:33566727},of:{value:69746},package:{value:20581},private:{value:20582},protected:{value:20583},public:{value:20584},set:{value:69744},static:{value:20585},super:{value:33566813},true:{value:33566726},with:{value:12387},yield:{value:1107316842},is:{value:131196},type:{value:131199},namespace:{value:131200},abstract:{value:131201},as:{value:167843947},module:{value:131202},global:{value:131203},require:{value:131204},target:{value:131205}});function o(e){return 0|r[e]}const a=e("characterType",[0,0,0,0,0,0,0,0,0,16,48,16,16,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0]);function s(e){return 0!=(1&l[0+(e>>>5)]>>>e)}function i(e){return 0!=(1&l[34816+(e>>>5)]>>>e)}function c(e){return 0!=(1&l[69632+(e>>>5)]>>>e)}const l=((e,t)=>{const n=new Uint32Array(104448);let r=0,o=0;for(;r<3392;){const a=e[r++];if(a<0)o-=a;else{let s=e[r++];2&a&&(s=t[s]),1&a?n.fill(s,o,o+=e[r++]):n[o++]=s}}return n})([-1,2,28,2,29,2,5,-1,0,77595648,3,46,2,3,0,14,2,57,2,58,3,0,3,0,3168796671,0,4294956992,2,1,2,0,2,59,3,0,4,0,4294966523,3,0,4,2,15,2,60,2,0,0,4294836735,0,3221225471,0,4294901942,2,61,0,134152192,3,0,2,0,4294951935,3,0,2,0,2683305983,0,2684354047,2,17,2,0,0,4294961151,3,0,2,2,20,2,0,0,608174079,2,0,2,127,2,6,2,62,-1,2,64,2,26,2,1,3,0,3,0,4294901711,2,40,0,4089839103,0,2961209759,0,1342439375,0,4294543342,0,3547201023,0,1577204103,0,4194240,0,4294688750,2,2,0,80831,0,4261478351,0,4294549486,2,2,0,2965387679,0,196559,0,3594373100,0,3288319768,0,8469959,2,171,0,4294828031,0,3825204735,0,123747807,0,65487,2,3,0,4092591615,0,1080049119,0,458703,2,3,2,0,0,2163244511,0,4227923919,0,4236247020,2,68,0,4284449919,0,851904,2,4,2,16,0,67076095,-1,2,69,0,1006628014,0,4093591391,-1,0,50331649,0,3265266687,2,34,0,4294844415,0,4278190047,2,23,2,125,-1,3,0,2,2,33,2,0,2,9,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,10,0,261632,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,2088959,2,31,2,8,0,909311,3,0,2,0,814743551,2,42,0,67057664,3,0,2,2,45,2,0,2,32,2,0,2,18,2,7,0,268374015,2,30,2,51,2,0,2,78,0,134153215,-1,2,6,2,0,2,7,0,2684354559,0,67044351,0,1073676416,-2,3,0,2,2,43,0,1046528,3,0,3,2,8,2,0,2,41,0,4294960127,2,9,2,39,2,10,0,4294377472,2,21,3,0,7,0,4227858431,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-1,2,122,0,1048577,2,84,2,12,-1,2,12,0,131042,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,1046559,2,0,2,13,2,0,0,2147516671,2,24,3,88,2,2,0,-16,2,89,0,524222462,2,4,2,0,0,4269801471,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,2,119,2,0,0,3220242431,3,0,3,2,20,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,2,0,2,27,2,0,2,8,3,0,2,0,67043391,0,3909091327,2,0,2,25,2,8,2,23,3,0,2,0,67076097,2,7,2,0,2,24,0,67059711,0,4236247039,3,0,2,0,939524103,0,8191999,2,97,2,98,2,14,2,95,3,0,3,0,67057663,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,3774349439,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,2,19,0,1638399,2,169,2,104,3,0,3,2,23,2,28,2,29,2,5,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-3,2,146,-4,2,23,2,0,2,37,0,1,2,0,2,63,2,32,2,16,2,9,2,0,2,109,-1,3,0,4,2,9,2,33,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277137519,0,2269118463,-1,3,23,2,-1,2,34,2,38,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,48,-14,2,23,2,44,2,37,-5,3,0,2,2,38,0,2147549120,2,0,2,16,2,17,2,130,2,0,2,52,0,4294901872,0,5242879,3,0,2,0,402595359,-1,2,118,0,1090519039,-2,2,120,2,39,2,0,2,55,2,40,0,4226678271,0,3766565279,0,2039759,-4,3,0,2,0,1140787199,-1,3,0,2,0,67043519,-5,2,0,0,4282384383,0,1056964609,-1,3,0,2,0,67043345,-1,2,0,2,41,2,42,-1,2,10,2,43,-6,2,0,2,16,-3,3,0,2,0,2147484671,-8,2,0,2,7,2,44,2,0,0,603979727,-1,2,0,2,45,-8,2,54,2,46,0,67043329,2,123,2,47,0,8388351,-2,2,124,0,3028287487,2,48,2,126,0,33259519,2,42,-9,2,24,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,2,42,-2,2,17,2,51,2,0,2,24,0,67043343,2,128,2,19,-21,3,0,2,-4,3,0,2,0,4294901791,2,7,2,164,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,0,1677656575,-166,0,4161266656,0,4071,0,15360,-4,0,28,-13,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,0,4294954999,2,0,-16,2,0,2,90,2,0,0,2105343,0,4160749584,0,65534,-42,0,4194303871,0,2011,-62,3,0,6,0,8323103,-1,3,0,2,2,55,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-22583,3,0,7,2,19,-6130,3,5,2,-1,0,69207040,3,46,2,3,0,14,2,57,2,58,-3,0,3168731136,0,4294956864,2,1,2,0,2,59,3,0,4,0,4294966275,3,0,4,2,15,2,60,2,0,2,35,-1,2,17,2,61,-1,2,0,2,62,0,4294885376,3,0,2,0,3145727,0,2617294944,0,4294770688,2,19,2,63,3,0,2,0,131135,2,94,0,70256639,0,71303167,0,272,2,45,2,62,-1,2,64,-2,2,96,0,603979775,0,4278255616,0,4294836227,0,4294549473,0,600178175,0,2952806400,0,268632067,0,4294543328,0,57540095,0,1577058304,0,1835008,0,4294688736,2,65,2,66,0,33554435,2,121,2,65,2,147,0,131075,0,3594373096,0,67094296,2,66,-1,2,67,0,603979263,2,156,0,3,0,4294828001,0,602930687,2,180,0,393219,2,67,0,671088639,0,2154840064,0,4227858435,0,4236247008,2,68,2,38,-1,2,4,0,917503,2,38,-1,2,69,0,537783470,0,4026531935,-1,0,1,-1,2,34,2,70,0,7936,-3,2,0,0,2147485695,0,1010761728,0,4292984930,0,16387,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,16,-1,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,253951,3,20,2,0,122879,2,0,2,8,0,276824064,-2,3,0,2,2,45,2,0,0,4294903295,2,0,2,18,2,7,-1,2,17,2,51,2,0,2,78,2,42,-1,2,24,2,0,2,31,-2,0,128,-2,2,79,2,8,0,4064,-1,2,117,0,4227907585,2,0,2,116,2,0,2,50,2,196,2,9,2,39,2,10,-1,0,6544896,3,0,6,-2,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-3,2,84,2,12,-3,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,817183,2,0,2,13,2,0,0,33023,2,24,3,88,2,-17,2,89,0,524157950,2,4,2,0,2,90,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,0,3072,2,0,0,2147516415,2,9,3,0,2,2,19,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,0,4294965179,0,7,2,0,2,8,2,92,2,8,-1,0,1761345536,2,94,2,95,2,38,2,23,2,96,2,36,2,162,0,2080440287,2,0,2,35,2,138,0,3296722943,2,0,0,1046675455,0,939524101,0,1837055,2,97,2,98,2,14,2,95,3,0,3,0,7,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,2700607615,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,-3,2,104,3,0,3,2,23,-1,3,5,2,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-8,2,23,2,0,2,37,-1,2,0,2,63,2,32,2,18,2,9,2,0,2,109,-1,3,0,4,2,9,2,17,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277075969,2,18,-1,3,23,2,-1,2,34,2,139,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,50,-14,2,23,2,44,2,116,-5,2,117,2,41,-2,2,117,2,19,2,17,2,35,2,117,2,38,0,4294901776,0,4718591,2,117,2,36,0,335544350,-1,2,118,2,119,-2,2,120,2,39,2,7,-1,2,121,2,65,0,3758161920,0,3,-4,2,0,2,31,2,174,-1,2,0,2,19,0,176,-5,2,0,2,49,2,182,-1,2,0,2,19,2,194,-1,2,0,2,62,-2,2,16,-7,2,0,2,119,-3,3,0,2,2,122,-8,0,4294965249,0,67633151,0,4026597376,2,0,0,536871887,-1,2,0,2,45,-8,2,54,2,49,0,1,2,123,2,19,-3,2,124,2,37,2,125,2,126,0,16778239,-10,2,36,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,-3,2,17,2,127,2,0,2,19,2,50,2,128,2,19,-21,3,0,2,-4,3,0,2,0,65567,-1,2,26,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,2,130,-187,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,2,138,-129,3,0,6,2,139,-1,3,0,2,2,50,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-28719,2,0,0,1,-1,2,122,2,0,0,8193,-21,0,50331648,0,10255,0,4,-11,2,66,2,168,-1,0,71680,-1,2,157,0,4292900864,0,805306431,-5,2,146,-1,2,176,-1,0,6144,-2,2,123,-1,2,150,-1,2,153,2,147,2,161,2,0,0,3223322624,2,36,0,4,-4,2,188,0,205128192,0,1333757536,0,2147483696,0,423953,0,747766272,0,2717763192,0,4286578751,0,278545,2,148,0,4294886464,0,33292336,0,417809,2,148,0,1329579616,0,4278190128,0,700594195,0,1006647527,0,4286497336,0,4160749631,2,149,0,469762560,0,4171219488,0,16711728,2,149,0,202375680,0,3214918176,0,4294508592,0,139280,-1,0,983584,2,190,0,58720275,0,3489923072,0,10517376,0,4293066815,0,1,0,2013265920,2,175,2,0,0,17816169,0,3288339281,0,201375904,2,0,-2,0,256,0,122880,0,16777216,2,146,0,4160757760,2,0,-6,2,163,-11,0,3263218176,-1,0,49664,0,2160197632,0,8388802,-1,0,12713984,-1,2,150,2,155,2,158,-2,2,159,-20,0,3758096385,-2,2,151,0,4292878336,2,22,2,166,0,4294057984,-2,2,160,2,152,2,172,-2,2,151,-1,2,179,-1,2,167,2,122,0,4026593280,0,14,0,4292919296,-1,2,154,0,939588608,-1,0,805306368,-1,2,122,0,1610612736,2,152,2,153,3,0,2,-2,2,154,2,155,-3,0,267386880,-1,2,156,0,7168,-1,0,65024,2,150,2,157,2,158,-7,2,165,-8,2,159,-1,0,1426112704,2,160,-1,2,185,0,271581216,0,2149777408,2,19,2,157,2,122,0,851967,0,3758129152,-1,2,19,2,178,-4,2,154,-20,2,192,2,161,-56,0,3145728,2,184,-1,2,191,2,122,-1,2,162,2,122,-4,0,32505856,-1,2,163,-1,0,2147385088,2,22,1,2155905152,2,-3,2,164,2,0,2,165,-2,2,166,-6,2,167,0,4026597375,0,1,-1,0,1,-1,2,168,-3,2,139,2,66,-2,2,162,2,177,-1,2,173,2,122,-6,2,122,-213,2,167,-657,2,17,-36,2,169,-1,2,186,-10,0,4294963200,-5,2,170,-5,2,158,2,0,2,24,-1,0,4227919872,-1,2,170,-2,0,4227874752,-3,0,2146435072,2,155,-2,0,1006649344,2,122,-1,2,22,0,201375744,-3,0,134217720,2,22,0,4286677377,0,32896,-1,2,171,-3,2,172,-349,2,173,2,174,2,175,3,0,264,-11,2,176,-2,2,158,2,0,0,520617856,0,2692743168,0,36,-3,0,524284,-11,2,19,-1,2,183,-1,2,181,0,3221291007,2,158,-1,0,524288,0,2158720,-3,2,155,0,1,-4,2,122,0,3808625411,0,3489628288,0,4096,0,1207959680,0,3221274624,2,0,-3,2,177,0,120,0,7340032,-2,0,4026564608,2,4,2,19,2,160,3,0,4,2,155,-1,2,178,2,175,-1,0,8176,2,179,2,177,2,180,-1,0,4290773232,2,0,-4,2,160,2,187,0,15728640,2,175,-1,2,157,-1,0,4294934512,3,0,4,-9,2,22,2,167,2,181,3,0,4,0,704,0,1849688064,0,4194304,-1,2,122,0,4294901887,2,0,0,130547712,0,1879048192,0,2080374784,3,0,2,-1,2,182,2,183,-1,0,17829776,0,2025848832,0,4261477888,-2,2,0,-1,0,4286580608,-1,0,29360128,2,184,0,16252928,0,3791388672,2,39,3,0,2,-2,2,193,2,0,-1,2,26,-1,0,66584576,-1,2,189,3,0,9,2,122,3,0,4,-1,2,157,2,158,3,0,5,-2,0,245760,0,2147418112,-1,2,146,2,199,0,4227923456,-1,2,185,2,186,2,22,-2,2,176,0,4292870145,0,262144,2,122,3,0,2,0,1073758848,2,187,-1,0,4227921920,2,188,0,68289024,0,528402016,0,4292927536,3,0,4,-2,0,2483027968,2,0,-2,2,189,3,0,5,-1,2,184,2,160,2,0,-2,0,4227923936,2,63,-1,2,170,2,94,2,0,2,150,2,154,3,0,6,-1,2,175,3,0,3,-2,0,2146959360,3,0,8,-2,2,157,-1,2,190,2,117,-1,2,151,3,0,8,2,191,0,8388608,2,171,2,169,2,183,0,4286578944,3,0,2,0,1152,0,1266679808,2,189,0,576,0,4261707776,2,94,3,0,9,2,151,3,0,8,-28,2,158,3,0,3,-3,0,4292902912,-6,2,96,3,0,85,-33,2,164,3,0,126,-18,2,192,3,0,269,-17,2,151,2,122,0,4294917120,3,0,2,2,19,0,4290822144,-2,0,67174336,0,520093700,2,17,3,0,21,-2,2,177,3,0,3,-2,0,65504,2,122,2,49,3,0,2,2,92,-191,2,123,-23,2,26,3,0,296,-8,2,122,3,0,2,2,19,-11,2,175,3,0,72,-3,0,3758159872,0,201391616,3,0,155,-7,2,167,-1,0,384,-1,0,133693440,-3,2,193,-2,2,30,3,0,4,2,166,-2,2,22,2,151,3,0,4,-2,2,185,-1,2,146,0,335552923,2,194,-1,0,538974272,0,2214592512,0,132e3,-10,0,192,-8,0,12288,-21,0,134213632,0,4294901761,3,0,42,0,100663424,0,4294965284,3,0,62,-6,0,4286578784,2,0,-2,0,1006696448,3,0,24,2,37,-1,2,195,3,0,10,2,194,0,4110942569,0,1432950139,0,2701658217,0,4026532864,0,4026532881,2,0,2,47,3,0,8,-1,2,154,-2,2,166,0,98304,0,65537,2,167,2,169,-2,2,154,-1,2,63,2,0,2,116,2,197,2,175,0,4294770176,2,30,3,0,4,-30,2,195,2,196,-3,2,166,-2,2,151,2,0,2,154,-1,2,189,-1,2,157,2,198,3,0,2,2,154,2,122,-1,0,193331200,-1,0,4227923960,2,197,-1,3,0,3,2,198,3,0,44,-1334,2,22,2,0,-129,2,195,-6,2,160,-180,2,199,-233,2,4,3,0,96,-16,2,160,3,0,22583,-7,2,17,3,0,6128],[4294967295,4294967291,4092460543,4294828015,4294967294,134217726,268435455,2147483647,1048575,1073741823,3892314111,1061158911,536805376,4294910143,4160749567,4294901759,134217727,4294901760,4194303,65535,262143,67108863,4286578688,536870911,8388607,4294918143,4294443008,255,67043328,2281701374,4294967232,2097151,4294903807,4294902783,4294967039,511,524287,131071,127,4294902271,4294549487,16777215,1023,67047423,4294901888,33554431,4286578687,4294770687,67043583,32767,15,2047999,4292870143,4294934527,4294966783,67045375,4294967279,262083,20511,4290772991,41943039,493567,2047,4294959104,1071644671,602799615,65536,4294828e3,805044223,4277151126,8191,1031749119,4294917631,2134769663,4286578493,4282253311,4294942719,33540095,4294905855,4294967264,2868854591,1608515583,265232348,534519807,2147614720,1060109444,4093640016,17376,2139062143,224,4169138175,4294909951,4294967292,4294965759,4294966272,4294901823,4294967280,8289918,4294934399,4294901775,4294965375,1602223615,4294967259,268369920,4292804608,486341884,4294963199,3087007615,1073692671,4128527,4279238655,4294902015,4294966591,2445279231,3670015,3238002687,63,4294967288,4294705151,4095,3221208447,4294549472,2147483648,4294705152,4294966143,64,4294966719,16383,3774873592,536807423,67043839,3758096383,3959414372,3755993023,2080374783,4294835295,4294967103,4160749565,4087,31,184024726,2862017156,1593309078,268434431,268434414,4294901763,536870912,2952790016,202506752,139264,402653184,4261412864,4227922944,2147532800,61440,3758096384,117440512,65280,4227858432,3233808384,3221225472,4294965248,32768,57152,4294934528,67108864,4293918720,4290772992,25165824,57344,4278190080,65472,4227907584,65520,1920,4026531840,49152,4160749568,4294836224,63488,1073741824,4294967040,251658240,196608,12582912,2097152,65408,64512,417808,4227923712,48,512,4294967168,4294966784,16,4292870144,4227915776,65528,4294950912,65532]);function u(e){const{index:t}=e,n=e.source.charCodeAt(t);if(n<55296||n>56319)return n;const r=e.source.charCodeAt(t+1);return r<56320||r>57343?n:65536+((1023&n)<<10)|1023&r}const d=e=>0!=(1&a[e])||s(e);function p(e){switch(e){case 0:return"\\0";case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:return c(e)?e<16?`\\x0${e.toString(16)}`:e<256?`\\x${e.toString(16)}`:e<4096?`\\u0${e.toString(16)}`:e<65536?`\\u${e.toString(16)}`:`\\u{${e.toString(16)}}`:k(e)}}function f(e,t){return e.source.charCodeAt(e.index)===t&&(e.index++,e.column++,!0)}function m(e,t){e.flags|=lt.NewLine,e.index++,0==(t&pt.LastIsCR)&&(e.column=0,e.line++)}function g(e,t){return t&ct.InClass&&i(e.source.charCodeAt(e.index))||an(e,1,n(e.token)),115}function x(e){e.flags|=lt.NewLine,e.index++,e.column=0,e.line++}const k=e=>e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023));function S(e){return e.index++,e.column++,e.index>=e.source.length&&an(e,14),u(e)}function w(e){return e<48?-1:e<=57?e-48:e<65?-1:e<=70?e-65+10:e<97?-1:e<=102?e-97+10:-1}function y(e,t){e.index++,e.column++,t>65535&&e.index++}function h(e,t,n){switch(n){case 98:return 8;case 102:return 12;case 114:return 13;case 110:return 10;case 116:return 9;case 118:return 11;case 13:case 10:case 8232:case 8233:return e.column=-1,e.line++,gt.Empty;case 48:case 49:case 50:case 51:{let r=n-48,o=e.index+1,a=e.column+1,s=e.source.charCodeAt(o);if(s<48||s>55){if(0!==r||56===s||57===s){if(t&ct.Strict)return gt.StrictOctal;e.flags|=lt.HasOctal}}else{if(t&ct.Strict)return gt.StrictOctal;e.flags|=lt.HasOctal,e.lastValue=s,r=8*r+(s-48),o++,a++,(s=e.source.charCodeAt(o))>=48&&s<=55&&(e.lastValue=s,r=8*r+(s-48),o++,a++),e.index=o-1,e.column=a-1}return r}case 52:case 53:case 54:case 55:{if(t&ct.Strict)return gt.StrictOctal;let r=n-48;const o=e.index+1,a=e.column+1,s=e.source.charCodeAt(o);return s>=48&&s<=55&&(r=8*r+(s-48),e.lastValue=s,e.index=o,e.column=a),r}case 56:case 57:return gt.EightOrNine;case 120:{const t=w(e.lastValue=S(e));if(t<0)return gt.InvalidHex;const n=w(e.lastValue=S(e));return n<0?gt.InvalidHex:t<<4|n}case 117:{let t=e.lastValue=S(e);if(123===t){let n=w(t=e.lastValue=S(e));if(n<0)return gt.InvalidHex;for(t=e.lastValue=S(e);125!==t;){const r=w(t);if(r<0)return gt.InvalidHex;if((n=16*n+r)>1114111)return gt.OutOfRange;t=e.lastValue=S(e)}return n}{let n=w(t);if(n<0)return gt.InvalidHex;for(let r=0;r<3;r++){const r=w(t=e.lastValue=S(e));if(r<0)return gt.InvalidHex;n=16*n+r}return n}}default:return e.source.charCodeAt(e.index)}}function A(e,t,n){switch(n){case gt.Empty:return;case gt.StrictOctal:an(e,t&ct.TaggedTemplate?76:11);case gt.EightOrNine:an(e,13);case gt.InvalidHex:an(e,75,"hexadecimal");case gt.OutOfRange:an(e,14)}}function E(e,t,n){const{index:r,lastValue:o}=e;let a="";e.index++,e.column++;let s=e.source.charCodeAt(e.index);for(;s!==n;){switch(s){case 13:case 10:an(e,6);case 92:if((s=S(e))>128)a+=k(s);else{e.lastValue=s;const n=h(e,t,s);n>=0?a+=k(n):A(e,t,n),s=e.lastValue}break;default:a+=k(s)}s=S(e)}return e.index++,e.column++,e.tokenRaw=e.source.slice(r,e.index),e.tokenValue=a,e.lastValue=o,33554435}function I(e,t){return e.index>=e.length&&an(e,9),e.index--,e.column--,b(e,t)}function b(e,t){const{index:n,lastValue:r}=e;let o=!0,a="",s=S(e);e:for(;96!==s;){switch(s){case 36:{const t=e.index+1;if(t<e.length&&123===e.source.charCodeAt(t)){e.index=t,e.column++,o=!1;break e}a+="$";break}case 92:if((s=S(e))>=128)a+=k(s);else{e.lastValue=s;const n=h(e,t|ct.Strict,s);if(n>=0)a+=k(n);else{if(n!==gt.Empty&&t&ct.TaggedTemplate){a=void 0,(s=v(e,e.lastValue))<0&&(o=!1);break e}A(e,t|ct.TaggedTemplate,n)}s=e.lastValue}break;case 13:case 10:case 8232:case 8233:e.column=-1,e.line++;default:null!=a&&(a+=k(s))}s=S(e)}return e.index++,e.column++,e.tokenValue=a,e.lastValue=r,o?(e.tokenRaw=e.source.slice(n+1,e.index-1),33554441):(e.tokenRaw=e.source.slice(n+1,e.index-2),33554440)}function v(e,t){for(;96!==t;){if(36===t&&123===e.source.charCodeAt(e.index+1))return e.index++,e.column++,-t;t=S(e)}return t}function C(e,t){e.index++,e.column++;let n=dt.None,r=w(e.source.charCodeAt(e.index));for(r<0&&an(e,0),e.index++,e.column++;e.index<e.length;){const o=e.source.charCodeAt(e.index);if(t&ct.OptionsNext&&95===o){n=R(e,n);continue}n&=~dt.SeenSeparator;const a=w(o);if(a<0)break;r=16*r+a,e.index++,e.column++}return n&dt.SeenSeparator&&an(e,59),F(e,t,r,f(e,110))}function O(e,t,n){e.index++,e.column++;let r,o=0,a=0,s=dt.None;for(;e.index<e.length;){if(r=e.source.charCodeAt(e.index),t&ct.OptionsNext&&95===r){s=R(e,s);continue}s&=~dt.SeenSeparator;const i=r-48;if(!(r>=48&&r<=57)||i>=n)break;a=a*n+i,e.index++,e.column++,o++}return 0===o&&an(e,0),s&dt.SeenSeparator&&an(e,59),F(e,t,a,f(e,110))}function N(e,t){switch(e.source.charCodeAt(e.index)){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:{t&ct.Strict&&an(e,0);let n=e.index,r=e.column,o=0;for(e.flags|=lt.HasOctal;n<e.length;){const a=e.source.charCodeAt(n);if(95===a)an(e,60);else{if(a<48||a>55)return D(e,t);o=8*o+(a-48),n++,r++}}return e.index=n,e.column=r,F(e,t,o,f(e,110))}case 56:case 57:e.flags|=lt.HasOctal;default:return t&ct.OptionsNext&&95===e.source.charCodeAt(e.index)&&an(e,60),D(e,t)}}function L(e,t){let n=e.source.charCodeAt(e.index);43!==n&&45!==n||(e.index++,e.column++,n=e.source.charCodeAt(e.index)),n>=48&&n<=57||an(e,0);const r=e.index,o=P(e);return e.source.substring(t,r)+o}function D(e,t,n=dt.None){let r=n&dt.Float?0:H(e,t);const o=e.source.charCodeAt(e.index);if(46!==o&&95!==o&&!i(o))return F(e,t,r);f(e,46)&&(t&ct.OptionsNext&&95===e.source.charCodeAt(e.index)&&an(e,60),n|=dt.Float,r=`${r}.${P(e)}`);const a=e.index;return f(e,110)&&(n&dt.Float&&an(e,0),n|=dt.BigInt),(f(e,101)||f(e,69))&&(n|=dt.Float,r+=L(e,a)),i(e.source.charCodeAt(e.index))&&an(e,0),F(e,t,n&dt.Float?parseFloat(r):parseInt(r,10),!!(n&dt.BigInt))}function R(e,t){return e.index++,e.column++,t&dt.SeenSeparator&&an(e,59),t|=dt.SeenSeparator}function P(e){let t=e.index,n=dt.None,r="";e:for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 95:const o=e.index;n=R(e,n),r+=e.source.substring(t,o),t=e.index;continue;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:n&=~dt.SeenSeparator,e.index++,e.column++;break;default:break e}return n&dt.SeenSeparator&&an(e,59),r+e.source.substring(t,e.index)}function H(e,t){let n=dt.None,r=0,o=e.source.charCodeAt(e.index);for(;o>=48&&o<=57||95===o;)t&ct.OptionsNext&&95===o?(n=R(e,n),o=e.source.charCodeAt(e.index)):(n&=~dt.SeenSeparator,r=10*r+(o-48),e.index++,e.column++,o=e.source.charCodeAt(e.index));return n&dt.SeenSeparator&&an(e,59),r}function F(e,t,n,r=!1){return e.tokenValue=n,t&ct.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),r?33554551:33554434}function B(e,t,n){let r=e.index,a="",s=!1;n&&y(e,n);e:for(;e.index<e.length;){const t=e.index;let n=e.source.charCodeAt(t);switch(n){case 92:a+=e.source.slice(r,t),a+=M(e),r=e.index,s=!0;break;default:if(n>=55296&&n<=56319){n=(1023&n)<<10|1023&e.source.charCodeAt(t+1)|65536}if(!d(n))break e;y(e,n)}}r<e.index&&(a+=e.source.slice(r,e.index)),e.tokenValue=a;const i=a.length;if(i>=2&&i<=11){const n=o(a);if(n>0)return s&&(t&ct.DisallowEscapedKeyword&&sn(e,t,3),e.flags|=lt.EscapedKeyword),n}return t&ct.OptionsRawidentifiers&&(e.tokenRaw=e.source.slice(r,e.index)),33685505}function V(e,t,n){return i(n=u(e))||an(e,10,p(n)),B(e,t,n)}function M(e){const{index:t}=e;if(t+5<e.length){117!==e.source.charCodeAt(t+1)&&an(e,0),e.index+=2,e.column+=2;const n=function(e){let t=e.source.charCodeAt(e.index),n=0;if(123===t){let r=w(t=S(e));for(;r>=0;)(n=n<<4|r)>1114111&&an(e,89),e.index++,e.column++,r=w(e.source.charCodeAt(e.index));125!==e.source.charCodeAt(e.index)&&an(e,75,"unicode"),f(e,125)}else for(let r=0;r<4;r++){const r=w(t=e.source.charCodeAt(e.index));r<0&&an(e,75,"unicode"),n=n<<4|r,e.index++,e.column++}return n}(e);return n>=55296&&n<=56319&&an(e,74),d(n)||an(e,75,"unicode"),k(n)}an(e,0)}function J(e,t,n,r){return t&ct.Module&&an(e,90),T(e,t,n,r)}function T(e,t,n,r){const o=e.index,a=!!(t&ct.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 13:return x(e),e.index<e.length&&10===e.source.charCodeAt(e.index)&&e.index++,n|pt.NewLine;case 10:case 8232:case 8233:return x(e),a&&G(e,t,r,o),n|pt.NewLine;default:e.index++,e.column++}return a&&G(e,t,r,o),n}function X(e,t,n){const r=e.index,o=!!(t&ct.OptionsComments);for(;e.index<e.length;)switch(e.source.charCodeAt(e.index)){case 42:if(e.index++,e.column++,n&=~pt.LastIsCR,f(e,47))return o&&G(e,t,"MultiLine",r),n;break;case 13:n|=pt.NewLine|pt.LastIsCR,x(e);break;case 10:m(e,n),n=n&~pt.LastIsCR|pt.NewLine;break;case 8232:case 8233:n=n&~pt.LastIsCR|pt.NewLine,x(e);break;default:n&=~pt.LastIsCR,e.index++,e.column++}sn(e,t,8)}function G(e,t,n,r){const{index:o,startIndex:a,startLine:s,startColumn:i,lastLine:c,lastColumn:l}=e,u={type:n,value:e.source.slice(r,"MultiLine"===n?o-2:o),start:a,end:o};t&ct.OptionsLoc&&(u.loc={start:{line:s,column:i},end:{line:c,column:l}}),e.comments.push(u)}function K(e,t){e.flags&=~lt.NewLine|lt.EscapedKeyword;const n=0===e.index;let r=pt.None;for(;e.index<e.length;){n||(e.startIndex=e.index,e.startColumn=e.column,e.startLine=e.line);const o=e.source.charCodeAt(e.index);if(o>128)switch(o){case 8232:case 8233:r=r&~pt.LastIsCR|pt.NewLine,x(e);break;case 65519:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:case 8205:e.index++,e.column++;break;default:return V(e,t,o)}else switch(o){case 13:r|=pt.NewLine|pt.LastIsCR,x(e);break;case 10:m(e,r),r=r&~pt.LastIsCR|pt.NewLine;break;case 9:case 11:case 12:case 32:e.index++,e.column++;break;case 40:return e.index++,e.column++,50331659;case 41:return e.index++,e.column++,16;case 44:return e.index++,e.column++,16777234;case 58:return e.index++,e.column++,16777237;case 59:return e.index++,e.column++,17825809;case 63:return e.index++,e.column++,22;case 93:return e.index++,e.column++,20;case 123:return e.index++,e.column++,41943052;case 125:return e.index++,e.column++,17825807;case 126:return e.index++,e.column++,301989934;case 91:return e.index++,e.column++,41943059;case 64:return e.index++,e.column++,120;case 47:if(e.index++,e.column++,e.index>=e.length)return 167774773;switch(e.source.charCodeAt(e.index)){case 47:e.index++,e.column++,r=T(e,t,r,"SingleLine");continue;case 42:e.index++,e.column++,r=X(e,t,r);continue;case 61:return e.index++,e.column++,100663333;default:return 167774773}case 45:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 45:if(e.index++,e.column++,(r&pt.NewLine||n)&&f(e,62)){r=J(e,t,r,"HTMLClose");continue}return 570425372;case 61:return e.index++,e.column++,67108899;default:return 436209968}case 60:if(e.index++,e.column++,f(e,33)&&f(e,45)&&f(e,45)){r=J(e,t,r,"HTMLOpen");continue}switch(e.source.charCodeAt(e.index)){case 60:return e.index++,e.column++,f(e,61)?67108894:167774273;case 61:return e.index++,e.column++,167774013;case 47:{if(!(t&ct.OptionsJSX))break;const n=e.index+1;if(n<e.length){const t=e.source.charCodeAt(n);if(42===t||47===t)break}return e.index++,e.column++,25}default:return 167774015}case 33:return e.index++,e.column++,f(e,61)?f(e,61)?167773754:167773756:301989933;case 39:case 34:return E(e,t,o);case 37:return e.index++,e.column++,f(e,61)?67108902:167774772;case 38:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 38===t?(e.index++,e.column++,169869879):61===t?(e.index++,e.column++,67108905):167773508}case 42:{if(e.index++,e.column++,e.index>=e.length)return 167774771;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,67108900):42!==t?167774771:(e.index++,e.column++,f(e,61)?67108897:167775030)}case 43:{if(e.index++,e.column++,e.index>=e.length)return 436209967;const t=e.source.charCodeAt(e.index);return 43===t?(e.index++,e.column++,570425371):61===t?(e.index++,e.column++,67108898):436209967}case 92:return B(e,t);case 61:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 61===t?(e.index++,e.column++,f(e,61)?167773753:167773755):62===t?(e.index++,e.column++,10):83886109}case 62:{if(e.index++,e.column++,e.index>=e.length)return 167774016;if(t&ct.InJSXChild)return 167774016;let n=e.source.charCodeAt(e.index);return 61===n?(e.index++,e.column++,167774014):62!==n?167774016:(e.index++,e.column++,62===(n=e.source.charCodeAt(e.index))?(e.index++,e.column++,f(e,61)?67108896:167774275):61===n?(e.index++,e.column++,67108895):167774274)}case 94:return e.index++,e.column++,f(e,61)?67108903:167773254;case 96:return b(e,t);case 124:{e.index++,e.column++;const t=e.source.charCodeAt(e.index);return 124===t?(e.index++,e.column++,169869624):61===t?(e.index++,e.column++,67108904):167772997}case 46:{let n=e.index+1;const r=e.source.charCodeAt(n);return r>=48&&r<=57?(D(e,t,dt.Float),33554434):46===r&&++n<e.length&&46===e.source.charCodeAt(n)?(e.index=n+1,e.column+=3,14):(e.index++,e.column++,16777229)}case 35:{e.index++,e.column++;const r=e.index,o=e.source.charCodeAt(r);if(t&ct.OptionsShebang&&n&&33===o){e.index=r+1,T(e,t,pt.None,"SheBang");continue}return g(e,t)}case 48:switch(e.index++,e.column++,e.source.charCodeAt(e.index)){case 88:case 120:return C(e,t);case 66:case 98:return O(e,t,2);case 79:case 111:return O(e,t,8);default:return N(e,t)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return D(e,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 36:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:default:return B(e,t,o)}}return 1048576}function Y(e,t){const n=e.index;let r=St.Empty;e:for(;;){const t=e.source.charCodeAt(e.index);if(e.index++,e.column++,r&St.Escape)r&=~St.Escape;else switch(t){case 47:if(r)break;break e;case 92:r|=St.Escape;break;case 91:r|=St.Class;break;case 93:r&=St.Escape;break;case 13:case 10:case 8232:case 8233:an(e,7)}e.index>=e.source.length&&an(e,7)}const o=e.index-1;let a=xt.Empty;const{index:s}=e;e:for(;e.index<e.source.length;){const n=e.source.charCodeAt(e.index);switch(n){case 103:a&xt.Global&&sn(e,t,15,"g"),a|=xt.Global;break;case 105:a&xt.IgnoreCase&&sn(e,t,15,"i"),a|=xt.IgnoreCase;break;case 109:a&xt.Multiline&&sn(e,t,15,"m"),a|=xt.Multiline;break;case 117:a&xt.Unicode&&sn(e,t,15,"u"),a|=xt.Unicode;break;case 121:a&xt.Sticky&&sn(e,t,15,"y"),a|=xt.Sticky;break;case 115:a&xt.DotAll&&sn(e,t,15,"s"),a|=xt.DotAll;break;default:if(!d(n))break e;an(e,16,k(n))}e.index++,e.column++}const i=e.source.slice(s,e.index),c=e.source.slice(n,o);return e.tokenRegExp={pattern:c,flags:i},t&ct.OptionsRaw&&(e.tokenRaw=e.source.slice(e.startIndex,e.index)),e.tokenValue=function(e,t,n,r){ct.OptionsNode;try{return new RegExp(n,r)}catch(e){return null}}(0,0,c,i),33554436}function q(e,t,n=[]){const{token:r}=e;return 8388608&r?41943052===r?function(e,t){const n=Vt(e),r=[];bt(e,t,41943052);for(;17825807!==e.token;){if(14===e.token){r.push($(e,t));break}r.push(_(e,t)),17825807!==e.token&&bt(e,t,16777234)}return bt(e,t,17825807),It(t,e,n,{type:"ObjectPattern",properties:r})}(e,t):function(e,t,n){const r=Vt(e);Ct(e,t);const o=[];for(;20!==e.token;)if(vt(e,t,16777234))o.push(null);else{if(14===e.token){o.push(j(e,t,n));break}o.push(Lt(e,t|ct.AllowIn,W)),20!==e.token&&bt(e,t,16777234)}return bt(e,t,20),It(t,e,r,{type:"ArrayPattern",elements:o})}(e,t,n):(1074003968&r&&(262144&r&&t&(ct.Async|ct.Module)?sn(e,t,48):1073741824&r&&t&(ct.Yield|ct.Strict)&&sn(e,t,49)),n.push(e.tokenValue),U(e,t))}function U(e,t){const{token:r}=e;4194304&r?(t&ct.Strict&&sn(e,t,17),e.flags|=lt.StrictEvalArguments):t&ct.BlockScope&&33574984===r?sn(e,t,27):Ot(r,20480)?(t&ct.Strict&&sn(e,t,1,n(r)),e.flags|=lt.StrictFunctionName):Mt(t,r)||sn(e,t,1,n(r));const o=Vt(e),a=e.tokenValue;return Ct(e,t),It(t,e,o,{type:"Identifier",name:a})}function j(e,t,n){const r=Vt(e);bt(e,t,14);const o=q(e,t,n);return 16777234===e.token&&sn(e,t,88),It(t,e,r,{type:"RestElement",argument:o})}function $(e,t){const n=Vt(e);bt(e,t,14);const{token:r}=e,o=q(e,t);return Ot(r,8388608)&&sn(e,t,94),16777234===e.token&&sn(e,t,88),It(t,e,n,{type:"RestElement",argument:o})}function z(e,t,n,r){return It(t,e,r,{type:"AssignmentPattern",left:n,right:Lt(e,t|ct.AllowIn,Ee)})}function W(e,t){const n=Vt(e),r=q(e,t);return vt(e,t,83886109)?It(t,e,n,{type:"AssignmentPattern",left:r,right:Ee(e,t|ct.AllowIn)}):r}function _(e,t){const n=Vt(e),{token:r}=e;let o,a,s=!1,i=!1;if(135168&r)if(o=Re(e,t),i=!vt(e,t,16777237)){const s=vt(e,t,83886109);t&ct.Yield&&1073741824&r&&sn(e,t,49),Mt(t,r)||sn(e,t,46),a=s?z(e,t,o,n):o}else a=W(e,t);else s=41943059===r,o=Te(e,t),bt(e,t,16777237),a=Lt(e,t,W);return It(t,e,n,{type:"Property",kind:"init",key:o,computed:s,value:a,method:!1,shorthand:i})}function Q(e,t){const n=Vt(e);let r,o=[],a=null,s=!1;bt(e,t,167774015);const i=167774016===e.token;if(i)r=function(e,t,n){return ee(e),It(t,e,n,{type:"JSXOpeningFragment"})}(e,t,n);else{r=Z(e,t,we(e,t),ae(e,t),s=vt(e,t,167774773),n)}if(i)return function(e,t,n,r){const o=ne(e,t),a=ge(e,t);return It(t,e,r,{type:"JSXFragment",children:o,openingElement:n,closingFragment:a})}(e,t,r,n);if(!s){o=ne(e,t),a=xe(e,t);const n=zt(r.name),s=zt(a.name);n!==s&&an(e,85,s)}return It(t,e,n,{type:"JSXElement",children:o,openingElement:r,closingElement:a})}function Z(e,t,n,r,o,a){return t&ct.InJSXChild&&o?bt(e,t,167774016):ee(e),It(t,e,a,{type:"JSXOpeningElement",name:n,attributes:r,selfClosing:o})}function ee(e){return e.token=te(e)}function te(e){if(e.index>=e.source.length)return 1048576;e.lastIndex=e.startIndex=e.index;const t=e.source.charCodeAt(e.index);if(60===t)return e.index++,e.column++,f(e,47)?25:167774015;if(123===t)return e.index++,e.column++,41943052;for(;e.index<e.source.length;){e.index++,e.column++;const t=e.source.charCodeAt(e.index);if(123===t||60===t)break}return 121}function ne(e,t){const n=[];for(;25!==e.token;)n.push(oe(e,t));return n}function re(e,t){const n=Vt(e),r=e.source.slice(e.startIndex,e.index);e.token=te(e);const o=It(t,e,n,{type:"JSXText",value:r});return t&ct.OptionsRaw&&(o.raw=r),o}function oe(e,t){switch(e.token){case 33685505:case 121:return re(e,t);case 41943052:return me(e,t&~ct.InJSXChild);case 167774015:return Q(e,t&~ct.InJSXChild);default:an(e,0)}}function ae(e,t){const n=[];for(;e.index<e.source.length&&167774773!==e.token&&167774016!==e.token;)n.push(ue(e,t));return n}function se(e,t){const n=Vt(e);bt(e,t,41943052),bt(e,t,14);const r=Lt(e,t&~ct.InJSXChild,Ee);return bt(e,t,17825807),It(t,e,n,{type:"JSXSpreadAttribute",argument:r})}function ie(e,t,n,r){return bt(e,t,16777237),It(t,e,r,{type:"JSXNamespacedName",namespace:n,name:ke(e,t)})}function ce(e,t){const n=Vt(e),r=ke(e,t);return 16777237===e.token?ie(e,t,r,n):r}function le(e,t){switch(function(e,t){e.lastIndex=e.index;const n=e.source.charCodeAt(e.index);switch(n){case 34:case 39:return function(e,t,n){const r=e.index;e.index++,e.column++;let o="",a=e.source.charCodeAt(e.index);for(;a!==n;)o+=k(a),e.index++,e.column++,a=e.source.charCodeAt(e.index),e.index>=e.source.length&&an(e,6);e.index++,e.column++,t&ct.OptionsRaw&&(e.tokenRaw=e.source.slice(r,e.index));return e.tokenValue=o,33554435}(e,t,n);default:return Ct(e,t)}}(e,t)){case 33554435:return Pe(e,t);case 41943052:return fe(e,t|ct.InJSXChild);case 167774015:return Q(e,t|ct.InJSXChild);default:return void sn(e,t,87)}}function ue(e,t){const n=Vt(e);if(41943052===e.token)return se(e,t);ye(e);const r=ce(e,t);return It(t,e,n,{type:"JSXAttribute",value:83886109===e.token?le(e,t):null,name:r})}function de(e,t){return It(t,e,Vt(e),{type:"JSXEmptyExpression"})}function pe(e,t){const n=Vt(e);bt(e,t,14);const r=he(e,t);return bt(e,t,17825807),It(t,e,n,{type:"JSXSpreadChild",expression:r})}function fe(e,t){const n=Vt(e);bt(e,t,41943052),17825807===e.token&&sn(e,t,84);const r=Lt(e,t&~ct.InJSXChild,Ee);return bt(e,t,17825807),It(t,e,n,{type:"JSXExpressionContainer",expression:r})}function me(e,t){const n=Vt(e);if(bt(e,t,41943052),14===e.token)return pe(e,t);const r=17825807===e.token?de(e,t):Lt(e,t,Ee);return ee(e),It(t,e,n,{type:"JSXExpressionContainer",expression:r})}function ge(e,t){const n=Vt(e);return bt(e,t,25),bt(e,t,167774016),It(t,e,n,{type:"JSXClosingFragment"})}function xe(e,t){const n=Vt(e);bt(e,t,25);const r=we(e,t);return t&ct.InJSXChild?bt(e,t,167774016):ee(e),It(t,e,n,{type:"JSXClosingElement",name:r})}function ke(e,t){const{token:r,tokenValue:o,tokenRaw:a}=e;135168&r||sn(e,t,1,n(e.token));const s=Vt(e);Ct(e,t);const i=It(t,e,s,{type:"JSXIdentifier",name:o});return t&ct.OptionsRawidentifiers&&(i.raw=a),i}function Se(e,t,n,r){return ye(e),It(t,e,r,{type:"JSXMemberExpression",object:n,property:ke(e,t)})}function we(e,t){const n=Vt(e);ye(e);let r=ke(e,t);if(16777237===e.token)return ie(e,t,r,n);for(;vt(e,t,16777229);)r=Se(e,t,r,n);return r}function ye(e){const{token:t}=e;if(135168&t){const t=e.index;let n=e.source.charCodeAt(e.index);for(;e.index<e.source.length&&(45===n||s(n));)n=S(e);e.tokenValue+=e.source.substr(t,e.index-t)}return e.token}function he(e,t){const n=Vt(e),r=Lt(e,t,Ee);return 16777234===e.token?Ae(e,t,r,n):r}function Ae(e,t,n,r){const o=[n];for(;vt(e,t,16777234);)o.push(Lt(e,t,Ee));return It(t,e,r,{type:"SequenceExpression",expressions:o})}function Ee(e,t){const r=Vt(e);let{token:o}=e;if(t&ct.Yield&&1073741824&o)return function(e,t,n){t&ct.InParameter&&sn(e,t,51),bt(e,t,1107316842);let r=null,o=!1;return e.flags<.NewLine||((o=vt(e,t,167774771))||33554432&e.token)&&(r=Ee(e,t)),It(t,e,n,{type:"YieldExpression",argument:r,delegate:o})}(e,t,r);let a=524288&o&&Ft(e,t,Gt)?function(e,t){const n=Vt(e);let r=Oe(e,t|ct.AllowIn,n);if(135168&e.token)return 262144&e.token&&sn(e,t,40),qe(e,t,ft.Await,n,[Ut(e,t)]);e.flags<.NewLine&&sn(e,t,36,"async");for(;50331659===e.token;){r=Oe(e,t,n,r);const o=Le(e,t);if(10===e.token){r=qe(e,t,ft.Await,n,o);break}r=It(t,e,n,{type:"CallExpression",callee:r,arguments:o})}return r}(e,t):function(e,t,r){const o=function e(t,r,o,a,s=Ie(t,r)){const i=r&ct.AllowIn^ct.AllowIn;for(;Ot(t.token,167772160);){const c=t.token,l=3840&c,u=(167775030===c)<<8;if(i&&167786289===c)break;if(l+u<=o)break;Ct(t,r),s=It(r,t,a,{type:2097152&c?"LogicalExpression":"BinaryExpression",left:s,right:e(t,r&~ct.AllowIn,l,Vt(t)),operator:n(c)})}return s}(e,t,0,r);if(!vt(e,t,22))return o;const a=Lt(e,t&~ct.AllowDecorator|ct.AllowIn,Ee);return bt(e,t,16777237),It(t,e,r,{type:"ConditionalExpression",test:o,consequent:a,alternate:Lt(e,t,Ee)})}(e,t,r);if(10===e.token)return 135168&o&&(4214784&o&&(20480&o&&(e.flags|=lt.HasStrictReserved),4194304&o&&(t&ct.Strict&&sn(e,t,47),e.flags|=lt.StrictEvalArguments)),a=[a]),function(e,t,n,r){e.flags&=~(lt.AllowDestructuring|lt.AllowBinding),e.flags<.NewLine&&sn(e,t,36,"=>");return bt(e,t,10),Ue(e,t&~ct.Async,r,n,ft.None)}(e,t&=~ct.Async,r,a);if(Ot(e.token,67108864)){o=e.token,t&ct.Strict&&jt(a.name)?sn(e,t,17):vt(e,t,83886109)?(e.flags<.AllowDestructuring||sn(e,t,73),t&ct.InParameter||Ht(e,t,a),t&ct.InParen&&(e.flags|=lt.SimpleParameterList),262144&e.token?($t(e),e.flags|=lt.HasAwait):t&ct.InParen&&t&(ct.Strict|ct.Yield)&&1073741824&e.token&&($t(e),e.flags|=lt.HasYield)):(Bt(a)||sn(e,t,5),e.flags&=~(lt.AllowDestructuring|lt.AllowBinding),Ct(e,t));const s=Lt(e,t|ct.AllowIn,Ee);return e.pendingExpressionError=null,It(t,e,r,{type:"AssignmentExpression",left:a,operator:n(o),right:s})}return a}function Ie(e,t){const r=Vt(e),{token:o}=e;if(Ot(o,301989888)){Ct(e,t),e.flags<.EscapedKeyword&&sn(e,t,3);const a=Lt(e,t,Ie);return 167775030===e.token&&sn(e,t,1,n(e.token)),t&ct.Strict&&302002219===o&&("Identifier"===a.type?sn(e,t,43):qt(a)&&sn(e,t,44)),It(t,e,r,{type:"UnaryExpression",operator:n(o),argument:a,prefix:!0})}return t&ct.Async&&262144&o?function(e,t,n){return t&ct.InParameter&&sn(e,t,52),bt(e,t,34017389),It(t,e,n,{type:"AwaitExpression",argument:Ie(e,t)})}(e,t,r):function(e,t,r){const{token:o}=e;if(Ot(e.token,570425344)){Ct(e,t);const a=Ce(e,t,r);return _t(e,t,a,"Prefix"),It(t,e,r,{type:"UpdateExpression",argument:a,operator:n(o),prefix:!0})}if(t&ct.OptionsJSX&&167774015===o)return Q(e,t|ct.InJSXChild);const a=Ce(e,t,r);if(Ot(e.token,570425344)&&!(e.flags<.NewLine)){_t(e,t,a,"Postfix");const o=e.token;return Ct(e,t),It(t,e,r,{type:"UpdateExpression",argument:a,operator:n(o),prefix:!1})}return a}(e,t,r)}function be(e,t,n=[]){const r=Vt(e);return bt(e,t,14),t&ct.InParen&&262144&e.token&&(e.flags|=lt.HasAwait),It(t,e,r,{type:"RestElement",argument:q(e,t,n)})}function ve(e,t){const n=Vt(e);return bt(e,t,14),It(t,e,n,{type:"SpreadElement",argument:Dt(e,t|ct.AllowIn,Ee)})}function Ce(e,t,n){const r=t&ct.OptionsNext&&33566810===e.token?tt(e,t|ct.AllowIn):Oe(e,t|ct.AllowIn,n);return function(e,t,n,r){for(;;){if(r=Oe(e,t,n,r),50331659!==e.token)return r;const o=Ne(e,t&~ct.AllowDecorator);r=It(t,e,n,{type:"CallExpression",callee:r,arguments:o})}}(e,t|ct.AllowIn,n,r)}function Oe(e,t,n,r=De(e,t)){for(;;)switch(e.token){case 16777229:vt(e,t,16777229),e.flags=e.flags&~lt.AllowBinding|lt.AllowDestructuring,r=It(t,e,n,{type:"MemberExpression",object:r,computed:!1,property:Be(e,t)});continue;case 41943059:{vt(e,t,41943059),e.flags=e.flags&~lt.AllowBinding|lt.AllowDestructuring;const o=he(e,t);bt(e,t,20),r=It(t,e,n,{type:"MemberExpression",object:r,computed:!0,property:o});continue}case 33554441:r=It(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:rt(e,t)});continue;case 33554440:r=It(t,e,n,{type:"TaggedTemplateExpression",tag:r,quasi:ot(e,t|ct.TaggedTemplate)});continue;default:return r}}function Ne(e,t){bt(e,t,50331659);const n=[];for(;16!==e.token;)14===e.token?n.push(ve(e,t)):(t&ct.Yield&&Ot(e.token,1073741824)&&(e.flags|=lt.HasYield,$t(e)),n.push(Lt(e,t|ct.AllowIn,Ee))),16!==e.token&&bt(e,t,16777234);return bt(e,t,16),n}function Le(e,t){bt(e,t,50331659);const n=[];let{token:r}=e,o=kt.Empty;for(;16!==e.token&&(14===e.token?(e.flags|=lt.SimpleParameterList,n.push(ve(e,t)),o=kt.HasSpread):(r=e.token,o=en(e,t,o),n.push(Dt(e,t|ct.AllowIn,Ee))),vt(e,t,16777234)&&(e.flags&=~lt.AllowDestructuring,o&kt.HasSpread&&(o=kt.SeenSpread)),16!==e.token););return bt(e,t,16),10===e.token&&(o&kt.SeenSpread?sn(e,t,78):o&kt.EvalOrArguments?(t&ct.Strict&&sn(e,t,47),e.flags|=lt.StrictEvalArguments):o&kt.Yield?(t&ct.Strict&&sn(e,t,51),e.flags|=lt.HasStrictReserved):e.flags<.HasYield?sn(e,t,51):(o&kt.Await||e.flags<.HasAwait)&&sn(e,t,52)),n}function De(e,t){switch(e.token){case 33685505:return Re(e,t);case 33554434:case 33554435:return Pe(e,t);case 594028:return function(e,t){return Ft(e,t,Yt)?Je(e,t):Re(e,t)}(e,t);case 50331659:return function(e,t){if(bt(e,t,50331659),vt(e,t,16)){if(e.flags&=~(lt.AllowDestructuring|lt.AllowBinding),10===e.token)return[]}else if(14===e.token){const r=[be(e,t)];return bt(e,t,16),e.flags=e.flags&~(lt.AllowDestructuring|lt.AllowBinding)|lt.SimpleParameterList,10!==e.token&&sn(e,t,1,n(e.token)),r}const r=Vt(e);let o=Zt(e,mt.None),a=Dt(e,t|ct.AllowIn,Ee);if(16777234===e.token){o|=mt.SequenceExpression;const s=[a];for(;vt(e,t|ct.DisallowEscapedKeyword,16777234);){if(14===e.token){e.flags<.AllowBinding||sn(e,t,77),e.flags|=lt.SimpleParameterList;const n=be(e,t);return bt(e,t,16),10!==e.token&&sn(e,t,78),s.push(n),s}if(vt(e,t,16))return 10!==e.token&&sn(e,t,1,n(e.token)),s;o=Zt(e,o),s.push(Dt(e,t,Ee))}a=It(t,e,r,{type:"SequenceExpression",expressions:s})}if(bt(e,t,16),10===e.token)return o&mt.HasEvalOrArguments?(t&ct.Strict&&sn(e,t,47),e.flags|=lt.StrictEvalArguments):o&mt.HasReservedWords?(t&ct.Strict&&sn(e,t,50),e.flags|=lt.HasStrictReserved):e.flags<.AllowBinding?e.flags<.HasYield?sn(e,t,51):t&ct.Async&&e.flags<.HasAwait&&sn(e,t,52):sn(e,t,77),e.flags&=~(lt.AllowBinding|lt.HasAwait|lt.HasYield),o&mt.SequenceExpression?a.expressions:[a];e.flags&=~(lt.HasAwait|lt.HasYield|lt.AllowBinding),Bt(a)||(e.flags&=~lt.AllowDestructuring);return a}(e,t|ct.InParen);case 41943059:return Dt(e,t,Ve);case 41943052:return Dt(e,t,Ge);case 33566808:return Me(e,t);case 33566727:case 33566726:case 33566725:return function(e,t){const r=Vt(e),{token:o}=e,a=n(o);e.flags<.EscapedKeyword&&sn(e,t,3);Ct(e,t);const s=It(t,e,r,{type:"Literal",value:33566727===o?null:"true"===a});t&ct.OptionsRaw&&(s.raw=a);return s}(e,t);case 120:case 33566797:return function(e,t){const n=Vt(e);let r=[];t&ct.OptionsExperimental&&(r=it(e,t));bt(e,t|ct.DisallowEscapedKeyword,33566797);const{token:o}=e;let a=wt.None,s=null,i=null;41943052!==o&&12372!==o&&(t&ct.Async&&262144&o&&sn(e,t,48),s=U(e,t|ct.Strict));vt(e,t,12372)&&(i=Ce(e,t|ct.Strict,n),a|=wt.Heritage);const c=_e(e,t|ct.Strict,a);return It(t,e,n,t&ct.OptionsExperimental?{type:"ClassExpression",id:s,superClass:i,body:c,decorators:r}:{type:"ClassExpression",id:s,superClass:i,body:c})}(e,t);case 33566811:return function(e,t){const r=Vt(e),o=Re(e,t);if(vt(e,t|ct.DisallowEscapedKeyword,16777229))return"target"===e.tokenValue&&t&(ct.InParameter|ct.InFunctionBody)||sn(e,t,53),nt(e,t,o,r);return It(t,e,r,{type:"NewExpression",callee:function(e,t,r){const{token:o}=e;if(t&ct.OptionsNext&&33566810===o)return Ft(e,t,Kt)&&sn(e,t,1,n(o)),tt(e,t);return Oe(e,t,r)}(e,t,r),arguments:50331659===e.token?Ne(e,t):[]})}(e,t);case 33566813:return function(e,t){const n=Vt(e);switch(bt(e,t,33566813),e.token){case 50331659:t&ct.AllowSuperProperty||sn(e,t,54);break;case 41943059:case 16777229:t&ct.Method||sn(e,t,55);break;default:sn(e,t,56)}return It(t,e,n,{type:"Super"})}(e,t);case 33554551:return He(e,t);case 33566815:return function(e,t){e.flags<.EscapedKeyword&&sn(e,t,3);const n=Vt(e);return Ct(e,t|ct.DisallowEscapedKeyword),It(t,e,n,{type:"ThisExpression"})}(e,t);case 115:return Be(e,t);case 167774773:case 100663333:return Y(e,t),function(e,t){const n=Vt(e),{tokenRegExp:r,tokenValue:o,tokenRaw:a}=e;Ct(e,t);const s=It(t,e,n,{type:"Literal",value:o,regex:r});t&ct.OptionsRaw&&(s.raw=a);return s}(e,t);case 33554441:return rt(e,t);case 33554440:return ot(e,t);case 33574984:return function(e,t){t&ct.Strict&&sn(e,t,50);const n=Vt(e),r=e.tokenValue;Ct(e,t),e.flags<.NewLine&&41943059===e.token&&sn(e,t,1,"let");return It(t,e,n,{type:"Identifier",name:r})}(e,t);case 12369:if(t&ct.OptionsExperimental)return function(e,t){const n=Vt(e);return bt(e,t,12369),It(t,e,n,{type:"DoExpression",body:Ln(e,t)})}(e,t);default:return Ut(e,t)}}function Re(e,t){const n=Vt(e),r=e.tokenValue;Ct(e,t|ct.TaggedTemplate);const o=It(t,e,n,{type:"Identifier",name:r});return t&ct.OptionsRawidentifiers&&(o.raw=e.tokenRaw),o}function Pe(e,t){const n=Vt(e),r=e.tokenValue;t&ct.Strict&&e.flags<.HasOctal&&sn(e,t,61),Ct(e,t);const o=It(t,e,n,{type:"Literal",value:r});return t&ct.OptionsRaw&&(o.raw=e.tokenRaw),o}function He(e,t){const n=Vt(e),{tokenValue:r,tokenRaw:o}=e;Ct(e,t);const a=It(t,e,n,{type:"Literal",value:r,bigint:o});return t&ct.OptionsRaw&&(a.raw=e.tokenRaw),a}function Fe(e,t,r){return 135168&r||sn(e,t,4,n(r)),Re(e,t)}function Be(e,t){if(!vt(e,t,115))return Fe(e,t,e.token);const{tokenValue:n}=e,r=Vt(e),o=n;return Ct(e,t),It(t,e,r,{type:"PrivateName",name:o})}function Ve(e,t){const n=Vt(e);bt(e,t,41943059);const r=[];for(;20!==e.token;)vt(e,t,16777234)?r.push(null):14===e.token?(r.push(ve(e,t)),20!==e.token&&(e.flags&=~(lt.AllowDestructuring|lt.AllowBinding),bt(e,t,16777234))):(r.push(Dt(e,t|ct.AllowIn,Ee)),20!==e.token&&bt(e,t,16777234));return bt(e,t,20),It(t,e,n,{type:"ArrayExpression",elements:r})}function Me(e,t){const n=Vt(e);bt(e,t,33566808);const r=vt(e,t,167774771)?ft.Generator:ft.None;let o=null;const{token:a}=e;135168&a&&(4194304&a&&(t&ct.Strict&&sn(e,t,47),e.flags|=lt.StrictEvalArguments),1073741824&e.token&&r&ft.Generator&&sn(e,t,49),o=U(e,t));const{params:s,body:i}=Rt(e,t&~(ct.Method|ct.AllowSuperProperty),r,je);return It(t,e,n,{type:"FunctionExpression",params:s,body:i,async:!1,generator:!!(r&ft.Generator),expression:!1,id:o})}function Je(e,t){const n=Vt(e);bt(e,t,594028),bt(e,t,33566808);const r=vt(e,t,167774771)?ft.Generator:ft.None,o=ft.Await;let a=null;const{token:s}=e;135168&s&&(4194304&s&&((t&ct.Strict||o&ft.Await)&&sn(e,t,47),e.flags|=lt.StrictFunctionName),262144&s&&sn(e,t,48),1073741824&e.token&&r&ft.Generator&&sn(e,t,49),a=U(e,t));const{params:i,body:c}=Rt(e,t&~(ct.Method|ct.AllowSuperProperty),r|o,je);return It(t,e,n,{type:"FunctionExpression",params:i,body:c,async:!0,generator:!!(r&ft.Generator),expression:!1,id:a})}function Te(e,t){switch(e.token){case 33554434:case 33554435:return Pe(e,t);case 41943059:return function(e,t){bt(e,t,41943059);const n=Ee(e,t|ct.AllowIn);return bt(e,t,20),n}(e,t);default:return Re(e,t)}}function Xe(e,t){const n=Vt(e);return bt(e,t,14),8388608&e.token&&(e.flags&=~lt.AllowDestructuring),It(t,e,n,{type:"SpreadElement",argument:Ee(e,t|ct.AllowIn)})}function Ge(e,t){const n=Vt(e);bt(e,t,41943052);const r=[];for(;17825807!==e.token;)r.push(14===e.token?Xe(e,t):Ke(e,t)),17825807!==e.token&&bt(e,t,16777234);return bt(e,t,17825807),e.flags&=~lt.HasProtoField,It(t,e,n,{type:"ObjectExpression",properties:r})}function Ke(e,t){const r=Vt(e),o=e.flags;let a,s=vt(e,t,167774771)?wt.Generator|wt.Method:wt.Method;const i=e.token;let c=Te(e,t);return 16777216&e.token||(o<.EscapedKeyword?sn(e,t,3):s&wt.Generator||!(524288&i)||e.flags<.NewLine?69743===i?(s=s&~wt.Method|wt.Getter,c=Te(e,t)):69744===i&&(s=s&~wt.Method|wt.Setter,c=Te(e,t)):(s|=vt(e,t,167774771)?wt.Generator|wt.Async:wt.Async,c=Te(e,t)),s&(wt.Getter|wt.Setter)&&s&wt.Generator&&sn(e,t,1,n(e.token))),50331659===e.token?a=Ye(e,t,s):(s&=~wt.Method,16777237===e.token?(s&(wt.Async|wt.Generator)?sn(e,t,1,n(e.token)):41943059!==i&&"__proto__"===e.tokenValue&&(e.flags<.HasProtoField?Qt(e,63):e.flags|=lt.HasProtoField),bt(e,t,16777237),262144&e.token&&(e.flags|=lt.HasAwait),a=Dt(e,t,Ee)):(s&(wt.Generator|wt.Async)||!Mt(t,i)?sn(e,t,1,n(i)):t&(ct.Strict|ct.Yield)&&1073741824&i&&($t(e),e.flags|=lt.HasYield),s|=wt.Shorthand,83886109===e.token?(t&ct.Strict&&4194304&i?an(e,47):Qt(e,91),bt(e,t,83886109),t&(ct.Strict|ct.Yield|ct.Async)&&1074003968&e.token&&($t(e),e.flags|=1073741824&e.token?lt.HasYield:lt.HasAwait),a=z(e,t,c,r)):(262144&i&&(t&ct.Async&&sn(e,t,46),$t(e),e.flags|=lt.HasAwait),a=c))),It(t,e,r,{type:"Property",key:c,value:a,kind:s&wt.Getter|s&wt.Setter?s&wt.Setter?"set":"get":"init",computed:41943059===i,method:!!(s&wt.Method),shorthand:!!(s&wt.Shorthand)})}function Ye(e,t,n){const r=Vt(e),o=n&wt.Generator?ft.Generator:ft.None,a=n&wt.Async?ft.Await:ft.None,{params:s,body:i}=Rt(e,t|ct.Method,o|a,je,n);return It(t,e,r,{type:"FunctionExpression",params:s,body:i,async:!!(n&wt.Async),generator:!!(n&wt.Generator),expression:!1,id:null})}function qe(e,t,n,r,o){return e.flags&=~(lt.AllowDestructuring|lt.AllowBinding),e.flags<.NewLine&&sn(e,t,36,"async"),bt(e,t,10),Ue(e,t|ct.Async,o,r,n)}function Ue(e,t,n,r,o){e.pendingExpressionError=null;for(const r in n)Ht(e,t|ct.InParameter,n[r]);const a=41943052!==e.token;return It(t,e,r,{type:"ArrowFunctionExpression",body:a?Lt(e,t&~(ct.Yield|ct.InParameter),Ee):Rt(e,t&~(ct.Yield|ct.AllowDecorator)|ct.InFunctionBody,o,$e),params:n,id:null,async:!!(o&ft.Await),generator:!1,expression:a})}function je(e,t,n){const r=ze(e,t|ct.InParameter,n),o=r.args;return{params:r.params,body:$e(e,t&~ct.AllowDecorator|ct.InFunctionBody,o)}}function $e(e,t,n){const r=Vt(e);bt(e,t|ct.DisallowEscapedKeyword,41943052);const o=[];for(;33554435===e.token;){const{tokenRaw:n,tokenValue:r}=e;o.push(vn(e,t)),12===n.length&&"use strict"===r&&(e.flags<.SimpleParameterList?sn(e,t,64):e.flags&(lt.HasStrictReserved|lt.StrictFunctionName)?sn(e,t,50):e.flags<.StrictEvalArguments&&sn(e,t,47),t|=ct.Strict)}t&ct.Strict&&Pt(e,t,n);const{labelSet:a}=e;e.labelSet={};const s=e.flags;for(e.flags=e.flags&~(lt.StrictFunctionName|lt.StrictEvalArguments|lt.InSwitchStatement|lt.InIterationStatement)|lt.AllowDestructuring;17825807!==e.token;)o.push(mn(e,t));return s<.InIterationStatement&&(e.flags|=lt.InIterationStatement),s<.InSwitchStatement&&(e.flags|=lt.InSwitchStatement),e.labelSet=a,bt(e,t,17825807),It(t,e,r,{type:"BlockStatement",body:o})}function ze(e,t,n){bt(e,t,50331659),e.flags&=~(lt.SimpleParameterList|lt.HasStrictReserved);const r=[],o=[];for(;16!==e.token;){if(14===e.token){n&wt.Setter&&sn(e,t,67),e.flags|=lt.SimpleParameterList,o.push(be(e,t,r));break}if(o.push(We(e,t,r)),!vt(e,t,16777234))break;if(16===e.token)break}return n&wt.Setter&&1!==o.length&&sn(e,t,66,"Setter","one",""),n&wt.Getter&&o.length>0&&sn(e,t,66,"Getter","no","s"),bt(e,t,16),{params:o,args:r}}function We(e,t,n){const r=Vt(e);135168&e.token?(Ot(e.token,20480)&&(t&ct.Strict&&sn(e,t,50),e.flags|=lt.StrictFunctionName),Ot(e.token,4194304)&&(t&ct.Strict&&sn(e,t,47),e.flags|=lt.StrictEvalArguments)):e.flags|=lt.SimpleParameterList;const o=q(e,t,n);return vt(e,t,83886109)?(1074003968&e.token&&t&(ct.Yield|ct.Async)&&sn(e,t,262144&e.token?52:51),e.flags|=lt.SimpleParameterList,It(t,e,r,{type:"AssignmentPattern",left:o,right:Lt(e,t,Ee)})):o}function _e(e,t,n){const r=Vt(e);bt(e,t,41943052);const o=[];let a=[];for(;17825807!==e.token;)vt(e,t,17825809)||(t&ct.OptionsExperimental&&(a=it(e,t),17825807===e.token&&an(e,92),0!==a.length&&"constructor"===e.tokenValue&&an(e,93)),o.push(t&ct.OptionsNext&&115===e.token?et(e,t,a):Qe(e,t,n,a)));return e.flags&=~lt.HasConstructor,bt(e,t,17825807),It(t,e,r,{type:"ClassBody",body:o})}function Qe(e,t,r,o){const a=Vt(e);let{tokenValue:s,token:i}=e;const c=e.flags;vt(e,t,167774771)&&(r|=wt.Generator),41943059===e.token&&(r|=wt.Computed),"constructor"===e.tokenValue&&(r&wt.Generator?sn(e,t,45,"generator"):r&wt.Heritage&&(t|=ct.AllowSuperProperty),r|=wt.Constructor);let l,u=Te(e,t);if(!(16777216&e.token)){if(c<.EscapedKeyword&&sn(e,t,3),20585===i&&(i=e.token,vt(e,t,167774771)&&(r|=wt.Generator),s=e.tokenValue,41943059===e.token&&(r|=wt.Computed),"prototype"===e.tokenValue&&sn(e,t,65),r|=wt.Static,u=Te(e,t),t&ct.OptionsNext&&Wt(e)))return"constructor"===s&&sn(e,t,1,n(e.token)),Ze(e,t,u,r,a,o);50331659!==e.token&&(!(524288&i)||r&wt.Generator||e.flags<.NewLine?69743!==i&&69744!==i||(r|=69743===i?wt.Getter:wt.Setter,s=e.tokenValue,41943059===e.token&&(r|=wt.Computed),u=Te(e,t&~ct.Strict)):(i=e.token,s=e.tokenValue,r|=wt.Async,vt(e,t,167774771)&&(r|=wt.Generator),41943059===e.token&&(r|=wt.Computed),u=Te(e,t)),"prototype"===s?sn(e,t,65):r&wt.Static||"constructor"!==s||sn(e,t,45,"accessor"))}if(50331659===e.token)!(r&wt.Computed)&&r&wt.Constructor&&(e.flags<.HasConstructor?an(e,12):e.flags|=lt.HasConstructor),l=Ye(e,t,r);else{if(t&ct.OptionsNext)return Ze(e,t,u,r,a,o);sn(e,t,1,n(i))}const d=r&wt.Constructor?"constructor":r&wt.Getter?"get":r&wt.Setter?"set":"method";return It(t,e,a,t&ct.OptionsExperimental?{type:"MethodDefinition",kind:d,static:!!(r&wt.Static),computed:!!(r&wt.Computed),key:u,value:l,decorators:o}:{type:"MethodDefinition",kind:d,static:!!(r&wt.Static),computed:!!(r&wt.Computed),key:u,value:l})}function Ze(e,t,n,r,o,a){r&wt.Constructor&&sn(e,t,0);let s=null;return r&(wt.Async|wt.Generator)&&sn(e,t,0),vt(e,t,83886109)&&(4194304&e.token&&sn(e,t,47),s=Ee(e,t)),vt(e,t,16777234),It(t,e,o,t&ct.OptionsExperimental?{type:"FieldDefinition",key:n,value:s,computed:!!(r&wt.Computed),static:!!(r&wt.Static),decorators:a}:{type:"FieldDefinition",key:n,value:s,computed:!!(r&wt.Computed),static:!!(r&wt.Static)})}function et(e,t,n){const r=Vt(e);bt(e,t|ct.InClass,115),"constructor"===e.tokenValue&&sn(e,t,41);const o=function(e,t,n){const r=e.tokenValue;return Ct(e,t),It(t,e,n,{type:"PrivateName",name:r})}(e,t,r);if(50331659===e.token)return function(e,t,n,r,o){const a=Ye(e,t|ct.Strict,wt.None);return e.flags&=~(lt.AllowDestructuring|lt.AllowBinding),It(t,e,r,t&ct.OptionsExperimental?{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:a,decorators:o}:{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:n,value:a})}(e,t,o,r,n);let a=null;return vt(e,t,83886109)&&(4194304&e.token&&sn(e,t,47),a=Ee(e,t)),vt(e,t,16777234),It(t,e,r,t&ct.OptionsExperimental?{type:"FieldDefinition",key:o,value:a,computed:!1,static:!1,decorators:n}:{type:"FieldDefinition",key:o,value:a,computed:!1,static:!1})}function tt(e,t){const r=Vt(e),o=Re(e,t);if(vt(e,t,16777229)){if(t&ct.Module&&"meta"===e.tokenValue)return nt(e,t,o,r);sn(e,t,1,n(e.token))}let a=function(e,t,n){return It(t,e,n,{type:"Import"})}(e,t,r);bt(e,t,50331659);const s=Lt(e,t|ct.AllowIn,Ee);return bt(e,t,16),a=It(t,e,r,{type:"CallExpression",callee:a,arguments:[s]})}function nt(e,t,n,r){return It(t,e,r,{meta:n,type:"MetaProperty",property:Re(e,t)})}function rt(e,t){return It(t,e,Vt(e),{type:"TemplateLiteral",expressions:[],quasis:[at(e,t)]})}function ot(e,t,n=[],r=[]){const o=Vt(e),{tokenValue:a,tokenRaw:s}=e;bt(e,t,33554440),n.push(he(e,t));const i=Vt(e);return r.push(function(e,t,n=null,r,o){return e.token=I(e,t),It(t,e,o,{type:"TemplateElement",value:{cooked:n,raw:r},tail:!1})}(e,t,a,s,o)),33554441===e.token?r.push(at(e,t,i)):ot(e,t,n,r),It(t,e,o,{type:"TemplateLiteral",expressions:n,quasis:r})}function at(e,t,n=Vt(e)){const{tokenValue:r,tokenRaw:o}=e;return bt(e,t,33554441),It(t,e,n,{type:"TemplateElement",value:{cooked:r,raw:o},tail:!0})}function st(e,t){const n=Vt(e);return It(t,e,n,{type:"Decorator",expression:Ce(e,t,n)})}function it(e,t){const n=[];for(;vt(e,t,120);)n.push(st(e,t|ct.AllowDecorator));return n}var ct,lt,ut,dt,pt,ft,mt,gt,xt,kt,St,wt;function yt(e,t,n,r){const o=Et(e,n);o||sn(e,t,32,n),!r||o&ut.Nested||sn(e,t,31,n)}function ht(e,t){var n;void 0===e.labelSet&&(e.labelSet={}),e.labelSet[`$${t}`]=12369===(n=e.token)||12386===n||12374===n?ut.Nested:ut.NotNested}function At(e,t){e.labelSet[`$${t}`]=ut.None}function Et(e,t){return e.labelSet?e.labelSet[`$${t}`]:ut.None}function It(e,t,n,r){const{lastIndex:o,lastLine:a,lastColumn:s,sourceFile:i,index:c}=t;return e&ct.LocationTracker&&(e&ct.OptionsRanges&&(r.start=n.index,r.end=o),e&ct.OptionsLoc&&(r.loc={start:{line:n.line,column:n.column},end:{line:a,column:s}},i&&(r.loc.source=i))),r}function bt(e,t,r,o=1){return e.token!==r&&an(e,o,n(e.token)),Ct(e,t),!0}function vt(e,t,n){return e.token===n&&(Ct(e,t),!0)}function Ct(e,t){return e.lastIndex=e.index,e.lastLine=e.line,e.lastColumn=e.column,e.token=K(e,t)}!function(e){e[e.Empty=0]="Empty",e[e.OptionsNext=1]="OptionsNext",e[e.OptionsRanges=2]="OptionsRanges",e[e.OptionsJSX=4]="OptionsJSX",e[e.OptionsRaw=8]="OptionsRaw",e[e.OptionsLoc=16]="OptionsLoc",e[e.OptionsGlobalReturn=32]="OptionsGlobalReturn",e[e.OptionsComments=64]="OptionsComments",e[e.OptionsShebang=128]="OptionsShebang",e[e.OptionsRawidentifiers=256]="OptionsRawidentifiers",e[e.OptionsTolerant=512]="OptionsTolerant",e[e.OptionsNode=1024]="OptionsNode",e[e.OptionsExperimental=2048]="OptionsExperimental",e[e.Strict=4096]="Strict",e[e.Module=8192]="Module",e[e.TaggedTemplate=16384]="TaggedTemplate",e[e.InClass=32768]="InClass",e[e.AllowIn=65536]="AllowIn",e[e.Async=131072]="Async",e[e.Yield=262144]="Yield",e[e.InParameter=524288]="InParameter",e[e.InFunctionBody=1048576]="InFunctionBody",e[e.AllowSingleStatement=2097152]="AllowSingleStatement",e[e.BlockScope=4194304]="BlockScope",e[e.ForStatement=8388608]="ForStatement",e[e.RequireIdentifier=16777216]="RequireIdentifier",e[e.Method=33554432]="Method",e[e.AllowSuperProperty=67108864]="AllowSuperProperty",e[e.InParen=134217728]="InParen",e[e.InJSXChild=268435456]="InJSXChild",e[e.DisallowEscapedKeyword=536870912]="DisallowEscapedKeyword",e[e.AllowDecorator=1073741824]="AllowDecorator",e[e.LocationTracker=18]="LocationTracker"}(ct||(ct=e("Context",{}))),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.AllowBinding=2]="AllowBinding",e[e.AllowDestructuring=4]="AllowDestructuring",e[e.SimpleParameterList=8]="SimpleParameterList",e[e.InSwitchStatement=16]="InSwitchStatement",e[e.InIterationStatement=32]="InIterationStatement",e[e.HasStrictReserved=64]="HasStrictReserved",e[e.HasOctal=128]="HasOctal",e[e.SimpleAssignmentTarget=256]="SimpleAssignmentTarget",e[e.HasProtoField=512]="HasProtoField",e[e.StrictFunctionName=1024]="StrictFunctionName",e[e.StrictEvalArguments=2048]="StrictEvalArguments",e[e.InFunctionBody=4096]="InFunctionBody",e[e.HasAwait=8192]="HasAwait",e[e.HasYield=16384]="HasYield",e[e.EscapedKeyword=32768]="EscapedKeyword",e[e.HasConstructor=65536]="HasConstructor"}(lt||(lt=e("Flags",{}))),function(e){e[e.None=0]="None",e[e.NotNested=1]="NotNested",e[e.Nested=2]="Nested"}(ut||(ut=e("Labels",{}))),function(e){e[e.None=0]="None",e[e.SeenSeparator=1]="SeenSeparator",e[e.EigthOrNine=2]="EigthOrNine",e[e.Float=4]="Float",e[e.BigInt=8]="BigInt"}(dt||(dt=e("NumericState",{}))),function(e){e[e.None=0]="None",e[e.NewLine=1]="NewLine",e[e.LastIsCR=2]="LastIsCR"}(pt||(pt=e("ScannerState",{}))),function(e){e[e.None=0]="None",e[e.Generator=1]="Generator",e[e.Await=2]="Await"}(ft||(ft=e("ModifierState",{}))),function(e){e[e.None=0]="None",e[e.SequenceExpression=1]="SequenceExpression",e[e.HasEvalOrArguments=2]="HasEvalOrArguments",e[e.HasReservedWords=4]="HasReservedWords",e[e.HasYield=8]="HasYield",e[e.HasBinding=16]="HasBinding"}(mt||(mt=e("CoverParenthesizedState",{}))),function(e){e[e.Empty=-1]="Empty",e[e.StrictOctal=-2]="StrictOctal",e[e.EightOrNine=-3]="EightOrNine",e[e.InvalidHex=-4]="InvalidHex",e[e.OutOfRange=-5]="OutOfRange"}(gt||(gt=e("Escape",{}))),function(e){e[e.Empty=0]="Empty",e[e.IgnoreCase=1]="IgnoreCase",e[e.Global=2]="Global",e[e.Multiline=4]="Multiline",e[e.Unicode=8]="Unicode",e[e.Sticky=16]="Sticky",e[e.DotAll=32]="DotAll"}(xt||(xt=e("RegexFlags",{}))),function(e){e[e.Empty=0]="Empty",e[e.SeenSpread=1]="SeenSpread",e[e.HasSpread=2]="HasSpread",e[e.SimpleParameter=4]="SimpleParameter",e[e.EvalOrArguments=8]="EvalOrArguments",e[e.Yield=16]="Yield",e[e.Await=32]="Await"}(kt||(kt=e("CoverCallState",{}))),function(e){e[e.Empty=0]="Empty",e[e.Escape=1]="Escape",e[e.Class=2]="Class"}(St||(St=e("RegexState",{}))),function(e){e[e.None=0]="None",e[e.Async=1]="Async",e[e.Generator=2]="Generator",e[e.Getter=4]="Getter",e[e.Setter=8]="Setter",e[e.Computed=16]="Computed",e[e.Method=32]="Method",e[e.Shorthand=64]="Shorthand",e[e.Static=128]="Static",e[e.Constructor=256]="Constructor",e[e.Heritage=512]="Heritage"}(wt||(wt=e("ObjectState",{})));const Ot=e("hasBit",(e,t)=>(e&t)===t);function Nt(e,t){return 1048576&e.token||e.flags<.NewLine?vt(e,t,17825809):an(e,!(t&ct.Async)&&262144&e.token?38:1,n(e.token))}function Lt(e,t,n){const{flags:r,pendingExpressionError:o}=e;e.flags|=lt.AllowBinding|lt.AllowDestructuring,e.pendingExpressionError=void 0;const a=n(e,t);if(e.pendingExpressionError){const{error:n,line:r,column:o,index:a}=e.pendingExpressionError;rn(e,t,a,r,o,n)}return e.flags&=~(lt.AllowBinding|lt.AllowDestructuring),r<.AllowBinding&&(e.flags|=lt.AllowBinding),r<.AllowDestructuring&&(e.flags|=lt.AllowDestructuring),e.pendingExpressionError=o,a}function Dt(e,t,n){const{flags:r,pendingExpressionError:o}=e;e.flags|=lt.AllowBinding|lt.AllowDestructuring,e.pendingExpressionError=void 0;const a=n(e,t);return e.flags<.AllowBinding&&r<.AllowBinding||(e.flags&=~lt.AllowBinding),e.flags<.AllowDestructuring&&r<.AllowDestructuring||(e.flags&=~lt.AllowDestructuring),e.pendingExpressionError=o||e.pendingExpressionError,a}function Rt(e,t,n,r,o=wt.None){return t&=~(ct.Async|ct.Yield|ct.InParameter),n&ft.Generator&&(t|=ct.Yield),n&ft.Await&&(t|=ct.Async),r(e,t,o)}function Pt(e,t,n){const r=new Map;for(let o=0;o<n.length;o++){const a=`@${n[o]}`;r.get(a)?sn(e,t,81):r.set(a,!0)}}const Ht=e("reinterpret",(e,t,n)=>{switch(n.type){case"Identifier":t&ct.Strict&&jt(n.name)&&an(e,3);case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":case"RestElement":case"MetaProperty":return;case"ArrayExpression":n.type="ArrayPattern";for(let r=0;r<n.elements.length;++r)null!==n.elements[r]&&Ht(e,t,n.elements[r]);return;case"ObjectExpression":n.type="ObjectPattern";for(let r=0;r<n.properties.length;r++)Ht(e,t,n.properties[r]);return;case"Property":return void Ht(e,t,n.value);case"SpreadElement":n.type="RestElement","ArrayExpression"===n.argument.type||"ObjectExpression"===n.argument.type||Bt(n.argument)||sn(e,t,71),Ht(e,t,n.argument);break;case"AssignmentExpression":return n.type="AssignmentPattern",delete n.operator,void Ht(e,t,n.left);case"MemberExpression":if(!(t&ct.InParameter))return;default:sn(e,t,t&ct.InParameter?77:73,n.type)}});function Ft(e,t,n){const{tokenValue:r,flags:o,line:a,column:s,startColumn:i,index:c,lastColumn:l,startLine:u,lastLine:d,lastIndex:p,startIndex:f,tokenRaw:m,token:g,lastValue:x,tokenRegExp:k,labelSet:S,errors:w,errorLocation:y,pendingExpressionError:h}=e,A=n(e,t);return e.index=c,e.token=g,e.tokenValue=r,e.tokenValue=r,e.flags=o,e.line=a,e.column=s,e.tokenRaw=m,e.lastValue=x,e.startColumn=i,e.lastColumn=l,e.startLine=u,e.lastLine=d,e.lastIndex=p,e.startIndex=f,e.tokenRegExp=k,e.labelSet=S,e.errors=w,e.errorLocation=y,e.tokenRegExp=k,e.pendingExpressionError=h,A}function Bt(e){return"Identifier"===e.type||"MemberExpression"===e.type}function Vt(e){return{line:e.startLine,column:e.startColumn,index:e.startIndex}}function Mt(e,t){return e&ct.Strict?!(e&ct.Module&&262144&t)&&(!(1073741824&t)&&(131072==(131072&t)||69632==(69632&t))):131072==(131072&t)||69632==(69632&t)||20480==(20480&t)}function Jt(e,t){Ct(e,t);const{token:n}=e;return!!(1082523648&n||33574984===n||69632==(69632&n))}function Tt(e){return 12368===e.token||17825807===e.token||12363===e.token}function Xt(e,t){return Ct(e,t),50331659===e.token||16777229===e.token}function Gt(e,t){Ct(e,t);const{token:n}=e;return 1073872896&n||50331659===n}function Kt(e,t){return Ct(e,t),50331659===e.token}function Yt(e,t){return Ct(e,t),!(e.flags<.NewLine)&&33566808===e.token}function qt(e){return!!e.property&&"PrivateName"===e.property.type}function Ut(e,t){const{token:r,tokenValue:o}=e;if(t&ct.Strict){if(t&ct.Module&&262144&r&&sn(e,t,40,n(e.token)),1073741824&r&&sn(e,t,40,n(e.token)),131072==(131072&r)||69632==(69632&r))return Re(e,t);an(e,1,n(e.token))}if(t&ct.Yield&&1073741824&r&&sn(e,t,40,n(e.token)),t&ct.Async&&262144&r&&sn(e,t,40,n(e.token)),131072==(131072&r)||69632==(69632&r)||20480==(20480&r))return Re(e,t);an(e,1,n(e.token))}function jt(e){return"eval"===e||"arguments"===e}function $t(e){e.errorLocation={line:e.startLine,column:e.startColumn,index:e.startIndex}}function zt(e){switch(e.type){case"JSXIdentifier":return e.name;case"JSXNamespacedName":return`${zt(e.namespace)}:${zt(e.name)}`;case"JSXMemberExpression":return`${zt(e.object)}.${zt(e.property)}`}}function Wt(e){const{token:t}=e;return 17825807===t||17825809===t||83886109===t}function _t(e,t,n,r){t&ct.Strict&&jt(n.name)&&sn(e,t,68,r),Bt(n)||sn(e,t,5)}function Qt(e,t){e.pendingExpressionError={error:nn[t],line:e.line,column:e.column,index:e.index}}function Zt(e,t){const{token:n}=e;return 8388608&n?e.flags|=lt.SimpleParameterList:4194304==(4194304&n)?($t(e),t|=mt.HasEvalOrArguments):20480==(20480&n)?($t(e),t|=mt.HasReservedWords):262144==(262144&n)&&($t(e),e.flags|=lt.HasAwait),t}function en(e,t,n){const{token:r}=e;return e.flags<.AllowBinding?8388608&r?e.flags|=lt.SimpleParameterList:4194304==(4194304&r)?($t(e),n|=kt.EvalOrArguments):262144==(262144&r)?($t(e),n|=kt.Await):1073741824==(1073741824&r)&&($t(e),n|=kt.Yield):sn(e,t,77),n}function tn(e){return 69746===e||167786289===e}const nn=e("errorMessages",{0:"Unexpected token",1:"Unexpected token '%0'",2:"Expected token '%0'",3:"Keyword must not contain escaped characters",4:"Keyword '%0' is reserved",5:"Invalid left-hand side in assignment",6:"Unterminated string literal",7:"Unterminated regular expression literal",8:"Unterminated MultiLineComment",9:"Unterminated template literal",10:"Invalid character '%0'",11:"Octal escapes are not allowed in strict mode",13:"Escapes \\8 or \\9 are not syntactically valid escapes",14:"Unicode escape code point out of range",15:"Duplicate regular expression flag '%0'",16:"Unexpected regular expression flag '%0'",17:"Eval or arguments can't be assigned to in strict mode code",18:"Illegal return statement",19:"In strict mode code, functions can only be declared at top level or inside a block",20:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",21:"%0 can't appear in single-statement context",22:"Generators can only be declared at the top level or inside a block",23:"'for await' loop should be used with 'of'",24:"Missing initializer in %0 declaration",25:"'for-%0' loop variable declaration may not have an initializer",26:"Invalid left-hand side in for-%0 loop: Must have a single binding.",27:"let is disallowed as a lexically bound name",28:"Lexical declaration cannot appear in a single-statement context",29:"Label '%0' has already been declared",30:"%0 statement must be nested within an iteration statement",31:"Illegal continue statement: '%0' does not denote an iteration statement",32:"Undefined label '%0'",33:"More than one default clause in switch statement",34:"%0 declarations may only appear at top level of a module",35:"Async functions can only be declared at the top level or inside a block",36:"No line break is allowed after '%0'",37:"Strict mode code may not include a with statement",38:"Await is only valid in async functions",39:"Function declaration must have a name in this context",12:"Duplicate constructor method in class",40:"'%0' may not be used as an identifier in this context",43:"Delete of an unqualified identifier in strict mode",44:"Private fields can not be deleted",41:"Classes may not have a private field named '#constructor'",42:"Classes may not have a field named 'constructor'",45:"Class constructor may not be a '%0'",46:"Unexpected reserved word",47:"Unexpected eval or arguments in strict mode",48:"'await' is not a valid identifier inside an async function",49:"'yield' is not a valid identifier inside an generator function",50:"Unexpected strict mode reserved word",52:"Await expression not allowed in formal parameter",51:"Yield expression not allowed in formal parameter",53:"new.target only allowed within functions",54:"super() is not allowed in this context",55:"Member access from super not allowed in this context",56:'Only "(" or "." or "[" are allowed after \'super\'',57:"'yield' is a reserved keyword within generator function bodies",58:"Only one underscore is allowed as numeric separator",59:"Numeric separators are not allowed at the end of numeric literals",60:"Numeric separator can not be used after leading 0.",61:"Legacy octal literals are not allowed in strict mode",62:"Invalid left-hand side in assignment",63:"Property name __proto__ appears more than once in object literal",64:"Illegal 'use strict' directive in function with non-simple parameter list",65:"Classes may not have a static property named 'prototype'",66:"%0 functions must have %1 argument%2",67:"Setter function argument must not be a rest parameter",68:"%0 increment/decrement may not have eval or arguments operand in strict mode",69:"Elision not allowed in object property list",70:"Rest element must be last element",72:"Spread element must be last element",71:"Rest parameter may not have a default initializer",73:"Invalid destructuring assignment target",74:"Unexpected surrogate pair",75:"Malformed %0 character escape sequence",76:"Template literals may not contain octal escape sequences",77:"Invalid binding pattern",78:"Rest parameter must be last formal parameter",79:"Missing catch or finally after try",80:"Illegal newline after throw",81:"Duplicate parameter name not allowed in this context",82:"Missing keyword 'as' after import *",83:"Labels must be followed by a ':'",84:"JSX attributes must only be assigned a non-empty 'expression'",85:"Expected corresponding JSX closing tag for %0",86:"Adjacent JSX elements must be wrapped in an enclosing tag",87:"Invalid JSX attribute value",88:"Rest element may not have a trailing comma",89:"Undefined Unicode code-point",90:"HTML comments are not allowed in modules",91:"Invalid shorthand property initializer",92:"Trailing decorator may be followed by method",93:"Decorators can't be used with a constructor",94:"`...` must be followed by an identifier in declaration contexts"});function rn(e,t,n,r,o,a){const s=new SyntaxError(`Line ${r}, column ${o}: ${a}`);if(s.index=n,s.line=r,s.column=o,s.description=a,!(t&ct.OptionsTolerant))throw s;e.errors.push(s)}function on(e){let{index:t,startLine:n,startColumn:r}=e;const o=e.errorLocation;return o&&(t=o.index,n=o.line,r=o.column),{index:t,line:n,column:r}}function an(e,t,...n){const{index:r,line:o,column:a}=on(e),s=nn[t].replace(/%(\d+)/g,(e,t)=>n[t]);rn(e,ct.Empty,r,o,a,s)}function sn(e,t,n,...r){const{index:o,line:a,column:s}=on(e);rn(e,t,o,a,s,nn[n].replace(/%(\d+)/g,(e,t)=>r[t]))}function cn(e,t){const n=Vt(e);let r=[];t&ct.OptionsExperimental&&(r=it(e,t)),bt(e,t|ct.DisallowEscapedKeyword,33566797);const o=t&ct.RequireIdentifier&&33685505!==e.token?null:U(e,t|ct.Strict|ct.DisallowEscapedKeyword);let a=wt.None,s=null;vt(e,t,12372)&&(s=Ce(e,t|ct.Strict,n),a|=wt.Heritage);const i=_e(e,t&~ct.RequireIdentifier|ct.Strict|ct.InClass,a);return It(t,e,n,t&ct.OptionsExperimental?{type:"ClassDeclaration",id:o,superClass:s,body:i,decorators:r}:{type:"ClassDeclaration",id:o,superClass:s,body:i})}function ln(e,t){const n=Vt(e);bt(e,t,33566808);let r=ft.None;return vt(e,t,167774771)&&(t&ct.AllowSingleStatement&&!(t&ct.InFunctionBody)&&sn(e,t,22),r=ft.Generator),un(e,t,r,n)}function un(e,t,n,r){const{token:o}=e;let a=null;t&ct.Yield&&1073741824&o&&sn(e,t,49),t&ct.Async&&262144&o&&sn(e,t,48),50331659!==o?a=U(e,t):t&ct.RequireIdentifier||sn(e,t,39);const{params:s,body:i}=Rt(e,t&~(ct.Method|ct.AllowSuperProperty|ct.RequireIdentifier),n,je);return It(t,e,r,{type:"FunctionDeclaration",params:s,body:i,async:!!(n&ft.Await),generator:!!(n&ft.Generator),expression:!1,id:a})}function dn(e,t){const n=Vt(e);bt(e,t,594028),bt(e,t,33566808);const r=ft.Await;return un(e,t,(vt(e,t,167774771)?ft.Generator:ft.None)|r,n)}function pn(e,t,r){const o=Vt(e),a=0!=(8388608&e.token),s=q(e,t);let i=null;return vt(e,t|ct.DisallowEscapedKeyword,83886109)?(i=Lt(e,t&~(ct.BlockScope|ct.ForStatement),Ee),tn(e.token)&&(t&ct.ForStatement||a)&&(167786289===e.token?(t&(ct.BlockScope|ct.Strict|ct.Async)||a)&&sn(e,t,25,n(e.token)):sn(e,t,25,n(e.token)))):tn(e.token)||!r&&!a||sn(e,t,24,r?"const":"destructuring"),It(t,e,o,{type:"VariableDeclarator",init:i,id:s})}function fn(e,t,r){const o=[pn(e,t,r)];for(;vt(e,t,16777234);)o.push(pn(e,t,r));return t&ct.ForStatement&&tn(e.token)&&1!==o.length&&sn(e,t,26,n(e.token)),o}function mn(e,t){switch(e.token){case 33566808:return ln(e,t);case 120:case 33566797:return cn(e,t);case 33574984:return function(e,t,n=!0){return Ft(e,t,Jt)?Bn(e,t|ct.BlockScope,n):Cn(e,t)}(e,t|ct.AllowIn);case 33566793:return Bn(e,t|ct.BlockScope|ct.AllowIn);case 594028:return function(e,t){return Ft(e,t,Yt)?dn(e,t):gn(e,t)}(e,t);case 33566810:if(t&ct.OptionsNext&&Ft(e,t,Xt))return bn(e,t|ct.AllowIn);case 12371:t&ct.Module&&sn(e,t,34,n(e.token));default:return gn(e,t|ct.AllowSingleStatement)}}function gn(e,t){switch(e.token){case 33566791:return Bn(e,t|ct.AllowIn);case 17825809:return xn(e,t);case 33566814:return Hn(e,t);case 41943052:return Ln(e,t);case 12380:return Dn(e,t);case 12377:return wn(e,t);case 12369:return On(e,t);case 12386:return Nn(e,t);case 12387:return Pn(e,t);case 12362:return Sn(e,t);case 12366:return kn(e,t);case 12367:return hn(e,t);case 302002272:return In(e,t);case 12385:return An(e,t|ct.DisallowEscapedKeyword);case 12374:return function(e,t){const n=Vt(e);bt(e,t,12374);const r=!!(t&ct.Async&&vt(e,t,34017389));bt(e,t|ct.DisallowEscapedKeyword,50331659);const{token:o}=e;let a,s=null,i=null,c=null,l="ForStatement",u=null,d=null;33566793===o||33574984===o&&Ft(e,t,Jt)?c=Bn(e,t&~ct.AllowIn|ct.BlockScope,!1):33566791===o?c=Bn(e,t&~ct.AllowIn,!1):17825809!==o&&(i=Vt(e),s=Dt(e,t&~ct.AllowIn|ct.DisallowEscapedKeyword,Ee));vt(e,t,69746)?(l="ForOfStatement",s?(e.flags<.AllowDestructuring&&"AssignmentExpression"!==s.type||sn(e,t,73),Ht(e,t,s)):s=c,a=Ee(e,t|ct.AllowIn)):vt(e,t,167786289)?(s?(e.flags<.AllowDestructuring||sn(e,t,73),Ht(e,t,s)):s=c,l="ForInStatement",a=he(e,t&~ct.AllowDecorator|ct.AllowIn)):(16777234===e.token&&(s=Ae(e,t,s,i)),c&&(s=c),bt(e,t,17825809),u=17825809!==e.token?he(e,t&~ct.AllowDecorator|ct.AllowIn):null,bt(e,t,17825809),d=16!==e.token?he(e,t&~ct.AllowDecorator|ct.AllowIn):null);bt(e,t,16);const p=Rn(e,t);return It(t,e,n,"ForOfStatement"===l?{type:l,body:p,left:s,right:a,await:r}:a?{type:l,body:p,left:s,right:a}:{type:l,body:p,init:s,test:u,update:d})}(e,t|ct.ForStatement);case 594028:return Ft(e,t,Yt)&&sn(e,t,35),Cn(e,t|ct.AllowSingleStatement);case 33566808:sn(e,t,t&ct.Strict?19:20);case 33566797:sn(e,t,21,n(e.token));default:return Cn(e,t)}}function xn(e,t){const n=Vt(e);return Ct(e,t),It(t,e,n,{type:"EmptyStatement"})}function kn(e,t){const r=Vt(e);Ct(e,t),e.flags&(lt.InSwitchStatement|lt.InIterationStatement)||sn(e,t,30,n(e.token));let o=null;if(!(e.flags<.NewLine)&&135168&e.token){const{tokenValue:n}=e;o=Re(e,t),yt(e,t,n,!0)}return Nt(e,t),It(t,e,r,{type:"ContinueStatement",label:o})}function Sn(e,t){const n=Vt(e);Ct(e,t);let r=null;if(!(e.flags<.NewLine)&&135168&e.token){const{tokenValue:n}=e;r=Re(e,t),yt(e,t,n,!1)}else e.flags&(lt.InSwitchStatement|lt.InIterationStatement)||sn(e,t,30,"break");return Nt(e,t),It(t,e,n,{type:"BreakStatement",label:r})}function wn(e,t){const n=Vt(e);Ct(e,t),bt(e,t,50331659);const r=he(e,t&~ct.AllowDecorator|ct.AllowIn);return bt(e,t,16),It(t,e,n,{type:"IfStatement",test:r,consequent:yn(e,t|ct.DisallowEscapedKeyword),alternate:vt(e,t,12370)?yn(e,t):null})}function yn(e,t){return t&ct.Strict||33566808!==e.token?gn(e,t&~ct.AllowSingleStatement):ln(e,t)}function hn(e,t){const n=Vt(e);return Ct(e,t),Nt(e,t),It(t,e,n,{type:"DebuggerStatement"})}function An(e,t){const n=Vt(e);Ct(e,t);const r=Ln(e,t),o=12364===e.token?En(e,t):null,a=vt(e,t,12373)?Ln(e,t):null;return o||a||sn(e,t,79),It(t,e,n,{type:"TryStatement",block:r,handler:o,finalizer:a})}function En(e,t){const n=Vt(e);Ct(e,t);let r=null;if(vt(e,t,50331659)){const n=[];r=q(e,t,n),Pt(e,t,n),bt(e,t,16)}return It(t,e,n,{type:"CatchClause",param:r,body:Ln(e,t)})}function In(e,t){const n=Vt(e);Ct(e,t),e.flags<.NewLine&&sn(e,t,80);const r=he(e,t&~ct.AllowDecorator|ct.AllowIn);return Nt(e,t),It(t,e,n,{type:"ThrowStatement",argument:r})}function bn(e,t){const n=Vt(e),r=he(e,t&~ct.AllowDecorator|ct.AllowIn);return Nt(e,t),It(t,e,n,{type:"ExpressionStatement",expression:r})}function vn(e,t){const n=Vt(e),r=e.tokenRaw.slice(1,-1),o=he(e,t&~ct.AllowDecorator|ct.AllowIn);return Nt(e,t),It(t,e,n,{type:"ExpressionStatement",expression:o,directive:r})}function Cn(e,t){const n=Vt(e),{tokenValue:r,token:o}=e,a=he(e,t&~(ct.AllowSingleStatement|ct.AllowDecorator)|ct.AllowIn);if(135168&o&&16777237===e.token){t&ct.Yield&&1073741824&o&&sn(e,t,57),bt(e,t,16777237,83),Et(e,r)&&sn(e,t,29,r),ht(e,r);const s=!(t&ct.Strict)&&t&ct.AllowSingleStatement&&33566808===e.token?ln(e,t):gn(e,t);return At(e,r),It(t,e,n,{type:"LabeledStatement",label:a,body:s})}return Nt(e,t),It(t,e,n,{type:"ExpressionStatement",expression:a})}function On(e,t){const n=Vt(e);Ct(e,t);const r=Rn(e,t);bt(e,t,12386),bt(e,t,50331659);const o=he(e,t&~ct.AllowDecorator|ct.AllowIn);return bt(e,t,16),vt(e,t,17825809),It(t,e,n,{type:"DoWhileStatement",body:r,test:o})}function Nn(e,t){const n=Vt(e);Ct(e,t),bt(e,t,50331659);const r=he(e,t&~ct.AllowDecorator|ct.AllowIn);return bt(e,t,16),It(t,e,n,{type:"WhileStatement",test:r,body:Rn(e,t)})}function Ln(e,t){const n=Vt(e),r=[];for(bt(e,t,41943052);17825807!==e.token;)r.push(mn(e,t));return bt(e,t,17825807),It(t,e,n,{type:"BlockStatement",body:r})}function Dn(e,t){const n=Vt(e);t&(ct.OptionsGlobalReturn|ct.InFunctionBody)||sn(e,t,18),e.flags<.EscapedKeyword&&sn(e,t,3),Ct(e,t);const r=1048576&e.token||e.flags<.NewLine?null:he(e,t&~(ct.InFunctionBody|ct.AllowDecorator)|ct.AllowIn);return Nt(e,t),It(t,e,n,{type:"ReturnStatement",argument:r})}function Rn(e,t){const n=e.flags;e.flags|=lt.InIterationStatement|lt.AllowDestructuring;const r=gn(e,t&~ct.AllowSingleStatement|ct.DisallowEscapedKeyword);return e.flags=n,r}function Pn(e,t){t&ct.Strict&&sn(e,t,37);const n=Vt(e);Ct(e,t),bt(e,t,50331659);const r=he(e,t&~ct.AllowDecorator|ct.AllowIn);return bt(e,t,16),It(t,e,n,{type:"WithStatement",object:r,body:gn(e,t&~ct.AllowSingleStatement)})}function Hn(e,t){const n=Vt(e);Ct(e,t),bt(e,t,50331659);const r=he(e,t&~ct.AllowDecorator|ct.AllowIn);bt(e,t,16),bt(e,t|ct.DisallowEscapedKeyword,41943052);const o=[],a=e.flags;e.flags|=lt.InSwitchStatement;let s=!1;for(;17825807!==e.token;){const n=Fn(e,t);o.push(n),null===n.test&&(s&&sn(e,t,33),s=!0)}return e.flags=a,bt(e,t,17825807),It(t,e,n,{type:"SwitchStatement",discriminant:r,cases:o})}function Fn(e,t){const n=Vt(e);let r=null;vt(e,t,12363)?r=he(e,t&~ct.AllowDecorator|ct.AllowIn):bt(e,t,12368),bt(e,t,16777237);const o=[];for(;!Tt(e);)o.push(mn(e,t|ct.AllowIn));return It(t,e,n,{type:"SwitchCase",test:r,consequent:o})}function Bn(e,t,r=!0){const o=Vt(e),{token:a}=e,s=33566793===a;Ct(e,t);const i=fn(e,t,s);return r&&Nt(e,t),It(t,e,o,{type:"VariableDeclaration",kind:n(a),declarations:i})}function Vn(e,t){Ct(e,t);const n=[];for(;1048576!==e.token;)n.push(33554435===e.token?vn(e,t):Mn(e,t|ct.AllowIn));return n}function Mn(e,t){switch(e.token){case 120:return it(e,t);case 12371:return Jn(e,t);case 33566810:if(!(t&ct.OptionsNext&&Ft(e,t,Xt)))return Xn(e,t);default:return mn(e,t)}}function Jn(e,t){const r=Vt(e),o=[];let a=null,s=null;switch(bt(e,t|ct.DisallowEscapedKeyword,12371),e.token){case 167774771:return function(e,t,n){bt(e,t,167774771);const r=qn(e,t);return Nt(e,t),It(t,e,n,{type:"ExportAllDeclaration",source:r})}(e,t,r);case 12368:return function(e,t,n){let r;switch(bt(e,t|ct.DisallowEscapedKeyword,12368),e.token){case 33566808:r=ln(e,t|ct.RequireIdentifier);break;case 120:case 33566797:r=cn(e,t&~ct.AllowIn|ct.RequireIdentifier);break;case 594028:r=function(e,t){return Ft(e,t,Yt)?dn(e,t|ct.RequireIdentifier):Ee(e,t|ct.AllowIn)}(e,t|ct.RequireIdentifier);break;default:r=Ee(e,t|ct.AllowIn),Nt(e,t)}return It(t,e,n,{type:"ExportDefaultDeclaration",declaration:r})}(e,t,r);case 41943052:{bt(e,t,41943052);let n=!1;for(;17825807!==e.token;)69743!==e.token&&12288&e.token&&(n=!0,$t(e)),o.push(Tn(e,t)),17825807!==e.token&&bt(e,t,16777234);bt(e,t|ct.DisallowEscapedKeyword,17825807),69745===e.token?a=qn(e,t):n&&sn(e,t,46),Nt(e,t);break}case 33566797:s=cn(e,t);break;case 33574984:case 33566793:s=Bn(e,t|ct.BlockScope);break;case 33566791:s=Bn(e,t);break;case 33566808:s=ln(e,t);break;case 594028:if(Ft(e,t,Yt)){s=dn(e,t);break}default:an(e,1,n(e.token))}return It(t,e,r,{type:"ExportNamedDeclaration",source:a,specifiers:o,declaration:s})}function Tn(e,t){const n=Vt(e),r=Fe(e,t|ct.DisallowEscapedKeyword,e.token);return It(t,e,n,{type:"ExportSpecifier",local:r,exported:vt(e,t,167843947)?Fe(e,t,e.token):r})}function Xn(e,t){const r=Vt(e);let o;bt(e,t,33566810);let a=[];return 33554435===e.token?o=Pe(e,t):(a=function(e,t){const r=[];switch(e.token){case 33685505:if(r.push(function(e,t){return It(t,e,Vt(e),{type:"ImportDefaultSpecifier",local:Re(e,t)})}(e,t)),vt(e,t,16777234))switch(e.token){case 167774771:Yn(e,t,r);break;case 41943052:Gn(e,t,r);break;default:sn(e,t,1,n(e.token))}break;case 41943052:Gn(e,t,r);break;case 167774771:Yn(e,t,r);break;default:an(e,1,n(e.token))}return r}(e,t|ct.DisallowEscapedKeyword),o=qn(e,t)),Nt(e,t),It(t,e,r,{type:"ImportDeclaration",specifiers:a,source:o})}function Gn(e,t,n){for(bt(e,t,41943052);17825807!==e.token;)n.push(Kn(e,t)),17825807!==e.token&&bt(e,t,16777234);bt(e,t,17825807)}function Kn(e,t){const n=Vt(e),{token:r}=e,o=Fe(e,t|ct.DisallowEscapedKeyword,r);let a;return vt(e,t,167843947)?a=U(e,t):(Ot(r,12288)&&sn(e,t,46),Ot(r,4194304)&&sn(e,t,47),a=o),It(t,e,n,{type:"ImportSpecifier",local:a,imported:o})}function Yn(e,t,n){const r=Vt(e);bt(e,t,167774771),bt(e,t,167843947,82);const o=U(e,t);n.push(It(t,e,r,{type:"ImportNamespaceSpecifier",local:o}))}function qn(e,t){return bt(e,t,69745),33554435!==e.token&&an(e,1,n(e.token)),Pe(e,t)}function Un(e,t){return{source:e,length:e.length,index:0,line:1,column:0,startIndex:0,startColumn:0,startLine:1,lastIndex:0,lastColumn:0,lastLine:0,pendingExpressionError:void 0,flags:lt.AllowDestructuring,token:1048576,tokenRaw:"",lastValue:0,comments:[],sourceFile:t,tokenRegExp:void 0,tokenValue:void 0,labelSet:void 0,errorLocation:void 0,errors:[]}}function jn(e,t,n){let r="";t&&(t.module&&(n|=ct.Module),t.next&&(n|=ct.OptionsNext),t.jsx&&(n|=ct.OptionsJSX),t.ranges&&(n|=ct.OptionsRanges),t.loc&&(n|=ct.OptionsLoc),t.raw&&(n|=ct.OptionsRaw),t.rawIdentifier&&(n|=ct.OptionsRawidentifiers),t.globalReturn&&(n|=ct.OptionsGlobalReturn),t.skipShebang&&(n|=ct.OptionsShebang),t.tolerant&&(n|=ct.OptionsTolerant),t.source&&(r=t.source),t.comments&&(n|=ct.OptionsComments),t.impliedStrict&&(n|=ct.Strict),t.experimental&&(n|=ct.OptionsExperimental),t.node&&(n|=ct.OptionsNode));const o=Un(e,r),a=n&ct.Module?Vn(o,n):$n(o,n),s={type:"Program",sourceType:n&ct.Module?"module":"script",body:a};return n&ct.LocationTracker&&(n&ct.OptionsRanges&&(s.start=0,s.end=e.length),n&ct.OptionsLoc&&(s.loc={start:{line:1,column:0},end:{line:o.line,column:o.column}},r&&(s.loc.source=r))),n&ct.OptionsComments&&(s.comments=o.comments),n&ct.OptionsTolerant&&(s.errors=o.errors),s}function $n(e,t){const n=[];let r=!0;for(Ct(e,t|ct.DisallowEscapedKeyword);1048576!==e.token;)r&&33554435!==e.token&&(r=!1),r?(t&ct.Strict||12!==e.tokenRaw.length||"use strict"!==e.tokenValue||(t|=ct.Strict),n.push(vn(e,t))):n.push(mn(e,t));return n}function zn(e,t){return t&&t.module?_n(e,t):Wn(e,t)}function Wn(e,t){return jn(e,t,ct.Empty)}function _n(e,t){return jn(e,t,ct.Strict|ct.Module)}e("ESTree",Object.freeze({})),e("Scanner",Object.freeze({scanIdentifier:B,scanMaybeIdentifier:V,scanHexIntegerLiteral:C,scanOctalOrBinary:O,scanImplicitOctalDigits:N,scanSignedInteger:L,scanNumericLiteral:D,scanNumericSeparator:R,scanDecimalDigitsOrSeparator:P,scanDecimalAsSmi:H,scanRegularExpression:Y,scan:K,scanEscapeSequence:h,throwStringError:A,scanString:E,consumeTemplateBrace:I,scanTemplate:b,skipSingleHTMLComment:J,skipSingleLineComment:T,skipMultiLineComment:X,addComment:G,nextUnicodeChar:u,isIdentifierPart:d,escapeInvalidCharacters:p,consumeOpt:f,consumeLineFeed:m,scanPrivateName:g,advanceNewline:x,fromCodePoint:k,readNext:S,toHex:w,advanceOnMaybeAstral:y}));e("Parser",Object.freeze({parseClassDeclaration:cn,parseFunctionDeclaration:ln,parseAsyncFunctionOrAsyncGeneratorDeclaration:dn,parseVariableDeclarationList:fn,parseExpression:he,parseSequenceExpression:Ae,parseAssignmentExpression:Ee,parseRestElement:be,parseLeftHandSideExpression:Ce,parsePrimaryExpression:De,parseIdentifier:Re,parseLiteral:Pe,parseBigIntLiteral:He,parseIdentifierName:Fe,parseFunctionExpression:Me,parseAsyncFunctionOrAsyncGeneratorExpression:Je,parsePropertyName:Te,parseObjectLiteral:Ge,parseFormalListAndBody:je,parseFunctionBody:$e,parseFormalParameters:ze,parseFormalParameterList:We,parseClassBodyAndElementList:_e,parseClassElement:Qe,parseDecorators:it,parseModuleItemList:Vn,parseModuleItem:Mn,parseExportDeclaration:Jn,parseImportDeclaration:Xn,createParser:Un,parseSource:jn,parseStatementList:$n,parse:zn,parseScript:Wn,parseModule:_n,parseBindingIdentifierOrPattern:q,parseBindingIdentifier:U,parseAssignmentRestElement:j,parseAssignmentPattern:z,parseBindingInitializer:W,parseStatementListItem:mn,parseStatement:gn,parseEmptyStatement:xn,parseContinueStatement:kn,parseBreakStatement:Sn,parseIfStatement:wn,parseDebuggerStatement:hn,parseTryStatement:An,parseCatchBlock:En,parseThrowStatement:In,parseExpressionStatement:bn,parseDirective:vn,parseExpressionOrLabelledStatement:Cn,parseDoWhileStatement:On,parseWhileStatement:Nn,parseBlockStatement:Ln,parseReturnStatement:Dn,parseIterationStatement:Rn,parseWithStatement:Pn,parseSwitchStatement:Hn,parseCaseOrDefaultClauses:Fn,parseVariableStatement:Bn,parseJSXRootElement:Q,parseJSXOpeningElement:Z,nextJSXToken:ee,scanJSXToken:te,parseJSXText:re,parseJSXAttributes:ae,parseJSXSpreadAttribute:se,parseJSXNamespacedName:ie,parseJSXAttributeName:ce,parseJSXAttribute:ue,parseJSXEmptyExpression:de,parseJSXSpreadChild:pe,parseJSXExpressionContainer:fe,parseJSXExpression:me,parseJSXClosingFragment:ge,parseJSXClosingElement:xe,parseJSXIdentifier:ke,parseJSXMemberExpression:Se,parseJSXElementName:we,scanJSXIdentifier:ye})),e("version","1.6.9")}}}); diff --git a/node_modules/cherow/dist/types/chars.d.ts b/node_modules/cherow/dist/types/chars.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/cherow/dist/types/chars.d.ts @@ -0,0 +1 @@ +export {};
diff --git a/node_modules/cherow/dist/types/cherow.d.ts b/node_modules/cherow/dist/types/cherow.d.ts new file mode 100644 index 0000000..f6b2e0e --- /dev/null +++ b/node_modules/cherow/dist/types/cherow.d.ts @@ -0,0 +1,11 @@ +import { parse, parseSource, parseModule, parseScript } from './parser/parser';
+import * as ESTree from './estree';
+import * as Scanner from './lexer/index';
+export declare const version = "1.6.9";
+export { ESTree, Scanner, parse, parseSource, parseModule, parseScript };
+export * from './chars';
+export * from './errors';
+export * from './token';
+export * from './types';
+export * from './unicode';
+export * from './utilities';
diff --git a/node_modules/cherow/dist/types/errors.d.ts b/node_modules/cherow/dist/types/errors.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/cherow/dist/types/errors.d.ts @@ -0,0 +1 @@ +export {};
diff --git a/node_modules/cherow/dist/types/estree.d.ts b/node_modules/cherow/dist/types/estree.d.ts new file mode 100644 index 0000000..90cfc6d --- /dev/null +++ b/node_modules/cherow/dist/types/estree.d.ts @@ -0,0 +1,556 @@ +export interface _Node<T extends string> {
+ type: T;
+ loc?: SourceLocation | null;
+ start?: number;
+ end?: number;
+ errors?: any;
+ comments?: any;
+ tokens?: any;
+ leadingComments?: Comment[];
+ trailingComments?: Comment[];
+ innerComments?: Comment[];
+}
+export declare type Specifiers = (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier);
+export interface T_Node extends T_Statement, T_Expression, T_Pattern, T_ModuleDeclaration, T_ModuleSpecifier {
+ 'Program': Program;
+ 'SwitchCase': SwitchCase;
+ 'CatchClause': CatchClause;
+ 'Property': Property | AssignmentProperty;
+ 'Super': Super;
+ 'SpreadElement': SpreadElement;
+ 'TemplateElement': TemplateElement;
+ 'ClassBody': ClassBody;
+ 'FieldDefinition ': FieldDefinition;
+ 'PrivateName': PrivateName;
+ 'Decorator': Decorator;
+ 'MethodDefinition': MethodDefinition;
+ 'VariableDeclarator': VariableDeclarator;
+ 'JSXIdentifier': JSXIdentifier;
+ 'JSXMemberExpression': JSXMemberExpression;
+ 'JSXNamespacedName': JSXNamespacedName;
+ 'JSXEmptyExpression': JSXEmptyExpression;
+ 'JSXExpressionContainer': JSXExpressionContainer;
+ 'JSXSpreadChild': JSXSpreadChild;
+ 'JSXText': JSXText;
+ 'JSXOpeningFragment': JSXOpeningFragment;
+ 'JSXOpeningElement': JSXOpeningElement;
+ 'JSXClosingFragment': JSXClosingFragment;
+ 'JSXClosingElement': JSXClosingElement;
+ 'JSXAttribute': JSXAttribute;
+ 'JSXSpreadAttribute': JSXSpreadAttribute;
+}
+export declare type Node = Program | SwitchCase | CatchClause | Statement | Expression | Property | AssignmentProperty | Super | SpreadElement | TemplateElement | ClassBody | FieldDefinition | PrivateName | Decorator | MethodDefinition | ModuleDeclaration | ModuleSpecifier | Pattern | VariableDeclarator | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXEmptyExpression | JSXExpressionContainer | JSXSpreadChild | JSXText | JSXOpeningElement | JSXOpeningFragment | JSXClosingElement | JSXClosingFragment | JSXAttribute | JSXSpreadAttribute;
+export interface _Statement<T extends string> extends _Node<T> {
+}
+export interface T_Statement extends T_Declaration {
+ 'ExpressionStatement': ExpressionStatement;
+ 'BlockStatement': BlockStatement;
+ 'EmptyStatement': EmptyStatement;
+ 'DebuggerStatement': DebuggerStatement;
+ 'WithStatement': WithStatement;
+ 'ReturnStatement': ReturnStatement;
+ 'LabeledStatement': LabeledStatement;
+ 'BreakStatement': BreakStatement;
+ 'ContinueStatement': ContinueStatement;
+ 'IfStatement': IfStatement;
+ 'SwitchStatement': SwitchStatement;
+ 'ThrowStatement': ThrowStatement;
+ 'TryStatement': TryStatement;
+ 'WhileStatement': WhileStatement;
+ 'DoWhileStatement': DoWhileStatement;
+ 'ForStatement': ForStatement;
+ 'ForInStatement': ForInStatement;
+ 'ForOfStatement': ForOfStatement;
+}
+export declare type Statement = ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration;
+export interface _TypeAnnotation<T extends string> extends _Node<T> {
+}
+export interface T_TypeAnnotation {
+ 'Identifier': Identifier;
+ 'FunctionExpression': FunctionExpression;
+ 'ObjectPattern': ObjectPattern;
+ 'ArrayPattern': ArrayPattern;
+ 'RestElement': RestElement;
+}
+export declare type TypeAnnotation = Identifier | FunctionExpression | ArrayPattern | ObjectPattern | RestElement;
+export interface _Expression<T extends string> extends _Node<T> {
+}
+export interface T_Expression {
+ 'Identifier': Identifier;
+ 'Literal': Literal | RegExpLiteral | BigIntLiteral;
+ 'BigIntLiteral': Literal;
+ 'PrivateMemberExpression': PrivateMemberExpression;
+ 'ThisExpression': ThisExpression;
+ 'ArrayExpression': ArrayExpression;
+ 'ObjectExpression': ObjectExpression;
+ 'FunctionExpression': FunctionExpression;
+ 'UnaryExpression': UnaryExpression;
+ 'UpdateExpression': UpdateExpression;
+ 'BinaryExpression': BinaryExpression;
+ 'AssignmentExpression': AssignmentExpression;
+ 'LogicalExpression': LogicalExpression;
+ 'MemberExpression': MemberExpression;
+ 'ConditionalExpression': ConditionalExpression;
+ 'CallExpression': CallExpression;
+ 'NewExpression': NewExpression;
+ 'Import': Import;
+ 'SequenceExpression': SequenceExpression;
+ 'ArrowFunctionExpression': ArrowFunctionExpression;
+ 'YieldExpression': YieldExpression;
+ 'TemplateLiteral': TemplateLiteral;
+ 'TaggedTemplateExpression': TaggedTemplateExpression;
+ 'ClassExpression': ClassExpression;
+ 'MetaProperty': MetaProperty;
+ 'AwaitExpression': AwaitExpression;
+ 'JSXElement': JSXElement;
+ 'JSXFragment': JSXFragment;
+}
+export declare type Expression = Identifier | Literal | BigIntLiteral | RegExpLiteral | ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | DoExpression | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | PrivateName | ConditionalExpression | CallExpression | NewExpression | SequenceExpression | Import | ArrowFunctionExpression | YieldExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | AwaitExpression | JSXElement | JSXFragment;
+export interface _Pattern<T extends string> extends _Node<T> {
+}
+export interface T_Pattern {
+ 'Identifier': Identifier;
+ 'ObjectPattern': ObjectPattern;
+ 'ArrayPattern': ArrayPattern;
+ 'MemberExpression': MemberExpression;
+ 'PrivateMemberExpression': PrivateMemberExpression;
+ 'AssignmentPattern': AssignmentPattern;
+ 'RestElement': RestElement;
+}
+export declare type PatternTop = Identifier | ObjectPattern | ArrayPattern | MemberExpression;
+export declare type PatternNoRest = PatternTop | AssignmentPattern;
+export declare type Pattern = PatternTop | AssignmentPattern | RestElement;
+export interface _Declaration<T extends string> extends _Statement<T> {
+}
+export interface T_Declaration {
+ 'FunctionDeclaration': FunctionDeclaration;
+ 'VariableDeclaration': VariableDeclaration;
+ 'ClassDeclaration': ClassDeclaration;
+}
+export declare type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
+export interface _ModuleDeclaration<T extends string> extends _Node<T> {
+}
+export interface T_ModuleDeclaration {
+ 'ImportDeclaration': ImportDeclaration;
+ 'ExportNamedDeclaration': ExportNamedDeclaration;
+ 'ExportDefaultDeclaration': ExportDefaultDeclaration;
+ 'ExportAllDeclaration': ExportAllDeclaration;
+}
+export declare type ModuleDeclaration = ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration;
+export interface _ModuleSpecifier<T extends string> extends _Node<T> {
+ local: Identifier;
+}
+export interface T_ModuleSpecifier {
+ 'ImportSpecifier': ImportSpecifier;
+ 'ImportDefaultSpecifier': ImportDefaultSpecifier;
+ 'ImportNamespaceSpecifier': ImportNamespaceSpecifier;
+ 'ExportSpecifier': ExportSpecifier;
+}
+export declare type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
+export interface SourceLocation {
+ start: Position;
+ end: Position;
+ source?: string;
+}
+export interface Position {
+ /** >= 1 */
+ line: number;
+ /** >= 0 */
+ column: number;
+}
+export declare type CommentType = 'SingleLine' | 'MultiLine' | 'HTMLClose' | 'HTMLOpen' | 'SheBang';
+export interface Comment {
+ type: CommentType;
+ value: string;
+ start?: number | undefined;
+ end?: number | undefined;
+ loc?: any;
+}
+/**
+* Core types
+*/
+export interface Program extends _Node<'Program'> {
+ sourceType: 'script' | 'module';
+ body: (Statement | ModuleDeclaration)[];
+}
+export interface ArrayExpression extends _Expression<'ArrayExpression'> {
+ elements: (Expression | SpreadElement | null)[];
+}
+export interface ArrayPattern extends _Pattern<'ArrayPattern'> {
+ elements: (Pattern | null)[];
+ typeAnnotation?: TypeAnnotation | null;
+}
+export declare type AssignmentOperator = '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '<<=' | '>>=' | '>>>=' | '|=' | '^=' | '&=' | '**=';
+export interface AssignmentExpression extends _Expression<'AssignmentExpression'> {
+ operator: AssignmentOperator;
+ left: Expression | PatternTop;
+ right: Expression;
+}
+export interface AssignmentPattern extends _Pattern<'AssignmentPattern'> {
+ left: PatternTop;
+ right: Expression;
+}
+export interface ArrowFunctionExpression extends _Expression<'ArrowFunctionExpression'> {
+ id: Identifier | null;
+ params: Pattern[];
+ body: BlockStatement | Expression;
+ expression: boolean;
+ async: boolean;
+ generator: false;
+}
+export interface AwaitExpression extends _Expression<'AwaitExpression'> {
+ argument: Expression;
+}
+export declare type BinaryOperator = '==' | '!=' | '===' | '!==' | '<' | '<=' | '>' | '>=' | '<<' | '>>' | '>>>' | '+' | '-' | '*' | '/' | '%' | '|' | '^' | '&' | 'in' | '**' | 'instanceof';
+export interface BinaryExpression extends _Expression<'BinaryExpression'> {
+ operator: BinaryOperator;
+ left: Expression;
+ right: Expression;
+}
+export interface BlockStatement extends _Statement<'BlockStatement'> {
+ body: Statement[];
+}
+export interface BreakStatement extends _Statement<'BreakStatement'> {
+ label: Identifier | null;
+}
+export interface CallExpression extends _Expression<'CallExpression'> {
+ callee: Expression | Import | Super;
+ arguments: (Expression | SpreadElement)[];
+}
+export interface CatchClause extends _Node<'CatchClause'> {
+ param: PatternTop;
+ body: BlockStatement;
+}
+export interface ClassBody extends _Node<'ClassBody'> {
+ body: (MethodDefinition | FieldDefinition)[];
+}
+export interface PrivateMemberExpression extends _Node<'PrivateMemberExpression '> {
+ object: Expression;
+ property: PrivateName;
+}
+export interface FieldDefinition extends _Node<'FieldDefinition '> {
+ key: PrivateName | Expression;
+ value: Expression | null;
+ computed: boolean;
+}
+export interface ClassDeclaration extends _Declaration<'ClassDeclaration'> {
+ id: Identifier | null;
+ superClass: Expression | null;
+ body: ClassBody;
+}
+export interface ClassExpression extends _Expression<'ClassExpression'> {
+ id: Identifier | null;
+ superClass: Expression | null;
+ body: ClassBody;
+}
+export interface MemberExpression extends _Expression<'MemberExpression'> {
+ computed: boolean;
+ object: Expression | Super;
+ property: Expression;
+}
+export interface ConditionalExpression extends _Expression<'ConditionalExpression'> {
+ test: Expression;
+ consequent: Expression;
+ alternate: Expression;
+}
+export interface ContinueStatement extends _Statement<'ContinueStatement'> {
+ label: Identifier | null;
+}
+export interface DebuggerStatement extends _Statement<'DebuggerStatement'> {
+}
+export interface DoWhileStatement extends _Statement<'DoWhileStatement'> {
+ body: Statement;
+ test: Expression;
+}
+export interface EmptyStatement extends _Statement<'EmptyStatement'> {
+}
+export interface ExportAllDeclaration extends _ModuleDeclaration<'ExportAllDeclaration'> {
+ source: Literal;
+}
+export interface ExportDefaultDeclaration extends _ModuleDeclaration<'ExportDefaultDeclaration'> {
+ declaration: Declaration | Expression;
+}
+export interface ExportNamedDeclaration extends _ModuleDeclaration<'ExportNamedDeclaration'> {
+ declaration: Declaration | null;
+ specifiers: ExportSpecifier[];
+ source: Literal | null;
+}
+export interface ExportSpecifier extends _ModuleSpecifier<'ExportSpecifier'> {
+ exported: Identifier;
+}
+export interface ExpressionStatement extends _Statement<'ExpressionStatement'> {
+ expression: Expression;
+}
+export interface ForInStatement extends _Statement<'ForInStatement'> {
+ left: VariableDeclaration | Expression | PatternNoRest;
+ right: Expression;
+ body: Statement;
+}
+export interface ForOfStatement extends _Statement<'ForOfStatement'> {
+ left: VariableDeclaration | Expression | PatternNoRest;
+ right: Expression;
+ body: Statement;
+ await: boolean;
+}
+export interface ForStatement extends _Statement<'ForStatement'> {
+ init: VariableDeclaration | Expression | null;
+ test: Expression | null;
+ update: Expression | null;
+ body: Statement;
+}
+export interface FunctionDeclaration extends _Declaration<'FunctionDeclaration'> {
+ id: Identifier | null;
+ params: Pattern[];
+ body: BlockStatement;
+ generator: boolean;
+ async: boolean;
+ expression: false;
+ typeAnnotation?: TypeAnnotation | null;
+}
+export interface FunctionExpression extends _Expression<'FunctionExpression'> {
+ id: Identifier | null;
+ params: Pattern[];
+ body: BlockStatement;
+ generator: boolean;
+ async: boolean;
+ expression: false;
+ typeAnnotation?: TypeAnnotation | null;
+}
+export interface DoExpression extends _Expression<'DoExpression'>, _Pattern<'DoExpression'> {
+ body: BlockStatement;
+}
+export interface Identifier extends _Expression<'Identifier'>, _Pattern<'Identifier'> {
+ name: string;
+ typeAnnotation?: TypeAnnotation | null;
+ raw?: string;
+}
+export interface IfStatement extends _Statement<'IfStatement'> {
+ test: Expression;
+ consequent: Statement;
+ alternate: Statement | null;
+}
+export interface Import extends _Node<'Import'> {
+}
+export interface ImportDeclaration extends _ModuleDeclaration<'ImportDeclaration'> {
+ specifiers: (ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier)[];
+ source: Literal;
+}
+export interface ImportDefaultSpecifier extends _ModuleSpecifier<'ImportDefaultSpecifier'> {
+}
+export interface ImportNamespaceSpecifier extends _ModuleSpecifier<'ImportNamespaceSpecifier'> {
+}
+export interface ImportSpecifier extends _ModuleSpecifier<'ImportSpecifier'> {
+ imported: Identifier;
+}
+export interface LabeledStatement extends _Statement<'LabeledStatement'> {
+ label: Identifier;
+ body: Statement;
+}
+export interface BigIntLiteral extends _Expression<'Literal'> {
+ value: number;
+ bigint: string;
+ raw?: string;
+}
+export interface Literal extends _Expression<'Literal'> {
+ value: boolean | number | string | null;
+ raw?: string;
+}
+export declare type LogicalOperator = '&&' | '||';
+export interface LogicalExpression extends _Expression<'LogicalExpression'> {
+ operator: LogicalOperator;
+ left: Expression;
+ right: Expression;
+}
+export interface MetaProperty extends _Expression<'MetaProperty'> {
+ meta: Identifier;
+ property: Identifier;
+}
+export interface PrivateName extends _Node<'PrivateName'> {
+ name: string;
+}
+export interface Decorator extends _Node<'Decorator'> {
+ expression: Expression;
+}
+export interface MethodDefinition extends _Node<'MethodDefinition'> {
+ key: Expression | PrivateName;
+ value: FunctionExpression | null;
+ kind: 'constructor' | 'method' | 'get' | 'set';
+ computed: boolean;
+ static: boolean;
+}
+export interface NewExpression extends _Expression<'NewExpression'> {
+ callee: Expression;
+ arguments: (Expression | SpreadElement)[];
+}
+export interface Property extends _Node<'Property'> {
+ key: Expression;
+ computed: boolean;
+ value: Expression | null;
+ kind: 'init' | 'get' | 'set';
+ method: boolean;
+ shorthand: boolean;
+}
+export interface ObjectExpression extends _Expression<'ObjectExpression'> {
+ properties: (Property | SpreadElement)[];
+}
+export interface AssignmentProperty extends _Node<'Property'> {
+ key: Expression;
+ value: PatternNoRest;
+ computed: boolean;
+ kind: 'init';
+ method: false;
+ shorthand: boolean;
+}
+export interface ObjectPattern extends _Pattern<'ObjectPattern'> {
+ properties: (AssignmentProperty | RestElement)[];
+ typeAnnotation?: TypeAnnotation | null;
+}
+export interface RegExpLiteral extends _Expression<'Literal'> {
+ value: RegExp | null;
+ raw?: string;
+ regex: {
+ pattern: string;
+ flags: string;
+ };
+}
+export interface RestElement extends _Pattern<'RestElement'> {
+ argument: PatternTop;
+ typeAnnotation?: TypeAnnotation | null;
+}
+export interface ReturnStatement extends _Statement<'ReturnStatement'> {
+ argument: Expression | null;
+}
+export interface ImportExpression extends _Expression<'Import'> {
+}
+export interface SequenceExpression extends _Expression<'SequenceExpression'> {
+ expressions: Expression[];
+}
+export interface SpreadElement extends _Node<'SpreadElement'> {
+ argument: Expression;
+}
+export interface Super extends _Node<'Super'> {
+}
+export interface SwitchCase extends _Node<'SwitchCase'> {
+ test: Expression | null;
+ consequent: Statement[];
+}
+export interface SwitchStatement extends _Statement<'SwitchStatement'> {
+ discriminant: Expression;
+ cases: SwitchCase[];
+}
+export interface TaggedTemplateExpression extends _Expression<'TaggedTemplateExpression'> {
+ tag: Expression;
+ quasi: TemplateLiteral;
+}
+export interface TemplateElement extends _Node<'TemplateElement'> {
+ value: {
+ cooked: string | null;
+ raw: string;
+ };
+ tail: boolean;
+}
+export interface TemplateLiteral extends _Expression<'TemplateLiteral'> {
+ quasis: TemplateElement[];
+ expressions: Expression[];
+}
+export interface ThisExpression extends _Expression<'ThisExpression'> {
+}
+export interface ThrowStatement extends _Statement<'ThrowStatement'> {
+ argument: Expression;
+}
+export interface TryStatement extends _Statement<'TryStatement'> {
+ block: BlockStatement;
+ handler: CatchClause | null;
+ finalizer: BlockStatement | null;
+}
+export declare type UnaryOperator = '-' | '+' | '!' | '~' | 'typeof' | 'void' | 'delete' | 'throw';
+export interface UnaryExpression extends _Expression<'UnaryExpression'> {
+ operator: UnaryOperator;
+ argument: Expression;
+ prefix: boolean;
+}
+export declare type UpdateOperator = '++' | '--';
+export interface UpdateExpression extends _Expression<'UpdateExpression'> {
+ operator: UpdateOperator;
+ argument: Expression | Pattern;
+ prefix: boolean;
+}
+export interface VariableDeclaration extends _Declaration<'VariableDeclaration'> {
+ declarations: VariableDeclarator[];
+ kind: 'var' | 'let' | 'const';
+}
+export interface VariableDeclarator extends _Node<'VariableDeclarator'> {
+ id: PatternTop;
+ init: Expression | null;
+}
+export interface WhileStatement extends _Statement<'WhileStatement'> {
+ test: Expression;
+ body: Statement;
+}
+export interface WithStatement extends _Statement<'WithStatement'> {
+ object: Expression;
+ body: Statement;
+}
+export interface YieldExpression extends _Expression<'YieldExpression'> {
+ argument: Expression | null;
+ delegate: boolean;
+}
+/**
+* JSX types
+*
+* Reference: https://github.com/facebook/jsx/blob/master/AST.md
+*/
+export interface JSXIdentifier extends _Node<'JSXIdentifier'> {
+ name: string;
+ raw?: string;
+}
+export interface JSXMemberExpression extends _Node<'JSXMemberExpression'> {
+ object: JSXMemberExpression | JSXIdentifier;
+ property: JSXIdentifier;
+}
+export interface JSXNamespacedName extends _Node<'JSXNamespacedName'> {
+ namespace: JSXIdentifier;
+ name: JSXIdentifier;
+}
+export interface JSXEmptyExpression extends _Node<'JSXEmptyExpression'> {
+}
+export interface JSXExpressionContainer extends _Node<'JSXExpressionContainer'> {
+ expression: Expression | JSXEmptyExpression;
+}
+export interface JSXSpreadChild extends _Node<'JSXSpreadChild'> {
+ expression: Expression;
+}
+export interface _JSXBoundaryElement<T extends string> extends _Node<T> {
+ name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName;
+}
+export interface JSXOpeningElement extends _JSXBoundaryElement<'JSXOpeningElement'> {
+ selfClosing: boolean;
+ attributes: (JSXAttribute | JSXSpreadAttribute)[];
+}
+export interface JSXText extends _Node<'JSXText'> {
+ value: string;
+ raw: string;
+}
+export interface JSXOpeningFragment extends _JSXBoundaryElement<'JSXOpeningFragment'> {
+}
+export interface JSXClosingFragment extends _JSXBoundaryElement<'JSXClosingFragment'> {
+}
+export interface JSXClosingElement extends _JSXBoundaryElement<'JSXClosingElement'> {
+}
+export interface JSXAttribute extends _Node<'JSXAttribute'> {
+ name: JSXIdentifier | JSXNamespacedName;
+ value: JSXText | JSXElement | JSXSpreadAttribute | JSXExpressionContainer | null;
+}
+export interface JSXSpreadAttribute extends _Node<'JSXSpreadAttribute'> {
+ argument: Expression;
+}
+export interface JSXFragment extends _Expression<'JSXFragment'> {
+ openingElement: JSXOpeningFragment;
+ children: (JSXText | JSXExpressionContainer | JSXSpreadChild | JSXFragment)[];
+ closingFragment: JSXClosingFragment | null;
+}
+export interface JSXElement extends _Expression<'JSXElement'> {
+ openingElement: JSXOpeningElement;
+ children: (JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement)[];
+ closingElement: JSXClosingElement | null;
+}
diff --git a/node_modules/cherow/dist/types/lexer/comments.d.ts b/node_modules/cherow/dist/types/lexer/comments.d.ts new file mode 100644 index 0000000..30e8a9a --- /dev/null +++ b/node_modules/cherow/dist/types/lexer/comments.d.ts @@ -0,0 +1,44 @@ +import * as ESTree from '../estree';
+import { Parser, CommentType } from '../types';
+import { Context, ScannerState } from '../utilities';
+/**
+ * Skips single HTML comments. Same behavior as in V8.
+ *
+ * @param parser Parser Object
+ * @param context Context masks.
+ * @param state Scanner state
+ * @param type Comment type
+ */
+export declare function skipSingleHTMLComment(parser: Parser, context: Context, state: ScannerState, type: CommentType): ScannerState;
+/**
+ * Skips SingleLineComment, SingleLineHTMLCloseComment and SingleLineHTMLOpenComment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SingleLineComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLOpenComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLCloseComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ * @param type Comment type
+ */
+export declare function skipSingleLineComment(parser: Parser, context: Context, state: ScannerState, type: CommentType): ScannerState;
+/**
+ * Skips multiline comment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-MultiLineComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ */
+export declare function skipMultiLineComment(parser: Parser, context: Context, state: ScannerState): any;
+/**
+ * Add comments
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param type Comment type
+ * @param commentStart Start position of comment
+ */
+export declare function addComment(parser: Parser, context: Context, type: ESTree.CommentType, commentStart: number): void;
diff --git a/node_modules/cherow/dist/types/lexer/common.d.ts b/node_modules/cherow/dist/types/lexer/common.d.ts new file mode 100644 index 0000000..35e3b6d --- /dev/null +++ b/node_modules/cherow/dist/types/lexer/common.d.ts @@ -0,0 +1,49 @@ +import { Chars } from '../chars';
+import { Parser } from '../types';
+import { Token } from '../token';
+import { Context, ScannerState } from '../utilities';
+/**
+ * Return the next unicodechar in the stream
+ *
+ * @param parser Parser object
+ */
+export declare function nextUnicodeChar(parser: Parser): number;
+/**
+ * Returns true if this is a valid identifier part
+ *
+ * @param code Codepoint
+ */
+export declare const isIdentifierPart: (code: number) => boolean;
+export declare function escapeInvalidCharacters(code: number): string;
+/**
+ * Consume an token in the scanner on match. This is an equalent to
+ * 'consume' used in the parser code itself.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function consumeOpt(parser: Parser, code: number): boolean;
+/**
+ * Consumes line feed
+ *
+ * @param parser Parser object
+ * @param state Scanner state
+ */
+export declare function consumeLineFeed(parser: Parser, state: ScannerState): void;
+/**
+ * Scans private name. Stage 3 proposal related
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanPrivateName(parser: Parser, context: Context): Token;
+/**
+ * Advance to new line
+ *
+ * @param parser Parser object
+ */
+export declare function advanceNewline(parser: Parser): void;
+export declare const fromCodePoint: (code: Chars) => string;
+export declare function readNext(parser: Parser): number;
+export declare function toHex(code: number): number;
+export declare function advanceOnMaybeAstral(parser: Parser, ch: number): void;
diff --git a/node_modules/cherow/dist/types/lexer/identifier.d.ts b/node_modules/cherow/dist/types/lexer/identifier.d.ts new file mode 100644 index 0000000..e38847a --- /dev/null +++ b/node_modules/cherow/dist/types/lexer/identifier.d.ts @@ -0,0 +1,22 @@ +import { Parser } from '../types';
+import { Token } from '../token';
+import { Context } from '../utilities';
+/**
+ * Scan identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+export declare function scanIdentifier(parser: Parser, context: Context, first?: number): Token;
+/**
+ * Scanning chars in the range 0...127, and treat them as an possible
+ * identifier. This allows subsequent checking to be faster.
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param first Code point
+ */
+export declare function scanMaybeIdentifier(parser: Parser, context: Context, first: number): Token;
diff --git a/node_modules/cherow/dist/types/lexer/index.d.ts b/node_modules/cherow/dist/types/lexer/index.d.ts new file mode 100644 index 0000000..daa3d02 --- /dev/null +++ b/node_modules/cherow/dist/types/lexer/index.d.ts @@ -0,0 +1,8 @@ +export * from './identifier';
+export * from './numbers';
+export * from './regexp';
+export * from './scan';
+export * from './string';
+export * from './template';
+export * from './comments';
+export * from './common';
diff --git a/node_modules/cherow/dist/types/lexer/numbers.d.ts b/node_modules/cherow/dist/types/lexer/numbers.d.ts new file mode 100644 index 0000000..41993b0 --- /dev/null +++ b/node_modules/cherow/dist/types/lexer/numbers.d.ts @@ -0,0 +1,71 @@ +import { Parser } from '../types';
+import { Token } from '../token';
+import { Context, NumericState } from '../utilities';
+/**
+ * Scans hex integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HexIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanHexIntegerLiteral(parser: Parser, context: Context): Token;
+/**
+ * Scans binary and octal integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalIntegerLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BinaryIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanOctalOrBinary(parser: Parser, context: Context, base: number): Token;
+/**
+ * Scans implicit octal digits
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalDigits)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanImplicitOctalDigits(parser: Parser, context: Context): Token;
+/**
+ * Scans signed integer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SignedInteger)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanSignedInteger(parser: Parser, end: number): string;
+/**
+ * Scans numeric literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanNumericLiteral(parser: Parser, context: Context, state?: NumericState): Token;
+/**
+ * Internal helper function for scanning numeric separators.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state NumericState state
+ */
+export declare function scanNumericSeparator(parser: Parser, state: NumericState): NumericState;
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanDecimalDigitsOrSeparator(parser: Parser): string;
+/**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanDecimalAsSmi(parser: Parser, context: Context): number;
diff --git a/node_modules/cherow/dist/types/lexer/regexp.d.ts b/node_modules/cherow/dist/types/lexer/regexp.d.ts new file mode 100644 index 0000000..e287cd1 --- /dev/null +++ b/node_modules/cherow/dist/types/lexer/regexp.d.ts @@ -0,0 +1,10 @@ +import { Parser } from '../types';
+import { Token } from '../token';
+import { Context } from '../utilities';
+/**
+ * Scans regular expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanRegularExpression(parser: Parser, context: Context): Token;
diff --git a/node_modules/cherow/dist/types/lexer/scan.d.ts b/node_modules/cherow/dist/types/lexer/scan.d.ts new file mode 100644 index 0000000..db7e727 --- /dev/null +++ b/node_modules/cherow/dist/types/lexer/scan.d.ts @@ -0,0 +1,13 @@ +import { Parser } from '../types';
+import { Token } from '../token';
+import { Context } from '../utilities';
+/**
+ * Scan
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-punctuatorss)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scan(parser: Parser, context: Context): Token;
diff --git a/node_modules/cherow/dist/types/lexer/string.d.ts b/node_modules/cherow/dist/types/lexer/string.d.ts new file mode 100644 index 0000000..549b17f --- /dev/null +++ b/node_modules/cherow/dist/types/lexer/string.d.ts @@ -0,0 +1,27 @@ +import { Parser } from '../types';
+import { Token } from '../token';
+import { Context, Escape } from '../utilities';
+/**
+ * Scan escape sequence
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanEscapeSequence(parser: Parser, context: Context, first: number): number;
+/**
+ * Throws a string error for either string or template literal
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function throwStringError(parser: Parser, context: Context, code: Escape): void;
+/**
+ * Scan a string literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote codepoint
+ */
+export declare function scanString(parser: Parser, context: Context, quote: number): Token;
diff --git a/node_modules/cherow/dist/types/lexer/template.d.ts b/node_modules/cherow/dist/types/lexer/template.d.ts new file mode 100644 index 0000000..e057b6a --- /dev/null +++ b/node_modules/cherow/dist/types/lexer/template.d.ts @@ -0,0 +1,18 @@ +import { Parser } from '../types';
+import { Token } from '../token';
+import { Context } from '../utilities';
+/**
+ * Consumes template brace
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function consumeTemplateBrace(parser: Parser, context: Context): Token;
+/**
+ * Scan template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param first Codepoint
+ */
+export declare function scanTemplate(parser: Parser, context: Context): Token;
diff --git a/node_modules/cherow/dist/types/parser/declarations.d.ts b/node_modules/cherow/dist/types/parser/declarations.d.ts new file mode 100644 index 0000000..1151077 --- /dev/null +++ b/node_modules/cherow/dist/types/parser/declarations.d.ts @@ -0,0 +1,40 @@ +import * as ESTree from '../estree';
+import { Parser } from '../types';
+import { Context } from '../utilities';
+/**
+ * Parses class declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseClassDeclaration(parser: Parser, context: Context): ESTree.ClassDeclaration;
+/**
+ * Parses function declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseFunctionDeclaration(parser: Parser, context: Context): ESTree.FunctionDeclaration;
+/**
+ * Parses async function or async generator declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseAsyncFunctionOrAsyncGeneratorDeclaration(parser: Parser, context: Context): ESTree.FunctionDeclaration;
+/**
+ * Parses variable declaration list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclarationList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseVariableDeclarationList(parser: Parser, context: Context, isConst: boolean): ESTree.VariableDeclarator[];
diff --git a/node_modules/cherow/dist/types/parser/expressions.d.ts b/node_modules/cherow/dist/types/parser/expressions.d.ts new file mode 100644 index 0000000..3fbf555 --- /dev/null +++ b/node_modules/cherow/dist/types/parser/expressions.d.ts @@ -0,0 +1,224 @@ +import * as ESTree from '../estree';
+import { Token } from '../token';
+import { Location, Parser } from '../types';
+import { Context, ObjectState } from '../utilities';
+/**
+ * Expression :
+ * AssignmentExpression
+ * Expression , AssignmentExpression
+ *
+ * ExpressionNoIn :
+ * AssignmentExpressionNoIn
+ * ExpressionNoIn , AssignmentExpressionNoIn
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Expression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseExpression(parser: Parser, context: Context): ESTree.Expression;
+/**
+ * Parse secuence expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseSequenceExpression(parser: Parser, context: Context, left: ESTree.Expression, pos: Location): ESTree.SequenceExpression;
+/**
+ * AssignmentExpression :
+ * ConditionalExpression
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpression
+ * LeftHandSideExpression AssignmentOperator AssignmentExpression
+ *
+ * AssignmentExpressionNoIn :
+ * ConditionalExpressionNoIn
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpressionNoIn
+ * LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseAssignmentExpression(parser: Parser, context: Context): ESTree.Expression;
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseRestElement(parser: Parser, context: Context, args?: string[]): ESTree.RestElement;
+/**
+ * Parse left hand side expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LeftHandSideExpression)
+ *
+ * @param Parser Parer instance
+ * @param Context Contextmasks
+ * @param pos Location info
+ */
+export declare function parseLeftHandSideExpression(parser: Parser, context: Context, pos: Location): ESTree.Expression;
+/**
+ * Parse primary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PrimaryExpression)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+export declare function parsePrimaryExpression(parser: Parser, context: Context): any;
+/**
+ * Parses identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseIdentifier(parser: Parser, context: Context): ESTree.Identifier;
+/**
+ * Parses string and number literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StringLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseLiteral(parser: Parser, context: Context): ESTree.Literal;
+/**
+ * Parses BigInt literal (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/proposal-bigint/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseBigIntLiteral(parser: Parser, context: Context): ESTree.Literal;
+/**
+ * Parse identifier name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-IdentifierName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t token
+ */
+export declare function parseIdentifierName(parser: Parser, context: Context, t: Token): ESTree.Identifier;
+/**
+ * Parses function expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseFunctionExpression(parser: Parser, context: Context): ESTree.FunctionExpression;
+/**
+ * Parses async function or async generator expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseAsyncFunctionOrAsyncGeneratorExpression(parser: Parser, context: Context): ESTree.FunctionExpression;
+/**
+ * Parse property name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parsePropertyName(parser: Parser, context: Context): ESTree.Expression;
+/**
+ * Parses object literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ObjectLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseObjectLiteral(parser: Parser, context: Context): ESTree.ObjectExpression;
+/**
+ * Parses formal parameters and function body.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseFormalListAndBody(parser: Parser, context: Context, state: ObjectState): {
+ params: (ESTree.Identifier | ESTree.ObjectPattern | ESTree.ArrayPattern | ESTree.RestElement)[];
+ body: ESTree.BlockStatement;
+};
+/**
+ * Parse funciton body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseFunctionBody(parser: Parser, context: Context, params: any): ESTree.BlockStatement;
+/**
+ * Parse formal parameters
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param Parser object
+ * @param Context masks
+ * @param Optional objectstate. Default to none
+ */
+export declare function parseFormalParameters(parser: Parser, context: Context, state: ObjectState): {
+ params: (ESTree.ArrayPattern | ESTree.RestElement | ESTree.ObjectPattern | ESTree.Identifier)[];
+ args: string[];
+};
+/**
+ * Parse formal parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseFormalParameterList(parser: Parser, context: Context, args: string[]): ESTree.Identifier | ESTree.ObjectPattern | ESTree.ArrayPattern | ESTree.RestElement;
+/**
+ * Parse class body and element list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElementList)
+ *
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseClassBodyAndElementList(parser: Parser, context: Context, state: ObjectState): ESTree.ClassBody;
+/**
+ * Parse class element and class public instance fields & private instance fields
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElement)
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseClassElement(parser: Parser, context: Context, state: ObjectState, decorators: ESTree.Decorator[]): ESTree.MethodDefinition | ESTree.FieldDefinition;
+/**
+ * Parses a list of decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseDecorators(parser: Parser, context: Context): ESTree.Decorator[];
diff --git a/node_modules/cherow/dist/types/parser/index.d.ts b/node_modules/cherow/dist/types/parser/index.d.ts new file mode 100644 index 0000000..3ec41e0 --- /dev/null +++ b/node_modules/cherow/dist/types/parser/index.d.ts @@ -0,0 +1,7 @@ +export * from './declarations';
+export * from './expressions';
+export * from './module';
+export * from './parser';
+export * from './pattern';
+export * from './statements';
+export * from './jsx';
diff --git a/node_modules/cherow/dist/types/parser/jsx.d.ts b/node_modules/cherow/dist/types/parser/jsx.d.ts new file mode 100644 index 0000000..6d760a2 --- /dev/null +++ b/node_modules/cherow/dist/types/parser/jsx.d.ts @@ -0,0 +1,153 @@ +import * as ESTree from '../estree';
+import { Parser, Location } from '../types';
+import { Token } from '../token';
+import { Context } from '../utilities';
+/**
+ * Parses JSX element or JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXRootElement(parser: Parser, context: Context): ESTree.JSXElement | ESTree.JSXFragment;
+/**
+ * Parses JSX opening element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param name Element name
+ * @param attributes Element attributes
+ * @param selfClosing True if this is a selfclosing JSX Element
+ * @param pos Line / Column tracking
+ */
+export declare function parseJSXOpeningElement(parser: Parser, context: Context, name: ESTree.JSXIdentifier | ESTree.JSXMemberExpression | ESTree.JSXNamespacedName, attributes: (ESTree.JSXAttribute | ESTree.JSXSpreadAttribute)[], selfClosing: boolean, pos: Location): ESTree.JSXOpeningElement;
+/**
+ * Prime the scanner and advance to the next JSX token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function nextJSXToken(parser: Parser): Token;
+/**
+ * Mini scanner
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanJSXToken(parser: Parser): Token;
+/**
+ * Parses JSX Text
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXText(parser: Parser, context: Context): ESTree.JSXText;
+/**
+ * Parses JSX attributes
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXAttributes(parser: Parser, context: Context): ReturnType<typeof parseJSXAttribute>[];
+/**
+ * Parses JSX spread attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXSpreadAttribute(parser: Parser, context: Context): ESTree.JSXSpreadAttribute;
+/**
+ * Parses JSX namespace name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param namespace Identifier
+ * @param pos Line / Column location
+ */
+export declare function parseJSXNamespacedName(parser: Parser, context: Context, namespace: ESTree.JSXIdentifier, pos: Location): ESTree.JSXNamespacedName;
+/**
+ * Parses JSX attribute name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXAttributeName(parser: Parser, context: Context): ESTree.JSXIdentifier | ESTree.JSXNamespacedName;
+/**
+ * Parses JSX Attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXAttribute(parser: Parser, context: Context): ESTree.JSXAttribute | ESTree.JSXSpreadAttribute;
+/**
+ * Parses JJSX Empty Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXEmptyExpression(parser: Parser, context: Context): ESTree.JSXEmptyExpression;
+/**
+ * Parses JSX Spread child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXSpreadChild(parser: Parser, context: Context): ESTree.JSXSpreadChild;
+/**
+ * Parses JSX Expression container
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXExpressionContainer(parser: Parser, context: Context): ESTree.JSXExpressionContainer;
+/**
+ * Parses JSX Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+export declare function parseJSXExpression(parser: Parser, context: Context): ESTree.JSXExpressionContainer | ESTree.JSXSpreadChild;
+/**
+ * Parses JSX Closing fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXClosingFragment(parser: Parser, context: Context): ESTree.JSXClosingFragment;
+/**
+ * Parses JSX Closing Element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+export declare function parseJSXClosingElement(parser: Parser, context: Context): ESTree.JSXClosingElement;
+/**
+ * Parses JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXIdentifier(parser: Parser, context: Context): ESTree.JSXIdentifier;
+/**
+ * Parses JSX Member expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+export declare function parseJSXMemberExpression(parser: Parser, context: Context, expr: ESTree.JSXIdentifier | ESTree.JSXMemberExpression, pos: Location): ESTree.JSXMemberExpression;
+/**
+ * Parses JSX Element name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseJSXElementName(parser: Parser, context: Context): any;
+/**
+ * Scans JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function scanJSXIdentifier(parser: Parser): Token;
diff --git a/node_modules/cherow/dist/types/parser/module.d.ts b/node_modules/cherow/dist/types/parser/module.d.ts new file mode 100644 index 0000000..c06156a --- /dev/null +++ b/node_modules/cherow/dist/types/parser/module.d.ts @@ -0,0 +1,41 @@ +import * as ESTree from '../estree';
+import { Parser } from '../types';
+import { parseStatementListItem, parseDirective } from './statements';
+import { parseDecorators } from './expressions';
+import { Context } from '../utilities';
+/**
+ * Parse module item list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItemList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseModuleItemList(parser: Parser, context: Context): (ReturnType<typeof parseDirective | typeof parseModuleItem>)[];
+/**
+ * Parse module item
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseModuleItem(parser: Parser, context: Context): ReturnType<typeof parseDecorators | typeof parseExportDeclaration | typeof parseImportDeclaration | typeof parseStatementListItem>;
+/**
+ * Parse export declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseExportDeclaration(parser: Parser, context: Context): ESTree.ExportAllDeclaration | ESTree.ExportNamedDeclaration | ESTree.ExportDefaultDeclaration;
+/**
+ * Parse import declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseImportDeclaration(parser: Parser, context: Context): ESTree.ImportDeclaration;
diff --git a/node_modules/cherow/dist/types/parser/parser.d.ts b/node_modules/cherow/dist/types/parser/parser.d.ts new file mode 100644 index 0000000..34905fe --- /dev/null +++ b/node_modules/cherow/dist/types/parser/parser.d.ts @@ -0,0 +1,55 @@ +import * as ESTree from '../estree';
+import { Options, Parser } from '../types';
+import { Context } from '../utilities';
+/**
+ * Creates the parser object
+ *
+ * @param source The source coode to parser
+ * @param sourceFile Optional source file info to be attached in every node
+ */
+export declare function createParser(source: string, sourceFile: string | void): Parser;
+/**
+ * Creating the parser
+ *
+ * @param source The source coode to parser
+ * @param options The parser options
+ * @param context Context masks
+ */
+export declare function parseSource(source: string, options: Options | void, /*@internal*/ context: Context): ESTree.Program;
+/**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+export declare function parseStatementList(parser: Parser, context: Context): ESTree.Statement[];
+/**
+ * Parse either script code or module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+export declare function parse(source: string, options?: Options): ESTree.Program;
+/**
+ * Parse script code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+export declare function parseScript(source: string, options?: Options): ESTree.Program;
+/**
+ * Parse module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+export declare function parseModule(source: string, options?: Options): ESTree.Program;
diff --git a/node_modules/cherow/dist/types/parser/pattern.d.ts b/node_modules/cherow/dist/types/parser/pattern.d.ts new file mode 100644 index 0000000..3ed609e --- /dev/null +++ b/node_modules/cherow/dist/types/parser/pattern.d.ts @@ -0,0 +1,49 @@ +import * as ESTree from '../estree';
+import { Location, Parser } from '../types';
+import { Context } from '../utilities';
+/**
+ * Parses either a binding identifier or binding pattern
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseBindingIdentifierOrPattern(parser: Parser, context: Context, args?: string[]): ESTree.PatternTop;
+/**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BindingIdentifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseBindingIdentifier(parser: Parser, context: Context): ESTree.Identifier;
+/**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseAssignmentRestElement(parser: Parser, context: Context, args: string[]): ESTree.RestElement;
+/** Parse assignment pattern
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param left LHS of assignment pattern
+ * @param pos Location
+ */
+export declare function parseAssignmentPattern(parser: Parser, context: Context, left: ESTree.PatternTop, pos: Location): ESTree.AssignmentPattern;
+/**
+ * Parse binding initializer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseBindingInitializer(parser: Parser, context: Context): ESTree.Identifier | ESTree.ObjectPattern | ESTree.ArrayPattern | ESTree.MemberExpression | ESTree.AssignmentPattern;
diff --git a/node_modules/cherow/dist/types/parser/statements.d.ts b/node_modules/cherow/dist/types/parser/statements.d.ts new file mode 100644 index 0000000..6be770c --- /dev/null +++ b/node_modules/cherow/dist/types/parser/statements.d.ts @@ -0,0 +1,203 @@ +import * as ESTree from '../estree';
+import { Parser } from '../types';
+import { Context } from '../utilities';
+/**
+ * Parses statement list items
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementListItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseStatementListItem(parser: Parser, context: Context): ESTree.Statement;
+/**
+ * Parses statements
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseStatement(parser: Parser, context: Context): ESTree.Statement;
+/**
+ * Parses empty statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-EmptyStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseEmptyStatement(parser: Parser, context: Context): ESTree.EmptyStatement;
+/**
+ * Parses the continue statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ContinueStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseContinueStatement(parser: Parser, context: Context): ESTree.ContinueStatement;
+/**
+ * Parses the break statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BreakStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseBreakStatement(parser: Parser, context: Context): ESTree.BreakStatement;
+/**
+ * Parses the if statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-if-statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseIfStatement(parser: Parser, context: Context): ESTree.IfStatement;
+/**
+ * Parses the debugger statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DebuggerStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseDebuggerStatement(parser: Parser, context: Context): ESTree.DebuggerStatement;
+/**
+ * Parses try statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TryStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseTryStatement(parser: Parser, context: Context): ESTree.TryStatement;
+/**
+ * Parses catch block
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Catch)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseCatchBlock(parser: Parser, context: Context): ESTree.CatchClause;
+/**
+ * Parses throw statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ThrowStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseThrowStatement(parser: Parser, context: Context): ESTree.ThrowStatement;
+/**
+ * Parses expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseExpressionStatement(parser: Parser, context: Context): ESTree.ExpressionStatement;
+/**
+ * Parse directive node
+ *
+ * * @see [Link](https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseDirective(parser: Parser, context: Context): ESTree.ExpressionStatement;
+/**
+ * Parses either expression or labelled statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LabelledStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseExpressionOrLabelledStatement(parser: Parser, context: Context): ESTree.ExpressionStatement | ESTree.LabeledStatement;
+/**
+ * Parses do while statement
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseDoWhileStatement(parser: Parser, context: Context): ESTree.DoWhileStatement;
+/**
+ * Parses while statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-WhileStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseWhileStatement(parser: Parser, context: Context): ESTree.WhileStatement;
+/**
+ * Parses block statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BlockStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Block)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseBlockStatement(parser: Parser, context: Context): ESTree.BlockStatement;
+/**
+ * Parses return statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ReturnStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseReturnStatement(parser: Parser, context: Context): ESTree.ReturnStatement;
+/**
+ * Sets the necessary mutable parser flags. The parser flags will
+ * be unset after done parsing out the statements.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-IterationStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseIterationStatement(parser: Parser, context: Context): ESTree.Statement;
+/**
+ * Parses with statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-WithStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseWithStatement(parser: Parser, context: Context): ESTree.WithStatement;
+/**
+ * Parses switch statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SwitchStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseSwitchStatement(parser: Parser, context: Context): ESTree.SwitchStatement;
+/**
+ * Parses either default clause or case clauses
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CaseClauses)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DefaultClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseCaseOrDefaultClauses(parser: Parser, context: Context): ESTree.SwitchCase;
+/**
+ * Parses variable statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseVariableStatement(parser: Parser, context: Context, shouldConsume?: boolean): ESTree.VariableDeclaration;
diff --git a/node_modules/cherow/dist/types/token.d.ts b/node_modules/cherow/dist/types/token.d.ts new file mode 100644 index 0000000..e7075bf --- /dev/null +++ b/node_modules/cherow/dist/types/token.d.ts @@ -0,0 +1,166 @@ +/**
+ * The token types and attributes.
+ */
+export declare const enum Token {
+ Type = 255,
+ PrecStart = 8,
+ Precedence = 3840,
+ Keyword = 4096,
+ Reserved = 12288,
+ FutureReserved = 20480,
+ Contextual = 69632,
+ IsIdentifier = 131072,
+ IsAwait = 262144,
+ IsAsync = 524288,
+ ASI = 1048576,
+ IsLogical = 2097152,
+ IsEvalOrArguments = 4194304,
+ IsBindingPattern = 8388608,
+ IsShorthandProperty = 16777216,
+ IsExpressionStart = 33554432,
+ IsAssignOp = 67108864,
+ IsBinaryOp = 167772160,
+ IsUnaryOp = 301989888,
+ IsUpdateOp = 570425344,
+ IsYield = 1073741824,
+ EndOfSource = 1048576,
+ Identifier = 33685505,
+ NumericLiteral = 33554434,
+ StringLiteral = 33554435,
+ RegularExpression = 33554436,
+ FalseKeyword = 33566725,
+ TrueKeyword = 33566726,
+ NullKeyword = 33566727,
+ TemplateCont = 33554440,
+ TemplateTail = 33554441,
+ Arrow = 10,
+ LeftParen = 50331659,
+ LeftBrace = 41943052,
+ Period = 16777229,
+ Ellipsis = 14,
+ RightBrace = 17825807,
+ RightParen = 16,
+ Semicolon = 17825809,
+ Comma = 16777234,
+ LeftBracket = 41943059,
+ RightBracket = 20,
+ Colon = 16777237,
+ QuestionMark = 22,
+ SingleQuote = 23,
+ DoubleQuote = 24,
+ JSXClose = 25,
+ JSXAutoClose = 26,
+ Increment = 570425371,
+ Decrement = 570425372,
+ Assign = 83886109,
+ ShiftLeftAssign = 67108894,
+ ShiftRightAssign = 67108895,
+ LogicalShiftRightAssign = 67108896,
+ ExponentiateAssign = 67108897,
+ AddAssign = 67108898,
+ SubtractAssign = 67108899,
+ MultiplyAssign = 67108900,
+ DivideAssign = 100663333,
+ ModuloAssign = 67108902,
+ BitwiseXorAssign = 67108903,
+ BitwiseOrAssign = 67108904,
+ BitwiseAndAssign = 67108905,
+ TypeofKeyword = 302002218,
+ DeleteKeyword = 302002219,
+ VoidKeyword = 302002220,
+ Negate = 301989933,
+ Complement = 301989934,
+ Add = 436209967,
+ Subtract = 436209968,
+ InKeyword = 167786289,
+ InstanceofKeyword = 167786290,
+ Multiply = 167774771,
+ Modulo = 167774772,
+ Divide = 167774773,
+ Exponentiate = 167775030,
+ LogicalAnd = 169869879,
+ LogicalOr = 169869624,
+ StrictEqual = 167773753,
+ StrictNotEqual = 167773754,
+ LooseEqual = 167773755,
+ LooseNotEqual = 167773756,
+ LessThanOrEqual = 167774013,
+ GreaterThanOrEqual = 167774014,
+ LessThan = 167774015,
+ GreaterThan = 167774016,
+ ShiftLeft = 167774273,
+ ShiftRight = 167774274,
+ LogicalShiftRight = 167774275,
+ BitwiseAnd = 167773508,
+ BitwiseOr = 167772997,
+ BitwiseXor = 167773254,
+ VarKeyword = 33566791,
+ LetKeyword = 33574984,
+ ConstKeyword = 33566793,
+ BreakKeyword = 12362,
+ CaseKeyword = 12363,
+ CatchKeyword = 12364,
+ ClassKeyword = 33566797,
+ ContinueKeyword = 12366,
+ DebuggerKeyword = 12367,
+ DefaultKeyword = 12368,
+ DoKeyword = 12369,
+ ElseKeyword = 12370,
+ ExportKeyword = 12371,
+ ExtendsKeyword = 12372,
+ FinallyKeyword = 12373,
+ ForKeyword = 12374,
+ FunctionKeyword = 33566808,
+ IfKeyword = 12377,
+ ImportKeyword = 33566810,
+ NewKeyword = 33566811,
+ ReturnKeyword = 12380,
+ SuperKeyword = 33566813,
+ SwitchKeyword = 33566814,
+ ThisKeyword = 33566815,
+ ThrowKeyword = 302002272,
+ TryKeyword = 12385,
+ WhileKeyword = 12386,
+ WithKeyword = 12387,
+ ImplementsKeyword = 20579,
+ InterfaceKeyword = 20580,
+ PackageKeyword = 20581,
+ PrivateKeyword = 20582,
+ ProtectedKeyword = 20583,
+ PublicKeyword = 20584,
+ StaticKeyword = 20585,
+ YieldKeyword = 1107316842,
+ AsKeyword = 167843947,
+ AsyncKeyword = 594028,
+ AwaitKeyword = 34017389,
+ ConstructorKeyword = 69742,
+ GetKeyword = 69743,
+ SetKeyword = 69744,
+ FromKeyword = 69745,
+ OfKeyword = 69746,
+ Hash = 115,
+ Eval = 37879924,
+ Arguments = 37879925,
+ EnumKeyword = 12406,
+ BigIntLiteral = 33554551,
+ At = 120,
+ JSXText = 121,
+ /** TS */
+ KeyOfKeyword = 131194,
+ ReadOnlyKeyword = 131195,
+ IsKeyword = 131196,
+ UniqueKeyword = 131197,
+ DeclareKeyword = 131198,
+ TypeKeyword = 131199,
+ NameSpaceKeyword = 131200,
+ AbstractKeyword = 131201,
+ ModuleKeyword = 131202,
+ GlobalKeyword = 131203,
+ RequireKeyword = 131204,
+ TargetKeyword = 131205
+}
+/**
+ * The conversion function between token and its string description/representation.
+ */
+export declare function tokenDesc(token: Token): string;
+export declare function descKeyword(value: string): Token;
diff --git a/node_modules/cherow/dist/types/types.d.ts b/node_modules/cherow/dist/types/types.d.ts new file mode 100644 index 0000000..f638fdd --- /dev/null +++ b/node_modules/cherow/dist/types/types.d.ts @@ -0,0 +1,71 @@ +import { Flags } from './utilities';
+import { Token } from './token';
+import * as parser from './parser/index';
+/**
+ * ForStatement types.
+ */
+export declare type ForStatementType = 'ForStatement' | 'ForOfStatement' | 'ForInStatement';
+/**
+ * Comment types.
+ */
+export declare type CommentType = 'MultiLine' | 'SingleLine' | 'SheBang' | 'HTMLOpen' | 'HTMLClose';
+/**
+ * The parser options.
+ */
+export interface Options {
+ module?: boolean;
+ comments?: boolean;
+ next?: boolean;
+ ranges?: boolean;
+ loc?: boolean;
+ jsx?: boolean;
+ raw?: boolean;
+ rawIdentifier?: boolean;
+ source?: string;
+ impliedStrict?: boolean;
+ globalReturn?: boolean;
+ experimental?: boolean;
+ skipShebang?: boolean;
+ tolerant?: boolean;
+ node?: boolean;
+}
+/**
+ * The parser interface.
+ */
+export interface Parser {
+ source: string;
+ length: number;
+ index: number;
+ line: number;
+ column: number;
+ startIndex: number;
+ startColumn: number;
+ startLine: number;
+ lastIndex: number;
+ lastColumn: number;
+ lastLine: number;
+ pendingExpressionError: any;
+ flags: Flags;
+ sourceFile: string | void;
+ errorLocation: any;
+ labelSet: any;
+ comments: any;
+ tokenValue: any;
+ tokenRaw: string;
+ lastValue: number;
+ tokenRegExp: any;
+ token: Token;
+ errors: any[];
+}
+export declare const Parser: {
+ [P in keyof typeof parser]: typeof parser[P];
+};
+/**
+ * Line / column location
+ *
+ */
+export interface Location {
+ index: number;
+ column: number;
+ line: number;
+}
diff --git a/node_modules/cherow/dist/types/unicode.d.ts b/node_modules/cherow/dist/types/unicode.d.ts new file mode 100644 index 0000000..5a3cd33 --- /dev/null +++ b/node_modules/cherow/dist/types/unicode.d.ts @@ -0,0 +1,4 @@ +declare function isValidIdentifierPart(code: number): boolean;
+declare function isValidIdentifierStart(code: number): boolean;
+declare function mustEscape(code: number): boolean;
+export { isValidIdentifierPart, isValidIdentifierStart, mustEscape };
diff --git a/node_modules/cherow/dist/types/utilities.d.ts b/node_modules/cherow/dist/types/utilities.d.ts new file mode 100644 index 0000000..0e6ef21 --- /dev/null +++ b/node_modules/cherow/dist/types/utilities.d.ts @@ -0,0 +1,403 @@ +import * as ESTree from './estree';
+import { Errors } from './errors';
+import { Parser, Location } from './types';
+import { Token } from './token';
+export declare enum Context {
+ Empty = 0,
+ OptionsNext = 1,
+ OptionsRanges = 2,
+ OptionsJSX = 4,
+ OptionsRaw = 8,
+ OptionsLoc = 16,
+ OptionsGlobalReturn = 32,
+ OptionsComments = 64,
+ OptionsShebang = 128,
+ OptionsRawidentifiers = 256,
+ OptionsTolerant = 512,
+ OptionsNode = 1024,
+ OptionsExperimental = 2048,
+ Strict = 4096,
+ Module = 8192,
+ TaggedTemplate = 16384,
+ InClass = 32768,
+ AllowIn = 65536,
+ Async = 131072,
+ Yield = 262144,
+ InParameter = 524288,
+ InFunctionBody = 1048576,
+ AllowSingleStatement = 2097152,
+ BlockScope = 4194304,
+ ForStatement = 8388608,
+ RequireIdentifier = 16777216,
+ Method = 33554432,
+ AllowSuperProperty = 67108864,
+ InParen = 134217728,
+ InJSXChild = 268435456,
+ DisallowEscapedKeyword = 536870912,
+ AllowDecorator = 1073741824,
+ LocationTracker = 18
+}
+export declare enum Flags {
+ None = 0,
+ NewLine = 1,
+ AllowBinding = 2,
+ AllowDestructuring = 4,
+ SimpleParameterList = 8,
+ InSwitchStatement = 16,
+ InIterationStatement = 32,
+ HasStrictReserved = 64,
+ HasOctal = 128,
+ SimpleAssignmentTarget = 256,
+ HasProtoField = 512,
+ StrictFunctionName = 1024,
+ StrictEvalArguments = 2048,
+ InFunctionBody = 4096,
+ HasAwait = 8192,
+ HasYield = 16384,
+ EscapedKeyword = 32768,
+ HasConstructor = 65536
+}
+export declare enum Labels {
+ None = 0,
+ NotNested = 1,
+ Nested = 2
+}
+export declare enum NumericState {
+ None = 0,
+ SeenSeparator = 1,
+ EigthOrNine = 2,
+ Float = 4,
+ BigInt = 8
+}
+export declare enum ScannerState {
+ None = 0,
+ NewLine = 1,
+ LastIsCR = 2
+}
+export declare enum ModifierState {
+ None = 0,
+ Generator = 1,
+ Await = 2
+}
+export declare enum CoverParenthesizedState {
+ None = 0,
+ SequenceExpression = 1,
+ HasEvalOrArguments = 2,
+ HasReservedWords = 4,
+ HasYield = 8,
+ HasBinding = 16
+}
+export declare enum Escape {
+ Empty = -1,
+ StrictOctal = -2,
+ EightOrNine = -3,
+ InvalidHex = -4,
+ OutOfRange = -5
+}
+export declare enum RegexFlags {
+ Empty = 0,
+ IgnoreCase = 1,
+ Global = 2,
+ Multiline = 4,
+ Unicode = 8,
+ Sticky = 16,
+ DotAll = 32
+}
+export declare enum CoverCallState {
+ Empty = 0,
+ SeenSpread = 1,
+ HasSpread = 2,
+ SimpleParameter = 4,
+ EvalOrArguments = 8,
+ Yield = 16,
+ Await = 32
+}
+export declare enum RegexState {
+ Empty = 0,
+ Escape = 1,
+ Class = 2
+}
+export declare enum ObjectState {
+ None = 0,
+ Async = 1,
+ Generator = 2,
+ Getter = 4,
+ Setter = 8,
+ Computed = 16,
+ Method = 32,
+ Shorthand = 64,
+ Static = 128,
+ Constructor = 256,
+ Heritage = 512
+}
+/**
+ * Validate break and continue statement
+ *
+ * @param parser Parser object
+ * @param label label
+ * @param isContinue true if validation continue statement
+ */
+export declare function validateBreakOrContinueLabel(parser: Parser, context: Context, label: string, isContinue: boolean): void;
+/**
+ * Add label to the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+export declare function addLabel(parser: Parser, label: string): void;
+/**
+ * Remove label from the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+export declare function popLabel(parser: Parser, label: string): void;
+/**
+ * Returns either true or false. Depends if the label exist.
+ *
+ * @param parser Parser object
+ * @param label Label
+ */
+export declare function hasLabel(parser: Parser, label: string): Labels;
+/**
+ * Finish each the node for each parse. Set line / and column on the node if the
+ * options are set for it
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Line / column
+ * @param node AST node
+ */
+export declare function finishNode<T extends ESTree.Node>(context: Context, parser: Parser, meta: Location, node: any): T;
+/**
+ * Consumes the next token. If the consumed token is not of the expected type
+ * then report an error and return null. Otherwise return true.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ * @param Err Optionally error message to be thrown
+ */
+export declare function expect(parser: Parser, context: Context, token: Token, err?: Errors): boolean;
+/**
+ * If the next token matches the given token, this consumes the token
+ * and returns true. Otherwise return false.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ */
+export declare function consume(parser: Parser, context: Context, token: Token): boolean;
+/**
+ * Advance and return the next token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function nextToken(parser: Parser, context: Context): Token;
+export declare const hasBit: (mask: number, flags: number) => boolean;
+/**
+ * Automatic Semicolon Insertion
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function consumeSemicolon(parser: Parser, context: Context): void | boolean;
+/**
+ * Bit fiddle current grammar state and keep track of the state during the parse and restore
+ * it back to original state after finish parsing or throw.
+ *
+ * Ideas for this is basicly from V8 and SM, but also the Esprima parser does this in a similar way.
+ *
+ * However this implementation is an major improvement over similiar implementations, and
+ * does not require additonal bitmasks to be set / unset during the parsing outside this function.
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ * @param errMsg Optional error message
+ */
+export declare function parseExpressionCoverGrammar<T>(parser: Parser, context: Context, callback: (parser: Parser, context: Context) => T): T;
+/**
+ * Restor current grammar to previous state, or unset necessary bitmasks
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ */
+export declare function restoreExpressionCoverGrammar<T>(parser: Parser, context: Context, callback: (parser: Parser, context: Context) => T): T;
+/**
+ * Set / unset yield / await context masks based on the
+ * ModifierState masks before invoking the callback and
+ * returning it's content
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Modifier state
+ * @param callback Callback function to be invoked
+ * @param methodState Optional Objectstate.
+ */
+export declare function swapContext<T>(parser: Parser, context: Context, state: ModifierState, callback: (parser: Parser, context: Context, state: ObjectState) => T, methodState?: ObjectState): T;
+/**
+ * Validates function params
+ *
+ * Note! In case anyone want to enable full scoping, replace 'paramSet' with an similiar
+ * object on the parser object itself. Then push / set the tokenValue to
+ * it an use an bitmask to mark it as an 'variable' not 'blockscope'. Then when
+ * implementing lexical scoping, you can use that for validation.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param params Array of token values
+ */
+export declare function validateParams(parser: Parser, context: Context, params: string[]): void;
+/**
+ * Reinterpret various expressions as pattern
+ * This is only used for assignment and arrow parameter list
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param node AST node
+ */
+export declare const reinterpret: (parser: Parser, context: Context, node: any) => void;
+/**
+ * Does a lookahead.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param callback Callback function to be invoked
+ */
+export declare function lookahead<T>(parser: Parser, context: Context, callback: (parser: Parser, context: Context) => T): T;
+/**
+ * Returns true if this an valid simple assignment target
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function isValidSimpleAssignmentTarget(node: ESTree.Node): boolean;
+/**
+ * Get current node location
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function getLocation(parser: Parser): Location;
+/**
+ * Returns true if this is an valid identifier
+ *
+ * @param context Context masks
+ * @param t Token
+ */
+export declare function isValidIdentifier(context: Context, t: Token): boolean;
+/**
+ * Returns true if this an valid lexical binding and not an identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function isLexical(parser: Parser, context: Context): boolean;
+/**
+ * Returns true if this is end of case or default clauses
+ *
+ * @param parser Parser object
+ */
+export declare function isEndOfCaseOrDefaultClauses(parser: Parser): boolean;
+/**
+ * Validates if the next token in the stream is a left paren or a period
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function nextTokenIsLeftParenOrPeriod(parser: Parser, context: Context): boolean;
+/**
+ * Validates if the next token in the stream is a identifier or left paren
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function nextTokenisIdentifierOrParen(parser: Parser, context: Context): boolean | number;
+/**
+ * Validates if the next token in the stream is left parenthesis.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function nextTokenIsLeftParen(parser: Parser, context: Context): boolean;
+/**
+ * Validates if the next token in the stream is a function keyword on the same line.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function nextTokenIsFuncKeywordOnSameLine(parser: Parser, context: Context): boolean;
+/**
+ * Checks if the property has any private field key
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function isPropertyWithPrivateFieldKey(expr: any): boolean;
+/**
+ * Parse and classify itendifier - similar method as in V8
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+export declare function parseAndClassifyIdentifier(parser: Parser, context: Context): any;
+export declare function nameIsArgumentsOrEval(value: string): boolean;
+/**
+ * Records an error from current position. If we report an error later, we'll do it from
+ * this position.
+ *
+ * @param parser Parser object
+ */
+export declare function setPendingError(parser: Parser): void;
+/**
+ * Returns tagName for JSX element
+ *
+ * @param elementName JSX Element name
+ */
+export declare function isEqualTagNames(elementName: ESTree.JSXNamespacedName | ESTree.JSXIdentifier | ESTree.JSXMemberExpression): string;
+/**
+ * Returns true if this is an instance field ( stage 3 proposal)
+ *
+ * @param parser Parser object
+ */
+export declare function isInstanceField(parser: Parser): boolean;
+/**
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expr AST expressions
+ * @param prefix prefix
+ */
+export declare function validateUpdateExpression(parser: Parser, context: Context, expr: ESTree.Expression, prefix: string): void;
+/**
+ * Record expression error
+ *
+ * @param parser Parser object
+ * @param error Error message
+ */
+export declare function setPendingExpressionError(parser: Parser, type: Errors): void;
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+export declare function validateCoverParenthesizedExpression(parser: Parser, state: CoverParenthesizedState): CoverParenthesizedState;
+/**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+export declare function validateAsyncArgumentList(parser: Parser, context: Context, state: CoverCallState): CoverCallState;
+/**
+ * Returns true if in or of token. Otherwise return false,
+ *
+ * @param t Token
+ */
+export declare function isInOrOf(t: Token): boolean;
diff --git a/node_modules/cherow/dist/types/xhtml-entities.d.ts b/node_modules/cherow/dist/types/xhtml-entities.d.ts new file mode 100644 index 0000000..4ead618 --- /dev/null +++ b/node_modules/cherow/dist/types/xhtml-entities.d.ts @@ -0,0 +1,254 @@ +export declare const XHTMLEntities: {
+ quot: string;
+ amp: string;
+ apos: string;
+ gt: string;
+ nbsp: string;
+ iexcl: string;
+ cent: string;
+ pound: string;
+ curren: string;
+ yen: string;
+ brvbar: string;
+ sect: string;
+ uml: string;
+ copy: string;
+ ordf: string;
+ laquo: string;
+ not: string;
+ shy: string;
+ reg: string;
+ macr: string;
+ deg: string;
+ plusmn: string;
+ sup2: string;
+ sup3: string;
+ acute: string;
+ micro: string;
+ para: string;
+ middot: string;
+ cedil: string;
+ sup1: string;
+ ordm: string;
+ raquo: string;
+ frac14: string;
+ frac12: string;
+ frac34: string;
+ iquest: string;
+ Agrave: string;
+ Aacute: string;
+ Acirc: string;
+ Atilde: string;
+ Auml: string;
+ Aring: string;
+ AElig: string;
+ Ccedil: string;
+ Egrave: string;
+ Eacute: string;
+ Ecirc: string;
+ Euml: string;
+ Igrave: string;
+ Iacute: string;
+ Icirc: string;
+ Iuml: string;
+ ETH: string;
+ Ntilde: string;
+ Ograve: string;
+ Oacute: string;
+ Ocirc: string;
+ Otilde: string;
+ Ouml: string;
+ times: string;
+ Oslash: string;
+ Ugrave: string;
+ Uacute: string;
+ Ucirc: string;
+ Uuml: string;
+ Yacute: string;
+ THORN: string;
+ szlig: string;
+ agrave: string;
+ aacute: string;
+ acirc: string;
+ atilde: string;
+ auml: string;
+ aring: string;
+ aelig: string;
+ ccedil: string;
+ egrave: string;
+ eacute: string;
+ ecirc: string;
+ euml: string;
+ igrave: string;
+ iacute: string;
+ icirc: string;
+ iuml: string;
+ eth: string;
+ ntilde: string;
+ ograve: string;
+ oacute: string;
+ ocirc: string;
+ otilde: string;
+ ouml: string;
+ divide: string;
+ oslash: string;
+ ugrave: string;
+ uacute: string;
+ ucirc: string;
+ uuml: string;
+ yacute: string;
+ thorn: string;
+ yuml: string;
+ OElig: string;
+ oelig: string;
+ Scaron: string;
+ scaron: string;
+ Yuml: string;
+ fnof: string;
+ circ: string;
+ tilde: string;
+ Alpha: string;
+ Beta: string;
+ Gamma: string;
+ Delta: string;
+ Epsilon: string;
+ Zeta: string;
+ Eta: string;
+ Theta: string;
+ Iota: string;
+ Kappa: string;
+ Lambda: string;
+ Mu: string;
+ Nu: string;
+ Xi: string;
+ Omicron: string;
+ Pi: string;
+ Rho: string;
+ Sigma: string;
+ Tau: string;
+ Upsilon: string;
+ Phi: string;
+ Chi: string;
+ Psi: string;
+ Omega: string;
+ alpha: string;
+ beta: string;
+ gamma: string;
+ delta: string;
+ epsilon: string;
+ zeta: string;
+ eta: string;
+ theta: string;
+ iota: string;
+ kappa: string;
+ lambda: string;
+ mu: string;
+ nu: string;
+ xi: string;
+ omicron: string;
+ pi: string;
+ rho: string;
+ sigmaf: string;
+ sigma: string;
+ tau: string;
+ upsilon: string;
+ phi: string;
+ chi: string;
+ psi: string;
+ omega: string;
+ thetasym: string;
+ upsih: string;
+ piv: string;
+ ensp: string;
+ emsp: string;
+ thinsp: string;
+ zwnj: string;
+ zwj: string;
+ lrm: string;
+ rlm: string;
+ ndash: string;
+ mdash: string;
+ lsquo: string;
+ rsquo: string;
+ sbquo: string;
+ ldquo: string;
+ rdquo: string;
+ bdquo: string;
+ dagger: string;
+ Dagger: string;
+ bull: string;
+ hellip: string;
+ permil: string;
+ prime: string;
+ Prime: string;
+ lsaquo: string;
+ rsaquo: string;
+ oline: string;
+ frasl: string;
+ euro: string;
+ image: string;
+ weierp: string;
+ real: string;
+ trade: string;
+ alefsym: string;
+ larr: string;
+ uarr: string;
+ rarr: string;
+ darr: string;
+ harr: string;
+ crarr: string;
+ lArr: string;
+ uArr: string;
+ rArr: string;
+ dArr: string;
+ hArr: string;
+ forall: string;
+ part: string;
+ exist: string;
+ empty: string;
+ nabla: string;
+ isin: string;
+ notin: string;
+ ni: string;
+ prod: string;
+ sum: string;
+ minus: string;
+ lowast: string;
+ radic: string;
+ prop: string;
+ infin: string;
+ ang: string;
+ and: string;
+ or: string;
+ cap: string;
+ cup: string;
+ int: string;
+ there4: string;
+ sim: string;
+ cong: string;
+ asymp: string;
+ ne: string;
+ equiv: string;
+ le: string;
+ ge: string;
+ sub: string;
+ sup: string;
+ nsub: string;
+ sube: string;
+ supe: string;
+ oplus: string;
+ otimes: string;
+ perp: string;
+ sdot: string;
+ lceil: string;
+ rceil: string;
+ lfloor: string;
+ rfloor: string;
+ loz: string;
+ spades: string;
+ clubs: string;
+ hearts: string;
+ diams: string;
+ lang: string;
+ rang: string;
+};
diff --git a/node_modules/cherow/dist/umd/cherow.js b/node_modules/cherow/dist/umd/cherow.js new file mode 100644 index 0000000..3aed3ca --- /dev/null +++ b/node_modules/cherow/dist/umd/cherow.js @@ -0,0 +1,7323 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.cherow = {}))); +}(this, (function (exports) { 'use strict'; + + // Note: this *must* be kept in sync with the enum's order.
+ //
+ // It exploits the enum value ordering, and it's necessarily a complete and
+ // utter hack.
+ //
+ // All to lower it to a single monomorphic array access.
+ const keywordDescTable = [
+ 'end of source',
+ /* Constants/Bindings */
+ 'identifier', 'number', 'string', 'regular expression',
+ 'false', 'true', 'null',
+ /* Template nodes */
+ 'template continuation', 'template end',
+ /* Punctuators */
+ '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '</', '/>',
+ /* Update operators */
+ '++', '--',
+ /* Assign operators */
+ '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
+ '&=',
+ /* Unary/binary operators */
+ 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
+ '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
+ /* Variable declaration kinds */
+ 'var', 'let', 'const',
+ /* Other reserved words */
+ 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
+ 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
+ 'this', 'throw', 'try', 'while', 'with',
+ /* Strict mode reserved words */
+ 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
+ /* Contextual keywords */
+ 'as', 'async', 'await', 'constructor', 'get', 'set', 'from', 'of',
+ '#',
+ 'eval', 'arguments', 'enum', 'BigInt', '@', 'JSXText',
+ /** TS */
+ 'KeyOf', 'ReadOnly', 'is', 'unique', 'declare', 'type', 'namespace', 'abstract', 'module',
+ 'global', 'require', 'target'
+ ];
+ /**
+ * The conversion function between token and its string description/representation.
+ */
+ function tokenDesc(token) {
+ return keywordDescTable[token & 255 /* Type */];
+ }
+ // Used `Object.create(null)` to avoid potential `Object.prototype`
+ // interference.
+ const descKeywordTable = Object.create(null, {
+ this: { value: 33566815 /* ThisKeyword */ },
+ function: { value: 33566808 /* FunctionKeyword */ },
+ if: { value: 12377 /* IfKeyword */ },
+ return: { value: 12380 /* ReturnKeyword */ },
+ var: { value: 33566791 /* VarKeyword */ },
+ else: { value: 12370 /* ElseKeyword */ },
+ for: { value: 12374 /* ForKeyword */ },
+ new: { value: 33566811 /* NewKeyword */ },
+ in: { value: 167786289 /* InKeyword */ },
+ typeof: { value: 302002218 /* TypeofKeyword */ },
+ while: { value: 12386 /* WhileKeyword */ },
+ case: { value: 12363 /* CaseKeyword */ },
+ break: { value: 12362 /* BreakKeyword */ },
+ try: { value: 12385 /* TryKeyword */ },
+ catch: { value: 12364 /* CatchKeyword */ },
+ delete: { value: 302002219 /* DeleteKeyword */ },
+ throw: { value: 302002272 /* ThrowKeyword */ },
+ switch: { value: 33566814 /* SwitchKeyword */ },
+ continue: { value: 12366 /* ContinueKeyword */ },
+ default: { value: 12368 /* DefaultKeyword */ },
+ instanceof: { value: 167786290 /* InstanceofKeyword */ },
+ do: { value: 12369 /* DoKeyword */ },
+ void: { value: 302002220 /* VoidKeyword */ },
+ finally: { value: 12373 /* FinallyKeyword */ },
+ arguments: { value: 37879925 /* Arguments */ },
+ keyof: { value: 131194 /* KeyOfKeyword */ },
+ readonly: { value: 131195 /* ReadOnlyKeyword */ },
+ unique: { value: 131197 /* UniqueKeyword */ },
+ declare: { value: 131198 /* DeclareKeyword */ },
+ async: { value: 594028 /* AsyncKeyword */ },
+ await: { value: 34017389 /* AwaitKeyword */ },
+ class: { value: 33566797 /* ClassKeyword */ },
+ const: { value: 33566793 /* ConstKeyword */ },
+ constructor: { value: 69742 /* ConstructorKeyword */ },
+ debugger: { value: 12367 /* DebuggerKeyword */ },
+ enum: { value: 12406 /* EnumKeyword */ },
+ eval: { value: 37879924 /* Eval */ },
+ export: { value: 12371 /* ExportKeyword */ },
+ extends: { value: 12372 /* ExtendsKeyword */ },
+ false: { value: 33566725 /* FalseKeyword */ },
+ from: { value: 69745 /* FromKeyword */ },
+ get: { value: 69743 /* GetKeyword */ },
+ implements: { value: 20579 /* ImplementsKeyword */ },
+ import: { value: 33566810 /* ImportKeyword */ },
+ interface: { value: 20580 /* InterfaceKeyword */ },
+ let: { value: 33574984 /* LetKeyword */ },
+ null: { value: 33566727 /* NullKeyword */ },
+ of: { value: 69746 /* OfKeyword */ },
+ package: { value: 20581 /* PackageKeyword */ },
+ private: { value: 20582 /* PrivateKeyword */ },
+ protected: { value: 20583 /* ProtectedKeyword */ },
+ public: { value: 20584 /* PublicKeyword */ },
+ set: { value: 69744 /* SetKeyword */ },
+ static: { value: 20585 /* StaticKeyword */ },
+ super: { value: 33566813 /* SuperKeyword */ },
+ true: { value: 33566726 /* TrueKeyword */ },
+ with: { value: 12387 /* WithKeyword */ },
+ yield: { value: 1107316842 /* YieldKeyword */ },
+ is: { value: 131196 /* IsKeyword */ },
+ type: { value: 131199 /* TypeKeyword */ },
+ namespace: { value: 131200 /* NameSpaceKeyword */ },
+ abstract: { value: 131201 /* AbstractKeyword */ },
+ as: { value: 167843947 /* AsKeyword */ },
+ module: { value: 131202 /* ModuleKeyword */ },
+ global: { value: 131203 /* GlobalKeyword */ },
+ require: { value: 131204 /* RequireKeyword */ },
+ target: { value: 131205 /* TargetKeyword */ },
+ });
+ function descKeyword(value) {
+ return (descKeywordTable[value] | 0);
+ } + + /*@internal*/
+ const characterType = [
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 16 /* Space */,
+ 16 /* Space */,
+ 48 /* Whitespace */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 16 /* Space */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 9 /* Decimals */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 7 /* Hexadecimal */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 3 /* Letters */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ 0 /* Unknown */,
+ ]; + + // Unicode v. 11 support
+ // tslint:disable
+ function isValidIdentifierPart(code) {
+ return (convert[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
+ }
+ function isValidIdentifierStart(code) {
+ return (convert[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
+ }
+ function mustEscape(code) {
+ return (convert[(code >>> 5) + 69632] >>> code & 31 & 1) !== 0;
+ }
+ const convert = ((compressed, lookup) => {
+ const result = new Uint32Array(104448);
+ let index = 0;
+ let subIndex = 0;
+ while (index < 3392) {
+ const inst = compressed[index++];
+ if (inst < 0) {
+ subIndex -= inst;
+ }
+ else {
+ let code = compressed[index++];
+ if (inst & 2)
+ code = lookup[code];
+ if (inst & 1) {
+ result.fill(code, subIndex, subIndex += compressed[index++]);
+ }
+ else {
+ result[subIndex++] = code;
+ }
+ }
+ }
+ return result;
+ })([-1, 2, 28, 2, 29, 2, 5, -1, 0, 77595648, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 15, 2, 60, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 61, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 20, 2, 0, 0, 608174079, 2, 0, 2, 127, 2, 6, 2, 62, -1, 2, 64, 2, 26, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2965387679, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 2, 171, 0, 4294828031, 0, 3825204735, 0, 123747807, 0, 65487, 2, 3, 0, 4092591615, 0, 1080049119, 0, 458703, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247020, 2, 68, 0, 4284449919, 0, 851904, 2, 4, 2, 16, 0, 67076095, -1, 2, 69, 0, 1006628014, 0, 4093591391, -1, 0, 50331649, 0, 3265266687, 2, 34, 0, 4294844415, 0, 4278190047, 2, 23, 2, 125, -1, 3, 0, 2, 2, 33, 2, 0, 2, 9, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 10, 0, 261632, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 2088959, 2, 31, 2, 8, 0, 909311, 3, 0, 2, 0, 814743551, 2, 42, 0, 67057664, 3, 0, 2, 2, 45, 2, 0, 2, 32, 2, 0, 2, 18, 2, 7, 0, 268374015, 2, 30, 2, 51, 2, 0, 2, 78, 0, 134153215, -1, 2, 6, 2, 0, 2, 7, 0, 2684354559, 0, 67044351, 0, 1073676416, -2, 3, 0, 2, 2, 43, 0, 1046528, 3, 0, 3, 2, 8, 2, 0, 2, 41, 0, 4294960127, 2, 9, 2, 39, 2, 10, 0, 4294377472, 2, 21, 3, 0, 7, 0, 4227858431, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -1, 2, 122, 0, 1048577, 2, 84, 2, 12, -1, 2, 12, 0, 131042, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 1046559, 2, 0, 2, 13, 2, 0, 0, 2147516671, 2, 24, 3, 88, 2, 2, 0, -16, 2, 89, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 2, 119, 2, 0, 0, 3220242431, 3, 0, 3, 2, 20, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 2, 0, 2, 27, 2, 0, 2, 8, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 25, 2, 8, 2, 23, 3, 0, 2, 0, 67076097, 2, 7, 2, 0, 2, 24, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 3774349439, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, 2, 19, 0, 1638399, 2, 169, 2, 104, 3, 0, 3, 2, 23, 2, 28, 2, 29, 2, 5, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -3, 2, 146, -4, 2, 23, 2, 0, 2, 37, 0, 1, 2, 0, 2, 63, 2, 32, 2, 16, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 33, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277137519, 0, 2269118463, -1, 3, 23, 2, -1, 2, 34, 2, 38, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 48, -14, 2, 23, 2, 44, 2, 37, -5, 3, 0, 2, 2, 38, 0, 2147549120, 2, 0, 2, 16, 2, 17, 2, 130, 2, 0, 2, 52, 0, 4294901872, 0, 5242879, 3, 0, 2, 0, 402595359, -1, 2, 118, 0, 1090519039, -2, 2, 120, 2, 39, 2, 0, 2, 55, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, -4, 3, 0, 2, 0, 1140787199, -1, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 41, 2, 42, -1, 2, 10, 2, 43, -6, 2, 0, 2, 16, -3, 3, 0, 2, 0, 2147484671, -8, 2, 0, 2, 7, 2, 44, 2, 0, 0, 603979727, -1, 2, 0, 2, 45, -8, 2, 54, 2, 46, 0, 67043329, 2, 123, 2, 47, 0, 8388351, -2, 2, 124, 0, 3028287487, 2, 48, 2, 126, 0, 33259519, 2, 42, -9, 2, 24, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, 2, 42, -2, 2, 17, 2, 51, 2, 0, 2, 24, 0, 67043343, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 4294901791, 2, 7, 2, 164, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 0, 1677656575, -166, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 90, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -42, 0, 4194303871, 0, 2011, -62, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 55, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -22583, 3, 0, 7, 2, 19, -6130, 3, 5, 2, -1, 0, 69207040, 3, 46, 2, 3, 0, 14, 2, 57, 2, 58, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 15, 2, 60, 2, 0, 2, 35, -1, 2, 17, 2, 61, -1, 2, 0, 2, 62, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 19, 2, 63, 3, 0, 2, 0, 131135, 2, 94, 0, 70256639, 0, 71303167, 0, 272, 2, 45, 2, 62, -1, 2, 64, -2, 2, 96, 0, 603979775, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 65, 2, 66, 0, 33554435, 2, 121, 2, 65, 2, 147, 0, 131075, 0, 3594373096, 0, 67094296, 2, 66, -1, 2, 67, 0, 603979263, 2, 156, 0, 3, 0, 4294828001, 0, 602930687, 2, 180, 0, 393219, 2, 67, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 68, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 69, 0, 537783470, 0, 4026531935, -1, 0, 1, -1, 2, 34, 2, 70, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 13, 2, 14, 3, 0, 10, 2, 71, 2, 0, 2, 72, 2, 73, 2, 74, 2, 0, 2, 75, 2, 0, 2, 16, -1, 2, 19, 3, 0, 2, 2, 11, 2, 4, 3, 0, 18, 2, 76, 2, 5, 3, 0, 2, 2, 77, 0, 253951, 3, 20, 2, 0, 122879, 2, 0, 2, 8, 0, 276824064, -2, 3, 0, 2, 2, 45, 2, 0, 0, 4294903295, 2, 0, 2, 18, 2, 7, -1, 2, 17, 2, 51, 2, 0, 2, 78, 2, 42, -1, 2, 24, 2, 0, 2, 31, -2, 0, 128, -2, 2, 79, 2, 8, 0, 4064, -1, 2, 117, 0, 4227907585, 2, 0, 2, 116, 2, 0, 2, 50, 2, 196, 2, 9, 2, 39, 2, 10, -1, 0, 6544896, 3, 0, 6, -2, 3, 0, 8, 2, 11, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -3, 2, 84, 2, 12, -3, 2, 85, 2, 86, 2, 87, 2, 0, 2, 35, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 817183, 2, 0, 2, 13, 2, 0, 0, 33023, 2, 24, 3, 88, 2, -17, 2, 89, 0, 524157950, 2, 4, 2, 0, 2, 90, 2, 4, 2, 0, 2, 14, 2, 79, 2, 15, 3, 0, 2, 2, 49, 2, 16, -1, 2, 17, -16, 3, 0, 205, 2, 18, -2, 3, 0, 655, 2, 19, 3, 0, 36, 2, 70, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 19, 2, 22, 2, 92, 3, 0, 2, 2, 93, 2, 21, -1, 2, 22, 0, 4294965179, 0, 7, 2, 0, 2, 8, 2, 92, 2, 8, -1, 0, 1761345536, 2, 94, 2, 95, 2, 38, 2, 23, 2, 96, 2, 36, 2, 162, 0, 2080440287, 2, 0, 2, 35, 2, 138, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 97, 2, 98, 2, 14, 2, 95, 3, 0, 3, 0, 7, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 25, 3, 0, 2, 2, 21, -1, 0, 2700607615, 2, 101, 2, 102, 3, 0, 2, 2, 20, 2, 26, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 47, 2, 0, 2, 27, 2, 103, -3, 2, 104, 3, 0, 3, 2, 23, -1, 3, 5, 2, 2, 30, 2, 0, 2, 7, 2, 105, -1, 2, 106, 2, 107, 2, 108, -1, 3, 0, 3, 2, 16, -2, 2, 0, 2, 31, -8, 2, 23, 2, 0, 2, 37, -1, 2, 0, 2, 63, 2, 32, 2, 18, 2, 9, 2, 0, 2, 109, -1, 3, 0, 4, 2, 9, 2, 17, 2, 110, 2, 6, 2, 0, 2, 111, 2, 0, 2, 50, -4, 3, 0, 9, 2, 24, 2, 18, 2, 27, -4, 2, 112, 2, 113, 2, 18, 2, 24, 2, 7, -2, 2, 114, 2, 18, 2, 21, -2, 2, 0, 2, 115, -2, 0, 4277075969, 2, 18, -1, 3, 23, 2, -1, 2, 34, 2, 139, 2, 0, 3, 18, 2, 2, 36, 2, 20, -3, 3, 0, 2, 2, 35, -1, 2, 0, 2, 36, 2, 0, 2, 36, 2, 0, 2, 50, -14, 2, 23, 2, 44, 2, 116, -5, 2, 117, 2, 41, -2, 2, 117, 2, 19, 2, 17, 2, 35, 2, 117, 2, 38, 0, 4294901776, 0, 4718591, 2, 117, 2, 36, 0, 335544350, -1, 2, 118, 2, 119, -2, 2, 120, 2, 39, 2, 7, -1, 2, 121, 2, 65, 0, 3758161920, 0, 3, -4, 2, 0, 2, 31, 2, 174, -1, 2, 0, 2, 19, 0, 176, -5, 2, 0, 2, 49, 2, 182, -1, 2, 0, 2, 19, 2, 194, -1, 2, 0, 2, 62, -2, 2, 16, -7, 2, 0, 2, 119, -3, 3, 0, 2, 2, 122, -8, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871887, -1, 2, 0, 2, 45, -8, 2, 54, 2, 49, 0, 1, 2, 123, 2, 19, -3, 2, 124, 2, 37, 2, 125, 2, 126, 0, 16778239, -10, 2, 36, -8, 3, 0, 28, 2, 21, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -85, 3, 0, 33, 2, 49, -126, 3, 0, 18, 2, 38, -269, 3, 0, 17, 2, 45, 2, 7, -3, 2, 17, 2, 127, 2, 0, 2, 19, 2, 50, 2, 128, 2, 19, -21, 3, 0, 2, -4, 3, 0, 2, 0, 65567, -1, 2, 26, -2, 0, 3, 3, 0, 191, 2, 20, 3, 0, 23, 2, 36, -296, 3, 0, 8, 2, 7, -2, 2, 17, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 129, 2, 130, -187, 3, 0, 2, 2, 52, 2, 0, 2, 131, 2, 132, 2, 56, 2, 0, 2, 133, 2, 134, 2, 135, 3, 0, 10, 2, 136, 2, 137, 2, 14, 3, 52, 2, 3, 53, 2, 3, 54, 2, 2, 138, -129, 3, 0, 6, 2, 139, -1, 3, 0, 2, 2, 50, -37, 2, 56, 2, 140, 2, 141, 2, 142, 2, 143, 2, 144, -138, 3, 0, 1334, 2, 24, -1, 3, 0, 129, 2, 31, 3, 0, 6, 2, 9, 3, 0, 180, 2, 145, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -28719, 2, 0, 0, 1, -1, 2, 122, 2, 0, 0, 8193, -21, 0, 50331648, 0, 10255, 0, 4, -11, 2, 66, 2, 168, -1, 0, 71680, -1, 2, 157, 0, 4292900864, 0, 805306431, -5, 2, 146, -1, 2, 176, -1, 0, 6144, -2, 2, 123, -1, 2, 150, -1, 2, 153, 2, 147, 2, 161, 2, 0, 0, 3223322624, 2, 36, 0, 4, -4, 2, 188, 0, 205128192, 0, 1333757536, 0, 2147483696, 0, 423953, 0, 747766272, 0, 2717763192, 0, 4286578751, 0, 278545, 2, 148, 0, 4294886464, 0, 33292336, 0, 417809, 2, 148, 0, 1329579616, 0, 4278190128, 0, 700594195, 0, 1006647527, 0, 4286497336, 0, 4160749631, 2, 149, 0, 469762560, 0, 4171219488, 0, 16711728, 2, 149, 0, 202375680, 0, 3214918176, 0, 4294508592, 0, 139280, -1, 0, 983584, 2, 190, 0, 58720275, 0, 3489923072, 0, 10517376, 0, 4293066815, 0, 1, 0, 2013265920, 2, 175, 2, 0, 0, 17816169, 0, 3288339281, 0, 201375904, 2, 0, -2, 0, 256, 0, 122880, 0, 16777216, 2, 146, 0, 4160757760, 2, 0, -6, 2, 163, -11, 0, 3263218176, -1, 0, 49664, 0, 2160197632, 0, 8388802, -1, 0, 12713984, -1, 2, 150, 2, 155, 2, 158, -2, 2, 159, -20, 0, 3758096385, -2, 2, 151, 0, 4292878336, 2, 22, 2, 166, 0, 4294057984, -2, 2, 160, 2, 152, 2, 172, -2, 2, 151, -1, 2, 179, -1, 2, 167, 2, 122, 0, 4026593280, 0, 14, 0, 4292919296, -1, 2, 154, 0, 939588608, -1, 0, 805306368, -1, 2, 122, 0, 1610612736, 2, 152, 2, 153, 3, 0, 2, -2, 2, 154, 2, 155, -3, 0, 267386880, -1, 2, 156, 0, 7168, -1, 0, 65024, 2, 150, 2, 157, 2, 158, -7, 2, 165, -8, 2, 159, -1, 0, 1426112704, 2, 160, -1, 2, 185, 0, 271581216, 0, 2149777408, 2, 19, 2, 157, 2, 122, 0, 851967, 0, 3758129152, -1, 2, 19, 2, 178, -4, 2, 154, -20, 2, 192, 2, 161, -56, 0, 3145728, 2, 184, -1, 2, 191, 2, 122, -1, 2, 162, 2, 122, -4, 0, 32505856, -1, 2, 163, -1, 0, 2147385088, 2, 22, 1, 2155905152, 2, -3, 2, 164, 2, 0, 2, 165, -2, 2, 166, -6, 2, 167, 0, 4026597375, 0, 1, -1, 0, 1, -1, 2, 168, -3, 2, 139, 2, 66, -2, 2, 162, 2, 177, -1, 2, 173, 2, 122, -6, 2, 122, -213, 2, 167, -657, 2, 17, -36, 2, 169, -1, 2, 186, -10, 0, 4294963200, -5, 2, 170, -5, 2, 158, 2, 0, 2, 24, -1, 0, 4227919872, -1, 2, 170, -2, 0, 4227874752, -3, 0, 2146435072, 2, 155, -2, 0, 1006649344, 2, 122, -1, 2, 22, 0, 201375744, -3, 0, 134217720, 2, 22, 0, 4286677377, 0, 32896, -1, 2, 171, -3, 2, 172, -349, 2, 173, 2, 174, 2, 175, 3, 0, 264, -11, 2, 176, -2, 2, 158, 2, 0, 0, 520617856, 0, 2692743168, 0, 36, -3, 0, 524284, -11, 2, 19, -1, 2, 183, -1, 2, 181, 0, 3221291007, 2, 158, -1, 0, 524288, 0, 2158720, -3, 2, 155, 0, 1, -4, 2, 122, 0, 3808625411, 0, 3489628288, 0, 4096, 0, 1207959680, 0, 3221274624, 2, 0, -3, 2, 177, 0, 120, 0, 7340032, -2, 0, 4026564608, 2, 4, 2, 19, 2, 160, 3, 0, 4, 2, 155, -1, 2, 178, 2, 175, -1, 0, 8176, 2, 179, 2, 177, 2, 180, -1, 0, 4290773232, 2, 0, -4, 2, 160, 2, 187, 0, 15728640, 2, 175, -1, 2, 157, -1, 0, 4294934512, 3, 0, 4, -9, 2, 22, 2, 167, 2, 181, 3, 0, 4, 0, 704, 0, 1849688064, 0, 4194304, -1, 2, 122, 0, 4294901887, 2, 0, 0, 130547712, 0, 1879048192, 0, 2080374784, 3, 0, 2, -1, 2, 182, 2, 183, -1, 0, 17829776, 0, 2025848832, 0, 4261477888, -2, 2, 0, -1, 0, 4286580608, -1, 0, 29360128, 2, 184, 0, 16252928, 0, 3791388672, 2, 39, 3, 0, 2, -2, 2, 193, 2, 0, -1, 2, 26, -1, 0, 66584576, -1, 2, 189, 3, 0, 9, 2, 122, 3, 0, 4, -1, 2, 157, 2, 158, 3, 0, 5, -2, 0, 245760, 0, 2147418112, -1, 2, 146, 2, 199, 0, 4227923456, -1, 2, 185, 2, 186, 2, 22, -2, 2, 176, 0, 4292870145, 0, 262144, 2, 122, 3, 0, 2, 0, 1073758848, 2, 187, -1, 0, 4227921920, 2, 188, 0, 68289024, 0, 528402016, 0, 4292927536, 3, 0, 4, -2, 0, 2483027968, 2, 0, -2, 2, 189, 3, 0, 5, -1, 2, 184, 2, 160, 2, 0, -2, 0, 4227923936, 2, 63, -1, 2, 170, 2, 94, 2, 0, 2, 150, 2, 154, 3, 0, 6, -1, 2, 175, 3, 0, 3, -2, 0, 2146959360, 3, 0, 8, -2, 2, 157, -1, 2, 190, 2, 117, -1, 2, 151, 3, 0, 8, 2, 191, 0, 8388608, 2, 171, 2, 169, 2, 183, 0, 4286578944, 3, 0, 2, 0, 1152, 0, 1266679808, 2, 189, 0, 576, 0, 4261707776, 2, 94, 3, 0, 9, 2, 151, 3, 0, 8, -28, 2, 158, 3, 0, 3, -3, 0, 4292902912, -6, 2, 96, 3, 0, 85, -33, 2, 164, 3, 0, 126, -18, 2, 192, 3, 0, 269, -17, 2, 151, 2, 122, 0, 4294917120, 3, 0, 2, 2, 19, 0, 4290822144, -2, 0, 67174336, 0, 520093700, 2, 17, 3, 0, 21, -2, 2, 177, 3, 0, 3, -2, 0, 65504, 2, 122, 2, 49, 3, 0, 2, 2, 92, -191, 2, 123, -23, 2, 26, 3, 0, 296, -8, 2, 122, 3, 0, 2, 2, 19, -11, 2, 175, 3, 0, 72, -3, 0, 3758159872, 0, 201391616, 3, 0, 155, -7, 2, 167, -1, 0, 384, -1, 0, 133693440, -3, 2, 193, -2, 2, 30, 3, 0, 4, 2, 166, -2, 2, 22, 2, 151, 3, 0, 4, -2, 2, 185, -1, 2, 146, 0, 335552923, 2, 194, -1, 0, 538974272, 0, 2214592512, 0, 132000, -10, 0, 192, -8, 0, 12288, -21, 0, 134213632, 0, 4294901761, 3, 0, 42, 0, 100663424, 0, 4294965284, 3, 0, 62, -6, 0, 4286578784, 2, 0, -2, 0, 1006696448, 3, 0, 24, 2, 37, -1, 2, 195, 3, 0, 10, 2, 194, 0, 4110942569, 0, 1432950139, 0, 2701658217, 0, 4026532864, 0, 4026532881, 2, 0, 2, 47, 3, 0, 8, -1, 2, 154, -2, 2, 166, 0, 98304, 0, 65537, 2, 167, 2, 169, -2, 2, 154, -1, 2, 63, 2, 0, 2, 116, 2, 197, 2, 175, 0, 4294770176, 2, 30, 3, 0, 4, -30, 2, 195, 2, 196, -3, 2, 166, -2, 2, 151, 2, 0, 2, 154, -1, 2, 189, -1, 2, 157, 2, 198, 3, 0, 2, 2, 154, 2, 122, -1, 0, 193331200, -1, 0, 4227923960, 2, 197, -1, 3, 0, 3, 2, 198, 3, 0, 44, -1334, 2, 22, 2, 0, -129, 2, 195, -6, 2, 160, -180, 2, 199, -233, 2, 4, 3, 0, 96, -16, 2, 160, 3, 0, 22583, -7, 2, 17, 3, 0, 6128], [4294967295, 4294967291, 4092460543, 4294828015, 4294967294, 134217726, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 1061158911, 536805376, 4294910143, 4160749567, 4294901759, 134217727, 4294901760, 4194303, 65535, 262143, 67108863, 4286578688, 536870911, 8388607, 4294918143, 4294443008, 255, 67043328, 2281701374, 4294967232, 2097151, 4294903807, 4294902783, 4294967039, 511, 524287, 131071, 127, 4294902271, 4294549487, 16777215, 1023, 67047423, 4294901888, 33554431, 4286578687, 4294770687, 67043583, 32767, 15, 2047999, 4292870143, 4294934527, 4294966783, 67045375, 4294967279, 262083, 20511, 4290772991, 41943039, 493567, 2047, 4294959104, 1071644671, 602799615, 65536, 4294828000, 805044223, 4277151126, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 4294967264, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4294967292, 4294965759, 4294966272, 4294901823, 4294967280, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 268369920, 4292804608, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4294966591, 2445279231, 3670015, 3238002687, 63, 4294967288, 4294705151, 4095, 3221208447, 4294549472, 2147483648, 4294705152, 4294966143, 64, 4294966719, 16383, 3774873592, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4087, 31, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 536870912, 2952790016, 202506752, 139264, 402653184, 4261412864, 4227922944, 2147532800, 61440, 3758096384, 117440512, 65280, 4227858432, 3233808384, 3221225472, 4294965248, 32768, 57152, 4294934528, 67108864, 4293918720, 4290772992, 25165824, 57344, 4278190080, 65472, 4227907584, 65520, 1920, 4026531840, 49152, 4160749568, 4294836224, 63488, 1073741824, 4294967040, 251658240, 196608, 12582912, 2097152, 65408, 64512, 417808, 4227923712, 48, 512, 4294967168, 4294966784, 16, 4292870144, 4227915776, 65528, 4294950912, 65532]); + + /**
+ * Return the next unicodechar in the stream
+ *
+ * @param parser Parser object
+ */
+ function nextUnicodeChar(parser) {
+ const { index } = parser;
+ const hi = parser.source.charCodeAt(index);
+ if (hi < 55296 /* LeadSurrogateMin */ || hi > 56319 /* LeadSurrogateMax */)
+ return hi;
+ const lo = parser.source.charCodeAt(index + 1);
+ if (lo < 56320 /* TrailSurrogateMin */ || lo > 57343 /* TrailSurrogateMax */)
+ return hi;
+ return 65536 /* NonBMPMin */ + ((hi & 0x3FF) << 10) | lo & 0x3FF;
+ }
+ /**
+ * Returns true if this is a valid identifier part
+ *
+ * @param code Codepoint
+ */
+ const isIdentifierPart = (code) => (characterType[code] & 1 /* IdentifierStart */) !== 0 || isValidIdentifierPart(code);
+ function escapeInvalidCharacters(code) {
+ switch (code) {
+ case 0 /* Null */:
+ return '\\0';
+ case 8 /* Backspace */:
+ return '\\b';
+ case 9 /* Tab */:
+ return '\\t';
+ case 10 /* LineFeed */:
+ return '\\n';
+ case 11 /* VerticalTab */:
+ return '\\v';
+ case 12 /* FormFeed */:
+ return '\\f';
+ case 13 /* CarriageReturn */:
+ return '\\r';
+ default:
+ if (!mustEscape(code))
+ return fromCodePoint(code);
+ if (code < 0x10)
+ return `\\x0${code.toString(16)}`;
+ if (code < 0x100)
+ return `\\x${code.toString(16)}`;
+ if (code < 0x1000)
+ return `\\u0${code.toString(16)}`;
+ if (code < 0x10000)
+ return `\\u${code.toString(16)}`;
+ return `\\u{${code.toString(16)}}`;
+ }
+ }
+ /**
+ * Consume an token in the scanner on match. This is an equalent to
+ * 'consume' used in the parser code itself.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function consumeOpt(parser, code) {
+ if (parser.source.charCodeAt(parser.index) !== code)
+ return false;
+ parser.index++;
+ parser.column++;
+ return true;
+ }
+ /**
+ * Consumes line feed
+ *
+ * @param parser Parser object
+ * @param state Scanner state
+ */
+ function consumeLineFeed(parser, state) {
+ parser.flags |= exports.Flags.NewLine;
+ parser.index++;
+ if ((state & exports.ScannerState.LastIsCR) === 0) {
+ parser.column = 0;
+ parser.line++;
+ }
+ }
+ /**
+ * Scans private name. Stage 3 proposal related
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanPrivateName(parser, context) {
+ if (!(context & exports.Context.InClass) || !isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return 115 /* Hash */;
+ }
+ /**
+ * Advance to new line
+ *
+ * @param parser Parser object
+ */
+ function advanceNewline(parser) {
+ parser.flags |= exports.Flags.NewLine;
+ parser.index++;
+ parser.column = 0;
+ parser.line++;
+ }
+ const fromCodePoint = (code) => {
+ return code <= 0xFFFF ?
+ String.fromCharCode(code) :
+ String.fromCharCode(((code - 65536 /* NonBMPMin */) >> 10) + 55296 /* LeadSurrogateMin */, ((code - 65536 /* NonBMPMin */) & (1024 - 1)) + 56320 /* TrailSurrogateMin */);
+ };
+ function readNext(parser) {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.source.length)
+ report(parser, 14 /* UnicodeOutOfRange */);
+ return nextUnicodeChar(parser);
+ }
+ function toHex(code) {
+ if (code < 48 /* Zero */)
+ return -1;
+ if (code <= 57 /* Nine */)
+ return code - 48 /* Zero */;
+ if (code < 65 /* UpperA */)
+ return -1;
+ if (code <= 70 /* UpperF */)
+ return code - 65 /* UpperA */ + 10;
+ if (code < 97 /* LowerA */)
+ return -1;
+ if (code <= 102 /* LowerF */)
+ return code - 97 /* LowerA */ + 10;
+ return -1;
+ }
+ function advanceOnMaybeAstral(parser, ch) {
+ parser.index++;
+ parser.column++;
+ if (ch > 0xFFFF)
+ parser.index++;
+ } + + /**
+ * Scan escape sequence
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanEscapeSequence(parser, context, first) {
+ switch (first) {
+ case 98 /* LowerB */:
+ return 8 /* Backspace */;
+ case 102 /* LowerF */:
+ return 12 /* FormFeed */;
+ case 114 /* LowerR */:
+ return 13 /* CarriageReturn */;
+ case 110 /* LowerN */:
+ return 10 /* LineFeed */;
+ case 116 /* LowerT */:
+ return 9 /* Tab */;
+ case 118 /* LowerV */:
+ return 11 /* VerticalTab */;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ return exports.Escape.Empty;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ {
+ // 1 to 3 octal digits
+ let code = first - 48 /* Zero */;
+ let index = parser.index + 1;
+ let column = parser.column + 1;
+ let next = parser.source.charCodeAt(index);
+ if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ // Strict mode code allows only \0, then a non-digit.
+ if (code !== 0 || next === 56 /* Eight */ || next === 57 /* Nine */) {
+ if (context & exports.Context.Strict)
+ return exports.Escape.StrictOctal;
+ parser.flags |= exports.Flags.HasOctal;
+ }
+ }
+ else if (context & exports.Context.Strict) {
+ return exports.Escape.StrictOctal;
+ }
+ else {
+ parser.flags |= exports.Flags.HasOctal;
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ parser.lastValue = next;
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ parser.index = index - 1;
+ parser.column = column - 1;
+ }
+ return code;
+ }
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ // 1 to 2 octal digits
+ if (context & exports.Context.Strict)
+ return exports.Escape.StrictOctal;
+ let code = first - 48 /* Zero */;
+ const index = parser.index + 1;
+ const column = parser.column + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 55 /* Seven */) {
+ code = code * 8 + (next - 48 /* Zero */);
+ parser.lastValue = next;
+ parser.index = index;
+ parser.column = column;
+ }
+ return code;
+ }
+ // `8`, `9` (invalid escapes)
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return exports.Escape.EightOrNine;
+ // ASCII escapes
+ case 120 /* LowerX */:
+ {
+ const ch1 = parser.lastValue = readNext(parser);
+ const hi = toHex(ch1);
+ if (hi < 0)
+ return exports.Escape.InvalidHex;
+ const ch2 = parser.lastValue = readNext(parser);
+ const lo = toHex(ch2);
+ if (lo < 0)
+ return exports.Escape.InvalidHex;
+ return hi << 4 | lo;
+ }
+ // UCS-2/Unicode escapes
+ case 117 /* LowerU */:
+ {
+ let ch = parser.lastValue = readNext(parser);
+ if (ch === 123 /* LeftBrace */) {
+ ch = parser.lastValue = readNext(parser);
+ let code = toHex(ch);
+ if (code < 0)
+ return exports.Escape.InvalidHex;
+ ch = parser.lastValue = readNext(parser);
+ while (ch !== 125 /* RightBrace */) {
+ const digit = toHex(ch);
+ if (digit < 0)
+ return exports.Escape.InvalidHex;
+ code = code * 16 + digit;
+ // Code point out of bounds
+ if (code > 1114111 /* NonBMPMax */)
+ return exports.Escape.OutOfRange;
+ ch = parser.lastValue = readNext(parser);
+ }
+ return code;
+ }
+ else {
+ // \uNNNN
+ let codePoint = toHex(ch);
+ if (codePoint < 0)
+ return exports.Escape.InvalidHex;
+ for (let i = 0; i < 3; i++) {
+ ch = parser.lastValue = readNext(parser);
+ const digit = toHex(ch);
+ if (digit < 0)
+ return exports.Escape.InvalidHex;
+ codePoint = codePoint * 16 + digit;
+ }
+ return codePoint;
+ }
+ }
+ default:
+ return parser.source.charCodeAt(parser.index);
+ }
+ }
+ /**
+ * Throws a string error for either string or template literal
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function throwStringError(parser, context, code) {
+ switch (code) {
+ case exports.Escape.Empty:
+ return;
+ case exports.Escape.StrictOctal:
+ report(parser, context & exports.Context.TaggedTemplate ?
+ 76 /* TemplateOctalLiteral */ :
+ 11 /* StrictOctalEscape */);
+ case exports.Escape.EightOrNine:
+ report(parser, 13 /* InvalidEightAndNine */);
+ case exports.Escape.InvalidHex:
+ report(parser, 75 /* MalformedEscape */, 'hexadecimal');
+ case exports.Escape.OutOfRange:
+ report(parser, 14 /* UnicodeOutOfRange */);
+ /* istanbul ignore next */
+ default:
+ // ignore
+ }
+ }
+ /**
+ * Scan a string literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote codepoint
+ */
+ function scanString(parser, context, quote) {
+ const { index: start, lastValue } = parser;
+ let ret = '';
+ parser.index++;
+ parser.column++; // consume quote
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ switch (ch) {
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ report(parser, 6 /* UnterminatedString */);
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch > 128 /* MaxAsciiCharacter */) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ const code = scanEscapeSequence(parser, context, ch);
+ if (code >= 0)
+ ret += fromCodePoint(code);
+ else
+ throwStringError(parser, context, code);
+ ch = parser.lastValue;
+ }
+ break;
+ default:
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++; // consume quote
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ return 33554435 /* StringLiteral */;
+ } + + /**
+ * Consumes template brace
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function consumeTemplateBrace(parser, context) {
+ if (parser.index >= parser.length)
+ report(parser, 9 /* UnterminatedTemplate */);
+ // Upon reaching a '}', consume it and rewind the scanner state
+ parser.index--;
+ parser.column--;
+ return scanTemplate(parser, context);
+ }
+ /**
+ * Scan template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param first Codepoint
+ */
+ function scanTemplate(parser, context) {
+ const { index: start, lastValue } = parser;
+ let tail = true;
+ let ret = '';
+ let ch = readNext(parser);
+ loop: while (ch !== 96 /* Backtick */) {
+ switch (ch) {
+ // Break after a literal `${` (thus the dedicated code path).
+ case 36 /* Dollar */:
+ {
+ const index = parser.index + 1;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 123 /* LeftBrace */) {
+ parser.index = index;
+ parser.column++;
+ tail = false;
+ break loop;
+ }
+ ret += '$';
+ break;
+ }
+ case 92 /* Backslash */:
+ ch = readNext(parser);
+ if (ch >= 128) {
+ ret += fromCodePoint(ch);
+ }
+ else {
+ parser.lastValue = ch;
+ // Because octals are forbidden in escaped template sequences and the fact that
+ // both string and template scanning uses the same method - 'scanEscapeSequence',
+ // we set the strict context mask.
+ const code = scanEscapeSequence(parser, context | exports.Context.Strict, ch);
+ if (code >= 0) {
+ ret += fromCodePoint(code);
+ }
+ else if (code !== exports.Escape.Empty && context & exports.Context.TaggedTemplate) {
+ ret = undefined;
+ ch = scanLooserTemplateSegment(parser, parser.lastValue);
+ if (ch < 0) {
+ tail = false;
+ }
+ break loop;
+ }
+ else {
+ throwStringError(parser, context | exports.Context.TaggedTemplate, code);
+ }
+ ch = parser.lastValue;
+ }
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ parser.column = -1;
+ parser.line++;
+ // falls through
+ default:
+ if (ret != null)
+ ret += fromCodePoint(ch);
+ }
+ ch = readNext(parser);
+ }
+ parser.index++;
+ parser.column++;
+ parser.tokenValue = ret;
+ parser.lastValue = lastValue;
+ if (tail) {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 1);
+ return 33554441 /* TemplateTail */;
+ }
+ else {
+ parser.tokenRaw = parser.source.slice(start + 1, parser.index - 2);
+ return 33554440 /* TemplateCont */;
+ }
+ }
+ /**
+ * Scan looser template segment
+ *
+ * @param parser Parser object
+ * @param ch codepoint
+ */
+ function scanLooserTemplateSegment(parser, ch) {
+ while (ch !== 96 /* Backtick */) {
+ if (ch === 36 /* Dollar */ && parser.source.charCodeAt(parser.index + 1) === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return -ch;
+ }
+ // Skip '\' and continue to scan the template token to search
+ // for the end, without validating any escape sequences
+ ch = readNext(parser);
+ }
+ return ch;
+ } + + // 11.8.3 Numeric Literals
+ /**
+ * Scans hex integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HexIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanHexIntegerLiteral(parser, context) {
+ parser.index++;
+ parser.column++;
+ let state = exports.NumericState.None;
+ let value = toHex(parser.source.charCodeAt(parser.index));
+ if (value < 0)
+ report(parser, 0 /* Unexpected */);
+ parser.index++;
+ parser.column++;
+ while (parser.index < parser.length) {
+ const next = parser.source.charCodeAt(parser.index);
+ if (context & exports.Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~exports.NumericState.SeenSeparator;
+ const digit = toHex(next);
+ if (digit < 0)
+ break;
+ value = value * 16 + digit;
+ parser.index++;
+ parser.column++;
+ }
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+ }
+ /**
+ * Scans binary and octal integer literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalIntegerLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BinaryIntegerLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanOctalOrBinary(parser, context, base) {
+ parser.index++;
+ parser.column++;
+ let digits = 0;
+ let ch;
+ let value = 0;
+ let state = exports.NumericState.None;
+ while (parser.index < parser.length) {
+ ch = parser.source.charCodeAt(parser.index);
+ if (context & exports.Context.OptionsNext && ch === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ continue;
+ }
+ state &= ~exports.NumericState.SeenSeparator;
+ const converted = ch - 48 /* Zero */;
+ if (!(ch >= 48 /* Zero */ && ch <= 57 /* Nine */) || converted >= base)
+ break;
+ value = value * base + converted;
+ parser.index++;
+ parser.column++;
+ digits++;
+ }
+ if (digits === 0)
+ report(parser, 0 /* Unexpected */);
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return assembleNumericLiteral(parser, context, value, consumeOpt(parser, 110 /* LowerN */));
+ }
+ /**
+ * Scans implicit octal digits
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-OctalDigits)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanImplicitOctalDigits(parser, context) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ {
+ if (context & exports.Context.Strict)
+ report(parser, 0 /* Unexpected */);
+ let index = parser.index;
+ let column = parser.column;
+ let code = 0;
+ parser.flags |= exports.Flags.HasOctal;
+ // Implicit octal, unless there is a non-octal digit.
+ // (Annex B.1.1 on Numeric Literals)
+ while (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ else if (next < 48 /* Zero */ || next > 55 /* Seven */) {
+ return scanNumericLiteral(parser, context);
+ }
+ else {
+ code = code * 8 + (next - 48 /* Zero */);
+ index++;
+ column++;
+ }
+ }
+ parser.index = index;
+ parser.column = column;
+ return assembleNumericLiteral(parser, context, code, consumeOpt(parser, 110 /* LowerN */));
+ }
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ parser.flags |= exports.Flags.HasOctal;
+ default:
+ if (context & exports.Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ return scanNumericLiteral(parser, context);
+ }
+ }
+ /**
+ * Scans signed integer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SignedInteger)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanSignedInteger(parser, end) {
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */ || next === 45 /* Hyphen */) {
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (!(next >= 48 /* Zero */ && next <= 57 /* Nine */)) {
+ report(parser, 0 /* Unexpected */);
+ }
+ const preNumericPart = parser.index;
+ const finalFragment = scanDecimalDigitsOrSeparator(parser);
+ return parser.source.substring(end, preNumericPart) + finalFragment;
+ }
+ /**
+ * Scans numeric literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanNumericLiteral(parser, context, state = exports.NumericState.None) {
+ let value = state & exports.NumericState.Float ?
+ 0 :
+ scanDecimalAsSmi(parser, context);
+ const next = parser.source.charCodeAt(parser.index);
+ // I know I'm causing a bug here. The question is - will anyone figure this out?
+ if (next !== 46 /* Period */ && next !== 95 /* Underscore */ && !isValidIdentifierStart(next)) {
+ return assembleNumericLiteral(parser, context, value);
+ }
+ if (consumeOpt(parser, 46 /* Period */)) {
+ if (context & exports.Context.OptionsNext && parser.source.charCodeAt(parser.index) === 95 /* Underscore */) {
+ report(parser, 60 /* ZeroDigitNumericSeparator */);
+ }
+ state |= exports.NumericState.Float;
+ value = `${value}.${scanDecimalDigitsOrSeparator(parser)}`;
+ }
+ const end = parser.index;
+ if (consumeOpt(parser, 110 /* LowerN */)) {
+ if (state & exports.NumericState.Float)
+ report(parser, 0 /* Unexpected */);
+ state |= exports.NumericState.BigInt;
+ }
+ if (consumeOpt(parser, 101 /* LowerE */) || consumeOpt(parser, 69 /* UpperE */)) {
+ state |= exports.NumericState.Float;
+ value += scanSignedInteger(parser, end);
+ }
+ if (isValidIdentifierStart(parser.source.charCodeAt(parser.index))) {
+ report(parser, 0 /* Unexpected */);
+ }
+ return assembleNumericLiteral(parser, context, state & exports.NumericState.Float ? parseFloat(value) : parseInt(value, 10), !!(state & exports.NumericState.BigInt));
+ }
+ /**
+ * Internal helper function for scanning numeric separators.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state NumericState state
+ */
+ function scanNumericSeparator(parser, state) {
+ parser.index++;
+ parser.column++;
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ state |= exports.NumericState.SeenSeparator;
+ return state;
+ }
+ /**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanDecimalDigitsOrSeparator(parser) {
+ let start = parser.index;
+ let state = exports.NumericState.None;
+ let ret = '';
+ loop: while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 95 /* Underscore */:
+ const preUnderscoreIndex = parser.index;
+ state = scanNumericSeparator(parser, state);
+ ret += parser.source.substring(start, preUnderscoreIndex);
+ start = parser.index;
+ continue;
+ case 48 /* Zero */:
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ state = state & ~exports.NumericState.SeenSeparator;
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ break loop;
+ }
+ }
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return ret + parser.source.substring(start, parser.index);
+ }
+ /**
+ * Internal helper function that scans numeric values
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanDecimalAsSmi(parser, context) {
+ let state = exports.NumericState.None;
+ let value = 0;
+ let next = parser.source.charCodeAt(parser.index);
+ while (next >= 48 /* Zero */ && next <= 57 /* Nine */ || next === 95 /* Underscore */) {
+ if (context & exports.Context.OptionsNext && next === 95 /* Underscore */) {
+ state = scanNumericSeparator(parser, state);
+ next = parser.source.charCodeAt(parser.index);
+ continue;
+ }
+ state &= ~exports.NumericState.SeenSeparator;
+ value = value * 10 + (next - 48 /* Zero */);
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ }
+ if (state & exports.NumericState.SeenSeparator)
+ report(parser, 59 /* TrailingNumericSeparator */);
+ return value;
+ }
+ /**
+ * Internal helper function that assamble the number scanning parts and return
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param value The numeric value
+ */
+ function assembleNumericLiteral(parser, context, value, isBigInt = false) {
+ parser.tokenValue = value;
+ if (context & exports.Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ return isBigInt ? 33554551 /* BigIntLiteral */ : 33554434 /* NumericLiteral */;
+ } + + /**
+ * Scan identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-string-literals)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function scanIdentifier(parser, context, first) {
+ let start = parser.index;
+ let ret = '';
+ let isEscaped = false;
+ if (first)
+ advanceOnMaybeAstral(parser, first);
+ loop: while (parser.index < parser.length) {
+ const index = parser.index;
+ let ch = parser.source.charCodeAt(index);
+ switch (ch) {
+ case 92 /* Backslash */:
+ ret += parser.source.slice(start, index);
+ ret += scanUnicodeCodePointEscape(parser);
+ start = parser.index;
+ isEscaped = true;
+ break;
+ default:
+ if (ch >= 0xD800 && ch <= 0xDBFF) {
+ const lo = parser.source.charCodeAt(index + 1);
+ ch = (ch & 0x3FF) << 10 | lo & 0x3FF | 0x10000;
+ }
+ if (!isIdentifierPart(ch))
+ break loop;
+ advanceOnMaybeAstral(parser, ch);
+ }
+ }
+ if (start < parser.index)
+ ret += parser.source.slice(start, parser.index);
+ parser.tokenValue = ret;
+ const len = ret.length;
+ // Keywords are between 2 and 11 characters long and start with a lowercase letter
+ // https://tc39.github.io/ecma262/#sec-keywords
+ if (len >= 2 && len <= 11) {
+ const token = descKeyword(ret);
+ if (token > 0) {
+ if (isEscaped) {
+ if (context & exports.Context.DisallowEscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ // Here we fall back to a mutual parser flag if the escaped keyword isn't disallowed through
+ // context masks. This is similiar to how V8 does it - they are using an
+ // 'escaped_keyword' token.
+ // - J.K. Thomas
+ parser.flags |= exports.Flags.EscapedKeyword;
+ }
+ return token;
+ }
+ }
+ if (context & exports.Context.OptionsRawidentifiers)
+ parser.tokenRaw = parser.source.slice(start, parser.index);
+ return 33685505 /* Identifier */;
+ }
+ /**
+ * Scanning chars in the range 0...127, and treat them as an possible
+ * identifier. This allows subsequent checking to be faster.
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param first Code point
+ */
+ function scanMaybeIdentifier(parser, context, first) {
+ first = nextUnicodeChar(parser);
+ if (!isValidIdentifierStart(first)) {
+ report(parser, 10 /* UnexpectedChar */, escapeInvalidCharacters(first));
+ }
+ return scanIdentifier(parser, context, first);
+ }
+ /**
+ * Scan unicode codepoint escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function scanUnicodeCodePointEscape(parser) {
+ const { index } = parser;
+ if (index + 5 < parser.length) {
+ if (parser.source.charCodeAt(index + 1) !== 117 /* LowerU */) {
+ report(parser, 0 /* Unexpected */);
+ }
+ parser.index += 2;
+ parser.column += 2;
+ const code = scanIdentifierUnicodeEscape(parser);
+ if (code >= 55296 /* LeadSurrogateMin */ && code <= 56319 /* LeadSurrogateMax */) {
+ report(parser, 74 /* UnexpectedSurrogate */);
+ }
+ if (!isIdentifierPart(code)) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ return fromCodePoint(code);
+ }
+ report(parser, 0 /* Unexpected */);
+ }
+ /**
+ * Scan identifier unicode escape
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function scanIdentifierUnicodeEscape(parser) {
+ // Accept both \uxxxx and \u{xxxxxx}. In the latter case, the number of
+ // hex digits between { } is arbitrary. \ and u have already been read.
+ let ch = parser.source.charCodeAt(parser.index);
+ let codePoint = 0;
+ // '\u{DDDDDDDD}'
+ if (ch === 123 /* LeftBrace */) { // {
+ ch = readNext(parser);
+ let digit = toHex(ch);
+ while (digit >= 0) {
+ codePoint = (codePoint << 4) | digit;
+ if (codePoint > 1114111 /* NonBMPMax */) {
+ report(parser, 89 /* UndefinedUnicodeCodePoint */);
+ }
+ parser.index++;
+ parser.column++;
+ digit = toHex(parser.source.charCodeAt(parser.index));
+ }
+ if (parser.source.charCodeAt(parser.index) !== 125 /* RightBrace */) {
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ }
+ consumeOpt(parser, 125 /* RightBrace */);
+ // '\uDDDD'
+ }
+ else {
+ for (let i = 0; i < 4; i++) {
+ ch = parser.source.charCodeAt(parser.index);
+ const digit = toHex(ch);
+ if (digit < 0)
+ report(parser, 75 /* MalformedEscape */, 'unicode');
+ codePoint = (codePoint << 4) | digit;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ return codePoint;
+ } + + // 11.4 Comments
+ /**
+ * Skips single HTML comments. Same behavior as in V8.
+ *
+ * @param parser Parser Object
+ * @param context Context masks.
+ * @param state Scanner state
+ * @param type Comment type
+ */
+ function skipSingleHTMLComment(parser, context, state, type) {
+ if (context & exports.Context.Module)
+ report(parser, 90 /* HtmlCommentInModule */);
+ return skipSingleLineComment(parser, context, state, type);
+ }
+ /**
+ * Skips SingleLineComment, SingleLineHTMLCloseComment and SingleLineHTMLOpenComment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SingleLineComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLOpenComment)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-SingleLineHTMLCloseComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ * @param type Comment type
+ */
+ function skipSingleLineComment(parser, context, state, type) {
+ const start = parser.index;
+ const collectable = !!(context & exports.Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 13 /* CarriageReturn */:
+ advanceNewline(parser);
+ if ((parser.index < parser.length) && parser.source.charCodeAt(parser.index) === 10 /* LineFeed */)
+ parser.index++;
+ return state | exports.ScannerState.NewLine;
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ advanceNewline(parser);
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state | exports.ScannerState.NewLine;
+ default:
+ parser.index++;
+ parser.column++;
+ }
+ }
+ if (collectable)
+ addComment(parser, context, type, start);
+ return state;
+ }
+ /**
+ * Skips multiline comment
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-annexB-MultiLineComment)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Scanner state
+ */
+ function skipMultiLineComment(parser, context, state) {
+ const start = parser.index;
+ const collectable = !!(context & exports.Context.OptionsComments);
+ while (parser.index < parser.length) {
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 42 /* Asterisk */:
+ parser.index++;
+ parser.column++;
+ state &= ~exports.ScannerState.LastIsCR;
+ if (consumeOpt(parser, 47 /* Slash */)) {
+ if (collectable)
+ addComment(parser, context, 'MultiLine', start);
+ return state;
+ }
+ break;
+ // Mark multiline comments containing linebreaks as new lines
+ // so we can perfectly handle edge cases like: '1/*\n*/--> a comment'
+ case 13 /* CarriageReturn */:
+ state |= exports.ScannerState.NewLine | exports.ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ break;
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ default:
+ state &= ~exports.ScannerState.LastIsCR;
+ parser.index++;
+ parser.column++;
+ }
+ }
+ // Unterminated multi-line comment.
+ tolerant(parser, context, 8 /* UnterminatedComment */);
+ }
+ /**
+ * Add comments
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param type Comment type
+ * @param commentStart Start position of comment
+ */
+ function addComment(parser, context, type, commentStart) {
+ const { index, startIndex: start, startLine, startColumn, lastLine, lastColumn } = parser;
+ const comment = {
+ type,
+ value: parser.source.slice(commentStart, type === 'MultiLine' ? index - 2 : index),
+ start,
+ end: index,
+ };
+ if (context & exports.Context.OptionsLoc) {
+ comment.loc = {
+ start: { line: startLine, column: startColumn },
+ end: { line: lastLine, column: lastColumn },
+ };
+ }
+ parser.comments.push(comment);
+ } + + /**
+ * Scan
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-punctuatorss)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-names-and-keywords)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scan(parser, context) {
+ parser.flags &= ~exports.Flags.NewLine | exports.Flags.EscapedKeyword;
+ const lineStart = parser.index === 0;
+ let state = exports.ScannerState.None;
+ while (parser.index < parser.length) {
+ if (!lineStart) {
+ parser.startIndex = parser.index;
+ parser.startColumn = parser.column;
+ parser.startLine = parser.line;
+ }
+ const first = parser.source.charCodeAt(parser.index);
+ if (first > 128 /* MaxAsciiCharacter */) {
+ switch (first) {
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ advanceNewline(parser);
+ break;
+ case 65519 /* ByteOrderMark */:
+ case 160 /* NonBreakingSpace */:
+ case 5760 /* Ogham */:
+ case 8192 /* EnQuad */:
+ case 8193 /* EmQuad */:
+ case 8194 /* EnSpace */:
+ case 8195 /* EmSpace */:
+ case 8196 /* ThreePerEmSpace */:
+ case 8197 /* FourPerEmSpace */:
+ case 8198 /* SixPerEmSpace */:
+ case 8199 /* FigureSpace */:
+ case 8200 /* PunctuationSpace */:
+ case 8201 /* ThinSpace */:
+ case 8202 /* HairSpace */:
+ case 8239 /* NarrowNoBreakSpace */:
+ case 8287 /* MathematicalSpace */:
+ case 12288 /* IdeographicSpace */:
+ case 65279 /* Zwnbs */:
+ case 8205 /* Zwj */:
+ parser.index++;
+ parser.column++;
+ break;
+ default:
+ return scanMaybeIdentifier(parser, context, first);
+ }
+ }
+ else {
+ // Note: Here we first get rid of LT and WS, then we make sure that the lookup time
+ // for the single punctuator char is short as possible. A single punctuator
+ // char is a valid token that cannot also be a prefix of a combination
+ // of long tokens - e.g. '(', ')' and '=' is valid. '==' is not.
+ switch (first) {
+ case 13 /* CarriageReturn */:
+ state |= exports.ScannerState.NewLine | exports.ScannerState.LastIsCR;
+ advanceNewline(parser);
+ break;
+ case 10 /* LineFeed */:
+ consumeLineFeed(parser, state);
+ state = state & ~exports.ScannerState.LastIsCR | exports.ScannerState.NewLine;
+ break;
+ case 9 /* Tab */:
+ case 11 /* VerticalTab */:
+ case 12 /* FormFeed */:
+ case 32 /* Space */:
+ parser.index++;
+ parser.column++;
+ break;
+ // `(`
+ case 40 /* LeftParen */:
+ parser.index++;
+ parser.column++;
+ return 50331659 /* LeftParen */;
+ // `)`
+ case 41 /* RightParen */:
+ parser.index++;
+ parser.column++;
+ return 16 /* RightParen */;
+ // `,`
+ case 44 /* Comma */:
+ parser.index++;
+ parser.column++;
+ return 16777234 /* Comma */;
+ // `:`
+ case 58 /* Colon */:
+ parser.index++;
+ parser.column++;
+ return 16777237 /* Colon */;
+ // `;`
+ case 59 /* Semicolon */:
+ parser.index++;
+ parser.column++;
+ return 17825809 /* Semicolon */;
+ // `?`
+ case 63 /* QuestionMark */:
+ parser.index++;
+ parser.column++;
+ return 22 /* QuestionMark */;
+ // `]`
+ case 93 /* RightBracket */:
+ parser.index++;
+ parser.column++;
+ return 20 /* RightBracket */;
+ // `{`
+ case 123 /* LeftBrace */:
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ // `}`
+ case 125 /* RightBrace */:
+ parser.index++;
+ parser.column++;
+ return 17825807 /* RightBrace */;
+ // `~`
+ case 126 /* Tilde */:
+ parser.index++;
+ parser.column++;
+ return 301989934 /* Complement */;
+ // `[`
+ case 91 /* LeftBracket */:
+ parser.index++;
+ parser.column++;
+ return 41943059 /* LeftBracket */;
+ // `@`
+ case 64 /* At */:
+ parser.index++;
+ parser.column++;
+ return 120 /* At */;
+ // `/`, `/=`, `/>`
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774773 /* Divide */;
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 47 /* Slash */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipSingleLineComment(parser, context, state, 'SingleLine');
+ continue;
+ }
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ state = skipMultiLineComment(parser, context, state);
+ continue;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 100663333 /* DivideAssign */;
+ }
+ default:
+ return 167774773 /* Divide */;
+ }
+ }
+ // `-`, `--`, `-=`
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++; // skip `-`
+ const next = parser.source.charCodeAt(parser.index);
+ switch (next) {
+ case 45 /* Hyphen */:
+ {
+ parser.index++;
+ parser.column++;
+ if ((state & exports.ScannerState.NewLine || lineStart) &&
+ consumeOpt(parser, 62 /* GreaterThan */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLClose');
+ continue;
+ }
+ return 570425372 /* Decrement */;
+ }
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ return 67108899 /* SubtractAssign */;
+ }
+ default:
+ return 436209968 /* Subtract */;
+ }
+ }
+ // `<`, `<=`, `<<`, `<<=`, `</`, <!--
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++; // skip `<`
+ if (consumeOpt(parser, 33 /* Exclamation */) &&
+ consumeOpt(parser, 45 /* Hyphen */) &&
+ consumeOpt(parser, 45 /* Hyphen */)) {
+ state = skipSingleHTMLComment(parser, context, state, 'HTMLOpen');
+ continue;
+ }
+ switch (parser.source.charCodeAt(parser.index)) {
+ case 60 /* LessThan */:
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 61 /* EqualSign */) ?
+ 67108894 /* ShiftLeftAssign */ :
+ 167774273 /* ShiftLeft */;
+ case 61 /* EqualSign */:
+ parser.index++;
+ parser.column++;
+ return 167774013 /* LessThanOrEqual */;
+ case 47 /* Slash */:
+ {
+ if (!(context & exports.Context.OptionsJSX))
+ break;
+ const index = parser.index + 1;
+ // Check that it's not a comment start.
+ if (index < parser.length) {
+ const next = parser.source.charCodeAt(index);
+ if (next === 42 /* Asterisk */ || next === 47 /* Slash */)
+ break;
+ }
+ parser.index++;
+ parser.column++;
+ return 25 /* JSXClose */;
+ }
+ default: // ignore
+ return 167774015 /* LessThan */;
+ }
+ // `!`, `!=`, `!==`
+ case 33 /* Exclamation */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 301989933 /* Negate */;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773756 /* LooseNotEqual */;
+ return 167773754 /* StrictNotEqual */;
+ // `'string'`, `"string"`
+ case 39 /* SingleQuote */:
+ case 34 /* DoubleQuote */:
+ return scanString(parser, context, first);
+ // `%`, `%=`
+ case 37 /* Percent */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167774772 /* Modulo */;
+ return 67108902 /* ModuloAssign */;
+ // `&`, `&&`, `&=`
+ case 38 /* Ampersand */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 38 /* Ampersand */) {
+ parser.index++;
+ parser.column++;
+ return 169869879 /* LogicalAnd */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108905 /* BitwiseAndAssign */;
+ }
+ return 167773508 /* BitwiseAnd */;
+ }
+ // `*`, `**`, `*=`, `**=`
+ case 42 /* Asterisk */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774771 /* Multiply */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108900 /* MultiplyAssign */;
+ }
+ if (next !== 42 /* Asterisk */)
+ return 167774771 /* Multiply */;
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167775030 /* Exponentiate */;
+ return 67108897 /* ExponentiateAssign */;
+ }
+ // `+`, `++`, `+=`
+ case 43 /* Plus */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 436209967 /* Add */;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 43 /* Plus */) {
+ parser.index++;
+ parser.column++;
+ return 570425371 /* Increment */;
+ }
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108898 /* AddAssign */;
+ }
+ return 436209967 /* Add */;
+ }
+ // `\\u{N}var`
+ case 92 /* Backslash */:
+ return scanIdentifier(parser, context);
+ // `=`, `==`, `===`, `=>`
+ case 61 /* EqualSign */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 167773753 /* StrictEqual */;
+ }
+ else {
+ return 167773755 /* LooseEqual */;
+ }
+ }
+ else if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ return 10 /* Arrow */;
+ }
+ return 83886109 /* Assign */;
+ }
+ // `>`, `>=`, `>>`, `>>>`, `>>=`, `>>>=`
+ case 62 /* GreaterThan */:
+ {
+ parser.index++;
+ parser.column++;
+ if (parser.index >= parser.length)
+ return 167774016 /* GreaterThan */;
+ if (context & exports.Context.InJSXChild)
+ return 167774016 /* GreaterThan */;
+ let next = parser.source.charCodeAt(parser.index);
+ if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 167774014 /* GreaterThanOrEqual */;
+ }
+ if (next !== 62 /* GreaterThan */)
+ return 167774016 /* GreaterThan */;
+ parser.index++;
+ parser.column++;
+ next = parser.source.charCodeAt(parser.index);
+ if (next === 62 /* GreaterThan */) {
+ parser.index++;
+ parser.column++;
+ if (consumeOpt(parser, 61 /* EqualSign */)) {
+ return 67108896 /* LogicalShiftRightAssign */;
+ }
+ else {
+ return 167774275 /* LogicalShiftRight */;
+ }
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108895 /* ShiftRightAssign */;
+ }
+ return 167774274 /* ShiftRight */;
+ }
+ // `^`, `^=`
+ case 94 /* Caret */:
+ parser.index++;
+ parser.column++;
+ if (!consumeOpt(parser, 61 /* EqualSign */))
+ return 167773254 /* BitwiseXor */;
+ return 67108903 /* BitwiseXorAssign */;
+ // ``string``
+ case 96 /* Backtick */:
+ return scanTemplate(parser, context);
+ // `|`, `||`, `|=`
+ case 124 /* VerticalBar */:
+ {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 124 /* VerticalBar */) {
+ parser.index++;
+ parser.column++;
+ return 169869624 /* LogicalOr */;
+ }
+ else if (next === 61 /* EqualSign */) {
+ parser.index++;
+ parser.column++;
+ return 67108904 /* BitwiseOrAssign */;
+ }
+ return 167772997 /* BitwiseOr */;
+ }
+ // `.`, `...`, `.123` (numeric literal)
+ case 46 /* Period */:
+ {
+ let index = parser.index + 1;
+ const next = parser.source.charCodeAt(index);
+ if (next >= 48 /* Zero */ && next <= 57 /* Nine */) {
+ scanNumericLiteral(parser, context, exports.NumericState.Float);
+ return 33554434 /* NumericLiteral */;
+ }
+ else if (next === 46 /* Period */) {
+ index++;
+ if (index < parser.length &&
+ parser.source.charCodeAt(index) === 46 /* Period */) {
+ parser.index = index + 1;
+ parser.column += 3;
+ return 14 /* Ellipsis */;
+ }
+ }
+ parser.index++;
+ parser.column++;
+ return 16777229 /* Period */;
+ }
+ // `#`
+ case 35 /* Hash */:
+ {
+ parser.index++;
+ parser.column++;
+ const index = parser.index;
+ const next = parser.source.charCodeAt(index);
+ if (context & exports.Context.OptionsShebang &&
+ lineStart &&
+ next === 33 /* Exclamation */) {
+ parser.index = index + 1;
+ skipSingleLineComment(parser, context, exports.ScannerState.None, 'SheBang');
+ continue;
+ }
+ return scanPrivateName(parser, context);
+ }
+ // `0`...`9`
+ case 48 /* Zero */:
+ {
+ parser.index++;
+ parser.column++;
+ switch (parser.source.charCodeAt(parser.index)) {
+ // Hex number - '0x', '0X'
+ case 88 /* UpperX */:
+ case 120 /* LowerX */:
+ return scanHexIntegerLiteral(parser, context);
+ // Binary number - '0b', '0B'
+ case 66 /* UpperB */:
+ case 98 /* LowerB */:
+ return scanOctalOrBinary(parser, context, 2);
+ // Octal number - '0o', '0O'
+ case 79 /* UpperO */:
+ case 111 /* LowerO */:
+ return scanOctalOrBinary(parser, context, 8);
+ default:
+ // Implicit octal digits startign with '0'
+ return scanImplicitOctalDigits(parser, context);
+ }
+ }
+ case 49 /* One */:
+ case 50 /* Two */:
+ case 51 /* Three */:
+ case 52 /* Four */:
+ case 53 /* Five */:
+ case 54 /* Six */:
+ case 55 /* Seven */:
+ case 56 /* Eight */:
+ case 57 /* Nine */:
+ return scanNumericLiteral(parser, context);
+ // `a`...`z`, `A`...`Z`, `_var`, `$var`
+ case 65 /* UpperA */:
+ case 66 /* UpperB */:
+ case 67 /* UpperC */:
+ case 68 /* UpperD */:
+ case 69 /* UpperE */:
+ case 70 /* UpperF */:
+ case 71 /* UpperG */:
+ case 72 /* UpperH */:
+ case 73 /* UpperI */:
+ case 74 /* UpperJ */:
+ case 75 /* UpperK */:
+ case 76 /* UpperL */:
+ case 77 /* UpperM */:
+ case 78 /* UpperN */:
+ case 79 /* UpperO */:
+ case 80 /* UpperP */:
+ case 81 /* UpperQ */:
+ case 82 /* UpperR */:
+ case 83 /* UpperS */:
+ case 84 /* UpperT */:
+ case 85 /* UpperU */:
+ case 86 /* UpperV */:
+ case 87 /* UpperW */:
+ case 88 /* UpperX */:
+ case 89 /* UpperY */:
+ case 90 /* UpperZ */:
+ case 36 /* Dollar */:
+ case 95 /* Underscore */:
+ case 97 /* LowerA */:
+ case 98 /* LowerB */:
+ case 99 /* LowerC */:
+ case 100 /* LowerD */:
+ case 101 /* LowerE */:
+ case 102 /* LowerF */:
+ case 103 /* LowerG */:
+ case 104 /* LowerH */:
+ case 105 /* LowerI */:
+ case 106 /* LowerJ */:
+ case 107 /* LowerK */:
+ case 108 /* LowerL */:
+ case 109 /* LowerM */:
+ case 110 /* LowerN */:
+ case 111 /* LowerO */:
+ case 112 /* LowerP */:
+ case 113 /* LowerQ */:
+ case 114 /* LowerR */:
+ case 115 /* LowerS */:
+ case 116 /* LowerT */:
+ case 117 /* LowerU */:
+ case 118 /* LowerV */:
+ case 119 /* LowerW */:
+ case 120 /* LowerX */:
+ case 121 /* LowerY */:
+ case 122 /* LowerZ */:
+ default:
+ return scanIdentifier(parser, context, first);
+ }
+ }
+ }
+ return 1048576 /* EndOfSource */;
+ } + + /**
+ * Scans regular expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanRegularExpression(parser, context) {
+ const bodyStart = parser.index;
+ let preparseState = exports.RegexState.Empty;
+ loop: while (true) {
+ const ch = parser.source.charCodeAt(parser.index);
+ parser.index++;
+ parser.column++;
+ if (preparseState & exports.RegexState.Escape) {
+ preparseState &= ~exports.RegexState.Escape;
+ }
+ else {
+ switch (ch) {
+ case 47 /* Slash */:
+ if (!preparseState)
+ break loop;
+ else
+ break;
+ case 92 /* Backslash */:
+ preparseState |= exports.RegexState.Escape;
+ break;
+ case 91 /* LeftBracket */:
+ preparseState |= exports.RegexState.Class;
+ break;
+ case 93 /* RightBracket */:
+ preparseState &= exports.RegexState.Escape;
+ break;
+ case 13 /* CarriageReturn */:
+ case 10 /* LineFeed */:
+ case 8232 /* LineSeparator */:
+ case 8233 /* ParagraphSeparator */:
+ report(parser, 7 /* UnterminatedRegExp */);
+ default: // ignore
+ }
+ }
+ if (parser.index >= parser.source.length) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ const bodyEnd = parser.index - 1;
+ let mask = exports.RegexFlags.Empty;
+ const { index: flagStart } = parser;
+ loop: while (parser.index < parser.source.length) {
+ const code = parser.source.charCodeAt(parser.index);
+ switch (code) {
+ case 103 /* LowerG */:
+ if (mask & exports.RegexFlags.Global)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'g');
+ mask |= exports.RegexFlags.Global;
+ break;
+ case 105 /* LowerI */:
+ if (mask & exports.RegexFlags.IgnoreCase)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'i');
+ mask |= exports.RegexFlags.IgnoreCase;
+ break;
+ case 109 /* LowerM */:
+ if (mask & exports.RegexFlags.Multiline)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'm');
+ mask |= exports.RegexFlags.Multiline;
+ break;
+ case 117 /* LowerU */:
+ if (mask & exports.RegexFlags.Unicode)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'u');
+ mask |= exports.RegexFlags.Unicode;
+ break;
+ case 121 /* LowerY */:
+ if (mask & exports.RegexFlags.Sticky)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 'y');
+ mask |= exports.RegexFlags.Sticky;
+ break;
+ case 115 /* LowerS */:
+ if (mask & exports.RegexFlags.DotAll)
+ tolerant(parser, context, 15 /* DuplicateRegExpFlag */, 's');
+ mask |= exports.RegexFlags.DotAll;
+ break;
+ default:
+ if (!isIdentifierPart(code))
+ break loop;
+ report(parser, 16 /* UnexpectedTokenRegExpFlag */, fromCodePoint(code));
+ }
+ parser.index++;
+ parser.column++;
+ }
+ const flags = parser.source.slice(flagStart, parser.index);
+ const pattern = parser.source.slice(bodyStart, bodyEnd);
+ parser.tokenRegExp = { pattern, flags };
+ if (context & exports.Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(parser.startIndex, parser.index);
+ parser.tokenValue = validate(parser, context, pattern, flags);
+ return 33554436 /* RegularExpression */;
+ }
+ /**
+ * Validates regular expressions
+ *
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param pattern Regexp body
+ * @param flags Regexp flags
+ */
+ function validate(parser, context, pattern, flags) {
+ if (!(context & exports.Context.OptionsNode)) {
+ try {
+ }
+ catch (e) {
+ report(parser, 7 /* UnterminatedRegExp */);
+ }
+ }
+ try {
+ return new RegExp(pattern, flags);
+ }
+ catch (e) {
+ return null;
+ }
+ } + + // 12.15.5 Destructuring Assignment
+ /**
+ * Parses either a binding identifier or binding pattern
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBindingIdentifierOrPattern(parser, context, args = []) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ return token === 41943052 /* LeftBrace */ ?
+ parserObjectAssignmentPattern(parser, context) :
+ parseArrayAssignmentPattern(parser, context, args);
+ }
+ else if (token & (262144 /* IsAwait */ | 1073741824 /* IsYield */)) {
+ if (token & 262144 /* IsAwait */ && (context & (exports.Context.Async | exports.Context.Module))) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ else if (token & 1073741824 /* IsYield */ && (context & (exports.Context.Yield | exports.Context.Strict))) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ }
+ args.push(parser.tokenValue);
+ return parseBindingIdentifier(parser, context);
+ }
+ /**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BindingIdentifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBindingIdentifier(parser, context) {
+ const { token } = parser;
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ else if (context & exports.Context.BlockScope && token === 33574984 /* LetKeyword */) {
+ // let is disallowed as a lexically bound name
+ tolerant(parser, context, 27 /* LetInLexicalBinding */);
+ }
+ else if (hasBit(token, 20480 /* FutureReserved */)) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ parser.flags |= exports.Flags.StrictFunctionName;
+ }
+ else if (!isValidIdentifier(context, token)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ }
+ /**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAssignmentRestElement(parser, context, args) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+ }
+ /**
+ * Parse rest property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ // tslint:disable-next-line:function-name
+ function AssignmentRestProperty(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const { token } = parser;
+ const argument = parseBindingIdentifierOrPattern(parser, context);
+ if (hasBit(token, 8388608 /* IsBindingPattern */))
+ tolerant(parser, context, 94 /* InvalidRestBindingPattern */);
+ if (parser.token === 16777234 /* Comma */)
+ tolerant(parser, context, 88 /* RestWithComma */);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+ }
+ /**
+ * ArrayAssignmentPattern[Yield] :
+ * [ Elisionopt AssignmentRestElement[?Yield]opt ]
+ * [ AssignmentElementList[?Yield] ]
+ * [ AssignmentElementList[?Yield] , Elisionopt AssignmentRestElement[?Yield]opt ]
+ *
+ * AssignmentRestElement[Yield] :
+ * ... DestructuringAssignmentTarget[?Yield]
+ *
+ * AssignmentElementList[Yield] :
+ * AssignmentElisionElement[?Yield]
+ * AssignmentElementList[?Yield] , AssignmentElisionElement[?Yield]
+ *
+ * AssignmentElisionElement[Yield] :
+ * Elisionopt AssignmentElement[?Yield]
+ *
+ * AssignmentElement[Yield] :
+ * DestructuringAssignmentTarget[?Yield] Initializer[In,?Yield]opt
+ *
+ * DestructuringAssignmentTarget[Yield] :
+ * LeftHandSideExpression[?Yield]
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param Parser object
+ * @param Context masks
+ */
+ function parseArrayAssignmentPattern(parser, context, args) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else {
+ if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseAssignmentRestElement(parser, context, args));
+ break;
+ }
+ else {
+ elements.push(parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseBindingInitializer));
+ }
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ // tslint:disable-next-line:no-object-literal-type-assertion
+ return finishNode(context, parser, pos, {
+ type: 'ArrayPattern',
+ elements,
+ });
+ }
+ /**
+ * Parse object assignment pattern
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parserObjectAssignmentPattern(parser, context) {
+ const pos = getLocation(parser);
+ const properties = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ properties.push(AssignmentRestProperty(parser, context));
+ break;
+ }
+ properties.push(parseAssignmentProperty(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ObjectPattern',
+ properties,
+ });
+ }
+ /** Parse assignment pattern
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param left LHS of assignment pattern
+ * @param pos Location
+ */
+ function parseAssignmentPattern(parser, context, left, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression),
+ });
+ }
+ /**
+ * Parse binding initializer
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentPattern)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayAssignmentPattern)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBindingInitializer(parser, context) {
+ const pos = getLocation(parser);
+ const left = parseBindingIdentifierOrPattern(parser, context);
+ return !consume(parser, context, 83886109 /* Assign */) ?
+ left :
+ finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseAssignmentExpression(parser, context | exports.Context.AllowIn),
+ });
+ }
+ /**
+ * Parse assignment property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAssignmentProperty(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ let key;
+ let value;
+ let computed = false;
+ let shorthand = false;
+ // single name binding
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ key = parseIdentifier(parser, context);
+ shorthand = !consume(parser, context, 16777237 /* Colon */);
+ if (shorthand) {
+ const hasInitializer = consume(parser, context, 83886109 /* Assign */);
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (!isValidIdentifier(context, token))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ value = hasInitializer ? parseAssignmentPattern(parser, context, key, pos) : key;
+ }
+ else
+ value = parseBindingInitializer(parser, context);
+ }
+ else {
+ computed = token === 41943059 /* LeftBracket */;
+ key = parsePropertyName(parser, context);
+ expect(parser, context, 16777237 /* Colon */);
+ value = parseExpressionCoverGrammar(parser, context, parseBindingInitializer);
+ }
+ // Note! The specs specifically state that this is "assignment property", but
+ // nothing in ESTree specs explains the difference between this "property" and the "property" for object literals.
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ kind: 'init',
+ key,
+ computed,
+ value,
+ method: false,
+ shorthand,
+ });
+ } + + // JSX Specification
+ // https://facebook.github.io/jsx/
+ /**
+ * Parses JSX element or JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXRootElement(parser, context) {
+ const pos = getLocation(parser);
+ let children = [];
+ let closingElement = null;
+ let selfClosing = false;
+ let openingElement;
+ expect(parser, context, 167774015 /* LessThan */);
+ const isFragment = parser.token === 167774016 /* GreaterThan */;
+ if (isFragment) {
+ openingElement = parseJSXOpeningFragment(parser, context, pos);
+ }
+ else {
+ const name = parseJSXElementName(parser, context);
+ const attributes = parseJSXAttributes(parser, context);
+ selfClosing = consume(parser, context, 167774773 /* Divide */);
+ openingElement = parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos);
+ }
+ if (isFragment)
+ return parseJSXFragment(parser, context, openingElement, pos);
+ if (!selfClosing) {
+ children = parseJSXChildren(parser, context);
+ closingElement = parseJSXClosingElement(parser, context);
+ const open = isEqualTagNames(openingElement.name);
+ const close = isEqualTagNames(closingElement.name);
+ if (open !== close)
+ report(parser, 85 /* ExpectedJSXClosingTag */, close);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'JSXElement',
+ children,
+ openingElement,
+ closingElement,
+ });
+ }
+ /**
+ * Parses JSX opening element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param name Element name
+ * @param attributes Element attributes
+ * @param selfClosing True if this is a selfclosing JSX Element
+ * @param pos Line / Column tracking
+ */
+ function parseJSXOpeningElement(parser, context, name, attributes, selfClosing, pos) {
+ if (context & exports.Context.InJSXChild && selfClosing)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningElement',
+ name,
+ attributes,
+ selfClosing,
+ });
+ }
+ /**
+ * Parse JSX fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param openingElement Opening fragment
+ * @param pos Line / Column location
+ */
+ function parseJSXFragment(parser, context, openingElement, pos) {
+ const children = parseJSXChildren(parser, context);
+ const closingFragment = parseJSXClosingFragment(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXFragment',
+ children,
+ openingElement,
+ closingFragment,
+ });
+ }
+ /**
+ * Parse JSX opening fragmentD
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXOpeningFragment(parser, context, pos) {
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXOpeningFragment',
+ });
+ }
+ /**
+ * Prime the scanner and advance to the next JSX token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextJSXToken(parser) {
+ return parser.token = scanJSXToken(parser);
+ }
+ /**
+ * Mini scanner
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanJSXToken(parser) {
+ if (parser.index >= parser.source.length)
+ return 1048576 /* EndOfSource */;
+ parser.lastIndex = parser.startIndex = parser.index;
+ const char = parser.source.charCodeAt(parser.index);
+ if (char === 60 /* LessThan */) {
+ parser.index++;
+ parser.column++;
+ return consumeOpt(parser, 47 /* Slash */) ? 25 /* JSXClose */ : 167774015 /* LessThan */;
+ }
+ else if (char === 123 /* LeftBrace */) {
+ parser.index++;
+ parser.column++;
+ return 41943052 /* LeftBrace */;
+ }
+ while (parser.index < parser.source.length) {
+ parser.index++;
+ parser.column++;
+ const next = parser.source.charCodeAt(parser.index);
+ if (next === 123 /* LeftBrace */ || next === 60 /* LessThan */)
+ break;
+ }
+ return 121 /* JSXText */;
+ }
+ /**
+ * Parses JSX children
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXChildren(parser, context) {
+ const children = [];
+ while (parser.token !== 25 /* JSXClose */) {
+ children.push(parseJSXChild(parser, context));
+ }
+ return children;
+ }
+ /**
+ * Parses JSX Text
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXText(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.source.slice(parser.startIndex, parser.index);
+ parser.token = scanJSXToken(parser);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXText',
+ value,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = value;
+ return node;
+ }
+ /**
+ * Parses JSX Child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXChild(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ case 121 /* JSXText */:
+ return parseJSXText(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpression(parser, context & ~exports.Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context & ~exports.Context.InJSXChild);
+ default:
+ report(parser, 0 /* Unexpected */);
+ }
+ return undefined; // note: get rid of this
+ }
+ /**
+ * Parses JSX attributes
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttributes(parser, context) {
+ const attributes = [];
+ while (parser.index < parser.source.length) {
+ if (parser.token === 167774773 /* Divide */ || parser.token === 167774016 /* GreaterThan */)
+ break;
+ attributes.push(parseJSXAttribute(parser, context));
+ }
+ return attributes;
+ }
+ /**
+ * Parses JSX spread attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXSpreadAttribute(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~exports.Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadAttribute',
+ argument: expression,
+ });
+ }
+ /**
+ * Parses JSX namespace name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param namespace Identifier
+ * @param pos Line / Column location
+ */
+ function parseJSXNamespacedName(parser, context, namespace, pos) {
+ expect(parser, context, 16777237 /* Colon */);
+ const name = parseJSXIdentifier(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'JSXNamespacedName',
+ namespace,
+ name,
+ });
+ }
+ /**
+ * Parses JSX attribute name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttributeName(parser, context) {
+ const pos = getLocation(parser);
+ const identifier = parseJSXIdentifier(parser, context);
+ return parser.token === 16777237 /* Colon */ ?
+ parseJSXNamespacedName(parser, context, identifier, pos) :
+ identifier;
+ }
+ /**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttributeValue(parser, context) {
+ switch (scanJSXAttributeValue(parser, context)) {
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseJSXExpressionContainer(parser, context | exports.Context.InJSXChild);
+ case 167774015 /* LessThan */:
+ return parseJSXRootElement(parser, context | exports.Context.InJSXChild);
+ default:
+ tolerant(parser, context, 87 /* InvalidJSXAttributeValue */);
+ return undefined; // note: get rid of this
+ }
+ }
+ /**
+ * Parses JSX Attribute
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXAttribute(parser, context) {
+ const pos = getLocation(parser);
+ if (parser.token === 41943052 /* LeftBrace */)
+ return parseJSXSpreadAttribute(parser, context);
+ scanJSXIdentifier(parser);
+ const attrName = parseJSXAttributeName(parser, context);
+ const value = parser.token === 83886109 /* Assign */ ? parseJSXAttributeValue(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'JSXAttribute',
+ value: value,
+ name: attrName,
+ });
+ }
+ /**
+ * Parses JSX Attribute value
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanJSXAttributeValue(parser, context) {
+ parser.lastIndex = parser.index;
+ const ch = parser.source.charCodeAt(parser.index);
+ switch (ch) {
+ case 34 /* DoubleQuote */:
+ case 39 /* SingleQuote */:
+ return scanJSXString(parser, context, ch);
+ default:
+ return nextToken(parser, context);
+ }
+ }
+ /**
+ * Parses JSX String
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param quote Code point
+ */
+ function scanJSXString(parser, context, quote) {
+ const rawStart = parser.index;
+ parser.index++;
+ parser.column++;
+ let ret = '';
+ let ch = parser.source.charCodeAt(parser.index);
+ while (ch !== quote) {
+ ret += fromCodePoint(ch);
+ parser.index++;
+ parser.column++;
+ ch = parser.source.charCodeAt(parser.index);
+ if (parser.index >= parser.source.length)
+ report(parser, 6 /* UnterminatedString */);
+ }
+ parser.index++;
+ parser.column++; // skip the quote
+ // raw
+ if (context & exports.Context.OptionsRaw)
+ parser.tokenRaw = parser.source.slice(rawStart, parser.index);
+ parser.tokenValue = ret;
+ return 33554435 /* StringLiteral */;
+ }
+ /**
+ * Parses JJSX Empty Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXEmptyExpression(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXEmptyExpression',
+ });
+ }
+ /**
+ * Parses JSX Spread child
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXSpreadChild(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const expression = parseExpression(parser, context);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXSpreadChild',
+ expression,
+ });
+ }
+ /**
+ * Parses JSX Expression container
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXExpressionContainer(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ // Note: JSX Expressions can't be empty
+ if (parser.token === 17825807 /* RightBrace */)
+ tolerant(parser, context, 84 /* NonEmptyJSXExpression */);
+ const expression = parseExpressionCoverGrammar(parser, context & ~exports.Context.InJSXChild, parseAssignmentExpression);
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+ }
+ /**
+ * Parses JSX Expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ if (parser.token === 14 /* Ellipsis */)
+ return parseJSXSpreadChild(parser, context);
+ const expression = parser.token === 17825807 /* RightBrace */ ?
+ parseJSXEmptyExpression(parser, context) :
+ parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXExpressionContainer',
+ expression,
+ });
+ }
+ /**
+ * Parses JSX Closing fragment
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXClosingFragment(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ expect(parser, context, 167774016 /* GreaterThan */);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingFragment',
+ });
+ }
+ /**
+ * Parses JSX Closing Element
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXClosingElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 25 /* JSXClose */);
+ const name = parseJSXElementName(parser, context);
+ if (context & exports.Context.InJSXChild)
+ expect(parser, context, 167774016 /* GreaterThan */);
+ else
+ nextJSXToken(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXClosingElement',
+ name,
+ });
+ }
+ /**
+ * Parses JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXIdentifier(parser, context) {
+ const { token, tokenValue: name, tokenRaw: raw } = parser;
+ if (!(token & (131072 /* IsIdentifier */ | 4096 /* Keyword */))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'JSXIdentifier',
+ name,
+ });
+ if (context & exports.Context.OptionsRawidentifiers)
+ node.raw = raw;
+ return node;
+ }
+ /**
+ * Parses JSX Member expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Line / Column location
+ */
+ function parseJSXMemberExpression(parser, context, expr, pos) {
+ // Note: In order to be able to parse cases like ''<A.B.C.D.E.foo-bar />', where the dash is located at the
+ // end, we must rescan for the JSX Identifier now. This because JSX identifiers differ from normal identifiers
+ scanJSXIdentifier(parser);
+ return finishNode(context, parser, pos, {
+ type: 'JSXMemberExpression',
+ object: expr,
+ property: parseJSXIdentifier(parser, context),
+ });
+ }
+ /**
+ * Parses JSX Element name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseJSXElementName(parser, context) {
+ const pos = getLocation(parser);
+ scanJSXIdentifier(parser);
+ let elementName = parseJSXIdentifier(parser, context);
+ if (parser.token === 16777237 /* Colon */)
+ return parseJSXNamespacedName(parser, context, elementName, pos);
+ while (consume(parser, context, 16777229 /* Period */)) {
+ elementName = parseJSXMemberExpression(parser, context, elementName, pos);
+ }
+ return elementName;
+ }
+ /**
+ * Scans JSX Identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function scanJSXIdentifier(parser) {
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const firstCharPosition = parser.index;
+ let ch = parser.source.charCodeAt(parser.index);
+ while ((parser.index < parser.source.length) && (ch === 45 /* Hyphen */ || (isValidIdentifierPart(ch)))) {
+ ch = readNext(parser);
+ }
+ parser.tokenValue += parser.source.substr(firstCharPosition, parser.index - firstCharPosition);
+ }
+ return parser.token;
+ } + + /**
+ * Expression :
+ * AssignmentExpression
+ * Expression , AssignmentExpression
+ *
+ * ExpressionNoIn :
+ * AssignmentExpressionNoIn
+ * ExpressionNoIn , AssignmentExpressionNoIn
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Expression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExpression(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ return parser.token === 16777234 /* Comma */ ?
+ parseSequenceExpression(parser, context, expr, pos) :
+ expr;
+ }
+ /**
+ * Parse secuence expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSequenceExpression(parser, context, left, pos) {
+ const expressions = [left];
+ while (consume(parser, context, 16777234 /* Comma */)) {
+ expressions.push(parseExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ /**
+ * Parse yield expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-YieldExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseYieldExpression(parser, context, pos) {
+ // YieldExpression[In] :
+ // yield
+ // yield [no LineTerminator here] AssignmentExpression[?In, Yield]
+ // yield [no LineTerminator here] * AssignmentExpression[?In, Yield]
+ // https://tc39.github.io/ecma262/#sec-generator-function-definitions-static-semantics-early-errors
+ if (context & exports.Context.InParameter)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ expect(parser, context, 1107316842 /* YieldKeyword */);
+ let argument = null;
+ let delegate = false;
+ if (!(parser.flags & exports.Flags.NewLine)) {
+ delegate = consume(parser, context, 167774771 /* Multiply */);
+ // 'Token.IsExpressionStart' bitmask contains the complete set of
+ // tokens that can appear after an AssignmentExpression, and none of them
+ // can start an AssignmentExpression.
+ if (delegate || parser.token & 33554432 /* IsExpressionStart */) {
+ argument = parseAssignmentExpression(parser, context);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'YieldExpression',
+ argument,
+ delegate,
+ });
+ }
+ /**
+ * AssignmentExpression :
+ * ConditionalExpression
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpression
+ * LeftHandSideExpression AssignmentOperator AssignmentExpression
+ *
+ * AssignmentExpressionNoIn :
+ * ConditionalExpressionNoIn
+ * YieldExpression
+ * ArrowFunction
+ * AsyncArrowFunction
+ * LeftHandSideExpression = AssignmentExpressionNoIn
+ * LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAssignmentExpression(parser, context) {
+ const pos = getLocation(parser);
+ let { token } = parser;
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ return parseYieldExpression(parser, context, pos);
+ let expr = token & 524288 /* IsAsync */ && lookahead(parser, context, nextTokenisIdentifierOrParen)
+ ? parserCoverCallExpressionAndAsyncArrowHead(parser, context)
+ : parseConditionalExpression(parser, context, pos);
+ if (parser.token === 10 /* Arrow */) {
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & (20480 /* FutureReserved */ | 4194304 /* IsEvalOrArguments */)) {
+ // Invalid: ' yield => { 'use strict'; 0 };'
+ if (token & 20480 /* FutureReserved */) {
+ parser.flags |= exports.Flags.HasStrictReserved;
+ }
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ }
+ expr = [expr];
+ }
+ return parseArrowFunction(parser, context &= ~exports.Context.Async, pos, expr);
+ }
+ if (hasBit(parser.token, 67108864 /* IsAssignOp */)) {
+ token = parser.token;
+ if (context & exports.Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 17 /* StrictLHSAssignment */);
+ }
+ else if (consume(parser, context, 83886109 /* Assign */)) {
+ if (!(parser.flags & exports.Flags.AllowDestructuring)) {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ // Only re-interpret if not inside a formal parameter list
+ if (!(context & exports.Context.InParameter))
+ reinterpret(parser, context, expr);
+ if (context & exports.Context.InParen)
+ parser.flags |= exports.Flags.SimpleParameterList;
+ if (parser.token & 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasAwait;
+ }
+ else if (context & exports.Context.InParen &&
+ context & (exports.Context.Strict | exports.Context.Yield) &&
+ parser.token & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasYield;
+ }
+ }
+ else {
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ nextToken(parser, context);
+ }
+ const right = parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ parser.pendingExpressionError = null;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentExpression',
+ left: expr,
+ operator: tokenDesc(token),
+ right,
+ });
+ }
+ return expr;
+ }
+ /**
+ * Parse conditional expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ConditionalExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseConditionalExpression(parser, context, pos) {
+ const test = parseBinaryExpression(parser, context, 0, pos);
+ if (!consume(parser, context, 22 /* QuestionMark */))
+ return test;
+ const consequent = parseExpressionCoverGrammar(parser, context & ~exports.Context.AllowDecorator | exports.Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16777237 /* Colon */);
+ return finishNode(context, parser, pos, {
+ type: 'ConditionalExpression',
+ test,
+ consequent,
+ alternate: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+ }
+ /**
+ * Parse binary expression.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-exp-operator)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-additive-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-bitwise-shift-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-equality-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-binary-logical-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-relational-operators)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-multiplicative-operators)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param minPrec Minimum precedence value
+ * @param pos Line / Column info
+ * @param Left Left hand side of the binary expression
+ */
+ function parseBinaryExpression(parser, context, minPrec, pos, left = parseUnaryExpression(parser, context)) {
+ // Shift-reduce parser for the binary operator part of the JS expression
+ // syntax.
+ const bit = context & exports.Context.AllowIn ^ exports.Context.AllowIn;
+ while (hasBit(parser.token, 167772160 /* IsBinaryOp */)) {
+ const t = parser.token;
+ const prec = t & 3840 /* Precedence */;
+ const delta = (t === 167775030 /* Exponentiate */) << 8 /* PrecStart */;
+ if (bit && t === 167786289 /* InKeyword */)
+ break;
+ // When the next token is no longer a binary operator, it's potentially the
+ // start of an expression, so we break the loop
+ if (prec + delta <= minPrec)
+ break;
+ nextToken(parser, context);
+ left = finishNode(context, parser, pos, {
+ type: t & 2097152 /* IsLogical */ ? 'LogicalExpression' : 'BinaryExpression',
+ left,
+ right: parseBinaryExpression(parser, context & ~exports.Context.AllowIn, prec, getLocation(parser)),
+ operator: tokenDesc(t),
+ });
+ }
+ return left;
+ }
+ /**
+ * Parse await expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AwaitExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ */
+ function parseAwaitExpression(parser, context, pos) {
+ if (context & exports.Context.InParameter)
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ expect(parser, context, 34017389 /* AwaitKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'AwaitExpression',
+ argument: parseUnaryExpression(parser, context),
+ });
+ }
+ /**
+ * Parses unary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UnaryExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseUnaryExpression(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ if (hasBit(token, 301989888 /* IsUnaryOp */)) {
+ nextToken(parser, context);
+ if (parser.flags & exports.Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ const argument = parseExpressionCoverGrammar(parser, context, parseUnaryExpression);
+ if (parser.token === 167775030 /* Exponentiate */) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & exports.Context.Strict && token === 302002219 /* DeleteKeyword */) {
+ if (argument.type === 'Identifier') {
+ tolerant(parser, context, 43 /* StrictDelete */);
+ }
+ else if (isPropertyWithPrivateFieldKey(argument)) {
+ tolerant(parser, context, 44 /* DeletePrivateField */);
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'UnaryExpression',
+ operator: tokenDesc(token),
+ argument,
+ prefix: true,
+ });
+ }
+ return context & exports.Context.Async && token & 262144 /* IsAwait */
+ ? parseAwaitExpression(parser, context, pos)
+ : parseUpdateExpression(parser, context, pos);
+ }
+ /**
+ * Parses update expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-UpdateExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseUpdateExpression(parser, context, pos) {
+ const { token } = parser;
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */)) {
+ nextToken(parser, context);
+ const expr = parseLeftHandSideExpression(parser, context, pos);
+ validateUpdateExpression(parser, context, expr, 'Prefix');
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expr,
+ operator: tokenDesc(token),
+ prefix: true,
+ });
+ }
+ else if (context & exports.Context.OptionsJSX && token === 167774015 /* LessThan */) {
+ return parseJSXRootElement(parser, context | exports.Context.InJSXChild);
+ }
+ const expression = parseLeftHandSideExpression(parser, context, pos);
+ if (hasBit(parser.token, 570425344 /* IsUpdateOp */) && !(parser.flags & exports.Flags.NewLine)) {
+ validateUpdateExpression(parser, context, expression, 'Postfix');
+ const operator = parser.token;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'UpdateExpression',
+ argument: expression,
+ operator: tokenDesc(operator),
+ prefix: false,
+ });
+ }
+ return expression;
+ }
+ /**
+ * Parse assignment rest element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentRestElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseRestElement(parser, context, args = []) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (context & exports.Context.InParen && parser.token & 262144 /* IsAwait */)
+ parser.flags |= exports.Flags.HasAwait;
+ const argument = parseBindingIdentifierOrPattern(parser, context, args);
+ return finishNode(context, parser, pos, {
+ type: 'RestElement',
+ argument,
+ });
+ }
+ /**
+ * Parse spread element
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SpreadElement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSpreadElement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ const argument = restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+ }
+ /**
+ * Parse left hand side expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LeftHandSideExpression)
+ *
+ * @param Parser Parer instance
+ * @param Context Contextmasks
+ * @param pos Location info
+ */
+ function parseLeftHandSideExpression(parser, context, pos) {
+ const expr = context & exports.Context.OptionsNext && parser.token === 33566810 /* ImportKeyword */
+ ? parseCallImportOrMetaProperty(parser, context | exports.Context.AllowIn)
+ : parseMemberExpression(parser, context | exports.Context.AllowIn, pos);
+ return parseCallExpression(parser, context | exports.Context.AllowIn, pos, expr);
+ }
+ /**
+ * Parse member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location info
+ * @param expr Expression
+ */
+ function parseMemberExpression(parser, context, pos, expr = parsePrimaryExpression(parser, context)) {
+ while (true) {
+ switch (parser.token) {
+ case 16777229 /* Period */: {
+ consume(parser, context, 16777229 /* Period */);
+ parser.flags = parser.flags & ~exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ const property = parseIdentifierNameOrPrivateName(parser, context);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: false,
+ property,
+ });
+ continue;
+ }
+ case 41943059 /* LeftBracket */: {
+ consume(parser, context, 41943059 /* LeftBracket */);
+ parser.flags = parser.flags & ~exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ const property = parseExpression(parser, context);
+ expect(parser, context, 20 /* RightBracket */);
+ expr = finishNode(context, parser, pos, {
+ type: 'MemberExpression',
+ object: expr,
+ computed: true,
+ property,
+ });
+ continue;
+ }
+ case 33554441 /* TemplateTail */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplateLiteral(parser, context),
+ });
+ continue;
+ }
+ case 33554440 /* TemplateCont */: {
+ expr = finishNode(context, parser, pos, {
+ type: 'TaggedTemplateExpression',
+ tag: expr,
+ quasi: parseTemplate(parser, context | exports.Context.TaggedTemplate),
+ });
+ continue;
+ }
+ default:
+ return expr;
+ }
+ }
+ }
+ /**
+ * Parse call expression
+ *
+ * @param parser Parer instance
+ * @param context Context masks
+ * @param pos Line / Colum info
+ * @param expr Expression
+ */
+ function parseCallExpression(parser, context, pos, expr) {
+ while (true) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ if (parser.token !== 50331659 /* LeftParen */)
+ return expr;
+ const args = parseArgumentList(parser, context & ~exports.Context.AllowDecorator);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ }
+ /**
+ * Parse cover call expression and async arrow head
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CoverCallExpressionAndAsyncArrowHead)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parserCoverCallExpressionAndAsyncArrowHead(parser, context) {
+ const pos = getLocation(parser);
+ let expr = parseMemberExpression(parser, context | exports.Context.AllowIn, pos);
+ // Here we jump right into it and parse a simple, faster sub-grammar for
+ // async arrow / async identifier + call expression. This could have been done different
+ // but ESTree sucks!
+ //
+ // - J.K. Thomas
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (parser.token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */);
+ return parseAsyncArrowFunction(parser, context, exports.ModifierState.Await, pos, [parseAndClassifyIdentifier(parser, context)]);
+ }
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ while (parser.token === 50331659 /* LeftParen */) {
+ expr = parseMemberExpression(parser, context, pos, expr);
+ const args = parseAsyncArgumentList(parser, context);
+ if (parser.token === 10 /* Arrow */) {
+ expr = parseAsyncArrowFunction(parser, context, exports.ModifierState.Await, pos, args);
+ break;
+ }
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: args,
+ });
+ }
+ return expr;
+ }
+ /**
+ * Parse argument list
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parseArgumentList(parser, context) {
+ // ArgumentList :
+ // AssignmentOrSpreadExpression
+ // ArgumentList , AssignmentOrSpreadExpression
+ //
+ // AssignmentOrSpreadExpression :
+ // ... AssignmentExpression
+ // AssignmentExpression
+ expect(parser, context, 50331659 /* LeftParen */);
+ const expressions = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ expressions.push(parseSpreadElement(parser, context));
+ }
+ else {
+ if (context & exports.Context.Yield && hasBit(parser.token, 1073741824 /* IsYield */)) {
+ parser.flags |= exports.Flags.HasYield;
+ setPendingError(parser);
+ }
+ expressions.push(parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression));
+ }
+ if (parser.token !== 16 /* RightParen */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return expressions;
+ }
+ /**
+ * Parse argument list for async arrow / async call expression
+ *
+ * @see [https://tc39.github.io/ecma262/#prod-ArgumentList)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parseAsyncArgumentList(parser, context) {
+ // Here we are parsing an "extended" argument list tweaked to handle async arrows. This is
+ // done here to avoid overhead and possible performance loss if we only
+ // parse out a simple call expression - E.g 'async(foo, bar)' or 'async(foo, bar)()';
+ //
+ // - J.K. Thomas
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = [];
+ let { token } = parser;
+ let state = exports.CoverCallState.Empty;
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ args.push(parseSpreadElement(parser, context));
+ state = exports.CoverCallState.HasSpread;
+ }
+ else {
+ token = parser.token;
+ state = validateAsyncArgumentList(parser, context, state);
+ args.push(restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression));
+ }
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ if (state & exports.CoverCallState.HasSpread)
+ state = exports.CoverCallState.SeenSpread;
+ }
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & exports.CoverCallState.SeenSpread) {
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ }
+ else if (state & exports.CoverCallState.EvalOrArguments) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ else if (state & exports.CoverCallState.Yield) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ parser.flags |= exports.Flags.HasStrictReserved;
+ }
+ else if (parser.flags & exports.Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (state & exports.CoverCallState.Await || parser.flags & exports.Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ }
+ return args;
+ }
+ /**
+ * Parse primary expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PrimaryExpression)
+ *
+ * @param Parser Parser object
+ * @param Context Context masks
+ */
+ function parsePrimaryExpression(parser, context) {
+ switch (parser.token) {
+ case 33685505 /* Identifier */:
+ return parseIdentifier(parser, context);
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionOrIdentifier(parser, context);
+ case 50331659 /* LeftParen */:
+ return parseParenthesizedExpression(parser, context | exports.Context.InParen);
+ case 41943059 /* LeftBracket */:
+ return restoreExpressionCoverGrammar(parser, context, parseArrayLiteral);
+ case 41943052 /* LeftBrace */:
+ return restoreExpressionCoverGrammar(parser, context, parseObjectLiteral);
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionExpression(parser, context);
+ case 33566727 /* NullKeyword */:
+ case 33566726 /* TrueKeyword */:
+ case 33566725 /* FalseKeyword */:
+ return parseNullOrTrueOrFalseLiteral(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassExpression(parser, context);
+ case 33566811 /* NewKeyword */:
+ return parseNewExpressionOrMetaProperty(parser, context);
+ case 33566813 /* SuperKeyword */:
+ return parseSuperProperty(parser, context);
+ case 33554551 /* BigIntLiteral */:
+ return parseBigIntLiteral(parser, context);
+ case 33566815 /* ThisKeyword */:
+ return parseThisExpression(parser, context);
+ case 115 /* Hash */:
+ return parseIdentifierNameOrPrivateName(parser, context);
+ case 167774773 /* Divide */:
+ case 100663333 /* DivideAssign */:
+ scanRegularExpression(parser, context);
+ return parseRegularExpressionLiteral(parser, context);
+ case 33554441 /* TemplateTail */:
+ return parseTemplateLiteral(parser, context);
+ case 33554440 /* TemplateCont */:
+ return parseTemplate(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetAsIdentifier(parser, context);
+ case 12369 /* DoKeyword */:
+ if (context & exports.Context.OptionsExperimental)
+ return parseDoExpression(parser, context);
+ default:
+ return parseAndClassifyIdentifier(parser, context);
+ }
+ }
+ /**
+ * Parse do expression (*experimental*)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDoExpression(parser, context) {
+ // AssignmentExpression ::
+ // do '{' StatementList '}'
+ const pos = getLocation(parser);
+ expect(parser, context, 12369 /* DoKeyword */);
+ return finishNode(context, parser, pos, {
+ type: 'DoExpression',
+ body: parseBlockStatement(parser, context)
+ });
+ }
+ /**
+ * Parse 'let' as identifier in 'sloppy mode', and throws
+ * in 'strict mode' / 'module code'. We also avoid a lookahead on the
+ * ASI restictions while checking this after parsing out the 'let' keyword
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+ function parseLetAsIdentifier(parser, context) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ if (parser.flags & exports.Flags.NewLine) {
+ if (parser.token === 41943059 /* LeftBracket */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, 'let');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ }
+ /**
+ * Parse either async function expression or identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context context mask
+ */
+ function parseAsyncFunctionOrIdentifier(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) :
+ parseIdentifier(parser, context);
+ }
+ /**
+ * Parses identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Identifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIdentifier(parser, context) {
+ const pos = getLocation(parser);
+ const name = parser.tokenValue;
+ nextToken(parser, context | exports.Context.TaggedTemplate);
+ const node = finishNode(context, parser, pos, {
+ type: 'Identifier',
+ name,
+ });
+ if (context & exports.Context.OptionsRawidentifiers)
+ node.raw = parser.tokenRaw;
+ return node;
+ }
+ /**
+ * Parse regular expression literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseRegularExpressionLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenRegExp, tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ regex: tokenRegExp,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = tokenRaw;
+ return node;
+ }
+ /**
+ * Parses string and number literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NumericLiteral)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StringLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const value = parser.tokenValue;
+ if (context & exports.Context.Strict && parser.flags & exports.Flags.HasOctal) {
+ tolerant(parser, context, 61 /* StrictOctalLiteral */);
+ }
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+ }
+ /**
+ * Parses BigInt literal (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/proposal-bigint/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBigIntLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: tokenValue,
+ bigint: tokenRaw,
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = parser.tokenRaw;
+ return node;
+ }
+ /**
+ * Parses either null or boolean literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BooleanLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNullOrTrueOrFalseLiteral(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const raw = tokenDesc(token);
+ if (parser.flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const node = finishNode(context, parser, pos, {
+ type: 'Literal',
+ value: token === 33566727 /* NullKeyword */ ? null : raw === 'true',
+ });
+ if (context & exports.Context.OptionsRaw)
+ node.raw = raw;
+ return node;
+ }
+ /**
+ * Parse this expression
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseThisExpression(parser, context) {
+ if (parser.flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ const pos = getLocation(parser);
+ nextToken(parser, context | exports.Context.DisallowEscapedKeyword);
+ return finishNode(context, parser, pos, {
+ type: 'ThisExpression',
+ });
+ }
+ /**
+ * Parse identifier name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-IdentifierName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t token
+ */
+ function parseIdentifierName(parser, context, t) {
+ if (!(t & (131072 /* IsIdentifier */ | 4096 /* Keyword */)))
+ tolerant(parser, context, 4 /* UnexpectedKeyword */, tokenDesc(t));
+ return parseIdentifier(parser, context);
+ }
+ /**
+ * Parse identifier name or private name (stage 3 proposal)
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIdentifierNameOrPrivateName(parser, context) {
+ if (!consume(parser, context, 115 /* Hash */))
+ return parseIdentifierName(parser, context, parser.token);
+ const { tokenValue } = parser;
+ const pos = getLocation(parser);
+ const name = tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+ }
+ /**
+ * Parse array literal
+ *
+ * ArrayLiteral :
+ * [ Elisionopt ]
+ * [ ElementList ]
+ * [ ElementList , Elisionopt ]
+ *
+ * ElementList :
+ * Elisionopt AssignmentExpression
+ * Elisionopt ... AssignmentExpression
+ * ElementList , Elisionopt AssignmentExpression
+ * ElementList , Elisionopt SpreadElement
+ *
+ * Elision :
+ * ,
+ * Elision ,
+ *
+ * SpreadElement :
+ * ... AssignmentExpression
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrayLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseArrayLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const elements = [];
+ while (parser.token !== 20 /* RightBracket */) {
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ elements.push(null);
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ elements.push(parseSpreadElement(parser, context));
+ if (parser.token !== 20 /* RightBracket */) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ else {
+ elements.push(restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression));
+ if (parser.token !== 20 /* RightBracket */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ }
+ expect(parser, context, 20 /* RightBracket */);
+ return finishNode(context, parser, pos, {
+ type: 'ArrayExpression',
+ elements,
+ });
+ }
+ /**
+ * Parses cover parenthesized expression and arrow parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-parseCoverParenthesizedExpressionAndArrowParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseParenthesizedExpression(parser, context) {
+ expect(parser, context, 50331659 /* LeftParen */);
+ if (consume(parser, context, 16 /* RightParen */)) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ if (parser.token === 10 /* Arrow */)
+ return [];
+ }
+ else if (parser.token === 14 /* Ellipsis */) {
+ const restExpr = [parseRestElement(parser, context)];
+ expect(parser, context, 16 /* RightParen */);
+ parser.flags = parser.flags & ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding) | exports.Flags.SimpleParameterList;
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return restExpr;
+ }
+ // Record the sequence position
+ const sequencepos = getLocation(parser);
+ let state = validateCoverParenthesizedExpression(parser, exports.CoverParenthesizedState.None);
+ let expr = restoreExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ // Sequence expression
+ if (parser.token === 16777234 /* Comma */) {
+ state |= exports.CoverParenthesizedState.SequenceExpression;
+ const expressions = [expr];
+ while (consume(parser, context | exports.Context.DisallowEscapedKeyword, 16777234 /* Comma */)) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (!(parser.flags & exports.Flags.AllowBinding))
+ tolerant(parser, context, 77 /* NotBindable */);
+ parser.flags |= exports.Flags.SimpleParameterList;
+ const restElement = parseRestElement(parser, context);
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 78 /* ParamAfterRest */);
+ expressions.push(restElement);
+ return expressions;
+ }
+ else if (consume(parser, context, 16 /* RightParen */)) {
+ if (parser.token !== 10 /* Arrow */)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return expressions;
+ }
+ else {
+ state = validateCoverParenthesizedExpression(parser, state);
+ expressions.push(restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression));
+ }
+ }
+ expr = finishNode(context, parser, sequencepos, {
+ type: 'SequenceExpression',
+ expressions,
+ });
+ }
+ expect(parser, context, 16 /* RightParen */);
+ if (parser.token === 10 /* Arrow */) {
+ if (state & exports.CoverParenthesizedState.HasEvalOrArguments) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ else if (state & exports.CoverParenthesizedState.HasReservedWords) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= exports.Flags.HasStrictReserved;
+ }
+ else if (!(parser.flags & exports.Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (parser.flags & exports.Flags.HasYield) {
+ tolerant(parser, context, 51 /* YieldInParameter */);
+ }
+ else if (context & exports.Context.Async && parser.flags & exports.Flags.HasAwait) {
+ tolerant(parser, context, 52 /* AwaitInParameter */);
+ }
+ parser.flags &= ~(exports.Flags.AllowBinding | exports.Flags.HasAwait | exports.Flags.HasYield);
+ return (state & exports.CoverParenthesizedState.SequenceExpression ? expr.expressions : [expr]);
+ }
+ parser.flags &= ~(exports.Flags.HasAwait | exports.Flags.HasYield | exports.Flags.AllowBinding);
+ if (!isValidSimpleAssignmentTarget(expr))
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ return expr;
+ }
+ /**
+ * Parses function expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFunctionExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? exports.ModifierState.Generator : exports.ModifierState.None;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & exports.ModifierState.Generator) {
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(exports.Context.Method | exports.Context.AllowSuperProperty), isGenerator, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: false,
+ generator: !!(isGenerator & exports.ModifierState.Generator),
+ expression: false,
+ id,
+ });
+ }
+ /**
+ * Parses async function or async generator expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionOrAsyncGeneratorExpression(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? exports.ModifierState.Generator : exports.ModifierState.None;
+ const isAwait = exports.ModifierState.Await;
+ let id = null;
+ const { token } = parser;
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (token & 4194304 /* IsEvalOrArguments */) {
+ if (context & exports.Context.Strict || isAwait & exports.ModifierState.Await)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictFunctionName;
+ }
+ if (token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (parser.token & 1073741824 /* IsYield */ && isGenerator & exports.ModifierState.Generator)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ id = parseBindingIdentifier(parser, context);
+ }
+ const { params, body } = swapContext(parser, context & ~(exports.Context.Method | exports.Context.AllowSuperProperty), isGenerator | isAwait, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: true,
+ generator: !!(isGenerator & exports.ModifierState.Generator),
+ expression: false,
+ id,
+ });
+ }
+ /**
+ * Parse computed property names
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ComputedPropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseComputedPropertyName(parser, context) {
+ expect(parser, context, 41943059 /* LeftBracket */);
+ const key = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ expect(parser, context, 20 /* RightBracket */);
+ return key;
+ }
+ /**
+ * Parse property name
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyName)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePropertyName(parser, context) {
+ switch (parser.token) {
+ case 33554434 /* NumericLiteral */:
+ case 33554435 /* StringLiteral */:
+ return parseLiteral(parser, context);
+ case 41943059 /* LeftBracket */:
+ return parseComputedPropertyName(parser, context);
+ default:
+ return parseIdentifier(parser, context);
+ }
+ }
+ /**
+ * Parse object spread properties
+ *
+ * @see [Link](https://tc39.github.io/proposal-object-rest-spread/#Spread)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSpreadProperties(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 14 /* Ellipsis */);
+ if (parser.token & 8388608 /* IsBindingPattern */)
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ const argument = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ return finishNode(context, parser, pos, {
+ type: 'SpreadElement',
+ argument,
+ });
+ }
+ /**
+ * Parses object literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ObjectLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseObjectLiteral(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const properties = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ properties.push(parser.token === 14 /* Ellipsis */ ?
+ parseSpreadProperties(parser, context) :
+ parsePropertyDefinition(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ parser.flags &= ~exports.Flags.HasProtoField;
+ return finishNode(context, parser, pos, {
+ type: 'ObjectExpression',
+ properties,
+ });
+ }
+ /**
+ * Parse property definition
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-PropertyDefinition)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePropertyDefinition(parser, context) {
+ const pos = getLocation(parser);
+ const flags = parser.flags;
+ let value;
+ let state = consume(parser, context, 167774771 /* Multiply */) ? exports.ObjectState.Generator | exports.ObjectState.Method : exports.ObjectState.Method;
+ const t = parser.token;
+ let key = parsePropertyName(parser, context);
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & exports.Flags.EscapedKeyword) {
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ }
+ else if (!(state & exports.ObjectState.Generator) && t & 524288 /* IsAsync */ && !(parser.flags & exports.Flags.NewLine)) {
+ state |= consume(parser, context, 167774771 /* Multiply */) ? exports.ObjectState.Generator | exports.ObjectState.Async : exports.ObjectState.Async;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69743 /* GetKeyword */) {
+ state = state & ~exports.ObjectState.Method | exports.ObjectState.Getter;
+ key = parsePropertyName(parser, context);
+ }
+ else if (t === 69744 /* SetKeyword */) {
+ state = state & ~exports.ObjectState.Method | exports.ObjectState.Setter;
+ key = parsePropertyName(parser, context);
+ }
+ if (state & (exports.ObjectState.Getter | exports.ObjectState.Setter)) {
+ if (state & exports.ObjectState.Generator)
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ state &= ~exports.ObjectState.Method;
+ if (parser.token === 16777237 /* Colon */) {
+ if ((state & (exports.ObjectState.Async | exports.ObjectState.Generator))) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ else if (t !== 41943059 /* LeftBracket */ && parser.tokenValue === '__proto__') {
+ if (parser.flags & exports.Flags.HasProtoField) {
+ // Record the error and put it on hold until we've determined
+ // whether or not we're destructuring
+ setPendingExpressionError(parser, 63 /* DuplicateProto */);
+ }
+ else
+ parser.flags |= exports.Flags.HasProtoField;
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ // Invalid: 'async ({a: await}) => 1'
+ if (parser.token & 262144 /* IsAwait */)
+ parser.flags |= exports.Flags.HasAwait;
+ value = restoreExpressionCoverGrammar(parser, context, parseAssignmentExpression);
+ }
+ else {
+ if ((state & (exports.ObjectState.Generator | exports.ObjectState.Async)) || !isValidIdentifier(context, t)) {
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(t));
+ }
+ else if (context & (exports.Context.Strict | exports.Context.Yield) && t & 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasYield;
+ }
+ state |= exports.ObjectState.Shorthand;
+ if (parser.token === 83886109 /* Assign */) {
+ if (context & exports.Context.Strict && t & 4194304 /* IsEvalOrArguments */) {
+ report(parser, 47 /* StrictEvalArguments */);
+ }
+ else
+ setPendingExpressionError(parser, 91 /* InvalidCoverInitializedName */);
+ expect(parser, context, 83886109 /* Assign */);
+ if (context & (exports.Context.Strict | exports.Context.Yield | exports.Context.Async) && parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */)) {
+ setPendingError(parser);
+ parser.flags |= parser.token & 1073741824 /* IsYield */ ? exports.Flags.HasYield : exports.Flags.HasAwait;
+ }
+ value = parseAssignmentPattern(parser, context, key, pos);
+ }
+ else {
+ if (t & 262144 /* IsAwait */) {
+ if (context & exports.Context.Async)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasAwait;
+ }
+ value = key;
+ }
+ }
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Property',
+ key,
+ value,
+ kind: !(state & exports.ObjectState.Getter | state & exports.ObjectState.Setter) ? 'init' : (state & exports.ObjectState.Setter) ? 'set' : 'get',
+ computed: t === 41943059 /* LeftBracket */,
+ method: !!(state & exports.ObjectState.Method),
+ shorthand: !!(state & exports.ObjectState.Shorthand),
+ });
+ }
+ /**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseMethodDeclaration(parser, context, state) {
+ const pos = getLocation(parser);
+ const isGenerator = state & exports.ObjectState.Generator ? exports.ModifierState.Generator : exports.ModifierState.None;
+ const isAsync = state & exports.ObjectState.Async ? exports.ModifierState.Await : exports.ModifierState.None;
+ const { params, body } = swapContext(parser, context | exports.Context.Method, isGenerator | isAsync, parseFormalListAndBody, state);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionExpression',
+ params,
+ body,
+ async: !!(state & exports.ObjectState.Async),
+ generator: !!(state & exports.ObjectState.Generator),
+ expression: false,
+ id: null,
+ });
+ }
+ /**
+ * Parse arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseArrowFunction(parser, context, pos, params) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, '=>');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context & ~exports.Context.Async, params, pos, exports.ModifierState.None);
+ }
+ /**
+ * Parse async arrow function
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncArrowFunction(parser, context, state, pos, params) {
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 36 /* InvalidLineBreak */, 'async');
+ expect(parser, context, 10 /* Arrow */);
+ return parseArrowBody(parser, context | exports.Context.Async, params, pos, state);
+ }
+ /**
+ * Shared helper function for both async arrow and arrows
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ArrowFunction)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncArrowFunction)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ // https://tc39.github.io/ecma262/#prod-AsyncArrowFunction
+ function parseArrowBody(parser, context, params, pos, state) {
+ parser.pendingExpressionError = null;
+ for (const i in params)
+ reinterpret(parser, context | exports.Context.InParameter, params[i]);
+ const expression = parser.token !== 41943052 /* LeftBrace */;
+ const body = expression ? parseExpressionCoverGrammar(parser, context & ~(exports.Context.Yield | exports.Context.InParameter), parseAssignmentExpression) :
+ swapContext(parser, context & ~(exports.Context.Yield | exports.Context.AllowDecorator) | exports.Context.InFunctionBody, state, parseFunctionBody);
+ return finishNode(context, parser, pos, {
+ type: 'ArrowFunctionExpression',
+ body,
+ params,
+ id: null,
+ async: !!(state & exports.ModifierState.Await),
+ generator: false,
+ expression,
+ });
+ }
+ /**
+ * Parses formal parameters and function body.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFormalListAndBody(parser, context, state) {
+ const paramList = parseFormalParameters(parser, context | exports.Context.InParameter, state);
+ const args = paramList.args;
+ const params = paramList.params;
+ const body = parseFunctionBody(parser, context & ~exports.Context.AllowDecorator | exports.Context.InFunctionBody, args);
+ return { params, body };
+ }
+ /**
+ * Parse funciton body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionBody)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFunctionBody(parser, context, params) {
+ // Note! The 'params' has an 'any' type now because it's really shouldn't be there. This should have been
+ // on the parser object instead. So for now the 'params' arg are only used within the
+ // 'parseFormalListAndBody' method, and not within the arrow function body.
+ const pos = getLocation(parser);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const body = [];
+ while (parser.token === 33554435 /* StringLiteral */) {
+ const { tokenRaw, tokenValue } = parser;
+ body.push(parseDirective(parser, context));
+ if (tokenRaw.length === /* length of prologue*/ 12 && tokenValue === 'use strict') {
+ if (parser.flags & exports.Flags.SimpleParameterList) {
+ tolerant(parser, context, 64 /* IllegalUseStrict */);
+ }
+ else if (parser.flags & (exports.Flags.HasStrictReserved | exports.Flags.StrictFunctionName)) {
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ }
+ else if (parser.flags & exports.Flags.StrictEvalArguments) {
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ }
+ context |= exports.Context.Strict;
+ }
+ }
+ if (context & exports.Context.Strict) {
+ validateParams(parser, context, params);
+ }
+ const { labelSet } = parser;
+ parser.labelSet = {};
+ const savedFlags = parser.flags;
+ parser.flags = parser.flags & ~(exports.Flags.StrictFunctionName | exports.Flags.StrictEvalArguments | exports.Flags.InSwitchStatement | exports.Flags.InIterationStatement) | exports.Flags.AllowDestructuring;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ if (savedFlags & exports.Flags.InIterationStatement)
+ parser.flags |= exports.Flags.InIterationStatement;
+ if (savedFlags & exports.Flags.InSwitchStatement)
+ parser.flags |= exports.Flags.InSwitchStatement;
+ parser.labelSet = labelSet;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body,
+ });
+ }
+ /**
+ * Parse formal parameters
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameters)
+ *
+ * @param Parser object
+ * @param Context masks
+ * @param Optional objectstate. Default to none
+ */
+ function parseFormalParameters(parser, context, state) {
+ // FormalParameterList :
+ // [empty]
+ // FunctionRestParameter
+ // FormalsList
+ // FormalsList , FunctionRestParameter
+ //
+ // FunctionRestParameter :
+ // ... BindingIdentifier
+ //
+ // FormalsList :
+ // FormalParameter
+ // FormalsList , FormalParameter
+ //
+ // FormalParameter :
+ // BindingElement
+ //
+ // BindingElement :
+ // SingleNameBinding
+ // BindingPattern Initializeropt
+ expect(parser, context, 50331659 /* LeftParen */);
+ parser.flags &= ~(exports.Flags.SimpleParameterList | exports.Flags.HasStrictReserved);
+ const args = [];
+ const params = [];
+ while (parser.token !== 16 /* RightParen */) {
+ if (parser.token === 14 /* Ellipsis */) {
+ if (state & exports.ObjectState.Setter)
+ tolerant(parser, context, 67 /* BadSetterRestParameter */);
+ parser.flags |= exports.Flags.SimpleParameterList;
+ params.push(parseRestElement(parser, context, args));
+ break;
+ }
+ params.push(parseFormalParameterList(parser, context, args));
+ if (!consume(parser, context, 16777234 /* Comma */))
+ break;
+ if (parser.token === 16 /* RightParen */)
+ break;
+ }
+ if (state & exports.ObjectState.Setter && params.length !== 1) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Setter', 'one', '');
+ }
+ if (state & exports.ObjectState.Getter && params.length > 0) {
+ tolerant(parser, context, 66 /* AccessorWrongArgs */, 'Getter', 'no', 's');
+ }
+ expect(parser, context, 16 /* RightParen */);
+ return { params, args };
+ }
+ /**
+ * Parse formal parameter list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FormalParameterList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFormalParameterList(parser, context, args) {
+ const pos = getLocation(parser);
+ if (parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ if (hasBit(parser.token, 20480 /* FutureReserved */)) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 50 /* UnexpectedStrictReserved */);
+ parser.flags |= exports.Flags.StrictFunctionName;
+ }
+ if (hasBit(parser.token, 4194304 /* IsEvalOrArguments */)) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ parser.flags |= exports.Flags.StrictEvalArguments;
+ }
+ }
+ else {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ }
+ const left = parseBindingIdentifierOrPattern(parser, context, args);
+ if (!consume(parser, context, 83886109 /* Assign */))
+ return left;
+ if (parser.token & (1073741824 /* IsYield */ | 262144 /* IsAwait */) && context & (exports.Context.Yield | exports.Context.Async)) {
+ tolerant(parser, context, parser.token & 262144 /* IsAwait */ ? 52 /* AwaitInParameter */ : 51 /* YieldInParameter */);
+ }
+ parser.flags |= exports.Flags.SimpleParameterList;
+ return finishNode(context, parser, pos, {
+ type: 'AssignmentPattern',
+ left,
+ right: parseExpressionCoverGrammar(parser, context, parseAssignmentExpression),
+ });
+ }
+ /**
+ * Parse class expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassExpression(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & exports.Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const { token } = parser;
+ let state = exports.ObjectState.None;
+ let id = null;
+ let superClass = null;
+ if ((token !== 41943052 /* LeftBrace */ && token !== 12372 /* ExtendsKeyword */)) {
+ if (context & exports.Context.Async && token & 262144 /* IsAwait */) {
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ }
+ id = parseBindingIdentifier(parser, context | exports.Context.Strict);
+ }
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | exports.Context.Strict, pos);
+ state |= exports.ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context | exports.Context.Strict, state);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassExpression',
+ id,
+ superClass,
+ body,
+ });
+ }
+ /**
+ * Parse class body and element list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassBody)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElementList)
+ *
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassBodyAndElementList(parser, context, state) {
+ const pos = getLocation(parser);
+ expect(parser, context, 41943052 /* LeftBrace */);
+ const body = [];
+ let decorators = [];
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (!consume(parser, context, 17825809 /* Semicolon */)) {
+ if (context & exports.Context.OptionsExperimental) {
+ decorators = parseDecorators(parser, context);
+ if (parser.token === 17825807 /* RightBrace */)
+ report(parser, 92 /* TrailingDecorators */);
+ if (decorators.length !== 0 && parser.tokenValue === 'constructor') {
+ report(parser, 93 /* GeneratorConstructor */);
+ }
+ }
+ body.push(context & exports.Context.OptionsNext && parser.token === 115 /* Hash */
+ ? parsePrivateFields(parser, context, decorators)
+ : parseClassElement(parser, context, state, decorators));
+ }
+ }
+ parser.flags &= ~exports.Flags.HasConstructor;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'ClassBody',
+ body,
+ });
+ }
+ /**
+ * Parse class element and class public instance fields & private instance fields
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassElement)
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassElement(parser, context, state, decorators) {
+ const pos = getLocation(parser);
+ let { tokenValue, token } = parser;
+ const flags = parser.flags;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ state |= exports.ObjectState.Generator;
+ }
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ if (parser.tokenValue === 'constructor') {
+ if (state & exports.ObjectState.Generator)
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'generator');
+ else if (state & exports.ObjectState.Heritage)
+ context |= exports.Context.AllowSuperProperty;
+ state |= exports.ObjectState.Constructor;
+ }
+ let key = parsePropertyName(parser, context);
+ let value;
+ if (!(parser.token & 16777216 /* IsShorthandProperty */)) {
+ if (flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ if (token === 20585 /* StaticKeyword */) {
+ token = parser.token;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= exports.ObjectState.Generator;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ if (parser.tokenValue === 'prototype')
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ state |= exports.ObjectState.Static;
+ key = parsePropertyName(parser, context);
+ if (context & exports.Context.OptionsNext && isInstanceField(parser)) {
+ if (tokenValue === 'constructor')
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ }
+ }
+ if (parser.token !== 50331659 /* LeftParen */) {
+ if (token & 524288 /* IsAsync */ && !(state & exports.ObjectState.Generator) && !(parser.flags & exports.Flags.NewLine)) {
+ token = parser.token;
+ tokenValue = parser.tokenValue;
+ state |= exports.ObjectState.Async;
+ if (consume(parser, context, 167774771 /* Multiply */))
+ state |= exports.ObjectState.Generator;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ key = parsePropertyName(parser, context);
+ }
+ else if ((token === 69743 /* GetKeyword */ || token === 69744 /* SetKeyword */)) {
+ state |= token === 69743 /* GetKeyword */ ? exports.ObjectState.Getter : exports.ObjectState.Setter;
+ tokenValue = parser.tokenValue;
+ if (parser.token === 41943059 /* LeftBracket */)
+ state |= exports.ObjectState.Computed;
+ key = parsePropertyName(parser, context & ~exports.Context.Strict);
+ }
+ if (tokenValue === 'prototype') {
+ tolerant(parser, context, 65 /* StaticPrototype */);
+ }
+ else if (!(state & exports.ObjectState.Static) && tokenValue === 'constructor') {
+ tolerant(parser, context, 45 /* InvalidConstructor */, 'accessor');
+ }
+ }
+ }
+ if (parser.token === 50331659 /* LeftParen */) {
+ if (!(state & exports.ObjectState.Computed) && state & exports.ObjectState.Constructor) {
+ if (parser.flags & exports.Flags.HasConstructor)
+ report(parser, 12 /* DuplicateConstructor */);
+ else
+ parser.flags |= exports.Flags.HasConstructor;
+ }
+ value = parseMethodDeclaration(parser, context, state);
+ }
+ else {
+ if (context & exports.Context.OptionsNext)
+ return parseFieldDefinition(parser, context, key, state, pos, decorators);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ }
+ const kind = (state & exports.ObjectState.Constructor) ? 'constructor' : (state & exports.ObjectState.Getter) ? 'get' :
+ (state & exports.ObjectState.Setter) ? 'set' : 'method';
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & exports.ObjectState.Static),
+ computed: !!(state & exports.ObjectState.Computed),
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind,
+ static: !!(state & exports.ObjectState.Static),
+ computed: !!(state & exports.ObjectState.Computed),
+ key,
+ value,
+ });
+ }
+ /**
+ * Parses field definition.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFieldDefinition(parser, context, key, state, pos, decorators) {
+ if (state & exports.ObjectState.Constructor)
+ tolerant(parser, context, 0 /* Unexpected */);
+ let value = null;
+ if (state & (exports.ObjectState.Async | exports.ObjectState.Generator))
+ tolerant(parser, context, 0 /* Unexpected */);
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & exports.ObjectState.Computed),
+ static: !!(state & exports.ObjectState.Static),
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: !!(state & exports.ObjectState.Computed),
+ static: !!(state & exports.ObjectState.Static),
+ });
+ }
+ /**
+ * Parse private name
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePrivateName(parser, context, pos) {
+ const name = parser.tokenValue;
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'PrivateName',
+ name,
+ });
+ }
+ /**
+ * Parses private instance fields
+ *
+ * @see [Link](https://tc39.github.io/proposal-class-public-fields/)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parsePrivateFields(parser, context, decorators) {
+ const pos = getLocation(parser);
+ expect(parser, context | exports.Context.InClass, 115 /* Hash */);
+ if (parser.tokenValue === 'constructor')
+ tolerant(parser, context, 41 /* PrivateFieldConstructor */);
+ const key = parsePrivateName(parser, context, pos);
+ if (parser.token === 50331659 /* LeftParen */)
+ return parsePrivateMethod(parser, context, key, pos, decorators);
+ let value = null;
+ if (consume(parser, context, 83886109 /* Assign */)) {
+ if (parser.token & 4194304 /* IsEvalOrArguments */)
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ value = parseAssignmentExpression(parser, context);
+ }
+ consume(parser, context, 16777234 /* Comma */);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ decorators
+ } : {
+ type: 'FieldDefinition',
+ key,
+ value,
+ computed: false,
+ static: false,
+ });
+ }
+ function parsePrivateMethod(parser, context, key, pos, decorators) {
+ const value = parseMethodDeclaration(parser, context | exports.Context.Strict, exports.ObjectState.None);
+ parser.flags &= ~(exports.Flags.AllowDestructuring | exports.Flags.AllowBinding);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ decorators
+ } : {
+ type: 'MethodDefinition',
+ kind: 'method',
+ static: false,
+ computed: false,
+ key,
+ value,
+ });
+ }
+ /**
+ * Parse either call expression or import expressions
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseCallImportOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ // Import.meta - Stage 3 proposal
+ if (consume(parser, context, 16777229 /* Period */)) {
+ if (context & exports.Context.Module && parser.tokenValue === 'meta')
+ return parseMetaProperty(parser, context, id, pos);
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ let expr = parseImportExpression(parser, context, pos);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const args = parseExpressionCoverGrammar(parser, context | exports.Context.AllowIn, parseAssignmentExpression);
+ expect(parser, context, 16 /* RightParen */);
+ expr = finishNode(context, parser, pos, {
+ type: 'CallExpression',
+ callee: expr,
+ arguments: [args],
+ });
+ return expr;
+ }
+ /**
+ * Parse Import() expression. (Stage 3 proposal)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+ function parseImportExpression(parser, context, pos) {
+ return finishNode(context, parser, pos, {
+ type: 'Import',
+ });
+ }
+ /**
+ * Parse meta property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Identifier
+ * @param pos Location
+ */
+ function parseMetaProperty(parser, context, meta, pos) {
+ return finishNode(context, parser, pos, {
+ meta,
+ type: 'MetaProperty',
+ property: parseIdentifier(parser, context),
+ });
+ }
+ /**
+ * Parse new expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NewExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNewExpressionOrMetaProperty(parser, context) {
+ const pos = getLocation(parser);
+ const id = parseIdentifier(parser, context);
+ if (consume(parser, context | exports.Context.DisallowEscapedKeyword, 16777229 /* Period */)) {
+ if (parser.tokenValue !== 'target' ||
+ !(context & (exports.Context.InParameter | exports.Context.InFunctionBody)))
+ tolerant(parser, context, 53 /* MetaNotInFunctionBody */);
+ return parseMetaProperty(parser, context, id, pos);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'NewExpression',
+ callee: parseImportOrMemberExpression(parser, context, pos),
+ arguments: parser.token === 50331659 /* LeftParen */ ? parseArgumentList(parser, context) : [],
+ });
+ }
+ /**
+ * Parse either import or member expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-MemberExpression)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportOrMemberExpression(parser, context, pos) {
+ const { token } = parser;
+ if (context & exports.Context.OptionsNext && token === 33566810 /* ImportKeyword */) {
+ // Invalid: '"new import(x)"'
+ if (lookahead(parser, context, nextTokenIsLeftParen))
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(token));
+ // Fixes cases like ''new import.meta','
+ return parseCallImportOrMetaProperty(parser, context);
+ }
+ return parseMemberExpression(parser, context, pos);
+ }
+ /**
+ * Parse super property
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SuperProperty)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSuperProperty(parser, context) {
+ // SuperProperty[Yield, Await]:
+ // super[Expression[+In, ?Yield, ?Await]]
+ // super.IdentifierName
+ const pos = getLocation(parser);
+ expect(parser, context, 33566813 /* SuperKeyword */);
+ switch (parser.token) {
+ case 50331659 /* LeftParen */:
+ // The super property has to be within a class constructor
+ if (!(context & exports.Context.AllowSuperProperty))
+ tolerant(parser, context, 54 /* BadSuperCall */);
+ break;
+ case 41943059 /* LeftBracket */:
+ case 16777229 /* Period */:
+ if (!(context & exports.Context.Method))
+ tolerant(parser, context, 55 /* UnexpectedSuper */);
+ break;
+ default:
+ tolerant(parser, context, 56 /* LoneSuper */);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'Super',
+ });
+ }
+ /**
+ * Parse template literal
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateLiteral)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseTemplateLiteral(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions: [],
+ quasis: [parseTemplateSpans(parser, context)],
+ });
+ }
+ /**
+ * Parse template head
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param cooked Cooked template value
+ * @param raw Raw template value
+ * @param pos Current location
+ */
+ function parseTemplateHead(parser, context, cooked = null, raw, pos) {
+ parser.token = consumeTemplateBrace(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked,
+ raw,
+ },
+ tail: false,
+ });
+ }
+ /**
+ * Parse template
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expression Expression AST node
+ * @param quasis Array of Template elements
+ */
+ function parseTemplate(parser, context, expressions = [], quasis = []) {
+ const pos = getLocation(parser);
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554440 /* TemplateCont */);
+ expressions.push(parseExpression(parser, context));
+ const t = getLocation(parser);
+ quasis.push(parseTemplateHead(parser, context, tokenValue, tokenRaw, pos));
+ if (parser.token === 33554441 /* TemplateTail */) {
+ quasis.push(parseTemplateSpans(parser, context, t));
+ }
+ else {
+ parseTemplate(parser, context, expressions, quasis);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'TemplateLiteral',
+ expressions,
+ quasis,
+ });
+ }
+ /**
+ * Parse template spans
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TemplateSpans)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param loc Current AST node location
+ */
+ function parseTemplateSpans(parser, context, pos = getLocation(parser)) {
+ const { tokenValue, tokenRaw } = parser;
+ expect(parser, context, 33554441 /* TemplateTail */);
+ return finishNode(context, parser, pos, {
+ type: 'TemplateElement',
+ value: {
+ cooked: tokenValue,
+ raw: tokenRaw,
+ },
+ tail: true,
+ });
+ }
+ /**
+ * Parses decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDecoratorList(parser, context) {
+ const pos = getLocation(parser);
+ return finishNode(context, parser, pos, {
+ type: 'Decorator',
+ expression: parseLeftHandSideExpression(parser, context, pos)
+ });
+ }
+ /**
+ * Parses a list of decorators
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDecorators(parser, context) {
+ const decoratorList = [];
+ while (consume(parser, context, 120 /* At */)) {
+ decoratorList.push(parseDecoratorList(parser, context | exports.Context.AllowDecorator));
+ }
+ return decoratorList;
+ } + + (function (Context) {
+ Context[Context["Empty"] = 0] = "Empty";
+ Context[Context["OptionsNext"] = 1] = "OptionsNext";
+ Context[Context["OptionsRanges"] = 2] = "OptionsRanges";
+ Context[Context["OptionsJSX"] = 4] = "OptionsJSX";
+ Context[Context["OptionsRaw"] = 8] = "OptionsRaw";
+ Context[Context["OptionsLoc"] = 16] = "OptionsLoc";
+ Context[Context["OptionsGlobalReturn"] = 32] = "OptionsGlobalReturn";
+ Context[Context["OptionsComments"] = 64] = "OptionsComments";
+ Context[Context["OptionsShebang"] = 128] = "OptionsShebang";
+ Context[Context["OptionsRawidentifiers"] = 256] = "OptionsRawidentifiers";
+ Context[Context["OptionsTolerant"] = 512] = "OptionsTolerant";
+ Context[Context["OptionsNode"] = 1024] = "OptionsNode";
+ Context[Context["OptionsExperimental"] = 2048] = "OptionsExperimental";
+ Context[Context["Strict"] = 4096] = "Strict";
+ Context[Context["Module"] = 8192] = "Module";
+ Context[Context["TaggedTemplate"] = 16384] = "TaggedTemplate";
+ Context[Context["InClass"] = 32768] = "InClass";
+ Context[Context["AllowIn"] = 65536] = "AllowIn";
+ Context[Context["Async"] = 131072] = "Async";
+ Context[Context["Yield"] = 262144] = "Yield";
+ Context[Context["InParameter"] = 524288] = "InParameter";
+ Context[Context["InFunctionBody"] = 1048576] = "InFunctionBody";
+ Context[Context["AllowSingleStatement"] = 2097152] = "AllowSingleStatement";
+ Context[Context["BlockScope"] = 4194304] = "BlockScope";
+ Context[Context["ForStatement"] = 8388608] = "ForStatement";
+ Context[Context["RequireIdentifier"] = 16777216] = "RequireIdentifier";
+ Context[Context["Method"] = 33554432] = "Method";
+ Context[Context["AllowSuperProperty"] = 67108864] = "AllowSuperProperty";
+ Context[Context["InParen"] = 134217728] = "InParen";
+ Context[Context["InJSXChild"] = 268435456] = "InJSXChild";
+ Context[Context["DisallowEscapedKeyword"] = 536870912] = "DisallowEscapedKeyword";
+ Context[Context["AllowDecorator"] = 1073741824] = "AllowDecorator";
+ Context[Context["LocationTracker"] = 18] = "LocationTracker";
+ })(exports.Context || (exports.Context = {}));
+ (function (Flags) {
+ Flags[Flags["None"] = 0] = "None";
+ Flags[Flags["NewLine"] = 1] = "NewLine";
+ Flags[Flags["AllowBinding"] = 2] = "AllowBinding";
+ Flags[Flags["AllowDestructuring"] = 4] = "AllowDestructuring";
+ Flags[Flags["SimpleParameterList"] = 8] = "SimpleParameterList";
+ Flags[Flags["InSwitchStatement"] = 16] = "InSwitchStatement";
+ Flags[Flags["InIterationStatement"] = 32] = "InIterationStatement";
+ Flags[Flags["HasStrictReserved"] = 64] = "HasStrictReserved";
+ Flags[Flags["HasOctal"] = 128] = "HasOctal";
+ Flags[Flags["SimpleAssignmentTarget"] = 256] = "SimpleAssignmentTarget";
+ Flags[Flags["HasProtoField"] = 512] = "HasProtoField";
+ Flags[Flags["StrictFunctionName"] = 1024] = "StrictFunctionName";
+ Flags[Flags["StrictEvalArguments"] = 2048] = "StrictEvalArguments";
+ Flags[Flags["InFunctionBody"] = 4096] = "InFunctionBody";
+ Flags[Flags["HasAwait"] = 8192] = "HasAwait";
+ Flags[Flags["HasYield"] = 16384] = "HasYield";
+ Flags[Flags["EscapedKeyword"] = 32768] = "EscapedKeyword";
+ Flags[Flags["HasConstructor"] = 65536] = "HasConstructor";
+ })(exports.Flags || (exports.Flags = {}));
+ (function (Labels) {
+ Labels[Labels["None"] = 0] = "None";
+ Labels[Labels["NotNested"] = 1] = "NotNested";
+ Labels[Labels["Nested"] = 2] = "Nested";
+ })(exports.Labels || (exports.Labels = {}));
+ (function (NumericState) {
+ NumericState[NumericState["None"] = 0] = "None";
+ NumericState[NumericState["SeenSeparator"] = 1] = "SeenSeparator";
+ NumericState[NumericState["EigthOrNine"] = 2] = "EigthOrNine";
+ NumericState[NumericState["Float"] = 4] = "Float";
+ NumericState[NumericState["BigInt"] = 8] = "BigInt";
+ })(exports.NumericState || (exports.NumericState = {}));
+ (function (ScannerState) {
+ ScannerState[ScannerState["None"] = 0] = "None";
+ ScannerState[ScannerState["NewLine"] = 1] = "NewLine";
+ ScannerState[ScannerState["LastIsCR"] = 2] = "LastIsCR";
+ })(exports.ScannerState || (exports.ScannerState = {}));
+ (function (ModifierState) {
+ ModifierState[ModifierState["None"] = 0] = "None";
+ ModifierState[ModifierState["Generator"] = 1] = "Generator";
+ ModifierState[ModifierState["Await"] = 2] = "Await";
+ })(exports.ModifierState || (exports.ModifierState = {}));
+ (function (CoverParenthesizedState) {
+ CoverParenthesizedState[CoverParenthesizedState["None"] = 0] = "None";
+ CoverParenthesizedState[CoverParenthesizedState["SequenceExpression"] = 1] = "SequenceExpression";
+ CoverParenthesizedState[CoverParenthesizedState["HasEvalOrArguments"] = 2] = "HasEvalOrArguments";
+ CoverParenthesizedState[CoverParenthesizedState["HasReservedWords"] = 4] = "HasReservedWords";
+ CoverParenthesizedState[CoverParenthesizedState["HasYield"] = 8] = "HasYield";
+ CoverParenthesizedState[CoverParenthesizedState["HasBinding"] = 16] = "HasBinding";
+ })(exports.CoverParenthesizedState || (exports.CoverParenthesizedState = {}));
+ (function (Escape) {
+ Escape[Escape["Empty"] = -1] = "Empty";
+ Escape[Escape["StrictOctal"] = -2] = "StrictOctal";
+ Escape[Escape["EightOrNine"] = -3] = "EightOrNine";
+ Escape[Escape["InvalidHex"] = -4] = "InvalidHex";
+ Escape[Escape["OutOfRange"] = -5] = "OutOfRange";
+ })(exports.Escape || (exports.Escape = {}));
+ (function (RegexFlags) {
+ RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
+ RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
+ RegexFlags[RegexFlags["Global"] = 2] = "Global";
+ RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
+ RegexFlags[RegexFlags["Unicode"] = 8] = "Unicode";
+ RegexFlags[RegexFlags["Sticky"] = 16] = "Sticky";
+ RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
+ })(exports.RegexFlags || (exports.RegexFlags = {}));
+ (function (CoverCallState) {
+ CoverCallState[CoverCallState["Empty"] = 0] = "Empty";
+ CoverCallState[CoverCallState["SeenSpread"] = 1] = "SeenSpread";
+ CoverCallState[CoverCallState["HasSpread"] = 2] = "HasSpread";
+ CoverCallState[CoverCallState["SimpleParameter"] = 4] = "SimpleParameter";
+ CoverCallState[CoverCallState["EvalOrArguments"] = 8] = "EvalOrArguments";
+ CoverCallState[CoverCallState["Yield"] = 16] = "Yield";
+ CoverCallState[CoverCallState["Await"] = 32] = "Await";
+ })(exports.CoverCallState || (exports.CoverCallState = {}));
+ (function (RegexState) {
+ RegexState[RegexState["Empty"] = 0] = "Empty";
+ RegexState[RegexState["Escape"] = 1] = "Escape";
+ RegexState[RegexState["Class"] = 2] = "Class";
+ })(exports.RegexState || (exports.RegexState = {}));
+ (function (ObjectState) {
+ ObjectState[ObjectState["None"] = 0] = "None";
+ ObjectState[ObjectState["Async"] = 1] = "Async";
+ ObjectState[ObjectState["Generator"] = 2] = "Generator";
+ ObjectState[ObjectState["Getter"] = 4] = "Getter";
+ ObjectState[ObjectState["Setter"] = 8] = "Setter";
+ ObjectState[ObjectState["Computed"] = 16] = "Computed";
+ ObjectState[ObjectState["Method"] = 32] = "Method";
+ ObjectState[ObjectState["Shorthand"] = 64] = "Shorthand";
+ ObjectState[ObjectState["Static"] = 128] = "Static";
+ ObjectState[ObjectState["Constructor"] = 256] = "Constructor";
+ ObjectState[ObjectState["Heritage"] = 512] = "Heritage";
+ })(exports.ObjectState || (exports.ObjectState = {}));
+ /**
+ * Validate break and continue statement
+ *
+ * @param parser Parser object
+ * @param label label
+ * @param isContinue true if validation continue statement
+ */
+ function validateBreakOrContinueLabel(parser, context, label, isContinue) {
+ const state = hasLabel(parser, label);
+ if (!state)
+ tolerant(parser, context, 32 /* UnknownLabel */, label);
+ if (isContinue && !(state & exports.Labels.Nested))
+ tolerant(parser, context, 31 /* IllegalContinue */, label);
+ }
+ /**
+ * Add label to the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+ function addLabel(parser, label) {
+ if (parser.labelSet === undefined)
+ parser.labelSet = {};
+ parser.labelSet[`$${label}`] = isIterationStatement(parser.token) ? exports.Labels.Nested : exports.Labels.NotNested;
+ }
+ /**
+ * Remove label from the stack
+ *
+ * @param parser Parser object
+ * @param label label
+ */
+ function popLabel(parser, label) {
+ parser.labelSet[`$${label}`] = exports.Labels.None;
+ }
+ /**
+ * Returns either true or false. Depends if the label exist.
+ *
+ * @param parser Parser object
+ * @param label Label
+ */
+ function hasLabel(parser, label) {
+ return !parser.labelSet ? exports.Labels.None : parser.labelSet[`$${label}`];
+ }
+ /**
+ * Finish each the node for each parse. Set line / and column on the node if the
+ * options are set for it
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param meta Line / column
+ * @param node AST node
+ */
+ function finishNode(context, parser, meta, node) {
+ const { lastIndex, lastLine, lastColumn, sourceFile, index } = parser;
+ if (context & exports.Context.LocationTracker) {
+ if (context & exports.Context.OptionsRanges) {
+ node.start = meta.index;
+ node.end = lastIndex;
+ }
+ if (context & exports.Context.OptionsLoc) {
+ node.loc = {
+ start: { line: meta.line, column: meta.column },
+ end: { line: lastLine, column: lastColumn }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ return node;
+ }
+ /**
+ * Consumes the next token. If the consumed token is not of the expected type
+ * then report an error and return null. Otherwise return true.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ * @param Err Optionally error message to be thrown
+ */
+ function expect(parser, context, token, err = 1 /* UnexpectedToken */) {
+ if (parser.token !== token)
+ report(parser, err, tokenDesc(parser.token));
+ nextToken(parser, context);
+ return true;
+ }
+ /**
+ * If the next token matches the given token, this consumes the token
+ * and returns true. Otherwise return false.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param t Token
+ */
+ function consume(parser, context, token) {
+ if (parser.token !== token)
+ return false;
+ nextToken(parser, context);
+ return true;
+ }
+ /**
+ * Advance and return the next token in the stream
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextToken(parser, context) {
+ parser.lastIndex = parser.index;
+ parser.lastLine = parser.line;
+ parser.lastColumn = parser.column;
+ return (parser.token = scan(parser, context));
+ }
+ const hasBit = (mask, flags) => (mask & flags) === flags;
+ /**
+ * Automatic Semicolon Insertion
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function consumeSemicolon(parser, context) {
+ return parser.token & 1048576 /* ASI */ || parser.flags & exports.Flags.NewLine
+ ? consume(parser, context, 17825809 /* Semicolon */)
+ : report(parser, !(context & exports.Context.Async) && parser.token & 262144 /* IsAwait */ ? 38 /* AwaitOutsideAsync */ : 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ /**
+ * Bit fiddle current grammar state and keep track of the state during the parse and restore
+ * it back to original state after finish parsing or throw.
+ *
+ * Ideas for this is basicly from V8 and SM, but also the Esprima parser does this in a similar way.
+ *
+ * However this implementation is an major improvement over similiar implementations, and
+ * does not require additonal bitmasks to be set / unset during the parsing outside this function.
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ * @param errMsg Optional error message
+ */
+ function parseExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // If there exist an pending expression error, we throw an error at
+ // the same location it was recorded
+ if (!!parser.pendingExpressionError) {
+ const { error, line, column, index } = parser.pendingExpressionError;
+ constructError(parser, context, index, line, column, error);
+ }
+ // Here we - just in case - disallow both binding and destructuring
+ // and only set the bitmaks if the previous flags (before the callback)
+ // is positive.
+ // Note that this bitmasks may have been turned off during parsing
+ // the callback
+ parser.flags &= ~(exports.Flags.AllowBinding | exports.Flags.AllowDestructuring);
+ if (flags & exports.Flags.AllowBinding)
+ parser.flags |= exports.Flags.AllowBinding;
+ if (flags & exports.Flags.AllowDestructuring)
+ parser.flags |= exports.Flags.AllowDestructuring;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+ }
+ /**
+ * Restor current grammar to previous state, or unset necessary bitmasks
+ *
+ * @param parser Parser state
+ * @param context Context mask
+ * @param callback Callback function
+ */
+ function restoreExpressionCoverGrammar(parser, context, callback) {
+ const { flags, pendingExpressionError } = parser;
+ parser.flags |= exports.Flags.AllowBinding | exports.Flags.AllowDestructuring;
+ // Clear pending expression error
+ parser.pendingExpressionError = undefined;
+ const res = callback(parser, context);
+ // Both the previous bitmasks and bitmasks set during parsing the callback
+ // has to be positive for us to allow further binding or destructuring.
+ // Note that we allow both before the callback, so this is the only thing
+ // we need to check for.
+ if (!(parser.flags & exports.Flags.AllowBinding) || !(flags & exports.Flags.AllowBinding)) {
+ parser.flags &= ~exports.Flags.AllowBinding;
+ }
+ if (!(parser.flags & exports.Flags.AllowDestructuring) || !(flags & exports.Flags.AllowDestructuring)) {
+ parser.flags &= ~exports.Flags.AllowDestructuring;
+ }
+ // Here we either
+ // 1) restore to previous pending expression error
+ // or
+ // 2) if a pending expression error have been set during the parse (*only in object literal*)
+ // we overwrite previous error, and keep the new one
+ parser.pendingExpressionError = pendingExpressionError || parser.pendingExpressionError;
+ return res;
+ }
+ /**
+ * Set / unset yield / await context masks based on the
+ * ModifierState masks before invoking the callback and
+ * returning it's content
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param state Modifier state
+ * @param callback Callback function to be invoked
+ * @param methodState Optional Objectstate.
+ */
+ function swapContext(parser, context, state, callback, methodState = exports.ObjectState.None) {
+ context &= ~(exports.Context.Async | exports.Context.Yield | exports.Context.InParameter);
+ if (state & exports.ModifierState.Generator)
+ context |= exports.Context.Yield;
+ if (state & exports.ModifierState.Await)
+ context |= exports.Context.Async;
+ return callback(parser, context, methodState);
+ }
+ /**
+ * Validates function params
+ *
+ * Note! In case anyone want to enable full scoping, replace 'paramSet' with an similiar
+ * object on the parser object itself. Then push / set the tokenValue to
+ * it an use an bitmask to mark it as an 'variable' not 'blockscope'. Then when
+ * implementing lexical scoping, you can use that for validation.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param params Array of token values
+ */
+ function validateParams(parser, context, params) {
+ const paramSet = new Map();
+ for (let i = 0; i < params.length; i++) {
+ const key = `@${params[i]}`;
+ if (paramSet.get(key)) {
+ tolerant(parser, context, 81 /* ParamDupe */);
+ }
+ else
+ paramSet.set(key, true);
+ }
+ }
+ /**
+ * Reinterpret various expressions as pattern
+ * This is only used for assignment and arrow parameter list
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param node AST node
+ */
+ const reinterpret = (parser, context, node) => {
+ switch (node.type) {
+ case 'Identifier':
+ if (context & exports.Context.Strict && nameIsArgumentsOrEval(node.name))
+ report(parser, 3 /* InvalidEscapedReservedWord */);
+ case 'ArrayPattern':
+ case 'AssignmentPattern':
+ case 'ObjectPattern':
+ case 'RestElement':
+ case 'MetaProperty':
+ return;
+ case 'ArrayExpression':
+ node.type = 'ArrayPattern';
+ for (let i = 0; i < node.elements.length; ++i) {
+ // skip holes in pattern
+ if (node.elements[i] !== null) {
+ reinterpret(parser, context, node.elements[i]);
+ }
+ }
+ return;
+ case 'ObjectExpression':
+ node.type = 'ObjectPattern';
+ for (let i = 0; i < node.properties.length; i++) {
+ reinterpret(parser, context, node.properties[i]);
+ }
+ return;
+ case 'Property':
+ reinterpret(parser, context, node.value);
+ return;
+ case 'SpreadElement':
+ node.type = 'RestElement';
+ if (node.argument.type !== 'ArrayExpression' &&
+ node.argument.type !== 'ObjectExpression' &&
+ !isValidSimpleAssignmentTarget(node.argument)) {
+ tolerant(parser, context, 71 /* RestDefaultInitializer */);
+ }
+ reinterpret(parser, context, node.argument);
+ break;
+ case 'AssignmentExpression':
+ node.type = 'AssignmentPattern';
+ delete node.operator; // operator is not relevant for assignment pattern
+ reinterpret(parser, context, node.left); // recursive descent
+ return;
+ case 'MemberExpression':
+ if (!(context & exports.Context.InParameter))
+ return;
+ // Fall through
+ default:
+ tolerant(parser, context, context & exports.Context.InParameter ? 77 /* NotBindable */ : 73 /* InvalidDestructuringTarget */, node.type);
+ }
+ };
+ /**
+ * Does a lookahead.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param callback Callback function to be invoked
+ */
+ function lookahead(parser, context, callback) {
+ const { tokenValue, flags, line, column, startColumn, index, lastColumn, startLine, lastLine, lastIndex, startIndex, tokenRaw, token, lastValue, tokenRegExp, labelSet, errors, errorLocation, pendingExpressionError } = parser;
+ const res = callback(parser, context);
+ parser.index = index;
+ parser.token = token;
+ parser.tokenValue = tokenValue;
+ parser.tokenValue = tokenValue;
+ parser.flags = flags;
+ parser.line = line;
+ parser.column = column;
+ parser.tokenRaw = tokenRaw;
+ parser.lastValue = lastValue;
+ parser.startColumn = startColumn;
+ parser.lastColumn = lastColumn;
+ parser.startLine = startLine;
+ parser.lastLine = lastLine;
+ parser.lastIndex = lastIndex;
+ parser.startIndex = startIndex;
+ parser.tokenRegExp = tokenRegExp;
+ parser.labelSet = labelSet;
+ parser.errors = errors;
+ parser.errorLocation = errorLocation;
+ parser.tokenRegExp = tokenRegExp;
+ parser.pendingExpressionError = pendingExpressionError;
+ return res;
+ }
+ /**
+ * Returns true if this an valid simple assignment target
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function isValidSimpleAssignmentTarget(node) {
+ return node.type === 'Identifier' || node.type === 'MemberExpression' ? true : false;
+ }
+ /**
+ * Get current node location
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function getLocation(parser) {
+ return {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+ }
+ /**
+ * Returns true if this is an valid identifier
+ *
+ * @param context Context masks
+ * @param t Token
+ */
+ function isValidIdentifier(context, t) {
+ if (context & exports.Context.Strict) {
+ if (context & exports.Context.Module && t & 262144 /* IsAwait */)
+ return false;
+ if (t & 1073741824 /* IsYield */)
+ return false;
+ return (t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (t & 69632 /* Contextual */) === 69632 /* Contextual */;
+ }
+ return ((t & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (t & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (t & 20480 /* FutureReserved */) === 20480 /* FutureReserved */);
+ }
+ /**
+ * Returns true if this an valid lexical binding and not an identifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function isLexical(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return !!(token & (131072 /* IsIdentifier */ | 8388608 /* IsBindingPattern */ | 1073741824 /* IsYield */ | 262144 /* IsAwait */) ||
+ token === 33574984 /* LetKeyword */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */);
+ }
+ /**
+ * Returns true if this is end of case or default clauses
+ *
+ * @param parser Parser object
+ */
+ function isEndOfCaseOrDefaultClauses(parser) {
+ return (parser.token === 12368 /* DefaultKeyword */ || parser.token === 17825807 /* RightBrace */ || parser.token === 12363 /* CaseKeyword */);
+ }
+ /**
+ * Validates if the next token in the stream is a left paren or a period
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenIsLeftParenOrPeriod(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */ || parser.token === 16777229 /* Period */;
+ }
+ /**
+ * Validates if the next token in the stream is a identifier or left paren
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenisIdentifierOrParen(parser, context) {
+ nextToken(parser, context);
+ const { token } = parser;
+ return token & (131072 /* IsIdentifier */ | 1073741824 /* IsYield */) || token === 50331659 /* LeftParen */;
+ }
+ /**
+ * Validates if the next token in the stream is left parenthesis.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenIsLeftParen(parser, context) {
+ nextToken(parser, context);
+ return parser.token === 50331659 /* LeftParen */;
+ }
+ /**
+ * Validates if the next token in the stream is a function keyword on the same line.
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function nextTokenIsFuncKeywordOnSameLine(parser, context) {
+ nextToken(parser, context);
+ return !(parser.flags & exports.Flags.NewLine) && parser.token === 33566808 /* FunctionKeyword */;
+ }
+ /**
+ * Checks if the property has any private field key
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function isPropertyWithPrivateFieldKey(expr) {
+ return !expr.property ? false : expr.property.type === 'PrivateName';
+ }
+ /**
+ * Parse and classify itendifier - similar method as in V8
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAndClassifyIdentifier(parser, context) {
+ const { token, tokenValue: name } = parser;
+ if (context & exports.Context.Strict) {
+ if (context & exports.Context.Module && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ || (token & 69632 /* Contextual */) === 69632 /* Contextual */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if (context & exports.Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 40 /* DisallowedInContext */, tokenDesc(parser.token));
+ if ((token & 131072 /* IsIdentifier */) === 131072 /* IsIdentifier */ ||
+ (token & 69632 /* Contextual */) === 69632 /* Contextual */ ||
+ (token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ return parseIdentifier(parser, context);
+ }
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ function nameIsArgumentsOrEval(value) {
+ return value === 'eval' || value === 'arguments';
+ }
+ /**
+ * Records an error from current position. If we report an error later, we'll do it from
+ * this position.
+ *
+ * @param parser Parser object
+ */
+ function setPendingError(parser) {
+ parser.errorLocation = {
+ line: parser.startLine,
+ column: parser.startColumn,
+ index: parser.startIndex
+ };
+ }
+ /**
+ * Returns tagName for JSX element
+ *
+ * @param elementName JSX Element name
+ */
+ function isEqualTagNames(elementName) {
+ // tslint:disable-next-line:switch-default | this switch is exhaustive
+ switch (elementName.type) {
+ case 'JSXIdentifier':
+ return elementName.name;
+ case 'JSXNamespacedName':
+ return `${isEqualTagNames(elementName.namespace)}:${isEqualTagNames(elementName.name)}`;
+ case 'JSXMemberExpression':
+ return `${isEqualTagNames(elementName.object)}.${isEqualTagNames(elementName.property)}`;
+ }
+ }
+ /**
+ * Returns true if this is an instance field ( stage 3 proposal)
+ *
+ * @param parser Parser object
+ */
+ function isInstanceField(parser) {
+ const { token } = parser;
+ return token === 17825807 /* RightBrace */ || token === 17825809 /* Semicolon */ || token === 83886109 /* Assign */;
+ }
+ /**
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param expr AST expressions
+ * @param prefix prefix
+ */
+ function validateUpdateExpression(parser, context, expr, prefix) {
+ if (context & exports.Context.Strict && nameIsArgumentsOrEval(expr.name)) {
+ tolerant(parser, context, 68 /* StrictLHSPrefixPostFix */, prefix);
+ }
+ if (!isValidSimpleAssignmentTarget(expr)) {
+ tolerant(parser, context, 5 /* InvalidLHSInAssignment */);
+ }
+ }
+ /**
+ * Record expression error
+ *
+ * @param parser Parser object
+ * @param error Error message
+ */
+ function setPendingExpressionError(parser, type) {
+ parser.pendingExpressionError = {
+ error: errorMessages[type],
+ line: parser.line,
+ column: parser.column,
+ index: parser.index
+ };
+ }
+ /**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+ function validateCoverParenthesizedExpression(parser, state) {
+ const { token } = parser;
+ if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= exports.CoverParenthesizedState.HasEvalOrArguments;
+ }
+ else if ((token & 20480 /* FutureReserved */) === 20480 /* FutureReserved */) {
+ setPendingError(parser);
+ state |= exports.CoverParenthesizedState.HasReservedWords;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ parser.flags |= exports.Flags.HasAwait;
+ }
+ }
+ return state;
+ }
+ /**
+ * Validate coer parenthesized expression
+ *
+ * @param parser Parser object
+ * @param state CoverParenthesizedState
+ */
+ function validateAsyncArgumentList(parser, context, state) {
+ const { token } = parser;
+ if (!(parser.flags & exports.Flags.AllowBinding)) {
+ tolerant(parser, context, 77 /* NotBindable */);
+ }
+ else if (token & 8388608 /* IsBindingPattern */) {
+ parser.flags |= exports.Flags.SimpleParameterList;
+ }
+ else {
+ if ((token & 4194304 /* IsEvalOrArguments */) === 4194304 /* IsEvalOrArguments */) {
+ setPendingError(parser);
+ state |= exports.CoverCallState.EvalOrArguments;
+ }
+ else if ((token & 262144 /* IsAwait */) === 262144 /* IsAwait */) {
+ setPendingError(parser);
+ state |= exports.CoverCallState.Await;
+ }
+ else if ((token & 1073741824 /* IsYield */) === 1073741824 /* IsYield */) {
+ setPendingError(parser);
+ state |= exports.CoverCallState.Yield;
+ }
+ }
+ return state;
+ }
+ /**
+ * Returns true if iteration statement. Otherwise return false,
+ *
+ * @param t Token
+ */
+ function isIterationStatement(t) {
+ return t === 12369 /* DoKeyword */ || t === 12386 /* WhileKeyword */ || t === 12374 /* ForKeyword */;
+ }
+ /**
+ * Returns true if in or of token. Otherwise return false,
+ *
+ * @param t Token
+ */
+ function isInOrOf(t) {
+ return t === 69746 /* OfKeyword */ || t === 167786289 /* InKeyword */;
+ } + + /*@internal*/
+ const errorMessages = {
+ [0 /* Unexpected */]: 'Unexpected token',
+ [1 /* UnexpectedToken */]: 'Unexpected token \'%0\'',
+ [2 /* ExpectedToken */]: 'Expected token \'%0\'',
+ [3 /* InvalidEscapedReservedWord */]: 'Keyword must not contain escaped characters',
+ [4 /* UnexpectedKeyword */]: 'Keyword \'%0\' is reserved',
+ [5 /* InvalidLHSInAssignment */]: 'Invalid left-hand side in assignment',
+ [6 /* UnterminatedString */]: 'Unterminated string literal',
+ [7 /* UnterminatedRegExp */]: 'Unterminated regular expression literal',
+ [8 /* UnterminatedComment */]: 'Unterminated MultiLineComment',
+ [9 /* UnterminatedTemplate */]: 'Unterminated template literal',
+ [10 /* UnexpectedChar */]: 'Invalid character \'%0\'',
+ [11 /* StrictOctalEscape */]: 'Octal escapes are not allowed in strict mode',
+ [13 /* InvalidEightAndNine */]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
+ [14 /* UnicodeOutOfRange */]: 'Unicode escape code point out of range',
+ [15 /* DuplicateRegExpFlag */]: 'Duplicate regular expression flag \'%0\'',
+ [16 /* UnexpectedTokenRegExpFlag */]: 'Unexpected regular expression flag \'%0\'',
+ [17 /* StrictLHSAssignment */]: 'Eval or arguments can\'t be assigned to in strict mode code',
+ [18 /* IllegalReturn */]: 'Illegal return statement',
+ [19 /* StrictFunction */]: 'In strict mode code, functions can only be declared at top level or inside a block',
+ [20 /* SloppyFunction */]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
+ [21 /* ForbiddenAsStatement */]: '%0 can\'t appear in single-statement context',
+ [22 /* GeneratorInSingleStatementContext */]: 'Generators can only be declared at the top level or inside a block',
+ [23 /* ForAwaitNotOf */]: '\'for await\' loop should be used with \'of\'',
+ [24 /* DeclarationMissingInitializer */]: 'Missing initializer in %0 declaration',
+ [25 /* ForInOfLoopInitializer */]: '\'for-%0\' loop variable declaration may not have an initializer',
+ [26 /* ForInOfLoopMultiBindings */]: 'Invalid left-hand side in for-%0 loop: Must have a single binding.',
+ [27 /* LetInLexicalBinding */]: 'let is disallowed as a lexically bound name',
+ [28 /* UnexpectedLexicalDeclaration */]: 'Lexical declaration cannot appear in a single-statement context',
+ [29 /* LabelRedeclaration */]: 'Label \'%0\' has already been declared',
+ [30 /* InvalidNestedStatement */]: '%0 statement must be nested within an iteration statement',
+ [31 /* IllegalContinue */]: 'Illegal continue statement: \'%0\' does not denote an iteration statement',
+ [32 /* UnknownLabel */]: 'Undefined label \'%0\'',
+ [33 /* MultipleDefaultsInSwitch */]: 'More than one default clause in switch statement',
+ [34 /* ImportExportDeclAtTopLevel */]: '%0 declarations may only appear at top level of a module',
+ [35 /* AsyncFunctionInSingleStatementContext */]: 'Async functions can only be declared at the top level or inside a block',
+ [36 /* InvalidLineBreak */]: 'No line break is allowed after \'%0\'',
+ [37 /* StrictModeWith */]: 'Strict mode code may not include a with statement',
+ [38 /* AwaitOutsideAsync */]: 'Await is only valid in async functions',
+ [39 /* UnNamedFunctionDecl */]: 'Function declaration must have a name in this context',
+ [12 /* DuplicateConstructor */]: 'Duplicate constructor method in class',
+ [40 /* DisallowedInContext */]: '\'%0\' may not be used as an identifier in this context',
+ [43 /* StrictDelete */]: 'Delete of an unqualified identifier in strict mode',
+ [44 /* DeletePrivateField */]: 'Private fields can not be deleted',
+ [41 /* PrivateFieldConstructor */]: 'Classes may not have a private field named \'#constructor\'',
+ [42 /* PublicFieldConstructor */]: 'Classes may not have a field named \'constructor\'',
+ [45 /* InvalidConstructor */]: 'Class constructor may not be a \'%0\'',
+ [46 /* UnexpectedReserved */]: 'Unexpected reserved word',
+ [47 /* StrictEvalArguments */]: 'Unexpected eval or arguments in strict mode',
+ [48 /* AwaitBindingIdentifier */]: '\'await\' is not a valid identifier inside an async function',
+ [49 /* YieldBindingIdentifier */]: '\'yield\' is not a valid identifier inside an generator function',
+ [50 /* UnexpectedStrictReserved */]: 'Unexpected strict mode reserved word',
+ [52 /* AwaitInParameter */]: 'Await expression not allowed in formal parameter',
+ [51 /* YieldInParameter */]: 'Yield expression not allowed in formal parameter',
+ [53 /* MetaNotInFunctionBody */]: 'new.target only allowed within functions',
+ [54 /* BadSuperCall */]: 'super() is not allowed in this context',
+ [55 /* UnexpectedSuper */]: 'Member access from super not allowed in this context',
+ [56 /* LoneSuper */]: 'Only "(" or "." or "[" are allowed after \'super\'',
+ [57 /* YieldReservedKeyword */]: '\'yield\' is a reserved keyword within generator function bodies',
+ [58 /* ContinuousNumericSeparator */]: 'Only one underscore is allowed as numeric separator',
+ [59 /* TrailingNumericSeparator */]: 'Numeric separators are not allowed at the end of numeric literals',
+ [60 /* ZeroDigitNumericSeparator */]: 'Numeric separator can not be used after leading 0.',
+ [61 /* StrictOctalLiteral */]: 'Legacy octal literals are not allowed in strict mode',
+ [62 /* InvalidLhsInAssignment */]: 'Invalid left-hand side in assignment',
+ [63 /* DuplicateProto */]: 'Property name __proto__ appears more than once in object literal',
+ [64 /* IllegalUseStrict */]: 'Illegal \'use strict\' directive in function with non-simple parameter list',
+ [65 /* StaticPrototype */]: 'Classes may not have a static property named \'prototype\'',
+ [66 /* AccessorWrongArgs */]: '%0 functions must have %1 argument%2',
+ [67 /* BadSetterRestParameter */]: 'Setter function argument must not be a rest parameter',
+ [68 /* StrictLHSPrefixPostFix */]: '%0 increment/decrement may not have eval or arguments operand in strict mode',
+ [69 /* InvalidElisonInObjPropList */]: 'Elision not allowed in object property list',
+ [70 /* ElementAfterRest */]: 'Rest element must be last element',
+ [72 /* ElementAfterSpread */]: 'Spread element must be last element',
+ [71 /* RestDefaultInitializer */]: 'Rest parameter may not have a default initializer',
+ [73 /* InvalidDestructuringTarget */]: 'Invalid destructuring assignment target',
+ [74 /* UnexpectedSurrogate */]: 'Unexpected surrogate pair',
+ [75 /* MalformedEscape */]: 'Malformed %0 character escape sequence',
+ [76 /* TemplateOctalLiteral */]: 'Template literals may not contain octal escape sequences',
+ [77 /* NotBindable */]: 'Invalid binding pattern',
+ [78 /* ParamAfterRest */]: 'Rest parameter must be last formal parameter',
+ [79 /* NoCatchOrFinally */]: 'Missing catch or finally after try',
+ [80 /* NewlineAfterThrow */]: 'Illegal newline after throw',
+ [81 /* ParamDupe */]: 'Duplicate parameter name not allowed in this context',
+ [82 /* AsAfterImportStart */]: 'Missing keyword \'as\' after import *',
+ [83 /* LabelNoColon */]: 'Labels must be followed by a \':\'',
+ [84 /* NonEmptyJSXExpression */]: 'JSX attributes must only be assigned a non-empty \'expression\'',
+ [85 /* ExpectedJSXClosingTag */]: 'Expected corresponding JSX closing tag for %0',
+ [86 /* AdjacentJSXElements */]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
+ [87 /* InvalidJSXAttributeValue */]: 'Invalid JSX attribute value',
+ [88 /* RestWithComma */]: 'Rest element may not have a trailing comma',
+ [89 /* UndefinedUnicodeCodePoint */]: 'Undefined Unicode code-point',
+ [90 /* HtmlCommentInModule */]: 'HTML comments are not allowed in modules',
+ [91 /* InvalidCoverInitializedName */]: 'Invalid shorthand property initializer',
+ [92 /* TrailingDecorators */]: 'Trailing decorator may be followed by method',
+ [93 /* GeneratorConstructor */]: 'Decorators can\'t be used with a constructor',
+ [94 /* InvalidRestBindingPattern */]: '`...` must be followed by an identifier in declaration contexts',
+ };
+ /**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param index The 0-based end index of the error.
+ * @param line The 0-based line position of the error.
+ * @param column The 0-based column position of the error.
+ * @param parser The 0-based end index of the current node.
+ * @param description Error description
+ */
+ /*@internal*/
+ function constructError(parser, context, index, line, column, description) {
+ const error = new SyntaxError(`Line ${line}, column ${column}: ${description}`);
+ error.index = index;
+ error.line = line;
+ error.column = column;
+ error.description = description;
+ if (context & exports.Context.OptionsTolerant) {
+ parser.errors.push(error);
+ }
+ else
+ throw error;
+ }
+ /**
+ * Collect line, index, and colum from either the recorded error
+ * or directly from the parser and returns it
+ *
+ * @param parser Parser instance
+ */
+ function getErrorLocation(parser) {
+ let { index, startLine: line, startColumn: column } = parser;
+ const errorLoc = parser.errorLocation;
+ if (!!errorLoc) {
+ index = errorLoc.index;
+ line = errorLoc.line;
+ column = errorLoc.column;
+ }
+ return { index, line, column };
+ }
+ /**
+ * Throws an error
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+ /*@internal*/
+ function report(parser, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, exports.Context.Empty, index, line, column, errorMessage);
+ }
+ /**
+ * If in tolerant mode, all errors are pushed to a top-level error array containing
+ * otherwise throws
+ *
+ * @param parser Parser instance
+ * @param context Context masks
+ * @param type Error type
+ * @param params Error params
+ */
+ /*@internal*/
+ function tolerant(parser, context, type, ...params) {
+ const { index, line, column } = getErrorLocation(parser);
+ const errorMessage = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
+ constructError(parser, context, index, line, column, errorMessage);
+ } + + // Declarations
+ /**
+ * Parses class declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseClassDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ let decorators = [];
+ if (context & exports.Context.OptionsExperimental)
+ decorators = parseDecorators(parser, context);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 33566797 /* ClassKeyword */);
+ const id = (context & exports.Context.RequireIdentifier && (parser.token !== 33685505 /* Identifier */))
+ ? null :
+ parseBindingIdentifier(parser, context | exports.Context.Strict | exports.Context.DisallowEscapedKeyword);
+ let state = exports.ObjectState.None;
+ let superClass = null;
+ if (consume(parser, context, 12372 /* ExtendsKeyword */)) {
+ superClass = parseLeftHandSideExpression(parser, context | exports.Context.Strict, pos);
+ state |= exports.ObjectState.Heritage;
+ }
+ const body = parseClassBodyAndElementList(parser, context & ~exports.Context.RequireIdentifier | exports.Context.Strict | exports.Context.InClass, state);
+ return finishNode(context, parser, pos, context & exports.Context.OptionsExperimental ? {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body,
+ decorators
+ } : {
+ type: 'ClassDeclaration',
+ id,
+ superClass,
+ body
+ });
+ }
+ /**
+ * Parses function declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-FunctionDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseFunctionDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ let isGenerator = exports.ModifierState.None;
+ if (consume(parser, context, 167774771 /* Multiply */)) {
+ if (context & exports.Context.AllowSingleStatement && !(context & exports.Context.InFunctionBody)) {
+ tolerant(parser, context, 22 /* GeneratorInSingleStatementContext */);
+ }
+ isGenerator = exports.ModifierState.Generator;
+ }
+ return parseFunctionDeclarationBody(parser, context, isGenerator, pos);
+ }
+ /**
+ * Parses out a function declartion body
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context mask
+ * @param state Modifier state
+ * @param pos Current location
+ */
+ function parseFunctionDeclarationBody(parser, context, state, pos) {
+ const { token } = parser;
+ let id = null;
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 49 /* YieldBindingIdentifier */);
+ if (context & exports.Context.Async && token & 262144 /* IsAwait */)
+ tolerant(parser, context, 48 /* AwaitBindingIdentifier */);
+ if (token !== 50331659 /* LeftParen */) {
+ id = parseBindingIdentifier(parser, context);
+ // Unnamed functions are forbidden in statement context.
+ }
+ else if (!(context & exports.Context.RequireIdentifier))
+ tolerant(parser, context, 39 /* UnNamedFunctionDecl */);
+ const { params, body } = swapContext(parser, context & ~(exports.Context.Method | exports.Context.AllowSuperProperty | exports.Context.RequireIdentifier), state, parseFormalListAndBody);
+ return finishNode(context, parser, pos, {
+ type: 'FunctionDeclaration',
+ params,
+ body,
+ async: !!(state & exports.ModifierState.Await),
+ generator: !!(state & exports.ModifierState.Generator),
+ expression: false,
+ id,
+ });
+ }
+ /**
+ * Parses async function or async generator declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 594028 /* AsyncKeyword */);
+ expect(parser, context, 33566808 /* FunctionKeyword */);
+ const isAwait = exports.ModifierState.Await;
+ const isGenerator = consume(parser, context, 167774771 /* Multiply */) ? exports.ModifierState.Generator : exports.ModifierState.None;
+ return parseFunctionDeclarationBody(parser, context, isGenerator | isAwait, pos);
+ }
+ /**
+ * VariableDeclaration :
+ * BindingIdentifier Initializeropt
+ * BindingPattern Initializer
+ *
+ * VariableDeclarationNoIn :
+ * BindingIdentifier InitializerNoInopt
+ * BindingPattern InitializerNoIn
+ *
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseVariableDeclaration(parser, context, isConst) {
+ const pos = getLocation(parser);
+ const isBindingPattern = (parser.token & 8388608 /* IsBindingPattern */) !== 0;
+ const id = parseBindingIdentifierOrPattern(parser, context);
+ let init = null;
+ if (consume(parser, context | exports.Context.DisallowEscapedKeyword, 83886109 /* Assign */)) {
+ init = parseExpressionCoverGrammar(parser, context & ~(exports.Context.BlockScope | exports.Context.ForStatement), parseAssignmentExpression);
+ if (isInOrOf(parser.token) && (context & exports.Context.ForStatement || isBindingPattern)) {
+ if (parser.token === 167786289 /* InKeyword */) {
+ // https://github.com/tc39/test262/blob/master/test/annexB/language/statements/for-in/strict-initializer.js
+ if (context & (exports.Context.BlockScope | exports.Context.Strict | exports.Context.Async) || isBindingPattern) {
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ }
+ else
+ tolerant(parser, context, 25 /* ForInOfLoopInitializer */, tokenDesc(parser.token));
+ }
+ // Note: Initializers are required for 'const' and binding patterns
+ }
+ else if (!isInOrOf(parser.token) && (isConst || isBindingPattern)) {
+ tolerant(parser, context, 24 /* DeclarationMissingInitializer */, isConst ? 'const' : 'destructuring');
+ }
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclarator',
+ init,
+ id,
+ });
+ }
+ /**
+ * Parses variable declaration list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableDeclarationList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseVariableDeclarationList(parser, context, isConst) {
+ const list = [parseVariableDeclaration(parser, context, isConst)];
+ while (consume(parser, context, 16777234 /* Comma */))
+ list.push(parseVariableDeclaration(parser, context, isConst));
+ if (context & exports.Context.ForStatement && isInOrOf(parser.token) && list.length !== 1) {
+ tolerant(parser, context, 26 /* ForInOfLoopMultiBindings */, tokenDesc(parser.token));
+ }
+ return list;
+ } + + // Statements
+ /**
+ * Parses statement list items
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementListItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseStatementListItem(parser, context) {
+ switch (parser.token) {
+ case 33566808 /* FunctionKeyword */:
+ return parseFunctionDeclaration(parser, context);
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ return parseClassDeclaration(parser, context);
+ case 33574984 /* LetKeyword */:
+ return parseLetOrExpressionStatement(parser, context | exports.Context.AllowIn);
+ case 33566793 /* ConstKeyword */:
+ return parseVariableStatement(parser, context | exports.Context.BlockScope | exports.Context.AllowIn);
+ case 594028 /* AsyncKeyword */:
+ return parseAsyncFunctionDeclarationOrStatement(parser, context);
+ case 33566810 /* ImportKeyword */: {
+ if (context & exports.Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod)) {
+ return parseExpressionStatement(parser, context | exports.Context.AllowIn);
+ }
+ }
+ case 12371 /* ExportKeyword */:
+ if (context & exports.Context.Module) {
+ tolerant(parser, context, 34 /* ImportExportDeclAtTopLevel */, tokenDesc(parser.token));
+ }
+ default:
+ return parseStatement(parser, context | exports.Context.AllowSingleStatement);
+ }
+ }
+ /**
+ * Parses statements
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseStatement(parser, context) {
+ switch (parser.token) {
+ case 33566791 /* VarKeyword */:
+ return parseVariableStatement(parser, context | exports.Context.AllowIn);
+ case 17825809 /* Semicolon */:
+ return parseEmptyStatement(parser, context);
+ case 33566814 /* SwitchKeyword */:
+ return parseSwitchStatement(parser, context);
+ case 41943052 /* LeftBrace */:
+ return parseBlockStatement(parser, context);
+ case 12380 /* ReturnKeyword */:
+ return parseReturnStatement(parser, context);
+ case 12377 /* IfKeyword */:
+ return parseIfStatement(parser, context);
+ case 12369 /* DoKeyword */:
+ return parseDoWhileStatement(parser, context);
+ case 12386 /* WhileKeyword */:
+ return parseWhileStatement(parser, context);
+ case 12387 /* WithKeyword */:
+ return parseWithStatement(parser, context);
+ case 12362 /* BreakKeyword */:
+ return parseBreakStatement(parser, context);
+ case 12366 /* ContinueKeyword */:
+ return parseContinueStatement(parser, context);
+ case 12367 /* DebuggerKeyword */:
+ return parseDebuggerStatement(parser, context);
+ case 302002272 /* ThrowKeyword */:
+ return parseThrowStatement(parser, context);
+ case 12385 /* TryKeyword */:
+ return parseTryStatement(parser, context | exports.Context.DisallowEscapedKeyword);
+ case 12374 /* ForKeyword */:
+ return parseForStatement(parser, context | exports.Context.ForStatement);
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ tolerant(parser, context, 35 /* AsyncFunctionInSingleStatementContext */);
+ }
+ return parseExpressionOrLabelledStatement(parser, context | exports.Context.AllowSingleStatement);
+ case 33566808 /* FunctionKeyword */:
+ // V8
+ tolerant(parser, context, context & exports.Context.Strict ? 19 /* StrictFunction */ : 20 /* SloppyFunction */);
+ case 33566797 /* ClassKeyword */:
+ tolerant(parser, context, 21 /* ForbiddenAsStatement */, tokenDesc(parser.token));
+ default:
+ return parseExpressionOrLabelledStatement(parser, context);
+ }
+ }
+ /**
+ * Parses empty statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-EmptyStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseEmptyStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'EmptyStatement'
+ });
+ }
+ /**
+ * Parses the continue statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ContinueStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseContinueStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ // Appearing of continue without an IterationStatement leads to syntax error
+ if (!(parser.flags & (exports.Flags.InSwitchStatement | exports.Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, tokenDesc(parser.token));
+ }
+ let label = null;
+ if (!(parser.flags & exports.Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, true);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ContinueStatement',
+ label
+ });
+ }
+ /**
+ * Parses the break statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BreakStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBreakStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let label = null;
+ if (!(parser.flags & exports.Flags.NewLine) && parser.token & (131072 /* IsIdentifier */ | 4096 /* Keyword */)) {
+ const { tokenValue } = parser;
+ label = parseIdentifier(parser, context);
+ validateBreakOrContinueLabel(parser, context, tokenValue, false);
+ }
+ else if (!(parser.flags & (exports.Flags.InSwitchStatement | exports.Flags.InIterationStatement))) {
+ tolerant(parser, context, 30 /* InvalidNestedStatement */, 'break');
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'BreakStatement',
+ label
+ });
+ }
+ /**
+ * Parses the if statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-if-statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIfStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const consequent = parseConsequentOrAlternate(parser, context | exports.Context.DisallowEscapedKeyword);
+ const alternate = consume(parser, context, 12370 /* ElseKeyword */) ? parseConsequentOrAlternate(parser, context) : null;
+ return finishNode(context, parser, pos, {
+ type: 'IfStatement',
+ test,
+ consequent,
+ alternate
+ });
+ }
+ /**
+ * Parse either consequent or alternate. Supports AnnexB.
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseConsequentOrAlternate(parser, context) {
+ return context & exports.Context.Strict || parser.token !== 33566808 /* FunctionKeyword */
+ ? parseStatement(parser, context & ~exports.Context.AllowSingleStatement)
+ : parseFunctionDeclaration(parser, context);
+ }
+ /**
+ * Parses the debugger statement production
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DebuggerStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDebuggerStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'DebuggerStatement'
+ });
+ }
+ /**
+ * Parses try statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-TryStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseTryStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const block = parseBlockStatement(parser, context);
+ const handler = parser.token === 12364 /* CatchKeyword */ ? parseCatchBlock(parser, context) : null;
+ const finalizer = consume(parser, context, 12373 /* FinallyKeyword */) ? parseBlockStatement(parser, context) : null;
+ if (!handler && !finalizer)
+ tolerant(parser, context, 79 /* NoCatchOrFinally */);
+ return finishNode(context, parser, pos, {
+ type: 'TryStatement',
+ block,
+ handler,
+ finalizer
+ });
+ }
+ /**
+ * Parses catch block
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Catch)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseCatchBlock(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ let param = null;
+ if (consume(parser, context, 50331659 /* LeftParen */)) {
+ const params = [];
+ param = parseBindingIdentifierOrPattern(parser, context, params);
+ validateParams(parser, context, params);
+ expect(parser, context, 16 /* RightParen */);
+ }
+ const body = parseBlockStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'CatchClause',
+ param,
+ body
+ });
+ }
+ /**
+ * Parses throw statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ThrowStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseThrowStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ if (parser.flags & exports.Flags.NewLine)
+ tolerant(parser, context, 80 /* NewlineAfterThrow */);
+ const argument = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ThrowStatement',
+ argument
+ });
+ }
+ /**
+ * Parses expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExpressionStatement(parser, context) {
+ const pos = getLocation(parser);
+ const expr = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+ }
+ /**
+ * Parse directive node
+ *
+ * * @see [Link](https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDirective(parser, context) {
+ const pos = getLocation(parser);
+ const directive = parser.tokenRaw.slice(1, -1);
+ const expr = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr,
+ directive
+ });
+ }
+ /**
+ * Parses either expression or labelled statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-LabelledStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExpressionOrLabelledStatement(parser, context) {
+ const pos = getLocation(parser);
+ const { tokenValue, token } = parser;
+ const expr = parseExpression(parser, (context & ~(exports.Context.AllowSingleStatement | exports.Context.AllowDecorator)) | exports.Context.AllowIn);
+ if (token & (131072 /* IsIdentifier */ | 4096 /* Keyword */) && parser.token === 16777237 /* Colon */) {
+ // If within generator function bodies, we do it like this so we can throw an nice error message
+ if (context & exports.Context.Yield && token & 1073741824 /* IsYield */)
+ tolerant(parser, context, 57 /* YieldReservedKeyword */);
+ expect(parser, context, 16777237 /* Colon */, 83 /* LabelNoColon */);
+ if (hasLabel(parser, tokenValue))
+ tolerant(parser, context, 29 /* LabelRedeclaration */, tokenValue);
+ addLabel(parser, tokenValue);
+ const body = !(context & exports.Context.Strict) &&
+ context & exports.Context.AllowSingleStatement &&
+ parser.token === 33566808 /* FunctionKeyword */
+ ? parseFunctionDeclaration(parser, context)
+ : parseStatement(parser, context);
+ popLabel(parser, tokenValue);
+ return finishNode(context, parser, pos, {
+ type: 'LabeledStatement',
+ label: expr,
+ body
+ });
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExpressionStatement',
+ expression: expr
+ });
+ }
+ /**
+ * Parses do while statement
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseDoWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ const body = parseIterationStatement(parser, context);
+ expect(parser, context, 12386 /* WhileKeyword */);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ consume(parser, context, 17825809 /* Semicolon */);
+ return finishNode(context, parser, pos, {
+ type: 'DoWhileStatement',
+ body,
+ test
+ });
+ }
+ /**
+ * Parses while statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-WhileStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseWhileStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'WhileStatement',
+ test,
+ body
+ });
+ }
+ /**
+ * Parses block statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-BlockStatement)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Block)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseBlockStatement(parser, context) {
+ const pos = getLocation(parser);
+ const body = [];
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ body.push(parseStatementListItem(parser, context));
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'BlockStatement',
+ body
+ });
+ }
+ /**
+ * Parses return statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ReturnStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseReturnStatement(parser, context) {
+ const pos = getLocation(parser);
+ if (!(context & (exports.Context.OptionsGlobalReturn | exports.Context.InFunctionBody))) {
+ tolerant(parser, context, 18 /* IllegalReturn */);
+ }
+ if (parser.flags & exports.Flags.EscapedKeyword)
+ tolerant(parser, context, 3 /* InvalidEscapedReservedWord */);
+ nextToken(parser, context);
+ const argument = !(parser.token & 1048576 /* ASI */) && !(parser.flags & exports.Flags.NewLine)
+ ? parseExpression(parser, (context & ~(exports.Context.InFunctionBody | exports.Context.AllowDecorator)) | exports.Context.AllowIn)
+ : null;
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ReturnStatement',
+ argument
+ });
+ }
+ /**
+ * Sets the necessary mutable parser flags. The parser flags will
+ * be unset after done parsing out the statements.
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-grammar-notation-IterationStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseIterationStatement(parser, context) {
+ // Note: We are deviating from the original grammar here beauce the original grammar says that the
+ // 'iterationStatement' should return either'for', 'do' or 'while' statements. We are doing some
+ // bitfiddling before and after to modify the parser state before we let the 'parseStatement'
+ // return the mentioned statements (to match the original grammar).
+ const savedFlags = parser.flags;
+ parser.flags |= exports.Flags.InIterationStatement | exports.Flags.AllowDestructuring;
+ const body = parseStatement(parser, (context & ~exports.Context.AllowSingleStatement) | exports.Context.DisallowEscapedKeyword);
+ parser.flags = savedFlags;
+ return body;
+ }
+ /**
+ * Parses with statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-WithStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseWithStatement(parser, context) {
+ if (context & exports.Context.Strict)
+ tolerant(parser, context, 37 /* StrictModeWith */);
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const object = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseStatement(parser, context & ~exports.Context.AllowSingleStatement);
+ return finishNode(context, parser, pos, {
+ type: 'WithStatement',
+ object,
+ body
+ });
+ }
+ /**
+ * Parses switch statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-SwitchStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseSwitchStatement(parser, context) {
+ const pos = getLocation(parser);
+ nextToken(parser, context);
+ expect(parser, context, 50331659 /* LeftParen */);
+ const discriminant = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ expect(parser, context, 16 /* RightParen */);
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 41943052 /* LeftBrace */);
+ const cases = [];
+ const savedFlags = parser.flags;
+ parser.flags |= exports.Flags.InSwitchStatement;
+ let seenDefault = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ const clause = parseCaseOrDefaultClauses(parser, context);
+ cases.push(clause);
+ if (clause.test === null) {
+ if (seenDefault)
+ tolerant(parser, context, 33 /* MultipleDefaultsInSwitch */);
+ seenDefault = true;
+ }
+ }
+ parser.flags = savedFlags;
+ expect(parser, context, 17825807 /* RightBrace */);
+ return finishNode(context, parser, pos, {
+ type: 'SwitchStatement',
+ discriminant,
+ cases
+ });
+ }
+ /**
+ * Parses either default clause or case clauses
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-CaseClauses)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-DefaultClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseCaseOrDefaultClauses(parser, context) {
+ const pos = getLocation(parser);
+ let test = null;
+ if (consume(parser, context, 12363 /* CaseKeyword */)) {
+ test = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ }
+ else {
+ expect(parser, context, 12368 /* DefaultKeyword */);
+ }
+ expect(parser, context, 16777237 /* Colon */);
+ const consequent = [];
+ while (!isEndOfCaseOrDefaultClauses(parser)) {
+ consequent.push(parseStatementListItem(parser, context | exports.Context.AllowIn));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'SwitchCase',
+ test,
+ consequent
+ });
+ }
+ /**
+ * Parses variable statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-VariableStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseVariableStatement(parser, context, shouldConsume = true) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const isConst = token === 33566793 /* ConstKeyword */;
+ nextToken(parser, context);
+ const declarations = parseVariableDeclarationList(parser, context, isConst);
+ // Only consume semicolons if not inside the 'ForStatement' production
+ if (shouldConsume)
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'VariableDeclaration',
+ kind: tokenDesc(token),
+ declarations
+ });
+ }
+ /**
+ * Parses either an lexical declaration (let) or an expression statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-let-and-const-declarations)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExpressionStatement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseLetOrExpressionStatement(parser, context, shouldConsume = true) {
+ return lookahead(parser, context, isLexical)
+ ? parseVariableStatement(parser, context | exports.Context.BlockScope, shouldConsume)
+ : parseExpressionOrLabelledStatement(parser, context);
+ }
+ /**
+ * Parses either async function declaration or statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-Statement)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionDeclarationOrStatement(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)
+ ? parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context)
+ : parseStatement(parser, context);
+ }
+ /**
+ * Parses either For, ForIn or ForOf statement
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-statement)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseForStatement(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 12374 /* ForKeyword */);
+ const awaitToken = !!(context & exports.Context.Async && consume(parser, context, 34017389 /* AwaitKeyword */));
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 50331659 /* LeftParen */);
+ const { token } = parser;
+ let init = null;
+ let sequencePos = null;
+ let variableStatement = null;
+ let type = 'ForStatement';
+ let test = null;
+ let update = null;
+ let right;
+ if (token === 33566793 /* ConstKeyword */ || (token === 33574984 /* LetKeyword */ && lookahead(parser, context, isLexical))) {
+ variableStatement = parseVariableStatement(parser, (context & ~exports.Context.AllowIn) | exports.Context.BlockScope, false);
+ }
+ else if (token === 33566791 /* VarKeyword */) {
+ variableStatement = parseVariableStatement(parser, context & ~exports.Context.AllowIn, false);
+ }
+ else if (token !== 17825809 /* Semicolon */) {
+ sequencePos = getLocation(parser);
+ init = restoreExpressionCoverGrammar(parser, (context & ~exports.Context.AllowIn) | exports.Context.DisallowEscapedKeyword, parseAssignmentExpression);
+ }
+ if (consume(parser, context, 69746 /* OfKeyword */)) {
+ type = 'ForOfStatement';
+ if (init) {
+ if (!(parser.flags & exports.Flags.AllowDestructuring) || init.type === 'AssignmentExpression') {
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ }
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ right = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ }
+ else if (consume(parser, context, 167786289 /* InKeyword */)) {
+ if (init) {
+ if (!(parser.flags & exports.Flags.AllowDestructuring))
+ tolerant(parser, context, 73 /* InvalidDestructuringTarget */);
+ reinterpret(parser, context, init);
+ }
+ else
+ init = variableStatement;
+ type = 'ForInStatement';
+ right = parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn);
+ }
+ else {
+ if (parser.token === 16777234 /* Comma */)
+ init = parseSequenceExpression(parser, context, init, sequencePos);
+ if (variableStatement)
+ init = variableStatement;
+ expect(parser, context, 17825809 /* Semicolon */);
+ test = parser.token !== 17825809 /* Semicolon */
+ ? parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn)
+ : null;
+ expect(parser, context, 17825809 /* Semicolon */);
+ update = parser.token !== 16 /* RightParen */
+ ? parseExpression(parser, (context & ~exports.Context.AllowDecorator) | exports.Context.AllowIn)
+ : null;
+ }
+ expect(parser, context, 16 /* RightParen */);
+ const body = parseIterationStatement(parser, context);
+ return finishNode(context, parser, pos, type === 'ForOfStatement'
+ ? {
+ type,
+ body,
+ left: init,
+ right,
+ await: awaitToken
+ }
+ : right
+ ? {
+ type: type,
+ body,
+ left: init,
+ right
+ }
+ : {
+ type: type,
+ body,
+ init,
+ test,
+ update
+ });
+ } + + // 15.2 Modules
+ /**
+ * Parse module item list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItemList)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseModuleItemList(parser, context) {
+ // Prime the scanner
+ nextToken(parser, context);
+ const statements = [];
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ statements.push(parser.token === 33554435 /* StringLiteral */ ?
+ parseDirective(parser, context) :
+ parseModuleItem(parser, context | exports.Context.AllowIn));
+ }
+ return statements;
+ }
+ /**
+ * Parse module item
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleItem)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseModuleItem(parser, context) {
+ switch (parser.token) {
+ // @decorator
+ case 120 /* At */:
+ return parseDecorators(parser, context);
+ // ExportDeclaration
+ case 12371 /* ExportKeyword */:
+ return parseExportDeclaration(parser, context);
+ // ImportDeclaration
+ case 33566810 /* ImportKeyword */:
+ // 'Dynamic Import' or meta property disallowed here
+ if (!(context & exports.Context.OptionsNext && lookahead(parser, context, nextTokenIsLeftParenOrPeriod))) {
+ return parseImportDeclaration(parser, context);
+ }
+ // falls through
+ default:
+ return parseStatementListItem(parser, context);
+ }
+ }
+ /**
+ * Parse export declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ExportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ const specifiers = [];
+ let source = null;
+ let declaration = null;
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 12371 /* ExportKeyword */);
+ switch (parser.token) {
+ // export * FromClause ;
+ case 167774771 /* Multiply */:
+ return parseExportAllDeclaration(parser, context, pos);
+ case 12368 /* DefaultKeyword */:
+ return parseExportDefault(parser, context, pos);
+ case 41943052 /* LeftBrace */:
+ {
+ // export ExportClause FromClause ;
+ // export ExportClause ;
+ expect(parser, context, 41943052 /* LeftBrace */);
+ let hasReservedWord = false;
+ while (parser.token !== 17825807 /* RightBrace */) {
+ if (parser.token !== 69743 /* GetKeyword */ && parser.token & 12288 /* Reserved */) {
+ hasReservedWord = true;
+ setPendingError(parser);
+ }
+ specifiers.push(parseNamedExportDeclaration(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 17825807 /* RightBrace */);
+ if (parser.token === 69745 /* FromKeyword */) {
+ source = parseModuleSpecifier(parser, context);
+ // The left hand side can't be a keyword where there is no
+ // 'from' keyword since it references a local binding.
+ }
+ else if (hasReservedWord)
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ consumeSemicolon(parser, context);
+ break;
+ }
+ // export ClassDeclaration
+ case 33566797 /* ClassKeyword */:
+ declaration = (parseClassDeclaration(parser, context));
+ break;
+ // export LexicalDeclaration
+ case 33574984 /* LetKeyword */:
+ case 33566793 /* ConstKeyword */:
+ declaration = parseVariableStatement(parser, context | exports.Context.BlockScope);
+ break;
+ // export VariableDeclaration
+ case 33566791 /* VarKeyword */:
+ declaration = parseVariableStatement(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context);
+ break;
+ // export HoistableDeclaration
+ case 594028 /* AsyncKeyword */:
+ if (lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine)) {
+ declaration = parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context);
+ break;
+ }
+ // Falls through
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportNamedDeclaration',
+ source,
+ specifiers,
+ declaration,
+ });
+ }
+ /**
+ * Parse export all declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseExportAllDeclaration(parser, context, pos) {
+ expect(parser, context, 167774771 /* Multiply */);
+ const source = parseModuleSpecifier(parser, context);
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ExportAllDeclaration',
+ source,
+ });
+ }
+ /**
+ * Parse named export declaration
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNamedExportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ // ExportSpecifier :
+ // IdentifierName
+ // IdentifierName as IdentifierName
+ const local = parseIdentifierName(parser, context | exports.Context.DisallowEscapedKeyword, parser.token);
+ const exported = consume(parser, context, 167843947 /* AsKeyword */)
+ ? parseIdentifierName(parser, context, parser.token)
+ : local;
+ return finishNode(context, parser, pos, {
+ type: 'ExportSpecifier',
+ local,
+ exported,
+ });
+ }
+ /**
+ * Parse export default
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ClassDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-HoistableDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ * @param pos Location
+ */
+ function parseExportDefault(parser, context, pos) {
+ expect(parser, context | exports.Context.DisallowEscapedKeyword, 12368 /* DefaultKeyword */);
+ let declaration;
+ switch (parser.token) {
+ // export default HoistableDeclaration[Default]
+ case 33566808 /* FunctionKeyword */:
+ declaration = parseFunctionDeclaration(parser, context | exports.Context.RequireIdentifier);
+ break;
+ // export default ClassDeclaration[Default]
+ // export default @decl ClassDeclaration[Default]
+ case 120 /* At */:
+ case 33566797 /* ClassKeyword */:
+ declaration = parseClassDeclaration(parser, context & ~exports.Context.AllowIn | exports.Context.RequireIdentifier);
+ break;
+ // export default HoistableDeclaration[Default]
+ case 594028 /* AsyncKeyword */:
+ declaration = parseAsyncFunctionOrAssignmentExpression(parser, context | exports.Context.RequireIdentifier);
+ break;
+ default:
+ // export default [lookahead ∉ {function, class}] AssignmentExpression[In] ;
+ declaration = parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ consumeSemicolon(parser, context);
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ExportDefaultDeclaration',
+ declaration,
+ });
+ }
+ /**
+ * Parse import declaration
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportDeclaration(parser, context) {
+ const pos = getLocation(parser);
+ expect(parser, context, 33566810 /* ImportKeyword */);
+ let source;
+ let specifiers = [];
+ // 'import' ModuleSpecifier ';'
+ if (parser.token === 33554435 /* StringLiteral */) {
+ source = parseLiteral(parser, context);
+ }
+ else {
+ specifiers = parseImportClause(parser, context | exports.Context.DisallowEscapedKeyword);
+ source = parseModuleSpecifier(parser, context);
+ }
+ consumeSemicolon(parser, context);
+ return finishNode(context, parser, pos, {
+ type: 'ImportDeclaration',
+ specifiers,
+ source,
+ });
+ }
+ /**
+ * Parse import clause
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportClause)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportClause(parser, context) {
+ const specifiers = [];
+ switch (parser.token) {
+ // 'import' ModuleSpecifier ';'
+ case 33685505 /* Identifier */:
+ {
+ specifiers.push(parseImportDefaultSpecifier(parser, context));
+ if (consume(parser, context, 16777234 /* Comma */)) {
+ switch (parser.token) {
+ // import a, * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ // import a, {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ default:
+ tolerant(parser, context, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ }
+ break;
+ }
+ // import {bar}
+ case 41943052 /* LeftBrace */:
+ parseNamedImports(parser, context, specifiers);
+ break;
+ // import * as foo
+ case 167774771 /* Multiply */:
+ parseNameSpaceImport(parser, context, specifiers);
+ break;
+ default:
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ }
+ return specifiers;
+ }
+ /**
+ * Parse named imports
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NamedImports)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNamedImports(parser, context, specifiers) {
+ expect(parser, context, 41943052 /* LeftBrace */);
+ while (parser.token !== 17825807 /* RightBrace */) {
+ specifiers.push(parseImportSpecifier(parser, context));
+ if (parser.token !== 17825807 /* RightBrace */)
+ expect(parser, context, 16777234 /* Comma */);
+ }
+ expect(parser, context, 17825807 /* RightBrace */);
+ }
+ /**
+ * Parse import specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ImportSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportSpecifier(parser, context) {
+ const pos = getLocation(parser);
+ const { token } = parser;
+ const imported = parseIdentifierName(parser, context | exports.Context.DisallowEscapedKeyword, token);
+ let local;
+ if (consume(parser, context, 167843947 /* AsKeyword */)) {
+ local = parseBindingIdentifier(parser, context);
+ }
+ else {
+ // An import name that is a keyword is a syntax error if it is not followed
+ // by the keyword 'as'.
+ if (hasBit(token, 12288 /* Reserved */))
+ tolerant(parser, context, 46 /* UnexpectedReserved */);
+ if (hasBit(token, 4194304 /* IsEvalOrArguments */))
+ tolerant(parser, context, 47 /* StrictEvalArguments */);
+ local = imported;
+ }
+ return finishNode(context, parser, pos, {
+ type: 'ImportSpecifier',
+ local,
+ imported,
+ });
+ }
+ /**
+ * Parse binding identifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-NameSpaceImport)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseNameSpaceImport(parser, context, specifiers) {
+ // NameSpaceImport:
+ // * as ImportedBinding
+ const pos = getLocation(parser);
+ expect(parser, context, 167774771 /* Multiply */);
+ expect(parser, context, 167843947 /* AsKeyword */, 82 /* AsAfterImportStart */);
+ const local = parseBindingIdentifier(parser, context);
+ specifiers.push(finishNode(context, parser, pos, {
+ type: 'ImportNamespaceSpecifier',
+ local,
+ }));
+ }
+ /**
+ * Parse module specifier
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-ModuleSpecifier)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseModuleSpecifier(parser, context) {
+ // ModuleSpecifier :
+ // StringLiteral
+ expect(parser, context, 69745 /* FromKeyword */);
+ if (parser.token !== 33554435 /* StringLiteral */)
+ report(parser, 1 /* UnexpectedToken */, tokenDesc(parser.token));
+ return parseLiteral(parser, context);
+ }
+ /**
+ * Parse import default specifier
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseImportDefaultSpecifier(parser, context) {
+ return finishNode(context, parser, getLocation(parser), {
+ type: 'ImportDefaultSpecifier',
+ local: parseIdentifier(parser, context),
+ });
+ }
+ /**
+ * Parses either async function or assignment expression
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AssignmentExpression)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncFunctionDeclaration)
+ * @see [Link](https://tc39.github.io/ecma262/#prod-AsyncGeneratorDeclaration)
+ *
+ * @param parser Parser object
+ * @param context Context masks
+ */
+ function parseAsyncFunctionOrAssignmentExpression(parser, context) {
+ return lookahead(parser, context, nextTokenIsFuncKeywordOnSameLine) ?
+ parseAsyncFunctionOrAsyncGeneratorDeclaration(parser, context | exports.Context.RequireIdentifier) :
+ parseAssignmentExpression(parser, context | exports.Context.AllowIn);
+ } + + /**
+ * Creates the parser object
+ *
+ * @param source The source coode to parser
+ * @param sourceFile Optional source file info to be attached in every node
+ */
+ function createParser(source, sourceFile) {
+ return {
+ // The source code to parse
+ source,
+ // Source length
+ length: source.length,
+ // Current position
+ index: 0,
+ // Current line
+ line: 1,
+ // Current column
+ column: 0,
+ // Start position before current token
+ startIndex: 0,
+ // Start position column before current token
+ startColumn: 0,
+ // Start position line before current token
+ startLine: 1,
+ // End position after parsing after current token
+ lastIndex: 0,
+ // End column position after current token
+ lastColumn: 0,
+ // End line position after current token
+ lastLine: 0,
+ // Pending cover grammar errors
+ pendingExpressionError: undefined,
+ // Mutable parser flags. Allows destructuring by default.
+ flags: exports.Flags.AllowDestructuring,
+ // The tokens
+ token: 1048576 /* EndOfSource */,
+ // Misc
+ tokenRaw: '',
+ lastValue: 0,
+ comments: [],
+ sourceFile,
+ tokenRegExp: undefined,
+ tokenValue: undefined,
+ labelSet: undefined,
+ errorLocation: undefined,
+ errors: [],
+ };
+ }
+ /**
+ * Creating the parser
+ *
+ * @param source The source coode to parser
+ * @param options The parser options
+ * @param context Context masks
+ */
+ function parseSource(source, options, /*@internal*/ context) {
+ let sourceFile = '';
+ if (!!options) {
+ // The flag to enable module syntax support
+ if (options.module)
+ context |= exports.Context.Module;
+ // The flag to enable stage 3 support (ESNext)
+ if (options.next)
+ context |= exports.Context.OptionsNext;
+ // The flag to enable React JSX parsing
+ if (options.jsx)
+ context |= exports.Context.OptionsJSX;
+ // The flag to enable start and end offsets to each node
+ if (options.ranges)
+ context |= exports.Context.OptionsRanges;
+ // The flag to enable line/column location information to each node
+ if (options.loc)
+ context |= exports.Context.OptionsLoc;
+ // The flag to attach raw property to each literal node
+ if (options.raw)
+ context |= exports.Context.OptionsRaw;
+ // Attach raw property to each identifier node
+ if (options.rawIdentifier)
+ context |= exports.Context.OptionsRawidentifiers;
+ // The flag to allow return in the global scope
+ if (options.globalReturn)
+ context |= exports.Context.OptionsGlobalReturn;
+ // The flag to allow to skip shebang - '#'
+ if (options.skipShebang)
+ context |= exports.Context.OptionsShebang;
+ // Enable tolerant mode
+ if (options.tolerant)
+ context |= exports.Context.OptionsTolerant;
+ // Set to true to record the source file in every node's loc object when the loc option is set.
+ if (!!options.source)
+ sourceFile = options.source;
+ // Create a top-level comments array containing all comments
+ if (!!options.comments)
+ context |= exports.Context.OptionsComments;
+ // The flag to enable implied strict mode
+ if (options.impliedStrict)
+ context |= exports.Context.Strict;
+ // The flag to enable experimental features
+ if (options.experimental)
+ context |= exports.Context.OptionsExperimental;
+ // The flag to set to bypass methods in Node
+ if (options.node)
+ context |= exports.Context.OptionsNode;
+ // Accepts a callback function to be invoked for each syntax node (as the node is constructed)
+ }
+ const parser = createParser(source, sourceFile);
+ const body = context & exports.Context.Module ?
+ parseModuleItemList(parser, context) :
+ parseStatementList(parser, context);
+ const node = {
+ type: 'Program',
+ sourceType: context & exports.Context.Module ? 'module' : 'script',
+ body: body,
+ };
+ if (context & exports.Context.LocationTracker) {
+ if (context & exports.Context.OptionsRanges) {
+ node.start = 0;
+ node.end = source.length;
+ }
+ if (context & exports.Context.OptionsLoc) {
+ node.loc = {
+ start: { line: 1, column: 0 },
+ end: { line: parser.line, column: parser.column
+ }
+ };
+ if (sourceFile)
+ node.loc.source = sourceFile;
+ }
+ }
+ if (context & exports.Context.OptionsComments)
+ node.comments = parser.comments;
+ if (context & exports.Context.OptionsTolerant)
+ node.errors = parser.errors;
+ return node;
+ }
+ /**
+ * Parse statement list
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#prod-StatementList)
+ *
+ * @param Parser instance
+ * @param Context masks
+ */
+ function parseStatementList(parser, context) {
+ const statements = [];
+ let hasProlog = true; // Parsing directive prologue.
+ // prime the scanner
+ nextToken(parser, context | exports.Context.DisallowEscapedKeyword);
+ while (parser.token !== 1048576 /* EndOfSource */) {
+ if (hasProlog && parser.token !== 33554435 /* StringLiteral */)
+ hasProlog = false;
+ if (hasProlog) {
+ if (!(context & exports.Context.Strict) && parser.tokenRaw.length === 12 && parser.tokenValue === 'use strict') {
+ context |= exports.Context.Strict;
+ }
+ statements.push(parseDirective(parser, context));
+ }
+ else {
+ statements.push(parseStatementListItem(parser, context));
+ }
+ }
+ return statements;
+ }
+ /**
+ * Parse either script code or module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+ function parse(source, options) {
+ return options && options.module
+ ? parseModule(source, options)
+ : parseScript(source, options);
+ }
+ /**
+ * Parse script code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-scripts)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+ function parseScript(source, options) {
+ return parseSource(source, options, exports.Context.Empty);
+ }
+ /**
+ * Parse module code
+ *
+ * @see [Link](https://tc39.github.io/ecma262/#sec-modules)
+ *
+ * @param source source code to parse
+ * @param options parser options
+ */
+ function parseModule(source, options) {
+ return parseSource(source, options, exports.Context.Strict | exports.Context.Module);
+ } + + + + var estree = /*#__PURE__*/Object.freeze({ + + }); + + + + var index = /*#__PURE__*/Object.freeze({ + scanIdentifier: scanIdentifier, + scanMaybeIdentifier: scanMaybeIdentifier, + scanHexIntegerLiteral: scanHexIntegerLiteral, + scanOctalOrBinary: scanOctalOrBinary, + scanImplicitOctalDigits: scanImplicitOctalDigits, + scanSignedInteger: scanSignedInteger, + scanNumericLiteral: scanNumericLiteral, + scanNumericSeparator: scanNumericSeparator, + scanDecimalDigitsOrSeparator: scanDecimalDigitsOrSeparator, + scanDecimalAsSmi: scanDecimalAsSmi, + scanRegularExpression: scanRegularExpression, + scan: scan, + scanEscapeSequence: scanEscapeSequence, + throwStringError: throwStringError, + scanString: scanString, + consumeTemplateBrace: consumeTemplateBrace, + scanTemplate: scanTemplate, + skipSingleHTMLComment: skipSingleHTMLComment, + skipSingleLineComment: skipSingleLineComment, + skipMultiLineComment: skipMultiLineComment, + addComment: addComment, + nextUnicodeChar: nextUnicodeChar, + isIdentifierPart: isIdentifierPart, + escapeInvalidCharacters: escapeInvalidCharacters, + consumeOpt: consumeOpt, + consumeLineFeed: consumeLineFeed, + scanPrivateName: scanPrivateName, + advanceNewline: advanceNewline, + fromCodePoint: fromCodePoint, + readNext: readNext, + toHex: toHex, + advanceOnMaybeAstral: advanceOnMaybeAstral + }); + + + + var parser = /*#__PURE__*/Object.freeze({ + parseClassDeclaration: parseClassDeclaration, + parseFunctionDeclaration: parseFunctionDeclaration, + parseAsyncFunctionOrAsyncGeneratorDeclaration: parseAsyncFunctionOrAsyncGeneratorDeclaration, + parseVariableDeclarationList: parseVariableDeclarationList, + parseExpression: parseExpression, + parseSequenceExpression: parseSequenceExpression, + parseAssignmentExpression: parseAssignmentExpression, + parseRestElement: parseRestElement, + parseLeftHandSideExpression: parseLeftHandSideExpression, + parsePrimaryExpression: parsePrimaryExpression, + parseIdentifier: parseIdentifier, + parseLiteral: parseLiteral, + parseBigIntLiteral: parseBigIntLiteral, + parseIdentifierName: parseIdentifierName, + parseFunctionExpression: parseFunctionExpression, + parseAsyncFunctionOrAsyncGeneratorExpression: parseAsyncFunctionOrAsyncGeneratorExpression, + parsePropertyName: parsePropertyName, + parseObjectLiteral: parseObjectLiteral, + parseFormalListAndBody: parseFormalListAndBody, + parseFunctionBody: parseFunctionBody, + parseFormalParameters: parseFormalParameters, + parseFormalParameterList: parseFormalParameterList, + parseClassBodyAndElementList: parseClassBodyAndElementList, + parseClassElement: parseClassElement, + parseDecorators: parseDecorators, + parseModuleItemList: parseModuleItemList, + parseModuleItem: parseModuleItem, + parseExportDeclaration: parseExportDeclaration, + parseImportDeclaration: parseImportDeclaration, + createParser: createParser, + parseSource: parseSource, + parseStatementList: parseStatementList, + parse: parse, + parseScript: parseScript, + parseModule: parseModule, + parseBindingIdentifierOrPattern: parseBindingIdentifierOrPattern, + parseBindingIdentifier: parseBindingIdentifier, + parseAssignmentRestElement: parseAssignmentRestElement, + parseAssignmentPattern: parseAssignmentPattern, + parseBindingInitializer: parseBindingInitializer, + parseStatementListItem: parseStatementListItem, + parseStatement: parseStatement, + parseEmptyStatement: parseEmptyStatement, + parseContinueStatement: parseContinueStatement, + parseBreakStatement: parseBreakStatement, + parseIfStatement: parseIfStatement, + parseDebuggerStatement: parseDebuggerStatement, + parseTryStatement: parseTryStatement, + parseCatchBlock: parseCatchBlock, + parseThrowStatement: parseThrowStatement, + parseExpressionStatement: parseExpressionStatement, + parseDirective: parseDirective, + parseExpressionOrLabelledStatement: parseExpressionOrLabelledStatement, + parseDoWhileStatement: parseDoWhileStatement, + parseWhileStatement: parseWhileStatement, + parseBlockStatement: parseBlockStatement, + parseReturnStatement: parseReturnStatement, + parseIterationStatement: parseIterationStatement, + parseWithStatement: parseWithStatement, + parseSwitchStatement: parseSwitchStatement, + parseCaseOrDefaultClauses: parseCaseOrDefaultClauses, + parseVariableStatement: parseVariableStatement, + parseJSXRootElement: parseJSXRootElement, + parseJSXOpeningElement: parseJSXOpeningElement, + nextJSXToken: nextJSXToken, + scanJSXToken: scanJSXToken, + parseJSXText: parseJSXText, + parseJSXAttributes: parseJSXAttributes, + parseJSXSpreadAttribute: parseJSXSpreadAttribute, + parseJSXNamespacedName: parseJSXNamespacedName, + parseJSXAttributeName: parseJSXAttributeName, + parseJSXAttribute: parseJSXAttribute, + parseJSXEmptyExpression: parseJSXEmptyExpression, + parseJSXSpreadChild: parseJSXSpreadChild, + parseJSXExpressionContainer: parseJSXExpressionContainer, + parseJSXExpression: parseJSXExpression, + parseJSXClosingFragment: parseJSXClosingFragment, + parseJSXClosingElement: parseJSXClosingElement, + parseJSXIdentifier: parseJSXIdentifier, + parseJSXMemberExpression: parseJSXMemberExpression, + parseJSXElementName: parseJSXElementName, + scanJSXIdentifier: scanJSXIdentifier + }); + + // tslint:disable-next-line:variable-name
+ const Parser = parser; + + const version = '1.6.9'; + + exports.version = version; + exports.ESTree = estree; + exports.Scanner = index; + exports.parse = parse; + exports.parseSource = parseSource; + exports.parseModule = parseModule; + exports.parseScript = parseScript; + exports.characterType = characterType; + exports.errorMessages = errorMessages; + exports.constructError = constructError; + exports.report = report; + exports.tolerant = tolerant; + exports.tokenDesc = tokenDesc; + exports.descKeyword = descKeyword; + exports.Parser = Parser; + exports.isValidIdentifierPart = isValidIdentifierPart; + exports.isValidIdentifierStart = isValidIdentifierStart; + exports.mustEscape = mustEscape; + exports.validateBreakOrContinueLabel = validateBreakOrContinueLabel; + exports.addLabel = addLabel; + exports.popLabel = popLabel; + exports.hasLabel = hasLabel; + exports.finishNode = finishNode; + exports.expect = expect; + exports.consume = consume; + exports.nextToken = nextToken; + exports.hasBit = hasBit; + exports.consumeSemicolon = consumeSemicolon; + exports.parseExpressionCoverGrammar = parseExpressionCoverGrammar; + exports.restoreExpressionCoverGrammar = restoreExpressionCoverGrammar; + exports.swapContext = swapContext; + exports.validateParams = validateParams; + exports.reinterpret = reinterpret; + exports.lookahead = lookahead; + exports.isValidSimpleAssignmentTarget = isValidSimpleAssignmentTarget; + exports.getLocation = getLocation; + exports.isValidIdentifier = isValidIdentifier; + exports.isLexical = isLexical; + exports.isEndOfCaseOrDefaultClauses = isEndOfCaseOrDefaultClauses; + exports.nextTokenIsLeftParenOrPeriod = nextTokenIsLeftParenOrPeriod; + exports.nextTokenisIdentifierOrParen = nextTokenisIdentifierOrParen; + exports.nextTokenIsLeftParen = nextTokenIsLeftParen; + exports.nextTokenIsFuncKeywordOnSameLine = nextTokenIsFuncKeywordOnSameLine; + exports.isPropertyWithPrivateFieldKey = isPropertyWithPrivateFieldKey; + exports.parseAndClassifyIdentifier = parseAndClassifyIdentifier; + exports.nameIsArgumentsOrEval = nameIsArgumentsOrEval; + exports.setPendingError = setPendingError; + exports.isEqualTagNames = isEqualTagNames; + exports.isInstanceField = isInstanceField; + exports.validateUpdateExpression = validateUpdateExpression; + exports.setPendingExpressionError = setPendingExpressionError; + exports.validateCoverParenthesizedExpression = validateCoverParenthesizedExpression; + exports.validateAsyncArgumentList = validateAsyncArgumentList; + exports.isInOrOf = isInOrOf; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/node_modules/cherow/dist/umd/cherow.min.js b/node_modules/cherow/dist/umd/cherow.min.js new file mode 100644 index 0000000..b3bf183 --- /dev/null +++ b/node_modules/cherow/dist/umd/cherow.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.cherow={})}(this,function(e){"use strict";const t=["end of source","identifier","number","string","regular expression","false","true","null","template continuation","template end","=>","(","{",".","...","}",")",";",",","[","]",":","?","'",'"',"</","/>","++","--","=","<<=",">>=",">>>=","**=","+=","-=","*=","/=","%=","^=","|=","&=","typeof","delete","void","!","~","+","-","in","instanceof","*","%","/","**","&&","||","===","!==","==","!=","<=",">=","<",">","<<",">>",">>>","&","|","^","var","let","const","break","case","catch","class","continue","debugger","default","do","else","export","extends","finally","for","function","if","import","new","return","super","switch","this","throw","try","while","with","implements","interface","package","private","protected","public","static","yield","as","async","await","constructor","get","set","from","of","#","eval","arguments","enum","BigInt","@","JSXText","KeyOf","ReadOnly","is","unique","declare","type","namespace","abstract","module","global","require","target"];function n(e){return t[255&e]}const o=Object.create(null,{this:{value:33566815},function:{value:33566808},if:{value:12377},return:{value:12380},var:{value:33566791},else:{value:12370},for:{value:12374},new:{value:33566811},in:{value:167786289},typeof:{value:302002218},while:{value:12386},case:{value:12363},break:{value:12362},try:{value:12385},catch:{value:12364},delete:{value:302002219},throw:{value:302002272},switch:{value:33566814},continue:{value:12366},default:{value:12368},instanceof:{value:167786290},do:{value:12369},void:{value:302002220},finally:{value:12373},arguments:{value:37879925},keyof:{value:131194},readonly:{value:131195},unique:{value:131197},declare:{value:131198},async:{value:594028},await:{value:34017389},class:{value:33566797},const:{value:33566793},constructor:{value:69742},debugger:{value:12367},enum:{value:12406},eval:{value:37879924},export:{value:12371},extends:{value:12372},false:{value:33566725},from:{value:69745},get:{value:69743},implements:{value:20579},import:{value:33566810},interface:{value:20580},let:{value:33574984},null:{value:33566727},of:{value:69746},package:{value:20581},private:{value:20582},protected:{value:20583},public:{value:20584},set:{value:69744},static:{value:20585},super:{value:33566813},true:{value:33566726},with:{value:12387},yield:{value:1107316842},is:{value:131196},type:{value:131199},namespace:{value:131200},abstract:{value:131201},as:{value:167843947},module:{value:131202},global:{value:131203},require:{value:131204},target:{value:131205}});function r(e){return 0|o[e]}const a=[0,0,0,0,0,0,0,0,0,16,48,16,16,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,0,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0];function s(e){return 0!=(1&l[0+(e>>>5)]>>>e)}function i(e){return 0!=(1&l[34816+(e>>>5)]>>>e)}function c(e){return 0!=(1&l[69632+(e>>>5)]>>>e)}const l=((e,t)=>{const n=new Uint32Array(104448);let o=0,r=0;for(;o<3392;){const a=e[o++];if(a<0)r-=a;else{let s=e[o++];2&a&&(s=t[s]),1&a?n.fill(s,r,r+=e[o++]):n[r++]=s}}return n})([-1,2,28,2,29,2,5,-1,0,77595648,3,46,2,3,0,14,2,57,2,58,3,0,3,0,3168796671,0,4294956992,2,1,2,0,2,59,3,0,4,0,4294966523,3,0,4,2,15,2,60,2,0,0,4294836735,0,3221225471,0,4294901942,2,61,0,134152192,3,0,2,0,4294951935,3,0,2,0,2683305983,0,2684354047,2,17,2,0,0,4294961151,3,0,2,2,20,2,0,0,608174079,2,0,2,127,2,6,2,62,-1,2,64,2,26,2,1,3,0,3,0,4294901711,2,40,0,4089839103,0,2961209759,0,1342439375,0,4294543342,0,3547201023,0,1577204103,0,4194240,0,4294688750,2,2,0,80831,0,4261478351,0,4294549486,2,2,0,2965387679,0,196559,0,3594373100,0,3288319768,0,8469959,2,171,0,4294828031,0,3825204735,0,123747807,0,65487,2,3,0,4092591615,0,1080049119,0,458703,2,3,2,0,0,2163244511,0,4227923919,0,4236247020,2,68,0,4284449919,0,851904,2,4,2,16,0,67076095,-1,2,69,0,1006628014,0,4093591391,-1,0,50331649,0,3265266687,2,34,0,4294844415,0,4278190047,2,23,2,125,-1,3,0,2,2,33,2,0,2,9,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,10,0,261632,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,2088959,2,31,2,8,0,909311,3,0,2,0,814743551,2,42,0,67057664,3,0,2,2,45,2,0,2,32,2,0,2,18,2,7,0,268374015,2,30,2,51,2,0,2,78,0,134153215,-1,2,6,2,0,2,7,0,2684354559,0,67044351,0,1073676416,-2,3,0,2,2,43,0,1046528,3,0,3,2,8,2,0,2,41,0,4294960127,2,9,2,39,2,10,0,4294377472,2,21,3,0,7,0,4227858431,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-1,2,122,0,1048577,2,84,2,12,-1,2,12,0,131042,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,1046559,2,0,2,13,2,0,0,2147516671,2,24,3,88,2,2,0,-16,2,89,0,524222462,2,4,2,0,0,4269801471,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,2,119,2,0,0,3220242431,3,0,3,2,20,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,2,0,2,27,2,0,2,8,3,0,2,0,67043391,0,3909091327,2,0,2,25,2,8,2,23,3,0,2,0,67076097,2,7,2,0,2,24,0,67059711,0,4236247039,3,0,2,0,939524103,0,8191999,2,97,2,98,2,14,2,95,3,0,3,0,67057663,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,3774349439,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,2,19,0,1638399,2,169,2,104,3,0,3,2,23,2,28,2,29,2,5,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-3,2,146,-4,2,23,2,0,2,37,0,1,2,0,2,63,2,32,2,16,2,9,2,0,2,109,-1,3,0,4,2,9,2,33,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277137519,0,2269118463,-1,3,23,2,-1,2,34,2,38,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,48,-14,2,23,2,44,2,37,-5,3,0,2,2,38,0,2147549120,2,0,2,16,2,17,2,130,2,0,2,52,0,4294901872,0,5242879,3,0,2,0,402595359,-1,2,118,0,1090519039,-2,2,120,2,39,2,0,2,55,2,40,0,4226678271,0,3766565279,0,2039759,-4,3,0,2,0,1140787199,-1,3,0,2,0,67043519,-5,2,0,0,4282384383,0,1056964609,-1,3,0,2,0,67043345,-1,2,0,2,41,2,42,-1,2,10,2,43,-6,2,0,2,16,-3,3,0,2,0,2147484671,-8,2,0,2,7,2,44,2,0,0,603979727,-1,2,0,2,45,-8,2,54,2,46,0,67043329,2,123,2,47,0,8388351,-2,2,124,0,3028287487,2,48,2,126,0,33259519,2,42,-9,2,24,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,2,42,-2,2,17,2,51,2,0,2,24,0,67043343,2,128,2,19,-21,3,0,2,-4,3,0,2,0,4294901791,2,7,2,164,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,0,1677656575,-166,0,4161266656,0,4071,0,15360,-4,0,28,-13,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,0,4294954999,2,0,-16,2,0,2,90,2,0,0,2105343,0,4160749584,0,65534,-42,0,4194303871,0,2011,-62,3,0,6,0,8323103,-1,3,0,2,2,55,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-22583,3,0,7,2,19,-6130,3,5,2,-1,0,69207040,3,46,2,3,0,14,2,57,2,58,-3,0,3168731136,0,4294956864,2,1,2,0,2,59,3,0,4,0,4294966275,3,0,4,2,15,2,60,2,0,2,35,-1,2,17,2,61,-1,2,0,2,62,0,4294885376,3,0,2,0,3145727,0,2617294944,0,4294770688,2,19,2,63,3,0,2,0,131135,2,94,0,70256639,0,71303167,0,272,2,45,2,62,-1,2,64,-2,2,96,0,603979775,0,4278255616,0,4294836227,0,4294549473,0,600178175,0,2952806400,0,268632067,0,4294543328,0,57540095,0,1577058304,0,1835008,0,4294688736,2,65,2,66,0,33554435,2,121,2,65,2,147,0,131075,0,3594373096,0,67094296,2,66,-1,2,67,0,603979263,2,156,0,3,0,4294828001,0,602930687,2,180,0,393219,2,67,0,671088639,0,2154840064,0,4227858435,0,4236247008,2,68,2,38,-1,2,4,0,917503,2,38,-1,2,69,0,537783470,0,4026531935,-1,0,1,-1,2,34,2,70,0,7936,-3,2,0,0,2147485695,0,1010761728,0,4292984930,0,16387,2,0,2,13,2,14,3,0,10,2,71,2,0,2,72,2,73,2,74,2,0,2,75,2,0,2,16,-1,2,19,3,0,2,2,11,2,4,3,0,18,2,76,2,5,3,0,2,2,77,0,253951,3,20,2,0,122879,2,0,2,8,0,276824064,-2,3,0,2,2,45,2,0,0,4294903295,2,0,2,18,2,7,-1,2,17,2,51,2,0,2,78,2,42,-1,2,24,2,0,2,31,-2,0,128,-2,2,79,2,8,0,4064,-1,2,117,0,4227907585,2,0,2,116,2,0,2,50,2,196,2,9,2,39,2,10,-1,0,6544896,3,0,6,-2,3,0,8,2,11,2,0,2,80,2,9,2,0,2,81,2,82,2,83,-3,2,84,2,12,-3,2,85,2,86,2,87,2,0,2,35,-83,2,0,2,53,2,7,3,0,4,0,817183,2,0,2,13,2,0,0,33023,2,24,3,88,2,-17,2,89,0,524157950,2,4,2,0,2,90,2,4,2,0,2,14,2,79,2,15,3,0,2,2,49,2,16,-1,2,17,-16,3,0,205,2,18,-2,3,0,655,2,19,3,0,36,2,70,-1,2,17,2,9,3,0,8,2,91,0,3072,2,0,0,2147516415,2,9,3,0,2,2,19,2,22,2,92,3,0,2,2,93,2,21,-1,2,22,0,4294965179,0,7,2,0,2,8,2,92,2,8,-1,0,1761345536,2,94,2,95,2,38,2,23,2,96,2,36,2,162,0,2080440287,2,0,2,35,2,138,0,3296722943,2,0,0,1046675455,0,939524101,0,1837055,2,97,2,98,2,14,2,95,3,0,3,0,7,3,0,349,2,99,2,100,2,6,-264,3,0,11,2,25,3,0,2,2,21,-1,0,2700607615,2,101,2,102,3,0,2,2,20,2,26,3,0,10,2,9,2,17,2,0,2,47,2,0,2,27,2,103,-3,2,104,3,0,3,2,23,-1,3,5,2,2,30,2,0,2,7,2,105,-1,2,106,2,107,2,108,-1,3,0,3,2,16,-2,2,0,2,31,-8,2,23,2,0,2,37,-1,2,0,2,63,2,32,2,18,2,9,2,0,2,109,-1,3,0,4,2,9,2,17,2,110,2,6,2,0,2,111,2,0,2,50,-4,3,0,9,2,24,2,18,2,27,-4,2,112,2,113,2,18,2,24,2,7,-2,2,114,2,18,2,21,-2,2,0,2,115,-2,0,4277075969,2,18,-1,3,23,2,-1,2,34,2,139,2,0,3,18,2,2,36,2,20,-3,3,0,2,2,35,-1,2,0,2,36,2,0,2,36,2,0,2,50,-14,2,23,2,44,2,116,-5,2,117,2,41,-2,2,117,2,19,2,17,2,35,2,117,2,38,0,4294901776,0,4718591,2,117,2,36,0,335544350,-1,2,118,2,119,-2,2,120,2,39,2,7,-1,2,121,2,65,0,3758161920,0,3,-4,2,0,2,31,2,174,-1,2,0,2,19,0,176,-5,2,0,2,49,2,182,-1,2,0,2,19,2,194,-1,2,0,2,62,-2,2,16,-7,2,0,2,119,-3,3,0,2,2,122,-8,0,4294965249,0,67633151,0,4026597376,2,0,0,536871887,-1,2,0,2,45,-8,2,54,2,49,0,1,2,123,2,19,-3,2,124,2,37,2,125,2,126,0,16778239,-10,2,36,-8,3,0,28,2,21,-3,3,0,3,2,49,3,0,6,2,50,-85,3,0,33,2,49,-126,3,0,18,2,38,-269,3,0,17,2,45,2,7,-3,2,17,2,127,2,0,2,19,2,50,2,128,2,19,-21,3,0,2,-4,3,0,2,0,65567,-1,2,26,-2,0,3,3,0,191,2,20,3,0,23,2,36,-296,3,0,8,2,7,-2,2,17,3,0,11,2,6,-72,3,0,3,2,129,2,130,-187,3,0,2,2,52,2,0,2,131,2,132,2,56,2,0,2,133,2,134,2,135,3,0,10,2,136,2,137,2,14,3,52,2,3,53,2,3,54,2,2,138,-129,3,0,6,2,139,-1,3,0,2,2,50,-37,2,56,2,140,2,141,2,142,2,143,2,144,-138,3,0,1334,2,24,-1,3,0,129,2,31,3,0,6,2,9,3,0,180,2,145,3,0,233,0,1,-96,3,0,16,2,9,-28719,2,0,0,1,-1,2,122,2,0,0,8193,-21,0,50331648,0,10255,0,4,-11,2,66,2,168,-1,0,71680,-1,2,157,0,4292900864,0,805306431,-5,2,146,-1,2,176,-1,0,6144,-2,2,123,-1,2,150,-1,2,153,2,147,2,161,2,0,0,3223322624,2,36,0,4,-4,2,188,0,205128192,0,1333757536,0,2147483696,0,423953,0,747766272,0,2717763192,0,4286578751,0,278545,2,148,0,4294886464,0,33292336,0,417809,2,148,0,1329579616,0,4278190128,0,700594195,0,1006647527,0,4286497336,0,4160749631,2,149,0,469762560,0,4171219488,0,16711728,2,149,0,202375680,0,3214918176,0,4294508592,0,139280,-1,0,983584,2,190,0,58720275,0,3489923072,0,10517376,0,4293066815,0,1,0,2013265920,2,175,2,0,0,17816169,0,3288339281,0,201375904,2,0,-2,0,256,0,122880,0,16777216,2,146,0,4160757760,2,0,-6,2,163,-11,0,3263218176,-1,0,49664,0,2160197632,0,8388802,-1,0,12713984,-1,2,150,2,155,2,158,-2,2,159,-20,0,3758096385,-2,2,151,0,4292878336,2,22,2,166,0,4294057984,-2,2,160,2,152,2,172,-2,2,151,-1,2,179,-1,2,167,2,122,0,4026593280,0,14,0,4292919296,-1,2,154,0,939588608,-1,0,805306368,-1,2,122,0,1610612736,2,152,2,153,3,0,2,-2,2,154,2,155,-3,0,267386880,-1,2,156,0,7168,-1,0,65024,2,150,2,157,2,158,-7,2,165,-8,2,159,-1,0,1426112704,2,160,-1,2,185,0,271581216,0,2149777408,2,19,2,157,2,122,0,851967,0,3758129152,-1,2,19,2,178,-4,2,154,-20,2,192,2,161,-56,0,3145728,2,184,-1,2,191,2,122,-1,2,162,2,122,-4,0,32505856,-1,2,163,-1,0,2147385088,2,22,1,2155905152,2,-3,2,164,2,0,2,165,-2,2,166,-6,2,167,0,4026597375,0,1,-1,0,1,-1,2,168,-3,2,139,2,66,-2,2,162,2,177,-1,2,173,2,122,-6,2,122,-213,2,167,-657,2,17,-36,2,169,-1,2,186,-10,0,4294963200,-5,2,170,-5,2,158,2,0,2,24,-1,0,4227919872,-1,2,170,-2,0,4227874752,-3,0,2146435072,2,155,-2,0,1006649344,2,122,-1,2,22,0,201375744,-3,0,134217720,2,22,0,4286677377,0,32896,-1,2,171,-3,2,172,-349,2,173,2,174,2,175,3,0,264,-11,2,176,-2,2,158,2,0,0,520617856,0,2692743168,0,36,-3,0,524284,-11,2,19,-1,2,183,-1,2,181,0,3221291007,2,158,-1,0,524288,0,2158720,-3,2,155,0,1,-4,2,122,0,3808625411,0,3489628288,0,4096,0,1207959680,0,3221274624,2,0,-3,2,177,0,120,0,7340032,-2,0,4026564608,2,4,2,19,2,160,3,0,4,2,155,-1,2,178,2,175,-1,0,8176,2,179,2,177,2,180,-1,0,4290773232,2,0,-4,2,160,2,187,0,15728640,2,175,-1,2,157,-1,0,4294934512,3,0,4,-9,2,22,2,167,2,181,3,0,4,0,704,0,1849688064,0,4194304,-1,2,122,0,4294901887,2,0,0,130547712,0,1879048192,0,2080374784,3,0,2,-1,2,182,2,183,-1,0,17829776,0,2025848832,0,4261477888,-2,2,0,-1,0,4286580608,-1,0,29360128,2,184,0,16252928,0,3791388672,2,39,3,0,2,-2,2,193,2,0,-1,2,26,-1,0,66584576,-1,2,189,3,0,9,2,122,3,0,4,-1,2,157,2,158,3,0,5,-2,0,245760,0,2147418112,-1,2,146,2,199,0,4227923456,-1,2,185,2,186,2,22,-2,2,176,0,4292870145,0,262144,2,122,3,0,2,0,1073758848,2,187,-1,0,4227921920,2,188,0,68289024,0,528402016,0,4292927536,3,0,4,-2,0,2483027968,2,0,-2,2,189,3,0,5,-1,2,184,2,160,2,0,-2,0,4227923936,2,63,-1,2,170,2,94,2,0,2,150,2,154,3,0,6,-1,2,175,3,0,3,-2,0,2146959360,3,0,8,-2,2,157,-1,2,190,2,117,-1,2,151,3,0,8,2,191,0,8388608,2,171,2,169,2,183,0,4286578944,3,0,2,0,1152,0,1266679808,2,189,0,576,0,4261707776,2,94,3,0,9,2,151,3,0,8,-28,2,158,3,0,3,-3,0,4292902912,-6,2,96,3,0,85,-33,2,164,3,0,126,-18,2,192,3,0,269,-17,2,151,2,122,0,4294917120,3,0,2,2,19,0,4290822144,-2,0,67174336,0,520093700,2,17,3,0,21,-2,2,177,3,0,3,-2,0,65504,2,122,2,49,3,0,2,2,92,-191,2,123,-23,2,26,3,0,296,-8,2,122,3,0,2,2,19,-11,2,175,3,0,72,-3,0,3758159872,0,201391616,3,0,155,-7,2,167,-1,0,384,-1,0,133693440,-3,2,193,-2,2,30,3,0,4,2,166,-2,2,22,2,151,3,0,4,-2,2,185,-1,2,146,0,335552923,2,194,-1,0,538974272,0,2214592512,0,132e3,-10,0,192,-8,0,12288,-21,0,134213632,0,4294901761,3,0,42,0,100663424,0,4294965284,3,0,62,-6,0,4286578784,2,0,-2,0,1006696448,3,0,24,2,37,-1,2,195,3,0,10,2,194,0,4110942569,0,1432950139,0,2701658217,0,4026532864,0,4026532881,2,0,2,47,3,0,8,-1,2,154,-2,2,166,0,98304,0,65537,2,167,2,169,-2,2,154,-1,2,63,2,0,2,116,2,197,2,175,0,4294770176,2,30,3,0,4,-30,2,195,2,196,-3,2,166,-2,2,151,2,0,2,154,-1,2,189,-1,2,157,2,198,3,0,2,2,154,2,122,-1,0,193331200,-1,0,4227923960,2,197,-1,3,0,3,2,198,3,0,44,-1334,2,22,2,0,-129,2,195,-6,2,160,-180,2,199,-233,2,4,3,0,96,-16,2,160,3,0,22583,-7,2,17,3,0,6128],[4294967295,4294967291,4092460543,4294828015,4294967294,134217726,268435455,2147483647,1048575,1073741823,3892314111,1061158911,536805376,4294910143,4160749567,4294901759,134217727,4294901760,4194303,65535,262143,67108863,4286578688,536870911,8388607,4294918143,4294443008,255,67043328,2281701374,4294967232,2097151,4294903807,4294902783,4294967039,511,524287,131071,127,4294902271,4294549487,16777215,1023,67047423,4294901888,33554431,4286578687,4294770687,67043583,32767,15,2047999,4292870143,4294934527,4294966783,67045375,4294967279,262083,20511,4290772991,41943039,493567,2047,4294959104,1071644671,602799615,65536,4294828e3,805044223,4277151126,8191,1031749119,4294917631,2134769663,4286578493,4282253311,4294942719,33540095,4294905855,4294967264,2868854591,1608515583,265232348,534519807,2147614720,1060109444,4093640016,17376,2139062143,224,4169138175,4294909951,4294967292,4294965759,4294966272,4294901823,4294967280,8289918,4294934399,4294901775,4294965375,1602223615,4294967259,268369920,4292804608,486341884,4294963199,3087007615,1073692671,4128527,4279238655,4294902015,4294966591,2445279231,3670015,3238002687,63,4294967288,4294705151,4095,3221208447,4294549472,2147483648,4294705152,4294966143,64,4294966719,16383,3774873592,536807423,67043839,3758096383,3959414372,3755993023,2080374783,4294835295,4294967103,4160749565,4087,31,184024726,2862017156,1593309078,268434431,268434414,4294901763,536870912,2952790016,202506752,139264,402653184,4261412864,4227922944,2147532800,61440,3758096384,117440512,65280,4227858432,3233808384,3221225472,4294965248,32768,57152,4294934528,67108864,4293918720,4290772992,25165824,57344,4278190080,65472,4227907584,65520,1920,4026531840,49152,4160749568,4294836224,63488,1073741824,4294967040,251658240,196608,12582912,2097152,65408,64512,417808,4227923712,48,512,4294967168,4294966784,16,4292870144,4227915776,65528,4294950912,65532]);function u(e){const{index:t}=e,n=e.source.charCodeAt(t);if(n<55296||n>56319)return n;const o=e.source.charCodeAt(t+1);return o<56320||o>57343?n:65536+((1023&n)<<10)|1023&o}const d=e=>0!=(1&a[e])||s(e);function p(e){switch(e){case 0:return"\\0";case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:return c(e)?e<16?`\\x0${e.toString(16)}`:e<256?`\\x${e.toString(16)}`:e<4096?`\\u0${e.toString(16)}`:e<65536?`\\u${e.toString(16)}`:`\\u{${e.toString(16)}}`:S(e)}}function x(e,t){return e.source.charCodeAt(e.index)===t&&(e.index++,e.column++,!0)}function f(t,n){t.flags|=e.Flags.NewLine,t.index++,0==(n&e.ScannerState.LastIsCR)&&(t.column=0,t.line++)}function m(t,o){return o&e.Context.InClass&&i(t.source.charCodeAt(t.index))||an(t,1,n(t.token)),115}function g(t){t.flags|=e.Flags.NewLine,t.index++,t.column=0,t.line++}const S=e=>e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023));function C(e){return e.index++,e.column++,e.index>=e.source.length&&an(e,14),u(e)}function k(e){return e<48?-1:e<=57?e-48:e<65?-1:e<=70?e-65+10:e<97?-1:e<=102?e-97+10:-1}function w(e,t){e.index++,e.column++,t>65535&&e.index++}function y(t,n,o){switch(o){case 98:return 8;case 102:return 12;case 114:return 13;case 110:return 10;case 116:return 9;case 118:return 11;case 13:case 10:case 8232:case 8233:return t.column=-1,t.line++,e.Escape.Empty;case 48:case 49:case 50:case 51:{let r=o-48,a=t.index+1,s=t.column+1,i=t.source.charCodeAt(a);if(i<48||i>55){if(0!==r||56===i||57===i){if(n&e.Context.Strict)return e.Escape.StrictOctal;t.flags|=e.Flags.HasOctal}}else{if(n&e.Context.Strict)return e.Escape.StrictOctal;t.flags|=e.Flags.HasOctal,t.lastValue=i,r=8*r+(i-48),a++,s++,(i=t.source.charCodeAt(a))>=48&&i<=55&&(t.lastValue=i,r=8*r+(i-48),a++,s++),t.index=a-1,t.column=s-1}return r}case 52:case 53:case 54:case 55:{if(n&e.Context.Strict)return e.Escape.StrictOctal;let r=o-48;const a=t.index+1,s=t.column+1,i=t.source.charCodeAt(a);return i>=48&&i<=55&&(r=8*r+(i-48),t.lastValue=i,t.index=a,t.column=s),r}case 56:case 57:return e.Escape.EightOrNine;case 120:{const n=k(t.lastValue=C(t));if(n<0)return e.Escape.InvalidHex;const o=k(t.lastValue=C(t));return o<0?e.Escape.InvalidHex:n<<4|o}case 117:{let n=t.lastValue=C(t);if(123===n){let o=k(n=t.lastValue=C(t));if(o<0)return e.Escape.InvalidHex;for(n=t.lastValue=C(t);125!==n;){const r=k(n);if(r<0)return e.Escape.InvalidHex;if((o=16*o+r)>1114111)return e.Escape.OutOfRange;n=t.lastValue=C(t)}return o}{let o=k(n);if(o<0)return e.Escape.InvalidHex;for(let r=0;r<3;r++){const r=k(n=t.lastValue=C(t));if(r<0)return e.Escape.InvalidHex;o=16*o+r}return o}}default:return t.source.charCodeAt(t.index)}}function h(t,n,o){switch(o){case e.Escape.Empty:return;case e.Escape.StrictOctal:an(t,n&e.Context.TaggedTemplate?76:11);case e.Escape.EightOrNine:an(t,13);case e.Escape.InvalidHex:an(t,75,"hexadecimal");case e.Escape.OutOfRange:an(t,14)}}function A(e,t,n){const{index:o,lastValue:r}=e;let a="";e.index++,e.column++;let s=e.source.charCodeAt(e.index);for(;s!==n;){switch(s){case 13:case 10:an(e,6);case 92:if((s=C(e))>128)a+=S(s);else{e.lastValue=s;const n=y(e,t,s);n>=0?a+=S(n):h(e,t,n),s=e.lastValue}break;default:a+=S(s)}s=C(e)}return e.index++,e.column++,e.tokenRaw=e.source.slice(o,e.index),e.tokenValue=a,e.lastValue=r,33554435}function b(e,t){return e.index>=e.length&&an(e,9),e.index--,e.column--,E(e,t)}function E(t,n){const{index:o,lastValue:r}=t;let a=!0,s="",i=C(t);e:for(;96!==i;){switch(i){case 36:{const e=t.index+1;if(e<t.length&&123===t.source.charCodeAt(e)){t.index=e,t.column++,a=!1;break e}s+="$";break}case 92:if((i=C(t))>=128)s+=S(i);else{t.lastValue=i;const o=y(t,n|e.Context.Strict,i);if(o>=0)s+=S(o);else{if(o!==e.Escape.Empty&&n&e.Context.TaggedTemplate){s=void 0,(i=I(t,t.lastValue))<0&&(a=!1);break e}h(t,n|e.Context.TaggedTemplate,o)}i=t.lastValue}break;case 13:case 10:case 8232:case 8233:t.column=-1,t.line++;default:null!=s&&(s+=S(i))}i=C(t)}return t.index++,t.column++,t.tokenValue=s,t.lastValue=r,a?(t.tokenRaw=t.source.slice(o+1,t.index-1),33554441):(t.tokenRaw=t.source.slice(o+1,t.index-2),33554440)}function I(e,t){for(;96!==t;){if(36===t&&123===e.source.charCodeAt(e.index+1))return e.index++,e.column++,-t;t=C(e)}return t}function O(t,n){t.index++,t.column++;let o=e.NumericState.None,r=k(t.source.charCodeAt(t.index));for(r<0&&an(t,0),t.index++,t.column++;t.index<t.length;){const a=t.source.charCodeAt(t.index);if(n&e.Context.OptionsNext&&95===a){o=R(t,o);continue}o&=~e.NumericState.SeenSeparator;const s=k(a);if(s<0)break;r=16*r+s,t.index++,t.column++}return o&e.NumericState.SeenSeparator&&an(t,59),M(t,n,r,x(t,110))}function v(t,n,o){t.index++,t.column++;let r,a=0,s=0,i=e.NumericState.None;for(;t.index<t.length;){if(r=t.source.charCodeAt(t.index),n&e.Context.OptionsNext&&95===r){i=R(t,i);continue}i&=~e.NumericState.SeenSeparator;const c=r-48;if(!(r>=48&&r<=57)||c>=o)break;s=s*o+c,t.index++,t.column++,a++}return 0===a&&an(t,0),i&e.NumericState.SeenSeparator&&an(t,59),M(t,n,s,x(t,110))}function F(t,n){switch(t.source.charCodeAt(t.index)){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:{n&e.Context.Strict&&an(t,0);let o=t.index,r=t.column,a=0;for(t.flags|=e.Flags.HasOctal;o<t.length;){const e=t.source.charCodeAt(o);if(95===e)an(t,60);else{if(e<48||e>55)return L(t,n);a=8*a+(e-48),o++,r++}}return t.index=o,t.column=r,M(t,n,a,x(t,110))}case 56:case 57:t.flags|=e.Flags.HasOctal;default:return n&e.Context.OptionsNext&&95===t.source.charCodeAt(t.index)&&an(t,60),L(t,n)}}function N(e,t){let n=e.source.charCodeAt(e.index);43!==n&&45!==n||(e.index++,e.column++,n=e.source.charCodeAt(e.index)),n>=48&&n<=57||an(e,0);const o=e.index,r=D(e);return e.source.substring(t,o)+r}function L(t,n,o=e.NumericState.None){let r=o&e.NumericState.Float?0:P(t,n);const a=t.source.charCodeAt(t.index);if(46!==a&&95!==a&&!i(a))return M(t,n,r);x(t,46)&&(n&e.Context.OptionsNext&&95===t.source.charCodeAt(t.index)&&an(t,60),o|=e.NumericState.Float,r=`${r}.${D(t)}`);const s=t.index;return x(t,110)&&(o&e.NumericState.Float&&an(t,0),o|=e.NumericState.BigInt),(x(t,101)||x(t,69))&&(o|=e.NumericState.Float,r+=N(t,s)),i(t.source.charCodeAt(t.index))&&an(t,0),M(t,n,o&e.NumericState.Float?parseFloat(r):parseInt(r,10),!!(o&e.NumericState.BigInt))}function R(t,n){return t.index++,t.column++,n&e.NumericState.SeenSeparator&&an(t,59),n|=e.NumericState.SeenSeparator}function D(t){let n=t.index,o=e.NumericState.None,r="";e:for(;t.index<t.length;)switch(t.source.charCodeAt(t.index)){case 95:const a=t.index;o=R(t,o),r+=t.source.substring(n,a),n=t.index;continue;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:o&=~e.NumericState.SeenSeparator,t.index++,t.column++;break;default:break e}return o&e.NumericState.SeenSeparator&&an(t,59),r+t.source.substring(n,t.index)}function P(t,n){let o=e.NumericState.None,r=0,a=t.source.charCodeAt(t.index);for(;a>=48&&a<=57||95===a;)n&e.Context.OptionsNext&&95===a?(o=R(t,o),a=t.source.charCodeAt(t.index)):(o&=~e.NumericState.SeenSeparator,r=10*r+(a-48),t.index++,t.column++,a=t.source.charCodeAt(t.index));return o&e.NumericState.SeenSeparator&&an(t,59),r}function M(t,n,o,r=!1){return t.tokenValue=o,n&e.Context.OptionsRaw&&(t.tokenRaw=t.source.slice(t.startIndex,t.index)),r?33554551:33554434}function j(t,n,o){let a=t.index,s="",i=!1;o&&w(t,o);e:for(;t.index<t.length;){const e=t.index;let n=t.source.charCodeAt(e);switch(n){case 92:s+=t.source.slice(a,e),s+=B(t),a=t.index,i=!0;break;default:if(n>=55296&&n<=56319){n=(1023&n)<<10|1023&t.source.charCodeAt(e+1)|65536}if(!d(n))break e;w(t,n)}}a<t.index&&(s+=t.source.slice(a,t.index)),t.tokenValue=s;const c=s.length;if(c>=2&&c<=11){const o=r(s);if(o>0)return i&&(n&e.Context.DisallowEscapedKeyword&&sn(t,n,3),t.flags|=e.Flags.EscapedKeyword),o}return n&e.Context.OptionsRawidentifiers&&(t.tokenRaw=t.source.slice(a,t.index)),33685505}function H(e,t,n){return i(n=u(e))||an(e,10,p(n)),j(e,t,n)}function B(e){const{index:t}=e;if(t+5<e.length){117!==e.source.charCodeAt(t+1)&&an(e,0),e.index+=2,e.column+=2;const n=function(e){let t=e.source.charCodeAt(e.index),n=0;if(123===t){let o=k(t=C(e));for(;o>=0;)(n=n<<4|o)>1114111&&an(e,89),e.index++,e.column++,o=k(e.source.charCodeAt(e.index));125!==e.source.charCodeAt(e.index)&&an(e,75,"unicode"),x(e,125)}else for(let o=0;o<4;o++){const o=k(t=e.source.charCodeAt(e.index));o<0&&an(e,75,"unicode"),n=n<<4|o,e.index++,e.column++}return n}(e);return n>=55296&&n<=56319&&an(e,74),d(n)||an(e,75,"unicode"),S(n)}an(e,0)}function V(t,n,o,r){return n&e.Context.Module&&an(t,90),J(t,n,o,r)}function J(t,n,o,r){const a=t.index,s=!!(n&e.Context.OptionsComments);for(;t.index<t.length;)switch(t.source.charCodeAt(t.index)){case 13:return g(t),t.index<t.length&&10===t.source.charCodeAt(t.index)&&t.index++,o|e.ScannerState.NewLine;case 10:case 8232:case 8233:return g(t),s&&X(t,n,r,a),o|e.ScannerState.NewLine;default:t.index++,t.column++}return s&&X(t,n,r,a),o}function T(t,n,o){const r=t.index,a=!!(n&e.Context.OptionsComments);for(;t.index<t.length;)switch(t.source.charCodeAt(t.index)){case 42:if(t.index++,t.column++,o&=~e.ScannerState.LastIsCR,x(t,47))return a&&X(t,n,"MultiLine",r),o;break;case 13:o|=e.ScannerState.NewLine|e.ScannerState.LastIsCR,g(t);break;case 10:f(t,o),o=o&~e.ScannerState.LastIsCR|e.ScannerState.NewLine;break;case 8232:case 8233:o=o&~e.ScannerState.LastIsCR|e.ScannerState.NewLine,g(t);break;default:o&=~e.ScannerState.LastIsCR,t.index++,t.column++}sn(t,n,8)}function X(t,n,o,r){const{index:a,startIndex:s,startLine:i,startColumn:c,lastLine:l,lastColumn:u}=t,d={type:o,value:t.source.slice(r,"MultiLine"===o?a-2:a),start:s,end:a};n&e.Context.OptionsLoc&&(d.loc={start:{line:i,column:c},end:{line:l,column:u}}),t.comments.push(d)}function G(t,n){t.flags&=~e.Flags.NewLine|e.Flags.EscapedKeyword;const o=0===t.index;let r=e.ScannerState.None;for(;t.index<t.length;){o||(t.startIndex=t.index,t.startColumn=t.column,t.startLine=t.line);const a=t.source.charCodeAt(t.index);if(a>128)switch(a){case 8232:case 8233:r=r&~e.ScannerState.LastIsCR|e.ScannerState.NewLine,g(t);break;case 65519:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:case 8205:t.index++,t.column++;break;default:return H(t,n,a)}else switch(a){case 13:r|=e.ScannerState.NewLine|e.ScannerState.LastIsCR,g(t);break;case 10:f(t,r),r=r&~e.ScannerState.LastIsCR|e.ScannerState.NewLine;break;case 9:case 11:case 12:case 32:t.index++,t.column++;break;case 40:return t.index++,t.column++,50331659;case 41:return t.index++,t.column++,16;case 44:return t.index++,t.column++,16777234;case 58:return t.index++,t.column++,16777237;case 59:return t.index++,t.column++,17825809;case 63:return t.index++,t.column++,22;case 93:return t.index++,t.column++,20;case 123:return t.index++,t.column++,41943052;case 125:return t.index++,t.column++,17825807;case 126:return t.index++,t.column++,301989934;case 91:return t.index++,t.column++,41943059;case 64:return t.index++,t.column++,120;case 47:if(t.index++,t.column++,t.index>=t.length)return 167774773;switch(t.source.charCodeAt(t.index)){case 47:t.index++,t.column++,r=J(t,n,r,"SingleLine");continue;case 42:t.index++,t.column++,r=T(t,n,r);continue;case 61:return t.index++,t.column++,100663333;default:return 167774773}case 45:switch(t.index++,t.column++,t.source.charCodeAt(t.index)){case 45:if(t.index++,t.column++,(r&e.ScannerState.NewLine||o)&&x(t,62)){r=V(t,n,r,"HTMLClose");continue}return 570425372;case 61:return t.index++,t.column++,67108899;default:return 436209968}case 60:if(t.index++,t.column++,x(t,33)&&x(t,45)&&x(t,45)){r=V(t,n,r,"HTMLOpen");continue}switch(t.source.charCodeAt(t.index)){case 60:return t.index++,t.column++,x(t,61)?67108894:167774273;case 61:return t.index++,t.column++,167774013;case 47:{if(!(n&e.Context.OptionsJSX))break;const o=t.index+1;if(o<t.length){const e=t.source.charCodeAt(o);if(42===e||47===e)break}return t.index++,t.column++,25}default:return 167774015}case 33:return t.index++,t.column++,x(t,61)?x(t,61)?167773754:167773756:301989933;case 39:case 34:return A(t,n,a);case 37:return t.index++,t.column++,x(t,61)?67108902:167774772;case 38:{t.index++,t.column++;const e=t.source.charCodeAt(t.index);return 38===e?(t.index++,t.column++,169869879):61===e?(t.index++,t.column++,67108905):167773508}case 42:{if(t.index++,t.column++,t.index>=t.length)return 167774771;const e=t.source.charCodeAt(t.index);return 61===e?(t.index++,t.column++,67108900):42!==e?167774771:(t.index++,t.column++,x(t,61)?67108897:167775030)}case 43:{if(t.index++,t.column++,t.index>=t.length)return 436209967;const e=t.source.charCodeAt(t.index);return 43===e?(t.index++,t.column++,570425371):61===e?(t.index++,t.column++,67108898):436209967}case 92:return j(t,n);case 61:{t.index++,t.column++;const e=t.source.charCodeAt(t.index);return 61===e?(t.index++,t.column++,x(t,61)?167773753:167773755):62===e?(t.index++,t.column++,10):83886109}case 62:{if(t.index++,t.column++,t.index>=t.length)return 167774016;if(n&e.Context.InJSXChild)return 167774016;let o=t.source.charCodeAt(t.index);return 61===o?(t.index++,t.column++,167774014):62!==o?167774016:(t.index++,t.column++,62===(o=t.source.charCodeAt(t.index))?(t.index++,t.column++,x(t,61)?67108896:167774275):61===o?(t.index++,t.column++,67108895):167774274)}case 94:return t.index++,t.column++,x(t,61)?67108903:167773254;case 96:return E(t,n);case 124:{t.index++,t.column++;const e=t.source.charCodeAt(t.index);return 124===e?(t.index++,t.column++,169869624):61===e?(t.index++,t.column++,67108904):167772997}case 46:{let o=t.index+1;const r=t.source.charCodeAt(o);return r>=48&&r<=57?(L(t,n,e.NumericState.Float),33554434):46===r&&++o<t.length&&46===t.source.charCodeAt(o)?(t.index=o+1,t.column+=3,14):(t.index++,t.column++,16777229)}case 35:{t.index++,t.column++;const r=t.index,a=t.source.charCodeAt(r);if(n&e.Context.OptionsShebang&&o&&33===a){t.index=r+1,J(t,n,e.ScannerState.None,"SheBang");continue}return m(t,n)}case 48:switch(t.index++,t.column++,t.source.charCodeAt(t.index)){case 88:case 120:return O(t,n);case 66:case 98:return v(t,n,2);case 79:case 111:return v(t,n,8);default:return F(t,n)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return L(t,n);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 36:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:default:return j(t,n,a)}}return 1048576}function K(t,n){const o=t.index;let r=e.RegexState.Empty;e:for(;;){const n=t.source.charCodeAt(t.index);if(t.index++,t.column++,r&e.RegexState.Escape)r&=~e.RegexState.Escape;else switch(n){case 47:if(r)break;break e;case 92:r|=e.RegexState.Escape;break;case 91:r|=e.RegexState.Class;break;case 93:r&=e.RegexState.Escape;break;case 13:case 10:case 8232:case 8233:an(t,7)}t.index>=t.source.length&&an(t,7)}const a=t.index-1;let s=e.RegexFlags.Empty;const{index:i}=t;e:for(;t.index<t.source.length;){const o=t.source.charCodeAt(t.index);switch(o){case 103:s&e.RegexFlags.Global&&sn(t,n,15,"g"),s|=e.RegexFlags.Global;break;case 105:s&e.RegexFlags.IgnoreCase&&sn(t,n,15,"i"),s|=e.RegexFlags.IgnoreCase;break;case 109:s&e.RegexFlags.Multiline&&sn(t,n,15,"m"),s|=e.RegexFlags.Multiline;break;case 117:s&e.RegexFlags.Unicode&&sn(t,n,15,"u"),s|=e.RegexFlags.Unicode;break;case 121:s&e.RegexFlags.Sticky&&sn(t,n,15,"y"),s|=e.RegexFlags.Sticky;break;case 115:s&e.RegexFlags.DotAll&&sn(t,n,15,"s"),s|=e.RegexFlags.DotAll;break;default:if(!d(o))break e;an(t,16,S(o))}t.index++,t.column++}const c=t.source.slice(i,t.index),l=t.source.slice(o,a);return t.tokenRegExp={pattern:l,flags:c},n&e.Context.OptionsRaw&&(t.tokenRaw=t.source.slice(t.startIndex,t.index)),t.tokenValue=function(t,n,o,r){e.Context.OptionsNode;try{return new RegExp(o,r)}catch(e){return null}}(0,0,l,c),33554436}function Y(t,n,o=[]){const{token:r}=t;return 8388608&r?41943052===r?function(e,t){const n=Ht(e),o=[];Et(e,t,41943052);for(;17825807!==e.token;){if(14===e.token){o.push($(e,t));break}o.push(_(e,t)),17825807!==e.token&&Et(e,t,16777234)}return Et(e,t,17825807),bt(t,e,n,{type:"ObjectPattern",properties:o})}(t,n):function(t,n,o){const r=Ht(t);Ot(t,n);const a=[];for(;20!==t.token;)if(It(t,n,16777234))a.push(null);else{if(14===t.token){a.push(U(t,n,o));break}a.push(Nt(t,n|e.Context.AllowIn,W)),20!==t.token&&Et(t,n,16777234)}return Et(t,n,20),bt(n,t,r,{type:"ArrayPattern",elements:a})}(t,n,o):(1074003968&r&&(262144&r&&n&(e.Context.Async|e.Context.Module)?sn(t,n,48):1073741824&r&&n&(e.Context.Yield|e.Context.Strict)&&sn(t,n,49)),o.push(t.tokenValue),q(t,n))}function q(t,o){const{token:r}=t;4194304&r?(o&e.Context.Strict&&sn(t,o,17),t.flags|=e.Flags.StrictEvalArguments):o&e.Context.BlockScope&&33574984===r?sn(t,o,27):vt(r,20480)?(o&e.Context.Strict&&sn(t,o,1,n(r)),t.flags|=e.Flags.StrictFunctionName):Bt(o,r)||sn(t,o,1,n(r));const a=Ht(t),s=t.tokenValue;return Ot(t,o),bt(o,t,a,{type:"Identifier",name:s})}function U(e,t,n){const o=Ht(e);Et(e,t,14);const r=Y(e,t,n);return 16777234===e.token&&sn(e,t,88),bt(t,e,o,{type:"RestElement",argument:r})}function $(e,t){const n=Ht(e);Et(e,t,14);const{token:o}=e,r=Y(e,t);return vt(o,8388608)&&sn(e,t,94),16777234===e.token&&sn(e,t,88),bt(t,e,n,{type:"RestElement",argument:r})}function z(t,n,o,r){return bt(n,t,r,{type:"AssignmentPattern",left:o,right:Nt(t,n|e.Context.AllowIn,Ae)})}function W(t,n){const o=Ht(t),r=Y(t,n);return It(t,n,83886109)?bt(n,t,o,{type:"AssignmentPattern",left:r,right:Ae(t,n|e.Context.AllowIn)}):r}function _(t,n){const o=Ht(t),{token:r}=t;let a,s,i=!1,c=!1;if(135168&r)if(a=Re(t,n),c=!It(t,n,16777237)){const i=It(t,n,83886109);n&e.Context.Yield&&1073741824&r&&sn(t,n,49),Bt(n,r)||sn(t,n,46),s=i?z(t,n,a,o):a}else s=W(t,n);else i=41943059===r,a=Je(t,n),Et(t,n,16777237),s=Nt(t,n,W);return bt(n,t,o,{type:"Property",kind:"init",key:a,computed:i,value:s,method:!1,shorthand:c})}function Q(e,t){const n=Ht(e);let o,r=[],a=null,s=!1;Et(e,t,167774015);const i=167774016===e.token;if(i)o=function(e,t,n){return ee(e),bt(t,e,n,{type:"JSXOpeningFragment"})}(e,t,n);else{o=Z(e,t,ke(e,t),ae(e,t),s=It(e,t,167774773),n)}if(i)return function(e,t,n,o){const r=ne(e,t),a=me(e,t);return bt(t,e,o,{type:"JSXFragment",children:r,openingElement:n,closingFragment:a})}(e,t,o,n);if(!s){r=ne(e,t),a=ge(e,t);const n=zt(o.name),s=zt(a.name);n!==s&&an(e,85,s)}return bt(t,e,n,{type:"JSXElement",children:r,openingElement:o,closingElement:a})}function Z(t,n,o,r,a,s){return n&e.Context.InJSXChild&&a?Et(t,n,167774016):ee(t),bt(n,t,s,{type:"JSXOpeningElement",name:o,attributes:r,selfClosing:a})}function ee(e){return e.token=te(e)}function te(e){if(e.index>=e.source.length)return 1048576;e.lastIndex=e.startIndex=e.index;const t=e.source.charCodeAt(e.index);if(60===t)return e.index++,e.column++,x(e,47)?25:167774015;if(123===t)return e.index++,e.column++,41943052;for(;e.index<e.source.length;){e.index++,e.column++;const t=e.source.charCodeAt(e.index);if(123===t||60===t)break}return 121}function ne(e,t){const n=[];for(;25!==e.token;)n.push(re(e,t));return n}function oe(t,n){const o=Ht(t),r=t.source.slice(t.startIndex,t.index);t.token=te(t);const a=bt(n,t,o,{type:"JSXText",value:r});return n&e.Context.OptionsRaw&&(a.raw=r),a}function re(t,n){switch(t.token){case 33685505:case 121:return oe(t,n);case 41943052:return fe(t,n&~e.Context.InJSXChild);case 167774015:return Q(t,n&~e.Context.InJSXChild);default:an(t,0)}}function ae(e,t){const n=[];for(;e.index<e.source.length&&167774773!==e.token&&167774016!==e.token;)n.push(ue(e,t));return n}function se(t,n){const o=Ht(t);Et(t,n,41943052),Et(t,n,14);const r=Nt(t,n&~e.Context.InJSXChild,Ae);return Et(t,n,17825807),bt(n,t,o,{type:"JSXSpreadAttribute",argument:r})}function ie(e,t,n,o){return Et(e,t,16777237),bt(t,e,o,{type:"JSXNamespacedName",namespace:n,name:Se(e,t)})}function ce(e,t){const n=Ht(e),o=Se(e,t);return 16777237===e.token?ie(e,t,o,n):o}function le(t,n){switch(function(t,n){t.lastIndex=t.index;const o=t.source.charCodeAt(t.index);switch(o){case 34:case 39:return function(t,n,o){const r=t.index;t.index++,t.column++;let a="",s=t.source.charCodeAt(t.index);for(;s!==o;)a+=S(s),t.index++,t.column++,s=t.source.charCodeAt(t.index),t.index>=t.source.length&&an(t,6);t.index++,t.column++,n&e.Context.OptionsRaw&&(t.tokenRaw=t.source.slice(r,t.index));return t.tokenValue=a,33554435}(t,n,o);default:return Ot(t,n)}}(t,n)){case 33554435:return De(t,n);case 41943052:return xe(t,n|e.Context.InJSXChild);case 167774015:return Q(t,n|e.Context.InJSXChild);default:return void sn(t,n,87)}}function ue(e,t){const n=Ht(e);if(41943052===e.token)return se(e,t);we(e);const o=ce(e,t);return bt(t,e,n,{type:"JSXAttribute",value:83886109===e.token?le(e,t):null,name:o})}function de(e,t){return bt(t,e,Ht(e),{type:"JSXEmptyExpression"})}function pe(e,t){const n=Ht(e);Et(e,t,14);const o=ye(e,t);return Et(e,t,17825807),bt(t,e,n,{type:"JSXSpreadChild",expression:o})}function xe(t,n){const o=Ht(t);Et(t,n,41943052),17825807===t.token&&sn(t,n,84);const r=Nt(t,n&~e.Context.InJSXChild,Ae);return Et(t,n,17825807),bt(n,t,o,{type:"JSXExpressionContainer",expression:r})}function fe(e,t){const n=Ht(e);if(Et(e,t,41943052),14===e.token)return pe(e,t);const o=17825807===e.token?de(e,t):Nt(e,t,Ae);return ee(e),bt(t,e,n,{type:"JSXExpressionContainer",expression:o})}function me(e,t){const n=Ht(e);return Et(e,t,25),Et(e,t,167774016),bt(t,e,n,{type:"JSXClosingFragment"})}function ge(t,n){const o=Ht(t);Et(t,n,25);const r=ke(t,n);return n&e.Context.InJSXChild?Et(t,n,167774016):ee(t),bt(n,t,o,{type:"JSXClosingElement",name:r})}function Se(t,o){const{token:r,tokenValue:a,tokenRaw:s}=t;135168&r||sn(t,o,1,n(t.token));const i=Ht(t);Ot(t,o);const c=bt(o,t,i,{type:"JSXIdentifier",name:a});return o&e.Context.OptionsRawidentifiers&&(c.raw=s),c}function Ce(e,t,n,o){return we(e),bt(t,e,o,{type:"JSXMemberExpression",object:n,property:Se(e,t)})}function ke(e,t){const n=Ht(e);we(e);let o=Se(e,t);if(16777237===e.token)return ie(e,t,o,n);for(;It(e,t,16777229);)o=Ce(e,t,o,n);return o}function we(e){const{token:t}=e;if(135168&t){const t=e.index;let n=e.source.charCodeAt(e.index);for(;e.index<e.source.length&&(45===n||s(n));)n=C(e);e.tokenValue+=e.source.substr(t,e.index-t)}return e.token}function ye(e,t){const n=Ht(e),o=Nt(e,t,Ae);return 16777234===e.token?he(e,t,o,n):o}function he(e,t,n,o){const r=[n];for(;It(e,t,16777234);)r.push(Nt(e,t,Ae));return bt(t,e,o,{type:"SequenceExpression",expressions:r})}function Ae(t,o){const r=Ht(t);let{token:a}=t;if(o&e.Context.Yield&&1073741824&a)return function(t,n,o){n&e.Context.InParameter&&sn(t,n,51),Et(t,n,1107316842);let r=null,a=!1;return t.flags&e.Flags.NewLine||((a=It(t,n,167774771))||33554432&t.token)&&(r=Ae(t,n)),bt(n,t,o,{type:"YieldExpression",argument:r,delegate:a})}(t,o,r);let s=524288&a&&Mt(t,o,Xt)?function(t,n){const o=Ht(t);let r=ve(t,n|e.Context.AllowIn,o);if(135168&t.token)return 262144&t.token&&sn(t,n,40),Ye(t,n,e.ModifierState.Await,o,[qt(t,n)]);t.flags&e.Flags.NewLine&&sn(t,n,36,"async");for(;50331659===t.token;){r=ve(t,n,o,r);const a=Ne(t,n);if(10===t.token){r=Ye(t,n,e.ModifierState.Await,o,a);break}r=bt(n,t,o,{type:"CallExpression",callee:r,arguments:a})}return r}(t,o):function(t,o,r){const a=function t(o,r,a,s,i=be(o,r)){const c=r&e.Context.AllowIn^e.Context.AllowIn;for(;vt(o.token,167772160);){const l=o.token,u=3840&l,d=(167775030===l)<<8;if(c&&167786289===l)break;if(u+d<=a)break;Ot(o,r),i=bt(r,o,s,{type:2097152&l?"LogicalExpression":"BinaryExpression",left:i,right:t(o,r&~e.Context.AllowIn,u,Ht(o)),operator:n(l)})}return i}(t,o,0,r);if(!It(t,o,22))return a;const s=Nt(t,o&~e.Context.AllowDecorator|e.Context.AllowIn,Ae);return Et(t,o,16777237),bt(o,t,r,{type:"ConditionalExpression",test:a,consequent:s,alternate:Nt(t,o,Ae)})}(t,o,r);if(10===t.token)return 135168&a&&(4214784&a&&(20480&a&&(t.flags|=e.Flags.HasStrictReserved),4194304&a&&(o&e.Context.Strict&&sn(t,o,47),t.flags|=e.Flags.StrictEvalArguments)),s=[s]),function(t,n,o,r){t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),t.flags&e.Flags.NewLine&&sn(t,n,36,"=>");return Et(t,n,10),qe(t,n&~e.Context.Async,r,o,e.ModifierState.None)}(t,o&=~e.Context.Async,r,s);if(vt(t.token,67108864)){a=t.token,o&e.Context.Strict&&Ut(s.name)?sn(t,o,17):It(t,o,83886109)?(t.flags&e.Flags.AllowDestructuring||sn(t,o,73),o&e.Context.InParameter||Pt(t,o,s),o&e.Context.InParen&&(t.flags|=e.Flags.SimpleParameterList),262144&t.token?($t(t),t.flags|=e.Flags.HasAwait):o&e.Context.InParen&&o&(e.Context.Strict|e.Context.Yield)&&1073741824&t.token&&($t(t),t.flags|=e.Flags.HasYield)):(jt(s)||sn(t,o,5),t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),Ot(t,o));const i=Nt(t,o|e.Context.AllowIn,Ae);return t.pendingExpressionError=null,bt(o,t,r,{type:"AssignmentExpression",left:s,operator:n(a),right:i})}return s}function be(t,o){const r=Ht(t),{token:a}=t;if(vt(a,301989888)){Ot(t,o),t.flags&e.Flags.EscapedKeyword&&sn(t,o,3);const s=Nt(t,o,be);return 167775030===t.token&&sn(t,o,1,n(t.token)),o&e.Context.Strict&&302002219===a&&("Identifier"===s.type?sn(t,o,43):Yt(s)&&sn(t,o,44)),bt(o,t,r,{type:"UnaryExpression",operator:n(a),argument:s,prefix:!0})}return o&e.Context.Async&&262144&a?function(t,n,o){return n&e.Context.InParameter&&sn(t,n,52),Et(t,n,34017389),bt(n,t,o,{type:"AwaitExpression",argument:be(t,n)})}(t,o,r):function(t,o,r){const{token:a}=t;if(vt(t.token,570425344)){Ot(t,o);const e=Oe(t,o,r);return _t(t,o,e,"Prefix"),bt(o,t,r,{type:"UpdateExpression",argument:e,operator:n(a),prefix:!0})}if(o&e.Context.OptionsJSX&&167774015===a)return Q(t,o|e.Context.InJSXChild);const s=Oe(t,o,r);if(vt(t.token,570425344)&&!(t.flags&e.Flags.NewLine)){_t(t,o,s,"Postfix");const e=t.token;return Ot(t,o),bt(o,t,r,{type:"UpdateExpression",argument:s,operator:n(e),prefix:!1})}return s}(t,o,r)}function Ee(t,n,o=[]){const r=Ht(t);return Et(t,n,14),n&e.Context.InParen&&262144&t.token&&(t.flags|=e.Flags.HasAwait),bt(n,t,r,{type:"RestElement",argument:Y(t,n,o)})}function Ie(t,n){const o=Ht(t);return Et(t,n,14),bt(n,t,o,{type:"SpreadElement",argument:Lt(t,n|e.Context.AllowIn,Ae)})}function Oe(t,n,o){const r=n&e.Context.OptionsNext&&33566810===t.token?tt(t,n|e.Context.AllowIn):ve(t,n|e.Context.AllowIn,o);return function(t,n,o,r){for(;;){if(r=ve(t,n,o,r),50331659!==t.token)return r;const a=Fe(t,n&~e.Context.AllowDecorator);r=bt(n,t,o,{type:"CallExpression",callee:r,arguments:a})}}(t,n|e.Context.AllowIn,o,r)}function ve(t,n,o,r=Le(t,n)){for(;;)switch(t.token){case 16777229:It(t,n,16777229),t.flags=t.flags&~e.Flags.AllowBinding|e.Flags.AllowDestructuring,r=bt(n,t,o,{type:"MemberExpression",object:r,computed:!1,property:je(t,n)});continue;case 41943059:{It(t,n,41943059),t.flags=t.flags&~e.Flags.AllowBinding|e.Flags.AllowDestructuring;const a=ye(t,n);Et(t,n,20),r=bt(n,t,o,{type:"MemberExpression",object:r,computed:!0,property:a});continue}case 33554441:r=bt(n,t,o,{type:"TaggedTemplateExpression",tag:r,quasi:ot(t,n)});continue;case 33554440:r=bt(n,t,o,{type:"TaggedTemplateExpression",tag:r,quasi:rt(t,n|e.Context.TaggedTemplate)});continue;default:return r}}function Fe(t,n){Et(t,n,50331659);const o=[];for(;16!==t.token;)14===t.token?o.push(Ie(t,n)):(n&e.Context.Yield&&vt(t.token,1073741824)&&(t.flags|=e.Flags.HasYield,$t(t)),o.push(Nt(t,n|e.Context.AllowIn,Ae))),16!==t.token&&Et(t,n,16777234);return Et(t,n,16),o}function Ne(t,n){Et(t,n,50331659);const o=[];let{token:r}=t,a=e.CoverCallState.Empty;for(;16!==t.token&&(14===t.token?(t.flags|=e.Flags.SimpleParameterList,o.push(Ie(t,n)),a=e.CoverCallState.HasSpread):(r=t.token,a=en(t,n,a),o.push(Lt(t,n|e.Context.AllowIn,Ae))),It(t,n,16777234)&&(t.flags&=~e.Flags.AllowDestructuring,a&e.CoverCallState.HasSpread&&(a=e.CoverCallState.SeenSpread)),16!==t.token););return Et(t,n,16),10===t.token&&(a&e.CoverCallState.SeenSpread?sn(t,n,78):a&e.CoverCallState.EvalOrArguments?(n&e.Context.Strict&&sn(t,n,47),t.flags|=e.Flags.StrictEvalArguments):a&e.CoverCallState.Yield?(n&e.Context.Strict&&sn(t,n,51),t.flags|=e.Flags.HasStrictReserved):t.flags&e.Flags.HasYield?sn(t,n,51):(a&e.CoverCallState.Await||t.flags&e.Flags.HasAwait)&&sn(t,n,52)),o}function Le(t,o){switch(t.token){case 33685505:return Re(t,o);case 33554434:case 33554435:return De(t,o);case 594028:return function(e,t){return Mt(e,t,Kt)?Ve(e,t):Re(e,t)}(t,o);case 50331659:return function(t,o){if(Et(t,o,50331659),It(t,o,16)){if(t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),10===t.token)return[]}else if(14===t.token){const r=[Ee(t,o)];return Et(t,o,16),t.flags=t.flags&~(e.Flags.AllowDestructuring|e.Flags.AllowBinding)|e.Flags.SimpleParameterList,10!==t.token&&sn(t,o,1,n(t.token)),r}const r=Ht(t);let a=Zt(t,e.CoverParenthesizedState.None),s=Lt(t,o|e.Context.AllowIn,Ae);if(16777234===t.token){a|=e.CoverParenthesizedState.SequenceExpression;const i=[s];for(;It(t,o|e.Context.DisallowEscapedKeyword,16777234);){if(14===t.token){t.flags&e.Flags.AllowBinding||sn(t,o,77),t.flags|=e.Flags.SimpleParameterList;const n=Ee(t,o);return Et(t,o,16),10!==t.token&&sn(t,o,78),i.push(n),i}if(It(t,o,16))return 10!==t.token&&sn(t,o,1,n(t.token)),i;a=Zt(t,a),i.push(Lt(t,o,Ae))}s=bt(o,t,r,{type:"SequenceExpression",expressions:i})}if(Et(t,o,16),10===t.token)return a&e.CoverParenthesizedState.HasEvalOrArguments?(o&e.Context.Strict&&sn(t,o,47),t.flags|=e.Flags.StrictEvalArguments):a&e.CoverParenthesizedState.HasReservedWords?(o&e.Context.Strict&&sn(t,o,50),t.flags|=e.Flags.HasStrictReserved):t.flags&e.Flags.AllowBinding?t.flags&e.Flags.HasYield?sn(t,o,51):o&e.Context.Async&&t.flags&e.Flags.HasAwait&&sn(t,o,52):sn(t,o,77),t.flags&=~(e.Flags.AllowBinding|e.Flags.HasAwait|e.Flags.HasYield),a&e.CoverParenthesizedState.SequenceExpression?s.expressions:[s];t.flags&=~(e.Flags.HasAwait|e.Flags.HasYield|e.Flags.AllowBinding),jt(s)||(t.flags&=~e.Flags.AllowDestructuring);return s}(t,o|e.Context.InParen);case 41943059:return Lt(t,o,He);case 41943052:return Lt(t,o,Xe);case 33566808:return Be(t,o);case 33566727:case 33566726:case 33566725:return function(t,o){const r=Ht(t),{token:a}=t,s=n(a);t.flags&e.Flags.EscapedKeyword&&sn(t,o,3);Ot(t,o);const i=bt(o,t,r,{type:"Literal",value:33566727===a?null:"true"===s});o&e.Context.OptionsRaw&&(i.raw=s);return i}(t,o);case 120:case 33566797:return function(t,n){const o=Ht(t);let r=[];n&e.Context.OptionsExperimental&&(r=it(t,n));Et(t,n|e.Context.DisallowEscapedKeyword,33566797);const{token:a}=t;let s=e.ObjectState.None,i=null,c=null;41943052!==a&&12372!==a&&(n&e.Context.Async&&262144&a&&sn(t,n,48),i=q(t,n|e.Context.Strict));It(t,n,12372)&&(c=Oe(t,n|e.Context.Strict,o),s|=e.ObjectState.Heritage);const l=_e(t,n|e.Context.Strict,s);return bt(n,t,o,n&e.Context.OptionsExperimental?{type:"ClassExpression",id:i,superClass:c,body:l,decorators:r}:{type:"ClassExpression",id:i,superClass:c,body:l})}(t,o);case 33566811:return function(t,o){const r=Ht(t),a=Re(t,o);if(It(t,o|e.Context.DisallowEscapedKeyword,16777229))return"target"===t.tokenValue&&o&(e.Context.InParameter|e.Context.InFunctionBody)||sn(t,o,53),nt(t,o,a,r);return bt(o,t,r,{type:"NewExpression",callee:function(t,o,r){const{token:a}=t;if(o&e.Context.OptionsNext&&33566810===a)return Mt(t,o,Gt)&&sn(t,o,1,n(a)),tt(t,o);return ve(t,o,r)}(t,o,r),arguments:50331659===t.token?Fe(t,o):[]})}(t,o);case 33566813:return function(t,n){const o=Ht(t);switch(Et(t,n,33566813),t.token){case 50331659:n&e.Context.AllowSuperProperty||sn(t,n,54);break;case 41943059:case 16777229:n&e.Context.Method||sn(t,n,55);break;default:sn(t,n,56)}return bt(n,t,o,{type:"Super"})}(t,o);case 33554551:return Pe(t,o);case 33566815:return function(t,n){t.flags&e.Flags.EscapedKeyword&&sn(t,n,3);const o=Ht(t);return Ot(t,n|e.Context.DisallowEscapedKeyword),bt(n,t,o,{type:"ThisExpression"})}(t,o);case 115:return je(t,o);case 167774773:case 100663333:return K(t,o),function(t,n){const o=Ht(t),{tokenRegExp:r,tokenValue:a,tokenRaw:s}=t;Ot(t,n);const i=bt(n,t,o,{type:"Literal",value:a,regex:r});n&e.Context.OptionsRaw&&(i.raw=s);return i}(t,o);case 33554441:return ot(t,o);case 33554440:return rt(t,o);case 33574984:return function(t,n){n&e.Context.Strict&&sn(t,n,50);const o=Ht(t),r=t.tokenValue;Ot(t,n),t.flags&e.Flags.NewLine&&41943059===t.token&&sn(t,n,1,"let");return bt(n,t,o,{type:"Identifier",name:r})}(t,o);case 12369:if(o&e.Context.OptionsExperimental)return function(e,t){const n=Ht(e);return Et(e,t,12369),bt(t,e,n,{type:"DoExpression",body:Nn(e,t)})}(t,o);default:return qt(t,o)}}function Re(t,n){const o=Ht(t),r=t.tokenValue;Ot(t,n|e.Context.TaggedTemplate);const a=bt(n,t,o,{type:"Identifier",name:r});return n&e.Context.OptionsRawidentifiers&&(a.raw=t.tokenRaw),a}function De(t,n){const o=Ht(t),r=t.tokenValue;n&e.Context.Strict&&t.flags&e.Flags.HasOctal&&sn(t,n,61),Ot(t,n);const a=bt(n,t,o,{type:"Literal",value:r});return n&e.Context.OptionsRaw&&(a.raw=t.tokenRaw),a}function Pe(t,n){const o=Ht(t),{tokenValue:r,tokenRaw:a}=t;Ot(t,n);const s=bt(n,t,o,{type:"Literal",value:r,bigint:a});return n&e.Context.OptionsRaw&&(s.raw=t.tokenRaw),s}function Me(e,t,o){return 135168&o||sn(e,t,4,n(o)),Re(e,t)}function je(e,t){if(!It(e,t,115))return Me(e,t,e.token);const{tokenValue:n}=e,o=Ht(e),r=n;return Ot(e,t),bt(t,e,o,{type:"PrivateName",name:r})}function He(t,n){const o=Ht(t);Et(t,n,41943059);const r=[];for(;20!==t.token;)It(t,n,16777234)?r.push(null):14===t.token?(r.push(Ie(t,n)),20!==t.token&&(t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),Et(t,n,16777234))):(r.push(Lt(t,n|e.Context.AllowIn,Ae)),20!==t.token&&Et(t,n,16777234));return Et(t,n,20),bt(n,t,o,{type:"ArrayExpression",elements:r})}function Be(t,n){const o=Ht(t);Et(t,n,33566808);const r=It(t,n,167774771)?e.ModifierState.Generator:e.ModifierState.None;let a=null;const{token:s}=t;135168&s&&(4194304&s&&(n&e.Context.Strict&&sn(t,n,47),t.flags|=e.Flags.StrictEvalArguments),1073741824&t.token&&r&e.ModifierState.Generator&&sn(t,n,49),a=q(t,n));const{params:i,body:c}=Rt(t,n&~(e.Context.Method|e.Context.AllowSuperProperty),r,Ue);return bt(n,t,o,{type:"FunctionExpression",params:i,body:c,async:!1,generator:!!(r&e.ModifierState.Generator),expression:!1,id:a})}function Ve(t,n){const o=Ht(t);Et(t,n,594028),Et(t,n,33566808);const r=It(t,n,167774771)?e.ModifierState.Generator:e.ModifierState.None,a=e.ModifierState.Await;let s=null;const{token:i}=t;135168&i&&(4194304&i&&((n&e.Context.Strict||a&e.ModifierState.Await)&&sn(t,n,47),t.flags|=e.Flags.StrictFunctionName),262144&i&&sn(t,n,48),1073741824&t.token&&r&e.ModifierState.Generator&&sn(t,n,49),s=q(t,n));const{params:c,body:l}=Rt(t,n&~(e.Context.Method|e.Context.AllowSuperProperty),r|a,Ue);return bt(n,t,o,{type:"FunctionExpression",params:c,body:l,async:!0,generator:!!(r&e.ModifierState.Generator),expression:!1,id:s})}function Je(t,n){switch(t.token){case 33554434:case 33554435:return De(t,n);case 41943059:return function(t,n){Et(t,n,41943059);const o=Ae(t,n|e.Context.AllowIn);return Et(t,n,20),o}(t,n);default:return Re(t,n)}}function Te(t,n){const o=Ht(t);return Et(t,n,14),8388608&t.token&&(t.flags&=~e.Flags.AllowDestructuring),bt(n,t,o,{type:"SpreadElement",argument:Ae(t,n|e.Context.AllowIn)})}function Xe(t,n){const o=Ht(t);Et(t,n,41943052);const r=[];for(;17825807!==t.token;)r.push(14===t.token?Te(t,n):Ge(t,n)),17825807!==t.token&&Et(t,n,16777234);return Et(t,n,17825807),t.flags&=~e.Flags.HasProtoField,bt(n,t,o,{type:"ObjectExpression",properties:r})}function Ge(t,o){const r=Ht(t),a=t.flags;let s,i=It(t,o,167774771)?e.ObjectState.Generator|e.ObjectState.Method:e.ObjectState.Method;const c=t.token;let l=Je(t,o);return 16777216&t.token||(a&e.Flags.EscapedKeyword?sn(t,o,3):i&e.ObjectState.Generator||!(524288&c)||t.flags&e.Flags.NewLine?69743===c?(i=i&~e.ObjectState.Method|e.ObjectState.Getter,l=Je(t,o)):69744===c&&(i=i&~e.ObjectState.Method|e.ObjectState.Setter,l=Je(t,o)):(i|=It(t,o,167774771)?e.ObjectState.Generator|e.ObjectState.Async:e.ObjectState.Async,l=Je(t,o)),i&(e.ObjectState.Getter|e.ObjectState.Setter)&&i&e.ObjectState.Generator&&sn(t,o,1,n(t.token))),50331659===t.token?s=Ke(t,o,i):(i&=~e.ObjectState.Method,16777237===t.token?(i&(e.ObjectState.Async|e.ObjectState.Generator)?sn(t,o,1,n(t.token)):41943059!==c&&"__proto__"===t.tokenValue&&(t.flags&e.Flags.HasProtoField?Qt(t,63):t.flags|=e.Flags.HasProtoField),Et(t,o,16777237),262144&t.token&&(t.flags|=e.Flags.HasAwait),s=Lt(t,o,Ae)):(i&(e.ObjectState.Generator|e.ObjectState.Async)||!Bt(o,c)?sn(t,o,1,n(c)):o&(e.Context.Strict|e.Context.Yield)&&1073741824&c&&($t(t),t.flags|=e.Flags.HasYield),i|=e.ObjectState.Shorthand,83886109===t.token?(o&e.Context.Strict&&4194304&c?an(t,47):Qt(t,91),Et(t,o,83886109),o&(e.Context.Strict|e.Context.Yield|e.Context.Async)&&1074003968&t.token&&($t(t),t.flags|=1073741824&t.token?e.Flags.HasYield:e.Flags.HasAwait),s=z(t,o,l,r)):(262144&c&&(o&e.Context.Async&&sn(t,o,46),$t(t),t.flags|=e.Flags.HasAwait),s=l))),bt(o,t,r,{type:"Property",key:l,value:s,kind:i&e.ObjectState.Getter|i&e.ObjectState.Setter?i&e.ObjectState.Setter?"set":"get":"init",computed:41943059===c,method:!!(i&e.ObjectState.Method),shorthand:!!(i&e.ObjectState.Shorthand)})}function Ke(t,n,o){const r=Ht(t),a=o&e.ObjectState.Generator?e.ModifierState.Generator:e.ModifierState.None,s=o&e.ObjectState.Async?e.ModifierState.Await:e.ModifierState.None,{params:i,body:c}=Rt(t,n|e.Context.Method,a|s,Ue,o);return bt(n,t,r,{type:"FunctionExpression",params:i,body:c,async:!!(o&e.ObjectState.Async),generator:!!(o&e.ObjectState.Generator),expression:!1,id:null})}function Ye(t,n,o,r,a){return t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),t.flags&e.Flags.NewLine&&sn(t,n,36,"async"),Et(t,n,10),qe(t,n|e.Context.Async,a,r,o)}function qe(t,n,o,r,a){t.pendingExpressionError=null;for(const r in o)Pt(t,n|e.Context.InParameter,o[r]);const s=41943052!==t.token;return bt(n,t,r,{type:"ArrowFunctionExpression",body:s?Nt(t,n&~(e.Context.Yield|e.Context.InParameter),Ae):Rt(t,n&~(e.Context.Yield|e.Context.AllowDecorator)|e.Context.InFunctionBody,a,$e),params:o,id:null,async:!!(a&e.ModifierState.Await),generator:!1,expression:s})}function Ue(t,n,o){const r=ze(t,n|e.Context.InParameter,o),a=r.args;return{params:r.params,body:$e(t,n&~e.Context.AllowDecorator|e.Context.InFunctionBody,a)}}function $e(t,n,o){const r=Ht(t);Et(t,n|e.Context.DisallowEscapedKeyword,41943052);const a=[];for(;33554435===t.token;){const{tokenRaw:o,tokenValue:r}=t;a.push(In(t,n)),12===o.length&&"use strict"===r&&(t.flags&e.Flags.SimpleParameterList?sn(t,n,64):t.flags&(e.Flags.HasStrictReserved|e.Flags.StrictFunctionName)?sn(t,n,50):t.flags&e.Flags.StrictEvalArguments&&sn(t,n,47),n|=e.Context.Strict)}n&e.Context.Strict&&Dt(t,n,o);const{labelSet:s}=t;t.labelSet={};const i=t.flags;for(t.flags=t.flags&~(e.Flags.StrictFunctionName|e.Flags.StrictEvalArguments|e.Flags.InSwitchStatement|e.Flags.InIterationStatement)|e.Flags.AllowDestructuring;17825807!==t.token;)a.push(fn(t,n));return i&e.Flags.InIterationStatement&&(t.flags|=e.Flags.InIterationStatement),i&e.Flags.InSwitchStatement&&(t.flags|=e.Flags.InSwitchStatement),t.labelSet=s,Et(t,n,17825807),bt(n,t,r,{type:"BlockStatement",body:a})}function ze(t,n,o){Et(t,n,50331659),t.flags&=~(e.Flags.SimpleParameterList|e.Flags.HasStrictReserved);const r=[],a=[];for(;16!==t.token;){if(14===t.token){o&e.ObjectState.Setter&&sn(t,n,67),t.flags|=e.Flags.SimpleParameterList,a.push(Ee(t,n,r));break}if(a.push(We(t,n,r)),!It(t,n,16777234))break;if(16===t.token)break}return o&e.ObjectState.Setter&&1!==a.length&&sn(t,n,66,"Setter","one",""),o&e.ObjectState.Getter&&a.length>0&&sn(t,n,66,"Getter","no","s"),Et(t,n,16),{params:a,args:r}}function We(t,n,o){const r=Ht(t);135168&t.token?(vt(t.token,20480)&&(n&e.Context.Strict&&sn(t,n,50),t.flags|=e.Flags.StrictFunctionName),vt(t.token,4194304)&&(n&e.Context.Strict&&sn(t,n,47),t.flags|=e.Flags.StrictEvalArguments)):t.flags|=e.Flags.SimpleParameterList;const a=Y(t,n,o);return It(t,n,83886109)?(1074003968&t.token&&n&(e.Context.Yield|e.Context.Async)&&sn(t,n,262144&t.token?52:51),t.flags|=e.Flags.SimpleParameterList,bt(n,t,r,{type:"AssignmentPattern",left:a,right:Nt(t,n,Ae)})):a}function _e(t,n,o){const r=Ht(t);Et(t,n,41943052);const a=[];let s=[];for(;17825807!==t.token;)It(t,n,17825809)||(n&e.Context.OptionsExperimental&&(s=it(t,n),17825807===t.token&&an(t,92),0!==s.length&&"constructor"===t.tokenValue&&an(t,93)),a.push(n&e.Context.OptionsNext&&115===t.token?et(t,n,s):Qe(t,n,o,s)));return t.flags&=~e.Flags.HasConstructor,Et(t,n,17825807),bt(n,t,r,{type:"ClassBody",body:a})}function Qe(t,o,r,a){const s=Ht(t);let{tokenValue:i,token:c}=t;const l=t.flags;It(t,o,167774771)&&(r|=e.ObjectState.Generator),41943059===t.token&&(r|=e.ObjectState.Computed),"constructor"===t.tokenValue&&(r&e.ObjectState.Generator?sn(t,o,45,"generator"):r&e.ObjectState.Heritage&&(o|=e.Context.AllowSuperProperty),r|=e.ObjectState.Constructor);let u,d=Je(t,o);if(!(16777216&t.token)){if(l&e.Flags.EscapedKeyword&&sn(t,o,3),20585===c&&(c=t.token,It(t,o,167774771)&&(r|=e.ObjectState.Generator),i=t.tokenValue,41943059===t.token&&(r|=e.ObjectState.Computed),"prototype"===t.tokenValue&&sn(t,o,65),r|=e.ObjectState.Static,d=Je(t,o),o&e.Context.OptionsNext&&Wt(t)))return"constructor"===i&&sn(t,o,1,n(t.token)),Ze(t,o,d,r,s,a);50331659!==t.token&&(!(524288&c)||r&e.ObjectState.Generator||t.flags&e.Flags.NewLine?69743!==c&&69744!==c||(r|=69743===c?e.ObjectState.Getter:e.ObjectState.Setter,i=t.tokenValue,41943059===t.token&&(r|=e.ObjectState.Computed),d=Je(t,o&~e.Context.Strict)):(c=t.token,i=t.tokenValue,r|=e.ObjectState.Async,It(t,o,167774771)&&(r|=e.ObjectState.Generator),41943059===t.token&&(r|=e.ObjectState.Computed),d=Je(t,o)),"prototype"===i?sn(t,o,65):r&e.ObjectState.Static||"constructor"!==i||sn(t,o,45,"accessor"))}if(50331659===t.token)!(r&e.ObjectState.Computed)&&r&e.ObjectState.Constructor&&(t.flags&e.Flags.HasConstructor?an(t,12):t.flags|=e.Flags.HasConstructor),u=Ke(t,o,r);else{if(o&e.Context.OptionsNext)return Ze(t,o,d,r,s,a);sn(t,o,1,n(c))}const p=r&e.ObjectState.Constructor?"constructor":r&e.ObjectState.Getter?"get":r&e.ObjectState.Setter?"set":"method";return bt(o,t,s,o&e.Context.OptionsExperimental?{type:"MethodDefinition",kind:p,static:!!(r&e.ObjectState.Static),computed:!!(r&e.ObjectState.Computed),key:d,value:u,decorators:a}:{type:"MethodDefinition",kind:p,static:!!(r&e.ObjectState.Static),computed:!!(r&e.ObjectState.Computed),key:d,value:u})}function Ze(t,n,o,r,a,s){r&e.ObjectState.Constructor&&sn(t,n,0);let i=null;return r&(e.ObjectState.Async|e.ObjectState.Generator)&&sn(t,n,0),It(t,n,83886109)&&(4194304&t.token&&sn(t,n,47),i=Ae(t,n)),It(t,n,16777234),bt(n,t,a,n&e.Context.OptionsExperimental?{type:"FieldDefinition",key:o,value:i,computed:!!(r&e.ObjectState.Computed),static:!!(r&e.ObjectState.Static),decorators:s}:{type:"FieldDefinition",key:o,value:i,computed:!!(r&e.ObjectState.Computed),static:!!(r&e.ObjectState.Static)})}function et(t,n,o){const r=Ht(t);Et(t,n|e.Context.InClass,115),"constructor"===t.tokenValue&&sn(t,n,41);const a=function(e,t,n){const o=e.tokenValue;return Ot(e,t),bt(t,e,n,{type:"PrivateName",name:o})}(t,n,r);if(50331659===t.token)return function(t,n,o,r,a){const s=Ke(t,n|e.Context.Strict,e.ObjectState.None);return t.flags&=~(e.Flags.AllowDestructuring|e.Flags.AllowBinding),bt(n,t,r,n&e.Context.OptionsExperimental?{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:o,value:s,decorators:a}:{type:"MethodDefinition",kind:"method",static:!1,computed:!1,key:o,value:s})}(t,n,a,r,o);let s=null;return It(t,n,83886109)&&(4194304&t.token&&sn(t,n,47),s=Ae(t,n)),It(t,n,16777234),bt(n,t,r,n&e.Context.OptionsExperimental?{type:"FieldDefinition",key:a,value:s,computed:!1,static:!1,decorators:o}:{type:"FieldDefinition",key:a,value:s,computed:!1,static:!1})}function tt(t,o){const r=Ht(t),a=Re(t,o);if(It(t,o,16777229)){if(o&e.Context.Module&&"meta"===t.tokenValue)return nt(t,o,a,r);sn(t,o,1,n(t.token))}let s=function(e,t,n){return bt(t,e,n,{type:"Import"})}(t,o,r);Et(t,o,50331659);const i=Nt(t,o|e.Context.AllowIn,Ae);return Et(t,o,16),s=bt(o,t,r,{type:"CallExpression",callee:s,arguments:[i]})}function nt(e,t,n,o){return bt(t,e,o,{meta:n,type:"MetaProperty",property:Re(e,t)})}function ot(e,t){return bt(t,e,Ht(e),{type:"TemplateLiteral",expressions:[],quasis:[at(e,t)]})}function rt(e,t,n=[],o=[]){const r=Ht(e),{tokenValue:a,tokenRaw:s}=e;Et(e,t,33554440),n.push(ye(e,t));const i=Ht(e);return o.push(function(e,t,n=null,o,r){return e.token=b(e,t),bt(t,e,r,{type:"TemplateElement",value:{cooked:n,raw:o},tail:!1})}(e,t,a,s,r)),33554441===e.token?o.push(at(e,t,i)):rt(e,t,n,o),bt(t,e,r,{type:"TemplateLiteral",expressions:n,quasis:o})}function at(e,t,n=Ht(e)){const{tokenValue:o,tokenRaw:r}=e;return Et(e,t,33554441),bt(t,e,n,{type:"TemplateElement",value:{cooked:o,raw:r},tail:!0})}function st(e,t){const n=Ht(e);return bt(t,e,n,{type:"Decorator",expression:Oe(e,t,n)})}function it(t,n){const o=[];for(;It(t,n,120);)o.push(st(t,n|e.Context.AllowDecorator));return o}var ct,lt,ut,dt,pt,xt,ft,mt,gt,St,Ct,kt;function wt(t,n,o,r){const a=At(t,o);a||sn(t,n,32,o),!r||a&e.Labels.Nested||sn(t,n,31,o)}function yt(t,n){var o;void 0===t.labelSet&&(t.labelSet={}),t.labelSet[`$${n}`]=12369===(o=t.token)||12386===o||12374===o?e.Labels.Nested:e.Labels.NotNested}function ht(t,n){t.labelSet[`$${n}`]=e.Labels.None}function At(t,n){return t.labelSet?t.labelSet[`$${n}`]:e.Labels.None}function bt(t,n,o,r){const{lastIndex:a,lastLine:s,lastColumn:i,sourceFile:c,index:l}=n;return t&e.Context.LocationTracker&&(t&e.Context.OptionsRanges&&(r.start=o.index,r.end=a),t&e.Context.OptionsLoc&&(r.loc={start:{line:o.line,column:o.column},end:{line:s,column:i}},c&&(r.loc.source=c))),r}function Et(e,t,o,r=1){return e.token!==o&&an(e,r,n(e.token)),Ot(e,t),!0}function It(e,t,n){return e.token===n&&(Ot(e,t),!0)}function Ot(e,t){return e.lastIndex=e.index,e.lastLine=e.line,e.lastColumn=e.column,e.token=G(e,t)}(ct=e.Context||(e.Context={}))[ct.Empty=0]="Empty",ct[ct.OptionsNext=1]="OptionsNext",ct[ct.OptionsRanges=2]="OptionsRanges",ct[ct.OptionsJSX=4]="OptionsJSX",ct[ct.OptionsRaw=8]="OptionsRaw",ct[ct.OptionsLoc=16]="OptionsLoc",ct[ct.OptionsGlobalReturn=32]="OptionsGlobalReturn",ct[ct.OptionsComments=64]="OptionsComments",ct[ct.OptionsShebang=128]="OptionsShebang",ct[ct.OptionsRawidentifiers=256]="OptionsRawidentifiers",ct[ct.OptionsTolerant=512]="OptionsTolerant",ct[ct.OptionsNode=1024]="OptionsNode",ct[ct.OptionsExperimental=2048]="OptionsExperimental",ct[ct.Strict=4096]="Strict",ct[ct.Module=8192]="Module",ct[ct.TaggedTemplate=16384]="TaggedTemplate",ct[ct.InClass=32768]="InClass",ct[ct.AllowIn=65536]="AllowIn",ct[ct.Async=131072]="Async",ct[ct.Yield=262144]="Yield",ct[ct.InParameter=524288]="InParameter",ct[ct.InFunctionBody=1048576]="InFunctionBody",ct[ct.AllowSingleStatement=2097152]="AllowSingleStatement",ct[ct.BlockScope=4194304]="BlockScope",ct[ct.ForStatement=8388608]="ForStatement",ct[ct.RequireIdentifier=16777216]="RequireIdentifier",ct[ct.Method=33554432]="Method",ct[ct.AllowSuperProperty=67108864]="AllowSuperProperty",ct[ct.InParen=134217728]="InParen",ct[ct.InJSXChild=268435456]="InJSXChild",ct[ct.DisallowEscapedKeyword=536870912]="DisallowEscapedKeyword",ct[ct.AllowDecorator=1073741824]="AllowDecorator",ct[ct.LocationTracker=18]="LocationTracker",(lt=e.Flags||(e.Flags={}))[lt.None=0]="None",lt[lt.NewLine=1]="NewLine",lt[lt.AllowBinding=2]="AllowBinding",lt[lt.AllowDestructuring=4]="AllowDestructuring",lt[lt.SimpleParameterList=8]="SimpleParameterList",lt[lt.InSwitchStatement=16]="InSwitchStatement",lt[lt.InIterationStatement=32]="InIterationStatement",lt[lt.HasStrictReserved=64]="HasStrictReserved",lt[lt.HasOctal=128]="HasOctal",lt[lt.SimpleAssignmentTarget=256]="SimpleAssignmentTarget",lt[lt.HasProtoField=512]="HasProtoField",lt[lt.StrictFunctionName=1024]="StrictFunctionName",lt[lt.StrictEvalArguments=2048]="StrictEvalArguments",lt[lt.InFunctionBody=4096]="InFunctionBody",lt[lt.HasAwait=8192]="HasAwait",lt[lt.HasYield=16384]="HasYield",lt[lt.EscapedKeyword=32768]="EscapedKeyword",lt[lt.HasConstructor=65536]="HasConstructor",(ut=e.Labels||(e.Labels={}))[ut.None=0]="None",ut[ut.NotNested=1]="NotNested",ut[ut.Nested=2]="Nested",(dt=e.NumericState||(e.NumericState={}))[dt.None=0]="None",dt[dt.SeenSeparator=1]="SeenSeparator",dt[dt.EigthOrNine=2]="EigthOrNine",dt[dt.Float=4]="Float",dt[dt.BigInt=8]="BigInt",(pt=e.ScannerState||(e.ScannerState={}))[pt.None=0]="None",pt[pt.NewLine=1]="NewLine",pt[pt.LastIsCR=2]="LastIsCR",(xt=e.ModifierState||(e.ModifierState={}))[xt.None=0]="None",xt[xt.Generator=1]="Generator",xt[xt.Await=2]="Await",(ft=e.CoverParenthesizedState||(e.CoverParenthesizedState={}))[ft.None=0]="None",ft[ft.SequenceExpression=1]="SequenceExpression",ft[ft.HasEvalOrArguments=2]="HasEvalOrArguments",ft[ft.HasReservedWords=4]="HasReservedWords",ft[ft.HasYield=8]="HasYield",ft[ft.HasBinding=16]="HasBinding",(mt=e.Escape||(e.Escape={}))[mt.Empty=-1]="Empty",mt[mt.StrictOctal=-2]="StrictOctal",mt[mt.EightOrNine=-3]="EightOrNine",mt[mt.InvalidHex=-4]="InvalidHex",mt[mt.OutOfRange=-5]="OutOfRange",(gt=e.RegexFlags||(e.RegexFlags={}))[gt.Empty=0]="Empty",gt[gt.IgnoreCase=1]="IgnoreCase",gt[gt.Global=2]="Global",gt[gt.Multiline=4]="Multiline",gt[gt.Unicode=8]="Unicode",gt[gt.Sticky=16]="Sticky",gt[gt.DotAll=32]="DotAll",(St=e.CoverCallState||(e.CoverCallState={}))[St.Empty=0]="Empty",St[St.SeenSpread=1]="SeenSpread",St[St.HasSpread=2]="HasSpread",St[St.SimpleParameter=4]="SimpleParameter",St[St.EvalOrArguments=8]="EvalOrArguments",St[St.Yield=16]="Yield",St[St.Await=32]="Await",(Ct=e.RegexState||(e.RegexState={}))[Ct.Empty=0]="Empty",Ct[Ct.Escape=1]="Escape",Ct[Ct.Class=2]="Class",(kt=e.ObjectState||(e.ObjectState={}))[kt.None=0]="None",kt[kt.Async=1]="Async",kt[kt.Generator=2]="Generator",kt[kt.Getter=4]="Getter",kt[kt.Setter=8]="Setter",kt[kt.Computed=16]="Computed",kt[kt.Method=32]="Method",kt[kt.Shorthand=64]="Shorthand",kt[kt.Static=128]="Static",kt[kt.Constructor=256]="Constructor",kt[kt.Heritage=512]="Heritage";const vt=(e,t)=>(e&t)===t;function Ft(t,o){return 1048576&t.token||t.flags&e.Flags.NewLine?It(t,o,17825809):an(t,!(o&e.Context.Async)&&262144&t.token?38:1,n(t.token))}function Nt(t,n,o){const{flags:r,pendingExpressionError:a}=t;t.flags|=e.Flags.AllowBinding|e.Flags.AllowDestructuring,t.pendingExpressionError=void 0;const s=o(t,n);if(t.pendingExpressionError){const{error:e,line:o,column:r,index:a}=t.pendingExpressionError;on(t,n,a,o,r,e)}return t.flags&=~(e.Flags.AllowBinding|e.Flags.AllowDestructuring),r&e.Flags.AllowBinding&&(t.flags|=e.Flags.AllowBinding),r&e.Flags.AllowDestructuring&&(t.flags|=e.Flags.AllowDestructuring),t.pendingExpressionError=a,s}function Lt(t,n,o){const{flags:r,pendingExpressionError:a}=t;t.flags|=e.Flags.AllowBinding|e.Flags.AllowDestructuring,t.pendingExpressionError=void 0;const s=o(t,n);return t.flags&e.Flags.AllowBinding&&r&e.Flags.AllowBinding||(t.flags&=~e.Flags.AllowBinding),t.flags&e.Flags.AllowDestructuring&&r&e.Flags.AllowDestructuring||(t.flags&=~e.Flags.AllowDestructuring),t.pendingExpressionError=a||t.pendingExpressionError,s}function Rt(t,n,o,r,a=e.ObjectState.None){return n&=~(e.Context.Async|e.Context.Yield|e.Context.InParameter),o&e.ModifierState.Generator&&(n|=e.Context.Yield),o&e.ModifierState.Await&&(n|=e.Context.Async),r(t,n,a)}function Dt(e,t,n){const o=new Map;for(let r=0;r<n.length;r++){const a=`@${n[r]}`;o.get(a)?sn(e,t,81):o.set(a,!0)}}const Pt=(t,n,o)=>{switch(o.type){case"Identifier":n&e.Context.Strict&&Ut(o.name)&&an(t,3);case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":case"RestElement":case"MetaProperty":return;case"ArrayExpression":o.type="ArrayPattern";for(let e=0;e<o.elements.length;++e)null!==o.elements[e]&&Pt(t,n,o.elements[e]);return;case"ObjectExpression":o.type="ObjectPattern";for(let e=0;e<o.properties.length;e++)Pt(t,n,o.properties[e]);return;case"Property":return void Pt(t,n,o.value);case"SpreadElement":o.type="RestElement","ArrayExpression"===o.argument.type||"ObjectExpression"===o.argument.type||jt(o.argument)||sn(t,n,71),Pt(t,n,o.argument);break;case"AssignmentExpression":return o.type="AssignmentPattern",delete o.operator,void Pt(t,n,o.left);case"MemberExpression":if(!(n&e.Context.InParameter))return;default:sn(t,n,n&e.Context.InParameter?77:73,o.type)}};function Mt(e,t,n){const{tokenValue:o,flags:r,line:a,column:s,startColumn:i,index:c,lastColumn:l,startLine:u,lastLine:d,lastIndex:p,startIndex:x,tokenRaw:f,token:m,lastValue:g,tokenRegExp:S,labelSet:C,errors:k,errorLocation:w,pendingExpressionError:y}=e,h=n(e,t);return e.index=c,e.token=m,e.tokenValue=o,e.tokenValue=o,e.flags=r,e.line=a,e.column=s,e.tokenRaw=f,e.lastValue=g,e.startColumn=i,e.lastColumn=l,e.startLine=u,e.lastLine=d,e.lastIndex=p,e.startIndex=x,e.tokenRegExp=S,e.labelSet=C,e.errors=k,e.errorLocation=w,e.tokenRegExp=S,e.pendingExpressionError=y,h}function jt(e){return"Identifier"===e.type||"MemberExpression"===e.type}function Ht(e){return{line:e.startLine,column:e.startColumn,index:e.startIndex}}function Bt(t,n){return t&e.Context.Strict?!(t&e.Context.Module&&262144&n)&&(!(1073741824&n)&&(131072==(131072&n)||69632==(69632&n))):131072==(131072&n)||69632==(69632&n)||20480==(20480&n)}function Vt(e,t){Ot(e,t);const{token:n}=e;return!!(1082523648&n||33574984===n||69632==(69632&n))}function Jt(e){return 12368===e.token||17825807===e.token||12363===e.token}function Tt(e,t){return Ot(e,t),50331659===e.token||16777229===e.token}function Xt(e,t){Ot(e,t);const{token:n}=e;return 1073872896&n||50331659===n}function Gt(e,t){return Ot(e,t),50331659===e.token}function Kt(t,n){return Ot(t,n),!(t.flags&e.Flags.NewLine)&&33566808===t.token}function Yt(e){return!!e.property&&"PrivateName"===e.property.type}function qt(t,o){const{token:r,tokenValue:a}=t;if(o&e.Context.Strict){if(o&e.Context.Module&&262144&r&&sn(t,o,40,n(t.token)),1073741824&r&&sn(t,o,40,n(t.token)),131072==(131072&r)||69632==(69632&r))return Re(t,o);an(t,1,n(t.token))}if(o&e.Context.Yield&&1073741824&r&&sn(t,o,40,n(t.token)),o&e.Context.Async&&262144&r&&sn(t,o,40,n(t.token)),131072==(131072&r)||69632==(69632&r)||20480==(20480&r))return Re(t,o);an(t,1,n(t.token))}function Ut(e){return"eval"===e||"arguments"===e}function $t(e){e.errorLocation={line:e.startLine,column:e.startColumn,index:e.startIndex}}function zt(e){switch(e.type){case"JSXIdentifier":return e.name;case"JSXNamespacedName":return`${zt(e.namespace)}:${zt(e.name)}`;case"JSXMemberExpression":return`${zt(e.object)}.${zt(e.property)}`}}function Wt(e){const{token:t}=e;return 17825807===t||17825809===t||83886109===t}function _t(t,n,o,r){n&e.Context.Strict&&Ut(o.name)&&sn(t,n,68,r),jt(o)||sn(t,n,5)}function Qt(e,t){e.pendingExpressionError={error:nn[t],line:e.line,column:e.column,index:e.index}}function Zt(t,n){const{token:o}=t;return 8388608&o?t.flags|=e.Flags.SimpleParameterList:4194304==(4194304&o)?($t(t),n|=e.CoverParenthesizedState.HasEvalOrArguments):20480==(20480&o)?($t(t),n|=e.CoverParenthesizedState.HasReservedWords):262144==(262144&o)&&($t(t),t.flags|=e.Flags.HasAwait),n}function en(t,n,o){const{token:r}=t;return t.flags&e.Flags.AllowBinding?8388608&r?t.flags|=e.Flags.SimpleParameterList:4194304==(4194304&r)?($t(t),o|=e.CoverCallState.EvalOrArguments):262144==(262144&r)?($t(t),o|=e.CoverCallState.Await):1073741824==(1073741824&r)&&($t(t),o|=e.CoverCallState.Yield):sn(t,n,77),o}function tn(e){return 69746===e||167786289===e}const nn={0:"Unexpected token",1:"Unexpected token '%0'",2:"Expected token '%0'",3:"Keyword must not contain escaped characters",4:"Keyword '%0' is reserved",5:"Invalid left-hand side in assignment",6:"Unterminated string literal",7:"Unterminated regular expression literal",8:"Unterminated MultiLineComment",9:"Unterminated template literal",10:"Invalid character '%0'",11:"Octal escapes are not allowed in strict mode",13:"Escapes \\8 or \\9 are not syntactically valid escapes",14:"Unicode escape code point out of range",15:"Duplicate regular expression flag '%0'",16:"Unexpected regular expression flag '%0'",17:"Eval or arguments can't be assigned to in strict mode code",18:"Illegal return statement",19:"In strict mode code, functions can only be declared at top level or inside a block",20:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",21:"%0 can't appear in single-statement context",22:"Generators can only be declared at the top level or inside a block",23:"'for await' loop should be used with 'of'",24:"Missing initializer in %0 declaration",25:"'for-%0' loop variable declaration may not have an initializer",26:"Invalid left-hand side in for-%0 loop: Must have a single binding.",27:"let is disallowed as a lexically bound name",28:"Lexical declaration cannot appear in a single-statement context",29:"Label '%0' has already been declared",30:"%0 statement must be nested within an iteration statement",31:"Illegal continue statement: '%0' does not denote an iteration statement",32:"Undefined label '%0'",33:"More than one default clause in switch statement",34:"%0 declarations may only appear at top level of a module",35:"Async functions can only be declared at the top level or inside a block",36:"No line break is allowed after '%0'",37:"Strict mode code may not include a with statement",38:"Await is only valid in async functions",39:"Function declaration must have a name in this context",12:"Duplicate constructor method in class",40:"'%0' may not be used as an identifier in this context",43:"Delete of an unqualified identifier in strict mode",44:"Private fields can not be deleted",41:"Classes may not have a private field named '#constructor'",42:"Classes may not have a field named 'constructor'",45:"Class constructor may not be a '%0'",46:"Unexpected reserved word",47:"Unexpected eval or arguments in strict mode",48:"'await' is not a valid identifier inside an async function",49:"'yield' is not a valid identifier inside an generator function",50:"Unexpected strict mode reserved word",52:"Await expression not allowed in formal parameter",51:"Yield expression not allowed in formal parameter",53:"new.target only allowed within functions",54:"super() is not allowed in this context",55:"Member access from super not allowed in this context",56:'Only "(" or "." or "[" are allowed after \'super\'',57:"'yield' is a reserved keyword within generator function bodies",58:"Only one underscore is allowed as numeric separator",59:"Numeric separators are not allowed at the end of numeric literals",60:"Numeric separator can not be used after leading 0.",61:"Legacy octal literals are not allowed in strict mode",62:"Invalid left-hand side in assignment",63:"Property name __proto__ appears more than once in object literal",64:"Illegal 'use strict' directive in function with non-simple parameter list",65:"Classes may not have a static property named 'prototype'",66:"%0 functions must have %1 argument%2",67:"Setter function argument must not be a rest parameter",68:"%0 increment/decrement may not have eval or arguments operand in strict mode",69:"Elision not allowed in object property list",70:"Rest element must be last element",72:"Spread element must be last element",71:"Rest parameter may not have a default initializer",73:"Invalid destructuring assignment target",74:"Unexpected surrogate pair",75:"Malformed %0 character escape sequence",76:"Template literals may not contain octal escape sequences",77:"Invalid binding pattern",78:"Rest parameter must be last formal parameter",79:"Missing catch or finally after try",80:"Illegal newline after throw",81:"Duplicate parameter name not allowed in this context",82:"Missing keyword 'as' after import *",83:"Labels must be followed by a ':'",84:"JSX attributes must only be assigned a non-empty 'expression'",85:"Expected corresponding JSX closing tag for %0",86:"Adjacent JSX elements must be wrapped in an enclosing tag",87:"Invalid JSX attribute value",88:"Rest element may not have a trailing comma",89:"Undefined Unicode code-point",90:"HTML comments are not allowed in modules",91:"Invalid shorthand property initializer",92:"Trailing decorator may be followed by method",93:"Decorators can't be used with a constructor",94:"`...` must be followed by an identifier in declaration contexts"};function on(t,n,o,r,a,s){const i=new SyntaxError(`Line ${r}, column ${a}: ${s}`);if(i.index=o,i.line=r,i.column=a,i.description=s,!(n&e.Context.OptionsTolerant))throw i;t.errors.push(i)}function rn(e){let{index:t,startLine:n,startColumn:o}=e;const r=e.errorLocation;return r&&(t=r.index,n=r.line,o=r.column),{index:t,line:n,column:o}}function an(t,n,...o){const{index:r,line:a,column:s}=rn(t),i=nn[n].replace(/%(\d+)/g,(e,t)=>o[t]);on(t,e.Context.Empty,r,a,s,i)}function sn(e,t,n,...o){const{index:r,line:a,column:s}=rn(e);on(e,t,r,a,s,nn[n].replace(/%(\d+)/g,(e,t)=>o[t]))}function cn(t,n){const o=Ht(t);let r=[];n&e.Context.OptionsExperimental&&(r=it(t,n)),Et(t,n|e.Context.DisallowEscapedKeyword,33566797);const a=n&e.Context.RequireIdentifier&&33685505!==t.token?null:q(t,n|e.Context.Strict|e.Context.DisallowEscapedKeyword);let s=e.ObjectState.None,i=null;It(t,n,12372)&&(i=Oe(t,n|e.Context.Strict,o),s|=e.ObjectState.Heritage);const c=_e(t,n&~e.Context.RequireIdentifier|e.Context.Strict|e.Context.InClass,s);return bt(n,t,o,n&e.Context.OptionsExperimental?{type:"ClassDeclaration",id:a,superClass:i,body:c,decorators:r}:{type:"ClassDeclaration",id:a,superClass:i,body:c})}function ln(t,n){const o=Ht(t);Et(t,n,33566808);let r=e.ModifierState.None;return It(t,n,167774771)&&(n&e.Context.AllowSingleStatement&&!(n&e.Context.InFunctionBody)&&sn(t,n,22),r=e.ModifierState.Generator),un(t,n,r,o)}function un(t,n,o,r){const{token:a}=t;let s=null;n&e.Context.Yield&&1073741824&a&&sn(t,n,49),n&e.Context.Async&&262144&a&&sn(t,n,48),50331659!==a?s=q(t,n):n&e.Context.RequireIdentifier||sn(t,n,39);const{params:i,body:c}=Rt(t,n&~(e.Context.Method|e.Context.AllowSuperProperty|e.Context.RequireIdentifier),o,Ue);return bt(n,t,r,{type:"FunctionDeclaration",params:i,body:c,async:!!(o&e.ModifierState.Await),generator:!!(o&e.ModifierState.Generator),expression:!1,id:s})}function dn(t,n){const o=Ht(t);Et(t,n,594028),Et(t,n,33566808);const r=e.ModifierState.Await;return un(t,n,(It(t,n,167774771)?e.ModifierState.Generator:e.ModifierState.None)|r,o)}function pn(t,o,r){const a=Ht(t),s=0!=(8388608&t.token),i=Y(t,o);let c=null;return It(t,o|e.Context.DisallowEscapedKeyword,83886109)?(c=Nt(t,o&~(e.Context.BlockScope|e.Context.ForStatement),Ae),tn(t.token)&&(o&e.Context.ForStatement||s)&&(167786289===t.token?(o&(e.Context.BlockScope|e.Context.Strict|e.Context.Async)||s)&&sn(t,o,25,n(t.token)):sn(t,o,25,n(t.token)))):tn(t.token)||!r&&!s||sn(t,o,24,r?"const":"destructuring"),bt(o,t,a,{type:"VariableDeclarator",init:c,id:i})}function xn(t,o,r){const a=[pn(t,o,r)];for(;It(t,o,16777234);)a.push(pn(t,o,r));return o&e.Context.ForStatement&&tn(t.token)&&1!==a.length&&sn(t,o,26,n(t.token)),a}function fn(t,o){switch(t.token){case 33566808:return ln(t,o);case 120:case 33566797:return cn(t,o);case 33574984:return function(t,n,o=!0){return Mt(t,n,Vt)?jn(t,n|e.Context.BlockScope,o):On(t,n)}(t,o|e.Context.AllowIn);case 33566793:return jn(t,o|e.Context.BlockScope|e.Context.AllowIn);case 594028:return function(e,t){return Mt(e,t,Kt)?dn(e,t):mn(e,t)}(t,o);case 33566810:if(o&e.Context.OptionsNext&&Mt(t,o,Tt))return En(t,o|e.Context.AllowIn);case 12371:o&e.Context.Module&&sn(t,o,34,n(t.token));default:return mn(t,o|e.Context.AllowSingleStatement)}}function mn(t,o){switch(t.token){case 33566791:return jn(t,o|e.Context.AllowIn);case 17825809:return gn(t,o);case 33566814:return Pn(t,o);case 41943052:return Nn(t,o);case 12380:return Ln(t,o);case 12377:return kn(t,o);case 12369:return vn(t,o);case 12386:return Fn(t,o);case 12387:return Dn(t,o);case 12362:return Cn(t,o);case 12366:return Sn(t,o);case 12367:return yn(t,o);case 302002272:return bn(t,o);case 12385:return hn(t,o|e.Context.DisallowEscapedKeyword);case 12374:return function(t,n){const o=Ht(t);Et(t,n,12374);const r=!!(n&e.Context.Async&&It(t,n,34017389));Et(t,n|e.Context.DisallowEscapedKeyword,50331659);const{token:a}=t;let s,i=null,c=null,l=null,u="ForStatement",d=null,p=null;33566793===a||33574984===a&&Mt(t,n,Vt)?l=jn(t,n&~e.Context.AllowIn|e.Context.BlockScope,!1):33566791===a?l=jn(t,n&~e.Context.AllowIn,!1):17825809!==a&&(c=Ht(t),i=Lt(t,n&~e.Context.AllowIn|e.Context.DisallowEscapedKeyword,Ae));It(t,n,69746)?(u="ForOfStatement",i?(t.flags&e.Flags.AllowDestructuring&&"AssignmentExpression"!==i.type||sn(t,n,73),Pt(t,n,i)):i=l,s=Ae(t,n|e.Context.AllowIn)):It(t,n,167786289)?(i?(t.flags&e.Flags.AllowDestructuring||sn(t,n,73),Pt(t,n,i)):i=l,u="ForInStatement",s=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn)):(16777234===t.token&&(i=he(t,n,i,c)),l&&(i=l),Et(t,n,17825809),d=17825809!==t.token?ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn):null,Et(t,n,17825809),p=16!==t.token?ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn):null);Et(t,n,16);const x=Rn(t,n);return bt(n,t,o,"ForOfStatement"===u?{type:u,body:x,left:i,right:s,await:r}:s?{type:u,body:x,left:i,right:s}:{type:u,body:x,init:i,test:d,update:p})}(t,o|e.Context.ForStatement);case 594028:return Mt(t,o,Kt)&&sn(t,o,35),On(t,o|e.Context.AllowSingleStatement);case 33566808:sn(t,o,o&e.Context.Strict?19:20);case 33566797:sn(t,o,21,n(t.token));default:return On(t,o)}}function gn(e,t){const n=Ht(e);return Ot(e,t),bt(t,e,n,{type:"EmptyStatement"})}function Sn(t,o){const r=Ht(t);Ot(t,o),t.flags&(e.Flags.InSwitchStatement|e.Flags.InIterationStatement)||sn(t,o,30,n(t.token));let a=null;if(!(t.flags&e.Flags.NewLine)&&135168&t.token){const{tokenValue:e}=t;a=Re(t,o),wt(t,o,e,!0)}return Ft(t,o),bt(o,t,r,{type:"ContinueStatement",label:a})}function Cn(t,n){const o=Ht(t);Ot(t,n);let r=null;if(!(t.flags&e.Flags.NewLine)&&135168&t.token){const{tokenValue:e}=t;r=Re(t,n),wt(t,n,e,!1)}else t.flags&(e.Flags.InSwitchStatement|e.Flags.InIterationStatement)||sn(t,n,30,"break");return Ft(t,n),bt(n,t,o,{type:"BreakStatement",label:r})}function kn(t,n){const o=Ht(t);Ot(t,n),Et(t,n,50331659);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Et(t,n,16),bt(n,t,o,{type:"IfStatement",test:r,consequent:wn(t,n|e.Context.DisallowEscapedKeyword),alternate:It(t,n,12370)?wn(t,n):null})}function wn(t,n){return n&e.Context.Strict||33566808!==t.token?mn(t,n&~e.Context.AllowSingleStatement):ln(t,n)}function yn(e,t){const n=Ht(e);return Ot(e,t),Ft(e,t),bt(t,e,n,{type:"DebuggerStatement"})}function hn(e,t){const n=Ht(e);Ot(e,t);const o=Nn(e,t),r=12364===e.token?An(e,t):null,a=It(e,t,12373)?Nn(e,t):null;return r||a||sn(e,t,79),bt(t,e,n,{type:"TryStatement",block:o,handler:r,finalizer:a})}function An(e,t){const n=Ht(e);Ot(e,t);let o=null;if(It(e,t,50331659)){const n=[];o=Y(e,t,n),Dt(e,t,n),Et(e,t,16)}return bt(t,e,n,{type:"CatchClause",param:o,body:Nn(e,t)})}function bn(t,n){const o=Ht(t);Ot(t,n),t.flags&e.Flags.NewLine&&sn(t,n,80);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Ft(t,n),bt(n,t,o,{type:"ThrowStatement",argument:r})}function En(t,n){const o=Ht(t),r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Ft(t,n),bt(n,t,o,{type:"ExpressionStatement",expression:r})}function In(t,n){const o=Ht(t),r=t.tokenRaw.slice(1,-1),a=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Ft(t,n),bt(n,t,o,{type:"ExpressionStatement",expression:a,directive:r})}function On(t,n){const o=Ht(t),{tokenValue:r,token:a}=t,s=ye(t,n&~(e.Context.AllowSingleStatement|e.Context.AllowDecorator)|e.Context.AllowIn);if(135168&a&&16777237===t.token){n&e.Context.Yield&&1073741824&a&&sn(t,n,57),Et(t,n,16777237,83),At(t,r)&&sn(t,n,29,r),yt(t,r);const i=!(n&e.Context.Strict)&&n&e.Context.AllowSingleStatement&&33566808===t.token?ln(t,n):mn(t,n);return ht(t,r),bt(n,t,o,{type:"LabeledStatement",label:s,body:i})}return Ft(t,n),bt(n,t,o,{type:"ExpressionStatement",expression:s})}function vn(t,n){const o=Ht(t);Ot(t,n);const r=Rn(t,n);Et(t,n,12386),Et(t,n,50331659);const a=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Et(t,n,16),It(t,n,17825809),bt(n,t,o,{type:"DoWhileStatement",body:r,test:a})}function Fn(t,n){const o=Ht(t);Ot(t,n),Et(t,n,50331659);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Et(t,n,16),bt(n,t,o,{type:"WhileStatement",test:r,body:Rn(t,n)})}function Nn(e,t){const n=Ht(e),o=[];for(Et(e,t,41943052);17825807!==e.token;)o.push(fn(e,t));return Et(e,t,17825807),bt(t,e,n,{type:"BlockStatement",body:o})}function Ln(t,n){const o=Ht(t);n&(e.Context.OptionsGlobalReturn|e.Context.InFunctionBody)||sn(t,n,18),t.flags&e.Flags.EscapedKeyword&&sn(t,n,3),Ot(t,n);const r=1048576&t.token||t.flags&e.Flags.NewLine?null:ye(t,n&~(e.Context.InFunctionBody|e.Context.AllowDecorator)|e.Context.AllowIn);return Ft(t,n),bt(n,t,o,{type:"ReturnStatement",argument:r})}function Rn(t,n){const o=t.flags;t.flags|=e.Flags.InIterationStatement|e.Flags.AllowDestructuring;const r=mn(t,n&~e.Context.AllowSingleStatement|e.Context.DisallowEscapedKeyword);return t.flags=o,r}function Dn(t,n){n&e.Context.Strict&&sn(t,n,37);const o=Ht(t);Ot(t,n),Et(t,n,50331659);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);return Et(t,n,16),bt(n,t,o,{type:"WithStatement",object:r,body:mn(t,n&~e.Context.AllowSingleStatement)})}function Pn(t,n){const o=Ht(t);Ot(t,n),Et(t,n,50331659);const r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn);Et(t,n,16),Et(t,n|e.Context.DisallowEscapedKeyword,41943052);const a=[],s=t.flags;t.flags|=e.Flags.InSwitchStatement;let i=!1;for(;17825807!==t.token;){const e=Mn(t,n);a.push(e),null===e.test&&(i&&sn(t,n,33),i=!0)}return t.flags=s,Et(t,n,17825807),bt(n,t,o,{type:"SwitchStatement",discriminant:r,cases:a})}function Mn(t,n){const o=Ht(t);let r=null;It(t,n,12363)?r=ye(t,n&~e.Context.AllowDecorator|e.Context.AllowIn):Et(t,n,12368),Et(t,n,16777237);const a=[];for(;!Jt(t);)a.push(fn(t,n|e.Context.AllowIn));return bt(n,t,o,{type:"SwitchCase",test:r,consequent:a})}function jn(e,t,o=!0){const r=Ht(e),{token:a}=e,s=33566793===a;Ot(e,t);const i=xn(e,t,s);return o&&Ft(e,t),bt(t,e,r,{type:"VariableDeclaration",kind:n(a),declarations:i})}function Hn(t,n){Ot(t,n);const o=[];for(;1048576!==t.token;)o.push(33554435===t.token?In(t,n):Bn(t,n|e.Context.AllowIn));return o}function Bn(t,n){switch(t.token){case 120:return it(t,n);case 12371:return Vn(t,n);case 33566810:if(!(n&e.Context.OptionsNext&&Mt(t,n,Tt)))return Tn(t,n);default:return fn(t,n)}}function Vn(t,o){const r=Ht(t),a=[];let s=null,i=null;switch(Et(t,o|e.Context.DisallowEscapedKeyword,12371),t.token){case 167774771:return function(e,t,n){Et(e,t,167774771);const o=Yn(e,t);return Ft(e,t),bt(t,e,n,{type:"ExportAllDeclaration",source:o})}(t,o,r);case 12368:return function(t,n,o){let r;switch(Et(t,n|e.Context.DisallowEscapedKeyword,12368),t.token){case 33566808:r=ln(t,n|e.Context.RequireIdentifier);break;case 120:case 33566797:r=cn(t,n&~e.Context.AllowIn|e.Context.RequireIdentifier);break;case 594028:r=function(t,n){return Mt(t,n,Kt)?dn(t,n|e.Context.RequireIdentifier):Ae(t,n|e.Context.AllowIn)}(t,n|e.Context.RequireIdentifier);break;default:r=Ae(t,n|e.Context.AllowIn),Ft(t,n)}return bt(n,t,o,{type:"ExportDefaultDeclaration",declaration:r})}(t,o,r);case 41943052:{Et(t,o,41943052);let n=!1;for(;17825807!==t.token;)69743!==t.token&&12288&t.token&&(n=!0,$t(t)),a.push(Jn(t,o)),17825807!==t.token&&Et(t,o,16777234);Et(t,o|e.Context.DisallowEscapedKeyword,17825807),69745===t.token?s=Yn(t,o):n&&sn(t,o,46),Ft(t,o);break}case 33566797:i=cn(t,o);break;case 33574984:case 33566793:i=jn(t,o|e.Context.BlockScope);break;case 33566791:i=jn(t,o);break;case 33566808:i=ln(t,o);break;case 594028:if(Mt(t,o,Kt)){i=dn(t,o);break}default:an(t,1,n(t.token))}return bt(o,t,r,{type:"ExportNamedDeclaration",source:s,specifiers:a,declaration:i})}function Jn(t,n){const o=Ht(t),r=Me(t,n|e.Context.DisallowEscapedKeyword,t.token);return bt(n,t,o,{type:"ExportSpecifier",local:r,exported:It(t,n,167843947)?Me(t,n,t.token):r})}function Tn(t,o){const r=Ht(t);let a;Et(t,o,33566810);let s=[];return 33554435===t.token?a=De(t,o):(s=function(e,t){const o=[];switch(e.token){case 33685505:if(o.push(function(e,t){return bt(t,e,Ht(e),{type:"ImportDefaultSpecifier",local:Re(e,t)})}(e,t)),It(e,t,16777234))switch(e.token){case 167774771:Kn(e,t,o);break;case 41943052:Xn(e,t,o);break;default:sn(e,t,1,n(e.token))}break;case 41943052:Xn(e,t,o);break;case 167774771:Kn(e,t,o);break;default:an(e,1,n(e.token))}return o}(t,o|e.Context.DisallowEscapedKeyword),a=Yn(t,o)),Ft(t,o),bt(o,t,r,{type:"ImportDeclaration",specifiers:s,source:a})}function Xn(e,t,n){for(Et(e,t,41943052);17825807!==e.token;)n.push(Gn(e,t)),17825807!==e.token&&Et(e,t,16777234);Et(e,t,17825807)}function Gn(t,n){const o=Ht(t),{token:r}=t,a=Me(t,n|e.Context.DisallowEscapedKeyword,r);let s;return It(t,n,167843947)?s=q(t,n):(vt(r,12288)&&sn(t,n,46),vt(r,4194304)&&sn(t,n,47),s=a),bt(n,t,o,{type:"ImportSpecifier",local:s,imported:a})}function Kn(e,t,n){const o=Ht(e);Et(e,t,167774771),Et(e,t,167843947,82);const r=q(e,t);n.push(bt(t,e,o,{type:"ImportNamespaceSpecifier",local:r}))}function Yn(e,t){return Et(e,t,69745),33554435!==e.token&&an(e,1,n(e.token)),De(e,t)}function qn(t,n){return{source:t,length:t.length,index:0,line:1,column:0,startIndex:0,startColumn:0,startLine:1,lastIndex:0,lastColumn:0,lastLine:0,pendingExpressionError:void 0,flags:e.Flags.AllowDestructuring,token:1048576,tokenRaw:"",lastValue:0,comments:[],sourceFile:n,tokenRegExp:void 0,tokenValue:void 0,labelSet:void 0,errorLocation:void 0,errors:[]}}function Un(t,n,o){let r="";n&&(n.module&&(o|=e.Context.Module),n.next&&(o|=e.Context.OptionsNext),n.jsx&&(o|=e.Context.OptionsJSX),n.ranges&&(o|=e.Context.OptionsRanges),n.loc&&(o|=e.Context.OptionsLoc),n.raw&&(o|=e.Context.OptionsRaw),n.rawIdentifier&&(o|=e.Context.OptionsRawidentifiers),n.globalReturn&&(o|=e.Context.OptionsGlobalReturn),n.skipShebang&&(o|=e.Context.OptionsShebang),n.tolerant&&(o|=e.Context.OptionsTolerant),n.source&&(r=n.source),n.comments&&(o|=e.Context.OptionsComments),n.impliedStrict&&(o|=e.Context.Strict),n.experimental&&(o|=e.Context.OptionsExperimental),n.node&&(o|=e.Context.OptionsNode));const a=qn(t,r),s=o&e.Context.Module?Hn(a,o):$n(a,o),i={type:"Program",sourceType:o&e.Context.Module?"module":"script",body:s};return o&e.Context.LocationTracker&&(o&e.Context.OptionsRanges&&(i.start=0,i.end=t.length),o&e.Context.OptionsLoc&&(i.loc={start:{line:1,column:0},end:{line:a.line,column:a.column}},r&&(i.loc.source=r))),o&e.Context.OptionsComments&&(i.comments=a.comments),o&e.Context.OptionsTolerant&&(i.errors=a.errors),i}function $n(t,n){const o=[];let r=!0;for(Ot(t,n|e.Context.DisallowEscapedKeyword);1048576!==t.token;)r&&33554435!==t.token&&(r=!1),r?(n&e.Context.Strict||12!==t.tokenRaw.length||"use strict"!==t.tokenValue||(n|=e.Context.Strict),o.push(In(t,n))):o.push(fn(t,n));return o}function zn(e,t){return t&&t.module?_n(e,t):Wn(e,t)}function Wn(t,n){return Un(t,n,e.Context.Empty)}function _n(t,n){return Un(t,n,e.Context.Strict|e.Context.Module)}var Qn=Object.freeze({}),Zn=Object.freeze({scanIdentifier:j,scanMaybeIdentifier:H,scanHexIntegerLiteral:O,scanOctalOrBinary:v,scanImplicitOctalDigits:F,scanSignedInteger:N,scanNumericLiteral:L,scanNumericSeparator:R,scanDecimalDigitsOrSeparator:D,scanDecimalAsSmi:P,scanRegularExpression:K,scan:G,scanEscapeSequence:y,throwStringError:h,scanString:A,consumeTemplateBrace:b,scanTemplate:E,skipSingleHTMLComment:V,skipSingleLineComment:J,skipMultiLineComment:T,addComment:X,nextUnicodeChar:u,isIdentifierPart:d,escapeInvalidCharacters:p,consumeOpt:x,consumeLineFeed:f,scanPrivateName:m,advanceNewline:g,fromCodePoint:S,readNext:C,toHex:k,advanceOnMaybeAstral:w});const eo=Object.freeze({parseClassDeclaration:cn,parseFunctionDeclaration:ln,parseAsyncFunctionOrAsyncGeneratorDeclaration:dn,parseVariableDeclarationList:xn,parseExpression:ye,parseSequenceExpression:he,parseAssignmentExpression:Ae,parseRestElement:Ee,parseLeftHandSideExpression:Oe,parsePrimaryExpression:Le,parseIdentifier:Re,parseLiteral:De,parseBigIntLiteral:Pe,parseIdentifierName:Me,parseFunctionExpression:Be,parseAsyncFunctionOrAsyncGeneratorExpression:Ve,parsePropertyName:Je,parseObjectLiteral:Xe,parseFormalListAndBody:Ue,parseFunctionBody:$e,parseFormalParameters:ze,parseFormalParameterList:We,parseClassBodyAndElementList:_e,parseClassElement:Qe,parseDecorators:it,parseModuleItemList:Hn,parseModuleItem:Bn,parseExportDeclaration:Vn,parseImportDeclaration:Tn,createParser:qn,parseSource:Un,parseStatementList:$n,parse:zn,parseScript:Wn,parseModule:_n,parseBindingIdentifierOrPattern:Y,parseBindingIdentifier:q,parseAssignmentRestElement:U,parseAssignmentPattern:z,parseBindingInitializer:W,parseStatementListItem:fn,parseStatement:mn,parseEmptyStatement:gn,parseContinueStatement:Sn,parseBreakStatement:Cn,parseIfStatement:kn,parseDebuggerStatement:yn,parseTryStatement:hn,parseCatchBlock:An,parseThrowStatement:bn,parseExpressionStatement:En,parseDirective:In,parseExpressionOrLabelledStatement:On,parseDoWhileStatement:vn,parseWhileStatement:Fn,parseBlockStatement:Nn,parseReturnStatement:Ln,parseIterationStatement:Rn,parseWithStatement:Dn,parseSwitchStatement:Pn,parseCaseOrDefaultClauses:Mn,parseVariableStatement:jn,parseJSXRootElement:Q,parseJSXOpeningElement:Z,nextJSXToken:ee,scanJSXToken:te,parseJSXText:oe,parseJSXAttributes:ae,parseJSXSpreadAttribute:se,parseJSXNamespacedName:ie,parseJSXAttributeName:ce,parseJSXAttribute:ue,parseJSXEmptyExpression:de,parseJSXSpreadChild:pe,parseJSXExpressionContainer:xe,parseJSXExpression:fe,parseJSXClosingFragment:me,parseJSXClosingElement:ge,parseJSXIdentifier:Se,parseJSXMemberExpression:Ce,parseJSXElementName:ke,scanJSXIdentifier:we});e.version="1.6.9",e.ESTree=Qn,e.Scanner=Zn,e.parse=zn,e.parseSource=Un,e.parseModule=_n,e.parseScript=Wn,e.characterType=a,e.errorMessages=nn,e.constructError=on,e.report=an,e.tolerant=sn,e.tokenDesc=n,e.descKeyword=r,e.Parser=eo,e.isValidIdentifierPart=s,e.isValidIdentifierStart=i,e.mustEscape=c,e.validateBreakOrContinueLabel=wt,e.addLabel=yt,e.popLabel=ht,e.hasLabel=At,e.finishNode=bt,e.expect=Et,e.consume=It,e.nextToken=Ot,e.hasBit=vt,e.consumeSemicolon=Ft,e.parseExpressionCoverGrammar=Nt,e.restoreExpressionCoverGrammar=Lt,e.swapContext=Rt,e.validateParams=Dt,e.reinterpret=Pt,e.lookahead=Mt,e.isValidSimpleAssignmentTarget=jt,e.getLocation=Ht,e.isValidIdentifier=Bt,e.isLexical=Vt,e.isEndOfCaseOrDefaultClauses=Jt,e.nextTokenIsLeftParenOrPeriod=Tt,e.nextTokenisIdentifierOrParen=Xt,e.nextTokenIsLeftParen=Gt,e.nextTokenIsFuncKeywordOnSameLine=Kt,e.isPropertyWithPrivateFieldKey=Yt,e.parseAndClassifyIdentifier=qt,e.nameIsArgumentsOrEval=Ut,e.setPendingError=$t,e.isEqualTagNames=zt,e.isInstanceField=Wt,e.validateUpdateExpression=_t,e.setPendingExpressionError=Qt,e.validateCoverParenthesizedExpression=Zt,e.validateAsyncArgumentList=en,e.isInOrOf=tn,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/node_modules/cherow/package.json b/node_modules/cherow/package.json new file mode 100644 index 0000000..bc7abe3 --- /dev/null +++ b/node_modules/cherow/package.json @@ -0,0 +1,92 @@ +{ + "name": "cherow", + "version": "1.6.9", + "description": "Fast and lightweight, standard-compliant javascript parser written in ECMAScript", + "main": "dist/umd/cherow.js", + "module": "dist/es2015/cherow.js", + "jsnext:main": "dist/es2015/cherow.js", + "types": "dist/types/cherow.d.ts", + "typings": "dist/types/cherow.d.ts", + "author": "KFlash", + "contributors": [ + "Fred Kleuver <https://github.com/fkleuver>" + ], + "license": "ISC", + "homepage": "https://github.com/cherow/cherow", + "repository": { + "type": "git", + "url": "https://github.com/cherow/cherow" + }, + "bugs": { + "url": "https://github.com/cherow/cherow/issues" + }, + "keywords": [ + "parsing", + "ecmascript", + "typescript", + "parser", + "performance", + "tolerant", + "estree", + "es2018", + "es2019", + "ECMAScript 2019", + "esnext", + "javascript", + "ast", + "jsx", + "tolerant", + "lightweight" + ], + "files": [ + "dist", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "README.md", + "LICENSE.md" + ], + "scripts": { + "lint": "cross-env ./node_modules/.bin/nps lint", + "build": "cross-env ./node_modules/.bin/nps build.default", + "minify": "cross-env ./node_modules/.bin/nps build.minify", + "test": "cross-env ./node_modules/.bin/nps test", + "test:watch": "cross-env ./node_modules/.bin/nps test.watch", + "coverage": "cross-env ./node_modules/.bin/nps coverage", + "post_coverage": "cross-env ./node_modules/.bin/nps coverage.post" + }, + "devDependencies": { + "@types/mocha": "^5.2.1", + "@types/node": "^10.3.2", + "clean-assert": "^2.0.0", + "coveralls": "^3.0.1", + "cross-env": "^5.1.6", + "lerna": "^2.11.0", + "mocha": "^5.2.0", + "move-cli": "^1.1.2", + "nps": "^5.9.0", + "nps-utils": "^1.5.0", + "nyc": "^11.8.0", + "rollup": "^0.60.1", + "rollup-plugin-commonjs": "^9.1.3", + "rollup-plugin-node-resolve": "^3.3.0", + "rollup-plugin-replace": "^2.0.0", + "rollup-plugin-typescript2": "^0.14.0", + "rollup-plugin-uglify": "^3.0.0", + "ts-node": "^6.1.0", + "tsconfig-paths": "^3.3.2", + "tslint": "^5.10.0", + "tslint-microsoft-contrib": "^5.0.3", + "typescript": "^2.9.1", + "unicode-11.0.0": "^0.7.7" + }, + "nyc": { + "reporter": [ + "lcov", + "text" + ], + "exclude": [ + "build/test/**/*.*" + ] + }, + "dependencies": {} +} |