jass 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +47 -0
- data/README.md +45 -0
- data/lib/jass.rb +55 -0
- data/lib/jass/base.rb +141 -0
- data/lib/jass/bundle_processor.rb +28 -0
- data/lib/jass/compiler.rb +112 -0
- data/lib/jass/dependency.rb +14 -0
- data/lib/jass/errors.rb +29 -0
- data/lib/jass/es6_processor.rb +17 -0
- data/lib/jass/function.rb +13 -0
- data/lib/jass/global_directive_processor.rb +12 -0
- data/lib/jass/plugin.rb +13 -0
- data/lib/jass/railtie.rb +12 -0
- data/lib/jass/version.rb +3 -0
- data/vendor/node_modules/@types/acorn/index.d.ts +256 -0
- data/vendor/node_modules/@types/acorn/package.json +29 -0
- data/vendor/node_modules/@types/estree/index.d.ts +546 -0
- data/vendor/node_modules/@types/estree/package.json +22 -0
- data/vendor/node_modules/acorn-dynamic-import/lib/index.js +17 -0
- data/vendor/node_modules/acorn-dynamic-import/lib/inject.js +72 -0
- data/vendor/node_modules/acorn-dynamic-import/lib/walk.js +22 -0
- data/vendor/node_modules/acorn-dynamic-import/package.json +45 -0
- data/vendor/node_modules/acorn-dynamic-import/src/index.js +4 -0
- data/vendor/node_modules/acorn-dynamic-import/src/inject.js +52 -0
- data/vendor/node_modules/acorn-dynamic-import/src/walk.js +12 -0
- data/vendor/node_modules/acorn-es7-plugin/acorn-es7-plugin.js +17 -0
- data/vendor/node_modules/acorn-es7-plugin/acorn-v3.js +333 -0
- data/vendor/node_modules/acorn-es7-plugin/acorn-v4.js +194 -0
- data/vendor/node_modules/acorn-es7-plugin/package.json +29 -0
- data/vendor/node_modules/acorn-jsx/index.js +3 -0
- data/vendor/node_modules/acorn-jsx/inject.js +449 -0
- data/vendor/node_modules/acorn-jsx/package.json +28 -0
- data/vendor/node_modules/acorn-jsx/xhtml.js +255 -0
- data/vendor/node_modules/acorn/bin/_acorn.js +69 -0
- data/vendor/node_modules/acorn/bin/acorn +4 -0
- data/vendor/node_modules/acorn/bin/run_test262.js +22 -0
- data/vendor/node_modules/acorn/bin/test262.whitelist +409 -0
- data/vendor/node_modules/acorn/dist/acorn.es.js +5305 -0
- data/vendor/node_modules/acorn/dist/acorn.js +5336 -0
- data/vendor/node_modules/acorn/dist/acorn_loose.es.js +1412 -0
- data/vendor/node_modules/acorn/dist/acorn_loose.js +1422 -0
- data/vendor/node_modules/acorn/dist/walk.es.js +419 -0
- data/vendor/node_modules/acorn/dist/walk.js +439 -0
- data/vendor/node_modules/acorn/package.json +56 -0
- data/vendor/node_modules/ansi-styles/index.js +165 -0
- data/vendor/node_modules/ansi-styles/package.json +56 -0
- data/vendor/node_modules/arr-diff/index.js +58 -0
- data/vendor/node_modules/arr-diff/package.json +49 -0
- data/vendor/node_modules/arr-flatten/index.js +22 -0
- data/vendor/node_modules/arr-flatten/package.json +76 -0
- data/vendor/node_modules/array-unique/index.js +28 -0
- data/vendor/node_modules/array-unique/package.json +37 -0
- data/vendor/node_modules/braces/index.js +399 -0
- data/vendor/node_modules/braces/package.json +83 -0
- data/vendor/node_modules/buble/bin/buble +24 -0
- data/vendor/node_modules/buble/bin/handleError.js +58 -0
- data/vendor/node_modules/buble/bin/runBuble.js +150 -0
- data/vendor/node_modules/buble/bin/showHelp.js +16 -0
- data/vendor/node_modules/buble/dist/buble-browser-deps.umd.js +14857 -0
- data/vendor/node_modules/buble/dist/buble-browser.cjs.js +9941 -0
- data/vendor/node_modules/buble/dist/buble-browser.es.js +9933 -0
- data/vendor/node_modules/buble/dist/buble.cjs.js +9433 -0
- data/vendor/node_modules/buble/dist/buble.es.js +9425 -0
- data/vendor/node_modules/buble/package.json +74 -0
- data/vendor/node_modules/buble/register.js +90 -0
- data/vendor/node_modules/buble/src/index.js +98 -0
- data/vendor/node_modules/buble/src/program/BlockStatement.js +373 -0
- data/vendor/node_modules/buble/src/program/Node.js +112 -0
- data/vendor/node_modules/buble/src/program/Program.js +74 -0
- data/vendor/node_modules/buble/src/program/Scope.js +116 -0
- data/vendor/node_modules/buble/src/program/extractNames.js +35 -0
- data/vendor/node_modules/buble/src/program/keys.js +4 -0
- data/vendor/node_modules/buble/src/program/types/ArrayExpression.js +70 -0
- data/vendor/node_modules/buble/src/program/types/ArrowFunctionExpression.js +52 -0
- data/vendor/node_modules/buble/src/program/types/AssignmentExpression.js +185 -0
- data/vendor/node_modules/buble/src/program/types/BinaryExpression.js +12 -0
- data/vendor/node_modules/buble/src/program/types/BreakStatement.js +26 -0
- data/vendor/node_modules/buble/src/program/types/CallExpression.js +104 -0
- data/vendor/node_modules/buble/src/program/types/ClassBody.js +237 -0
- data/vendor/node_modules/buble/src/program/types/ClassDeclaration.js +79 -0
- data/vendor/node_modules/buble/src/program/types/ClassExpression.js +51 -0
- data/vendor/node_modules/buble/src/program/types/ContinueStatement.js +17 -0
- data/vendor/node_modules/buble/src/program/types/ExportDefaultDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/types/ExportNamedDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/types/ForInStatement.js +76 -0
- data/vendor/node_modules/buble/src/program/types/ForOfStatement.js +89 -0
- data/vendor/node_modules/buble/src/program/types/ForStatement.js +54 -0
- data/vendor/node_modules/buble/src/program/types/FunctionDeclaration.js +25 -0
- data/vendor/node_modules/buble/src/program/types/FunctionExpression.js +74 -0
- data/vendor/node_modules/buble/src/program/types/Identifier.js +54 -0
- data/vendor/node_modules/buble/src/program/types/IfStatement.js +29 -0
- data/vendor/node_modules/buble/src/program/types/ImportDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/types/ImportDefaultSpecifier.js +8 -0
- data/vendor/node_modules/buble/src/program/types/ImportSpecifier.js +8 -0
- data/vendor/node_modules/buble/src/program/types/JSXAttribute.js +20 -0
- data/vendor/node_modules/buble/src/program/types/JSXClosingElement.js +27 -0
- data/vendor/node_modules/buble/src/program/types/JSXClosingFragment.js +22 -0
- data/vendor/node_modules/buble/src/program/types/JSXElement.js +57 -0
- data/vendor/node_modules/buble/src/program/types/JSXExpressionContainer.js +10 -0
- data/vendor/node_modules/buble/src/program/types/JSXFragment.js +4 -0
- data/vendor/node_modules/buble/src/program/types/JSXOpeningElement.js +93 -0
- data/vendor/node_modules/buble/src/program/types/JSXOpeningFragment.js +7 -0
- data/vendor/node_modules/buble/src/program/types/JSXSpreadAttribute.js +10 -0
- data/vendor/node_modules/buble/src/program/types/Literal.js +43 -0
- data/vendor/node_modules/buble/src/program/types/MemberExpression.js +13 -0
- data/vendor/node_modules/buble/src/program/types/NewExpression.js +55 -0
- data/vendor/node_modules/buble/src/program/types/ObjectExpression.js +250 -0
- data/vendor/node_modules/buble/src/program/types/Property.js +52 -0
- data/vendor/node_modules/buble/src/program/types/ReturnStatement.js +32 -0
- data/vendor/node_modules/buble/src/program/types/SpreadElement.js +12 -0
- data/vendor/node_modules/buble/src/program/types/Super.js +88 -0
- data/vendor/node_modules/buble/src/program/types/TaggedTemplateExpression.js +63 -0
- data/vendor/node_modules/buble/src/program/types/TemplateElement.js +7 -0
- data/vendor/node_modules/buble/src/program/types/TemplateLiteral.js +80 -0
- data/vendor/node_modules/buble/src/program/types/ThisExpression.js +31 -0
- data/vendor/node_modules/buble/src/program/types/UpdateExpression.js +32 -0
- data/vendor/node_modules/buble/src/program/types/VariableDeclaration.js +101 -0
- data/vendor/node_modules/buble/src/program/types/VariableDeclarator.js +43 -0
- data/vendor/node_modules/buble/src/program/types/index.js +98 -0
- data/vendor/node_modules/buble/src/program/types/shared/LoopStatement.js +105 -0
- data/vendor/node_modules/buble/src/program/types/shared/ModuleDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/wrap.js +68 -0
- data/vendor/node_modules/buble/src/support.js +97 -0
- data/vendor/node_modules/buble/src/utils/CompileError.js +30 -0
- data/vendor/node_modules/buble/src/utils/array.js +11 -0
- data/vendor/node_modules/buble/src/utils/checkConst.js +8 -0
- data/vendor/node_modules/buble/src/utils/deindent.js +30 -0
- data/vendor/node_modules/buble/src/utils/destructure.js +377 -0
- data/vendor/node_modules/buble/src/utils/getSnippet.js +30 -0
- data/vendor/node_modules/buble/src/utils/isReference.js +41 -0
- data/vendor/node_modules/buble/src/utils/locate.js +20 -0
- data/vendor/node_modules/buble/src/utils/patterns.js +1 -0
- data/vendor/node_modules/buble/src/utils/removeTrailingComma.js +13 -0
- data/vendor/node_modules/buble/src/utils/reserved.js +6 -0
- data/vendor/node_modules/buble/src/utils/spread.js +70 -0
- data/vendor/node_modules/builtin-modules/builtin-modules.json +39 -0
- data/vendor/node_modules/builtin-modules/index.js +10 -0
- data/vendor/node_modules/builtin-modules/package.json +40 -0
- data/vendor/node_modules/builtin-modules/static.js +2 -0
- data/vendor/node_modules/chalk/index.js +228 -0
- data/vendor/node_modules/chalk/package.json +66 -0
- data/vendor/node_modules/chalk/templates.js +128 -0
- data/vendor/node_modules/chalk/types/index.d.ts +97 -0
- data/vendor/node_modules/color-convert/conversions.js +861 -0
- data/vendor/node_modules/color-convert/index.js +78 -0
- data/vendor/node_modules/color-convert/package.json +46 -0
- data/vendor/node_modules/color-convert/route.js +97 -0
- data/vendor/node_modules/color-name/index.js +152 -0
- data/vendor/node_modules/color-name/package.json +25 -0
- data/vendor/node_modules/color-name/test.js +7 -0
- data/vendor/node_modules/date-time/index.js +33 -0
- data/vendor/node_modules/date-time/package.json +39 -0
- data/vendor/node_modules/escape-string-regexp/index.js +11 -0
- data/vendor/node_modules/escape-string-regexp/package.json +41 -0
- data/vendor/node_modules/estree-walker/dist/estree-walker.es.js +57 -0
- data/vendor/node_modules/estree-walker/dist/estree-walker.umd.js +68 -0
- data/vendor/node_modules/estree-walker/package.json +34 -0
- data/vendor/node_modules/estree-walker/src/estree-walker.js +51 -0
- data/vendor/node_modules/expand-brackets/index.js +163 -0
- data/vendor/node_modules/expand-brackets/package.json +62 -0
- data/vendor/node_modules/expand-range/index.js +43 -0
- data/vendor/node_modules/expand-range/package.json +73 -0
- data/vendor/node_modules/extglob/index.js +178 -0
- data/vendor/node_modules/extglob/package.json +60 -0
- data/vendor/node_modules/filename-regex/index.js +10 -0
- data/vendor/node_modules/filename-regex/package.json +50 -0
- data/vendor/node_modules/fill-range/index.js +408 -0
- data/vendor/node_modules/fill-range/package.json +61 -0
- data/vendor/node_modules/for-in/index.js +16 -0
- data/vendor/node_modules/for-in/package.json +68 -0
- data/vendor/node_modules/for-own/index.js +19 -0
- data/vendor/node_modules/for-own/package.json +70 -0
- data/vendor/node_modules/glob-base/index.js +51 -0
- data/vendor/node_modules/glob-base/package.json +52 -0
- data/vendor/node_modules/glob-parent/index.js +10 -0
- data/vendor/node_modules/glob-parent/package.json +35 -0
- data/vendor/node_modules/glob-parent/test.js +28 -0
- data/vendor/node_modules/has-flag/index.js +8 -0
- data/vendor/node_modules/has-flag/package.json +44 -0
- data/vendor/node_modules/irregular-plurals/irregular-plurals.json +146 -0
- data/vendor/node_modules/irregular-plurals/package.json +39 -0
- data/vendor/node_modules/is-buffer/index.js +21 -0
- data/vendor/node_modules/is-buffer/package.json +51 -0
- data/vendor/node_modules/is-dotfile/index.js +14 -0
- data/vendor/node_modules/is-dotfile/package.json +69 -0
- data/vendor/node_modules/is-equal-shallow/index.js +27 -0
- data/vendor/node_modules/is-equal-shallow/package.json +54 -0
- data/vendor/node_modules/is-extendable/index.js +13 -0
- data/vendor/node_modules/is-extendable/package.json +51 -0
- data/vendor/node_modules/is-extglob/index.js +11 -0
- data/vendor/node_modules/is-extglob/package.json +48 -0
- data/vendor/node_modules/is-glob/index.js +14 -0
- data/vendor/node_modules/is-glob/package.json +60 -0
- data/vendor/node_modules/is-module/index.js +11 -0
- data/vendor/node_modules/is-module/package.json +20 -0
- data/vendor/node_modules/is-number/index.js +19 -0
- data/vendor/node_modules/is-number/package.json +59 -0
- data/vendor/node_modules/is-posix-bracket/index.js +10 -0
- data/vendor/node_modules/is-posix-bracket/package.json +64 -0
- data/vendor/node_modules/is-primitive/index.js +13 -0
- data/vendor/node_modules/is-primitive/package.json +46 -0
- data/vendor/node_modules/is-reference/dist/is-reference.es.js +26 -0
- data/vendor/node_modules/is-reference/dist/is-reference.js +34 -0
- data/vendor/node_modules/is-reference/dist/types/index.d.ts +2 -0
- data/vendor/node_modules/is-reference/package.json +47 -0
- data/vendor/node_modules/isarray/index.js +5 -0
- data/vendor/node_modules/isarray/package.json +45 -0
- data/vendor/node_modules/isarray/test.js +20 -0
- data/vendor/node_modules/isobject/index.js +14 -0
- data/vendor/node_modules/isobject/package.json +67 -0
- data/vendor/node_modules/kind-of/index.js +116 -0
- data/vendor/node_modules/kind-of/package.json +90 -0
- data/vendor/node_modules/locate-character/dist/locate-character.es.js +43 -0
- data/vendor/node_modules/locate-character/dist/locate-character.umd.js +54 -0
- data/vendor/node_modules/locate-character/dist/types/index.d.ts +17 -0
- data/vendor/node_modules/locate-character/package.json +41 -0
- data/vendor/node_modules/magic-string/dist/magic-string.cjs.js +1300 -0
- data/vendor/node_modules/magic-string/dist/magic-string.es.js +1296 -0
- data/vendor/node_modules/magic-string/dist/magic-string.umd.js +1352 -0
- data/vendor/node_modules/magic-string/index.d.ts +83 -0
- data/vendor/node_modules/magic-string/node_modules/vlq/dist/vlq.js +91 -0
- data/vendor/node_modules/magic-string/node_modules/vlq/package.json +27 -0
- data/vendor/node_modules/magic-string/node_modules/vlq/src/vlq.js +78 -0
- data/vendor/node_modules/magic-string/package.json +55 -0
- data/vendor/node_modules/micromatch/index.js +431 -0
- data/vendor/node_modules/micromatch/lib/chars.js +67 -0
- data/vendor/node_modules/micromatch/lib/expand.js +304 -0
- data/vendor/node_modules/micromatch/lib/glob.js +193 -0
- data/vendor/node_modules/micromatch/lib/utils.js +149 -0
- data/vendor/node_modules/micromatch/package.json +114 -0
- data/vendor/node_modules/minimist/index.js +236 -0
- data/vendor/node_modules/minimist/package.json +45 -0
- data/vendor/node_modules/nodent-compiler/compiler.js +171 -0
- data/vendor/node_modules/nodent-compiler/lib/arboriculture.js +2694 -0
- data/vendor/node_modules/nodent-compiler/lib/output.js +934 -0
- data/vendor/node_modules/nodent-compiler/lib/parser.js +291 -0
- data/vendor/node_modules/nodent-compiler/package.json +37 -0
- data/vendor/node_modules/normalize-path/index.js +19 -0
- data/vendor/node_modules/normalize-path/package.json +78 -0
- data/vendor/node_modules/object.omit/index.js +40 -0
- data/vendor/node_modules/object.omit/package.json +67 -0
- data/vendor/node_modules/os-homedir/index.js +24 -0
- data/vendor/node_modules/os-homedir/package.json +41 -0
- data/vendor/node_modules/parse-glob/index.js +156 -0
- data/vendor/node_modules/parse-glob/package.json +62 -0
- data/vendor/node_modules/parse-ms/index.js +16 -0
- data/vendor/node_modules/parse-ms/package.json +34 -0
- data/vendor/node_modules/path-parse/index.js +93 -0
- data/vendor/node_modules/path-parse/index.min.js +1 -0
- data/vendor/node_modules/path-parse/package.json +33 -0
- data/vendor/node_modules/path-parse/test.js +77 -0
- data/vendor/node_modules/path-parse/test.min.js +1 -0
- data/vendor/node_modules/plur/index.js +20 -0
- data/vendor/node_modules/plur/package.json +42 -0
- data/vendor/node_modules/preserve/index.js +54 -0
- data/vendor/node_modules/preserve/package.json +48 -0
- data/vendor/node_modules/preserve/test.js +48 -0
- data/vendor/node_modules/pretty-ms/index.js +48 -0
- data/vendor/node_modules/pretty-ms/package.json +48 -0
- data/vendor/node_modules/randomatic/index.js +82 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/index.js +22 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +116 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +90 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/package.json +83 -0
- data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +119 -0
- data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +90 -0
- data/vendor/node_modules/randomatic/package.json +78 -0
- data/vendor/node_modules/regex-cache/index.js +68 -0
- data/vendor/node_modules/regex-cache/package.json +64 -0
- data/vendor/node_modules/remove-trailing-separator/index.js +17 -0
- data/vendor/node_modules/remove-trailing-separator/package.json +37 -0
- data/vendor/node_modules/repeat-element/index.js +18 -0
- data/vendor/node_modules/repeat-element/package.json +44 -0
- data/vendor/node_modules/repeat-string/index.js +70 -0
- data/vendor/node_modules/repeat-string/package.json +77 -0
- data/vendor/node_modules/require-relative/index.js +33 -0
- data/vendor/node_modules/require-relative/package.json +22 -0
- data/vendor/node_modules/resolve/index.js +8 -0
- data/vendor/node_modules/resolve/lib/async.js +203 -0
- data/vendor/node_modules/resolve/lib/caller.js +8 -0
- data/vendor/node_modules/resolve/lib/core.js +53 -0
- data/vendor/node_modules/resolve/lib/core.json +69 -0
- data/vendor/node_modules/resolve/lib/node-modules-paths.js +45 -0
- data/vendor/node_modules/resolve/lib/sync.js +93 -0
- data/vendor/node_modules/resolve/package.json +40 -0
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +804 -0
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +800 -0
- data/vendor/node_modules/rollup-plugin-commonjs/package.json +52 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/ast-utils.js +104 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/defaultResolver.js +39 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/helpers.js +19 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +198 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +431 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/utils.js +13 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +218 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +214 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/package.json +51 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/src/empty.js +1 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +205 -0
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +223 -0
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +214 -0
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +217 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +55 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +59 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +65 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +33 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +49 -0
- data/vendor/node_modules/rollup-pluginutils/package.json +40 -0
- data/vendor/node_modules/rollup-pluginutils/src/addExtension.js +6 -0
- data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +147 -0
- data/vendor/node_modules/rollup-pluginutils/src/createFilter.js +33 -0
- data/vendor/node_modules/rollup-pluginutils/src/index.js +4 -0
- data/vendor/node_modules/rollup-pluginutils/src/makeLegalIdentifier.js +15 -0
- data/vendor/node_modules/rollup-pluginutils/src/utils/ensureArray.js +5 -0
- data/vendor/node_modules/rollup/bin/rollup +4085 -0
- data/vendor/node_modules/rollup/dist/rollup.browser.js +19829 -0
- data/vendor/node_modules/rollup/dist/rollup.es.js +23586 -0
- data/vendor/node_modules/rollup/dist/rollup.js +23597 -0
- data/vendor/node_modules/rollup/dist/typings/Chunk.d.ts +85 -0
- data/vendor/node_modules/rollup/dist/typings/ExternalModule.d.ts +30 -0
- data/vendor/node_modules/rollup/dist/typings/Graph.d.ts +47 -0
- data/vendor/node_modules/rollup/dist/typings/Module.d.ts +130 -0
- data/vendor/node_modules/rollup/dist/typings/ast/CallOptions.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/Entity.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/ExecutionPathOptions.d.ts +57 -0
- data/vendor/node_modules/rollup/dist/typings/ast/clone.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/ast/enhance.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/ast/keys.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayExpression.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayPattern.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrowFunctionExpression.d.ts +25 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentPattern.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentProperty.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AwaitExpression.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/BinaryExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/BlockStatement.d.ts +19 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/BreakStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/CallExpression.d.ts +22 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/CatchClause.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassBody.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassDeclaration.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassExpression.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ConditionalExpression.d.ts +28 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/DoWhileStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/EmptyStatement.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportAllDeclaration.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportDefaultDeclaration.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportNamedDeclaration.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportSpecifier.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExpressionStatement.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForInStatement.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForOfStatement.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForStatement.d.ts +19 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionDeclaration.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionExpression.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Identifier.d.ts +29 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/IfStatement.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Import.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDeclaration.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDefaultSpecifier.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportNamespaceSpecifier.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportSpecifier.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/LabeledStatement.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Literal.d.ts +22 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/LogicalExpression.d.ts +23 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/MemberExpression.d.ts +34 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/MethodDefinition.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/NewExpression.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/NodeType.d.ts +64 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectExpression.d.ts +22 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectPattern.d.ts +15 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Program.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Property.d.ts +30 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/RestElement.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ReturnStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SequenceExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SpreadElement.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchCase.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchStatement.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/TaggedTemplateExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateElement.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateLiteral.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThisExpression.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThrowStatement.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnaryExpression.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnknownNode.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/UpdateExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclaration.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclarator.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/WhileStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/YieldExpression.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/index.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/ClassNode.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Expression.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/FunctionNode.d.ts +25 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Node.d.ts +133 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Pattern.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/pureFunctions.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/BlockScope.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/CatchScope.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/FunctionScope.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/GlobalScope.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/ModuleScope.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/ParameterScope.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/ReturnValueScope.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/Scope.d.ts +42 -0
- data/vendor/node_modules/rollup/dist/typings/ast/utils/extractNames.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/ast/values.d.ts +31 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ArgumentsVariable.d.ts +15 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ExportDefaultVariable.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ExternalVariable.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/GlobalVariable.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/LocalVariable.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/NamespaceVariable.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ParameterVariable.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ReplaceableInitializationVariable.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ThisVariable.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/Variable.d.ts +43 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/VariableReassignmentTracker.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/amd.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/cjs.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/es.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/iife.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/index.d.ts +15 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/esModuleExport.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getExportBlock.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getGlobalNameMaker.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getInteropBlock.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/sanitize.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/setupNamespace.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/trimEmptyImports.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/warnOnBuiltins.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/system.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/umd.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/node-entry.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/rollup/index.d.ts +167 -0
- data/vendor/node_modules/rollup/dist/typings/utils/callIfFunction.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/collapseSourcemaps.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/utils/commondir.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/defaults.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/utils/deprecateOptions.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/utils/ensureArray.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/utils/entryHashing.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/error.d.ts +18 -0
- data/vendor/node_modules/rollup/dist/typings/utils/first-sync.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/first.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/flushTime.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/utils/fs.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/getCodeFrame.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/getExportMode.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/getIndentString.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/utils/identifierHelpers.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/mergeOptions.d.ts +19 -0
- data/vendor/node_modules/rollup/dist/typings/utils/object.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/utils/path.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/utils/promise.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/utils/relativeId.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/renderHelpers.d.ts +26 -0
- data/vendor/node_modules/rollup/dist/typings/utils/sourceMappingURL.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/timers.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/utils/transform.d.ts +25 -0
- data/vendor/node_modules/rollup/dist/typings/utils/transformBundle.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/watch/chokidar.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/watch/fileWatchers.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/watch/index.d.ts +47 -0
- data/vendor/node_modules/rollup/package.json +122 -0
- data/vendor/node_modules/rollup/typings/package.json.d.ts +3 -0
- data/vendor/node_modules/signal-exit/index.js +157 -0
- data/vendor/node_modules/signal-exit/package.json +38 -0
- data/vendor/node_modules/signal-exit/signals.js +53 -0
- data/vendor/node_modules/source-map/dist/source-map.debug.js +3091 -0
- data/vendor/node_modules/source-map/dist/source-map.js +3090 -0
- data/vendor/node_modules/source-map/dist/source-map.min.js +2 -0
- data/vendor/node_modules/source-map/lib/array-set.js +121 -0
- data/vendor/node_modules/source-map/lib/base64-vlq.js +140 -0
- data/vendor/node_modules/source-map/lib/base64.js +67 -0
- data/vendor/node_modules/source-map/lib/binary-search.js +111 -0
- data/vendor/node_modules/source-map/lib/mapping-list.js +79 -0
- data/vendor/node_modules/source-map/lib/quick-sort.js +114 -0
- data/vendor/node_modules/source-map/lib/source-map-consumer.js +1082 -0
- data/vendor/node_modules/source-map/lib/source-map-generator.js +416 -0
- data/vendor/node_modules/source-map/lib/source-node.js +413 -0
- data/vendor/node_modules/source-map/lib/util.js +417 -0
- data/vendor/node_modules/source-map/package.json +72 -0
- data/vendor/node_modules/source-map/source-map.js +8 -0
- data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.es.js +129 -0
- data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.umd.js +140 -0
- data/vendor/node_modules/sourcemap-codec/dist/types/sourcemap-codec.d.ts +5 -0
- data/vendor/node_modules/sourcemap-codec/package.json +52 -0
- data/vendor/node_modules/supports-color/browser.js +5 -0
- data/vendor/node_modules/supports-color/index.js +135 -0
- data/vendor/node_modules/supports-color/package.json +53 -0
- data/vendor/node_modules/time-zone/index.js +10 -0
- data/vendor/node_modules/time-zone/package.json +35 -0
- data/vendor/node_modules/vlq/dist/types/vlq.d.ts +2 -0
- data/vendor/node_modules/vlq/dist/vlq.es.js +64 -0
- data/vendor/node_modules/vlq/dist/vlq.js +75 -0
- data/vendor/node_modules/vlq/package.json +30 -0
- data/vendor/package.json +15 -0
- data/vendor/yarn.lock +453 -0
- metadata +641 -0
@@ -0,0 +1,1422 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./acorn')) :
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', './acorn'], factory) :
|
4
|
+
(factory((global.acorn = global.acorn || {}, global.acorn.loose = {}),global.acorn));
|
5
|
+
}(this, (function (exports,__acorn) { 'use strict';
|
6
|
+
|
7
|
+
function noop() {}
|
8
|
+
|
9
|
+
// Registered plugins
|
10
|
+
var pluginsLoose = {};
|
11
|
+
|
12
|
+
var LooseParser = function LooseParser(input, options) {
|
13
|
+
if ( options === void 0 ) options = {};
|
14
|
+
|
15
|
+
this.toks = __acorn.tokenizer(input, options);
|
16
|
+
this.options = this.toks.options;
|
17
|
+
this.input = this.toks.input;
|
18
|
+
this.tok = this.last = {type: __acorn.tokTypes.eof, start: 0, end: 0};
|
19
|
+
this.tok.validateRegExpFlags = noop;
|
20
|
+
this.tok.validateRegExpPattern = noop;
|
21
|
+
if (this.options.locations) {
|
22
|
+
var here = this.toks.curPosition();
|
23
|
+
this.tok.loc = new __acorn.SourceLocation(this.toks, here, here);
|
24
|
+
}
|
25
|
+
this.ahead = []; // Tokens ahead
|
26
|
+
this.context = []; // Indentation contexted
|
27
|
+
this.curIndent = 0;
|
28
|
+
this.curLineStart = 0;
|
29
|
+
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
|
30
|
+
this.inAsync = false;
|
31
|
+
// Load plugins
|
32
|
+
this.options.pluginsLoose = options.pluginsLoose || {};
|
33
|
+
this.loadPlugins(this.options.pluginsLoose);
|
34
|
+
};
|
35
|
+
|
36
|
+
LooseParser.prototype.startNode = function startNode () {
|
37
|
+
return new __acorn.Node(this.toks, this.tok.start, this.options.locations ? this.tok.loc.start : null)
|
38
|
+
};
|
39
|
+
|
40
|
+
LooseParser.prototype.storeCurrentPos = function storeCurrentPos () {
|
41
|
+
return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start
|
42
|
+
};
|
43
|
+
|
44
|
+
LooseParser.prototype.startNodeAt = function startNodeAt (pos) {
|
45
|
+
if (this.options.locations) {
|
46
|
+
return new __acorn.Node(this.toks, pos[0], pos[1])
|
47
|
+
} else {
|
48
|
+
return new __acorn.Node(this.toks, pos)
|
49
|
+
}
|
50
|
+
};
|
51
|
+
|
52
|
+
LooseParser.prototype.finishNode = function finishNode (node, type) {
|
53
|
+
node.type = type;
|
54
|
+
node.end = this.last.end;
|
55
|
+
if (this.options.locations)
|
56
|
+
{ node.loc.end = this.last.loc.end; }
|
57
|
+
if (this.options.ranges)
|
58
|
+
{ node.range[1] = this.last.end; }
|
59
|
+
return node
|
60
|
+
};
|
61
|
+
|
62
|
+
LooseParser.prototype.dummyNode = function dummyNode (type) {
|
63
|
+
var dummy = this.startNode();
|
64
|
+
dummy.type = type;
|
65
|
+
dummy.end = dummy.start;
|
66
|
+
if (this.options.locations)
|
67
|
+
{ dummy.loc.end = dummy.loc.start; }
|
68
|
+
if (this.options.ranges)
|
69
|
+
{ dummy.range[1] = dummy.start; }
|
70
|
+
this.last = {type: __acorn.tokTypes.name, start: dummy.start, end: dummy.start, loc: dummy.loc};
|
71
|
+
return dummy
|
72
|
+
};
|
73
|
+
|
74
|
+
LooseParser.prototype.dummyIdent = function dummyIdent () {
|
75
|
+
var dummy = this.dummyNode("Identifier");
|
76
|
+
dummy.name = "✖";
|
77
|
+
return dummy
|
78
|
+
};
|
79
|
+
|
80
|
+
LooseParser.prototype.dummyString = function dummyString () {
|
81
|
+
var dummy = this.dummyNode("Literal");
|
82
|
+
dummy.value = dummy.raw = "✖";
|
83
|
+
return dummy
|
84
|
+
};
|
85
|
+
|
86
|
+
LooseParser.prototype.eat = function eat (type) {
|
87
|
+
if (this.tok.type === type) {
|
88
|
+
this.next();
|
89
|
+
return true
|
90
|
+
} else {
|
91
|
+
return false
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
LooseParser.prototype.isContextual = function isContextual (name) {
|
96
|
+
return this.tok.type === __acorn.tokTypes.name && this.tok.value === name
|
97
|
+
};
|
98
|
+
|
99
|
+
LooseParser.prototype.eatContextual = function eatContextual (name) {
|
100
|
+
return this.tok.value === name && this.eat(__acorn.tokTypes.name)
|
101
|
+
};
|
102
|
+
|
103
|
+
LooseParser.prototype.canInsertSemicolon = function canInsertSemicolon () {
|
104
|
+
return this.tok.type === __acorn.tokTypes.eof || this.tok.type === __acorn.tokTypes.braceR ||
|
105
|
+
__acorn.lineBreak.test(this.input.slice(this.last.end, this.tok.start))
|
106
|
+
};
|
107
|
+
|
108
|
+
LooseParser.prototype.semicolon = function semicolon () {
|
109
|
+
return this.eat(__acorn.tokTypes.semi)
|
110
|
+
};
|
111
|
+
|
112
|
+
LooseParser.prototype.expect = function expect (type) {
|
113
|
+
var this$1 = this;
|
114
|
+
|
115
|
+
if (this.eat(type)) { return true }
|
116
|
+
for (var i = 1; i <= 2; i++) {
|
117
|
+
if (this$1.lookAhead(i).type == type) {
|
118
|
+
for (var j = 0; j < i; j++) { this$1.next(); }
|
119
|
+
return true
|
120
|
+
}
|
121
|
+
}
|
122
|
+
};
|
123
|
+
|
124
|
+
LooseParser.prototype.pushCx = function pushCx () {
|
125
|
+
this.context.push(this.curIndent);
|
126
|
+
};
|
127
|
+
|
128
|
+
LooseParser.prototype.popCx = function popCx () {
|
129
|
+
this.curIndent = this.context.pop();
|
130
|
+
};
|
131
|
+
|
132
|
+
LooseParser.prototype.lineEnd = function lineEnd (pos) {
|
133
|
+
while (pos < this.input.length && !__acorn.isNewLine(this.input.charCodeAt(pos))) { ++pos; }
|
134
|
+
return pos
|
135
|
+
};
|
136
|
+
|
137
|
+
LooseParser.prototype.indentationAfter = function indentationAfter (pos) {
|
138
|
+
var this$1 = this;
|
139
|
+
|
140
|
+
for (var count = 0;; ++pos) {
|
141
|
+
var ch = this$1.input.charCodeAt(pos);
|
142
|
+
if (ch === 32) { ++count; }
|
143
|
+
else if (ch === 9) { count += this$1.options.tabSize; }
|
144
|
+
else { return count }
|
145
|
+
}
|
146
|
+
};
|
147
|
+
|
148
|
+
LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) {
|
149
|
+
if (this.tok.type === closeTok || this.tok.type === __acorn.tokTypes.eof) { return true }
|
150
|
+
return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
|
151
|
+
(!blockHeuristic || this.nextLineStart >= this.input.length ||
|
152
|
+
this.indentationAfter(this.nextLineStart) < indent)
|
153
|
+
};
|
154
|
+
|
155
|
+
LooseParser.prototype.tokenStartsLine = function tokenStartsLine () {
|
156
|
+
var this$1 = this;
|
157
|
+
|
158
|
+
for (var p = this.tok.start - 1; p >= this.curLineStart; --p) {
|
159
|
+
var ch = this$1.input.charCodeAt(p);
|
160
|
+
if (ch !== 9 && ch !== 32) { return false }
|
161
|
+
}
|
162
|
+
return true
|
163
|
+
};
|
164
|
+
|
165
|
+
LooseParser.prototype.extend = function extend (name, f) {
|
166
|
+
this[name] = f(this[name]);
|
167
|
+
};
|
168
|
+
|
169
|
+
LooseParser.prototype.loadPlugins = function loadPlugins (pluginConfigs) {
|
170
|
+
var this$1 = this;
|
171
|
+
|
172
|
+
for (var name in pluginConfigs) {
|
173
|
+
var plugin = pluginsLoose[name];
|
174
|
+
if (!plugin) { throw new Error("Plugin '" + name + "' not found") }
|
175
|
+
plugin(this$1, pluginConfigs[name]);
|
176
|
+
}
|
177
|
+
};
|
178
|
+
|
179
|
+
LooseParser.prototype.parse = function parse () {
|
180
|
+
this.next();
|
181
|
+
return this.parseTopLevel()
|
182
|
+
};
|
183
|
+
|
184
|
+
var lp = LooseParser.prototype;
|
185
|
+
|
186
|
+
function isSpace(ch) {
|
187
|
+
return (ch < 14 && ch > 8) || ch === 32 || ch === 160 || __acorn.isNewLine(ch)
|
188
|
+
}
|
189
|
+
|
190
|
+
lp.next = function() {
|
191
|
+
var this$1 = this;
|
192
|
+
|
193
|
+
this.last = this.tok;
|
194
|
+
if (this.ahead.length)
|
195
|
+
{ this.tok = this.ahead.shift(); }
|
196
|
+
else
|
197
|
+
{ this.tok = this.readToken(); }
|
198
|
+
|
199
|
+
if (this.tok.start >= this.nextLineStart) {
|
200
|
+
while (this.tok.start >= this.nextLineStart) {
|
201
|
+
this$1.curLineStart = this$1.nextLineStart;
|
202
|
+
this$1.nextLineStart = this$1.lineEnd(this$1.curLineStart) + 1;
|
203
|
+
}
|
204
|
+
this.curIndent = this.indentationAfter(this.curLineStart);
|
205
|
+
}
|
206
|
+
};
|
207
|
+
|
208
|
+
lp.readToken = function() {
|
209
|
+
var this$1 = this;
|
210
|
+
|
211
|
+
for (;;) {
|
212
|
+
try {
|
213
|
+
this$1.toks.next();
|
214
|
+
if (this$1.toks.type === __acorn.tokTypes.dot &&
|
215
|
+
this$1.input.substr(this$1.toks.end, 1) === "." &&
|
216
|
+
this$1.options.ecmaVersion >= 6) {
|
217
|
+
this$1.toks.end++;
|
218
|
+
this$1.toks.type = __acorn.tokTypes.ellipsis;
|
219
|
+
}
|
220
|
+
return new __acorn.Token(this$1.toks)
|
221
|
+
} catch (e) {
|
222
|
+
if (!(e instanceof SyntaxError)) { throw e }
|
223
|
+
|
224
|
+
// Try to skip some text, based on the error message, and then continue
|
225
|
+
var msg = e.message, pos = e.raisedAt, replace = true;
|
226
|
+
if (/unterminated/i.test(msg)) {
|
227
|
+
pos = this$1.lineEnd(e.pos + 1);
|
228
|
+
if (/string/.test(msg)) {
|
229
|
+
replace = {start: e.pos, end: pos, type: __acorn.tokTypes.string, value: this$1.input.slice(e.pos + 1, pos)};
|
230
|
+
} else if (/regular expr/i.test(msg)) {
|
231
|
+
var re = this$1.input.slice(e.pos, pos);
|
232
|
+
try { re = new RegExp(re); } catch (e) { /* ignore compilation error due to new syntax */ }
|
233
|
+
replace = {start: e.pos, end: pos, type: __acorn.tokTypes.regexp, value: re};
|
234
|
+
} else if (/template/.test(msg)) {
|
235
|
+
replace = {
|
236
|
+
start: e.pos,
|
237
|
+
end: pos,
|
238
|
+
type: __acorn.tokTypes.template,
|
239
|
+
value: this$1.input.slice(e.pos, pos)
|
240
|
+
};
|
241
|
+
} else {
|
242
|
+
replace = false;
|
243
|
+
}
|
244
|
+
} else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(msg)) {
|
245
|
+
while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) { ++pos; }
|
246
|
+
} else if (/character escape|expected hexadecimal/i.test(msg)) {
|
247
|
+
while (pos < this.input.length) {
|
248
|
+
var ch = this$1.input.charCodeAt(pos++);
|
249
|
+
if (ch === 34 || ch === 39 || __acorn.isNewLine(ch)) { break }
|
250
|
+
}
|
251
|
+
} else if (/unexpected character/i.test(msg)) {
|
252
|
+
pos++;
|
253
|
+
replace = false;
|
254
|
+
} else if (/regular expression/i.test(msg)) {
|
255
|
+
replace = true;
|
256
|
+
} else {
|
257
|
+
throw e
|
258
|
+
}
|
259
|
+
this$1.resetTo(pos);
|
260
|
+
if (replace === true) { replace = {start: pos, end: pos, type: __acorn.tokTypes.name, value: "✖"}; }
|
261
|
+
if (replace) {
|
262
|
+
if (this$1.options.locations)
|
263
|
+
{ replace.loc = new __acorn.SourceLocation(
|
264
|
+
this$1.toks,
|
265
|
+
__acorn.getLineInfo(this$1.input, replace.start),
|
266
|
+
__acorn.getLineInfo(this$1.input, replace.end)); }
|
267
|
+
return replace
|
268
|
+
}
|
269
|
+
}
|
270
|
+
}
|
271
|
+
};
|
272
|
+
|
273
|
+
lp.resetTo = function(pos) {
|
274
|
+
var this$1 = this;
|
275
|
+
|
276
|
+
this.toks.pos = pos;
|
277
|
+
var ch = this.input.charAt(pos - 1);
|
278
|
+
this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) ||
|
279
|
+
/[enwfd]/.test(ch) &&
|
280
|
+
/\b(case|else|return|throw|new|in|(instance|type)?of|delete|void)$/.test(this.input.slice(pos - 10, pos));
|
281
|
+
|
282
|
+
if (this.options.locations) {
|
283
|
+
this.toks.curLine = 1;
|
284
|
+
this.toks.lineStart = __acorn.lineBreakG.lastIndex = 0;
|
285
|
+
var match;
|
286
|
+
while ((match = __acorn.lineBreakG.exec(this.input)) && match.index < pos) {
|
287
|
+
++this$1.toks.curLine;
|
288
|
+
this$1.toks.lineStart = match.index + match[0].length;
|
289
|
+
}
|
290
|
+
}
|
291
|
+
};
|
292
|
+
|
293
|
+
lp.lookAhead = function(n) {
|
294
|
+
var this$1 = this;
|
295
|
+
|
296
|
+
while (n > this.ahead.length)
|
297
|
+
{ this$1.ahead.push(this$1.readToken()); }
|
298
|
+
return this.ahead[n - 1]
|
299
|
+
};
|
300
|
+
|
301
|
+
function isDummy(node) { return node.name == "✖" }
|
302
|
+
|
303
|
+
var lp$1 = LooseParser.prototype;
|
304
|
+
|
305
|
+
lp$1.parseTopLevel = function() {
|
306
|
+
var this$1 = this;
|
307
|
+
|
308
|
+
var node = this.startNodeAt(this.options.locations ? [0, __acorn.getLineInfo(this.input, 0)] : 0);
|
309
|
+
node.body = [];
|
310
|
+
while (this.tok.type !== __acorn.tokTypes.eof) { node.body.push(this$1.parseStatement()); }
|
311
|
+
this.toks.adaptDirectivePrologue(node.body);
|
312
|
+
this.last = this.tok;
|
313
|
+
if (this.options.ecmaVersion >= 6) {
|
314
|
+
node.sourceType = this.options.sourceType;
|
315
|
+
}
|
316
|
+
return this.finishNode(node, "Program")
|
317
|
+
};
|
318
|
+
|
319
|
+
lp$1.parseStatement = function() {
|
320
|
+
var this$1 = this;
|
321
|
+
|
322
|
+
var starttype = this.tok.type, node = this.startNode(), kind;
|
323
|
+
|
324
|
+
if (this.toks.isLet()) {
|
325
|
+
starttype = __acorn.tokTypes._var;
|
326
|
+
kind = "let";
|
327
|
+
}
|
328
|
+
|
329
|
+
switch (starttype) {
|
330
|
+
case __acorn.tokTypes._break: case __acorn.tokTypes._continue:
|
331
|
+
this.next();
|
332
|
+
var isBreak = starttype === __acorn.tokTypes._break;
|
333
|
+
if (this.semicolon() || this.canInsertSemicolon()) {
|
334
|
+
node.label = null;
|
335
|
+
} else {
|
336
|
+
node.label = this.tok.type === __acorn.tokTypes.name ? this.parseIdent() : null;
|
337
|
+
this.semicolon();
|
338
|
+
}
|
339
|
+
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
340
|
+
|
341
|
+
case __acorn.tokTypes._debugger:
|
342
|
+
this.next();
|
343
|
+
this.semicolon();
|
344
|
+
return this.finishNode(node, "DebuggerStatement")
|
345
|
+
|
346
|
+
case __acorn.tokTypes._do:
|
347
|
+
this.next();
|
348
|
+
node.body = this.parseStatement();
|
349
|
+
node.test = this.eat(__acorn.tokTypes._while) ? this.parseParenExpression() : this.dummyIdent();
|
350
|
+
this.semicolon();
|
351
|
+
return this.finishNode(node, "DoWhileStatement")
|
352
|
+
|
353
|
+
case __acorn.tokTypes._for:
|
354
|
+
this.next(); // `for` keyword
|
355
|
+
var isAwait = this.options.ecmaVersion >= 9 && this.inAsync && this.eatContextual("await");
|
356
|
+
|
357
|
+
this.pushCx();
|
358
|
+
this.expect(__acorn.tokTypes.parenL);
|
359
|
+
if (this.tok.type === __acorn.tokTypes.semi) { return this.parseFor(node, null) }
|
360
|
+
var isLet = this.toks.isLet();
|
361
|
+
if (isLet || this.tok.type === __acorn.tokTypes._var || this.tok.type === __acorn.tokTypes._const) {
|
362
|
+
var init$1 = this.parseVar(true, isLet ? "let" : this.tok.value);
|
363
|
+
if (init$1.declarations.length === 1 && (this.tok.type === __acorn.tokTypes._in || this.isContextual("of"))) {
|
364
|
+
if (this.options.ecmaVersion >= 9 && this.tok.type !== __acorn.tokTypes._in) {
|
365
|
+
node.await = isAwait;
|
366
|
+
}
|
367
|
+
return this.parseForIn(node, init$1)
|
368
|
+
}
|
369
|
+
return this.parseFor(node, init$1)
|
370
|
+
}
|
371
|
+
var init = this.parseExpression(true);
|
372
|
+
if (this.tok.type === __acorn.tokTypes._in || this.isContextual("of")) {
|
373
|
+
if (this.options.ecmaVersion >= 9 && this.tok.type !== __acorn.tokTypes._in) {
|
374
|
+
node.await = isAwait;
|
375
|
+
}
|
376
|
+
return this.parseForIn(node, this.toAssignable(init))
|
377
|
+
}
|
378
|
+
return this.parseFor(node, init)
|
379
|
+
|
380
|
+
case __acorn.tokTypes._function:
|
381
|
+
this.next();
|
382
|
+
return this.parseFunction(node, true)
|
383
|
+
|
384
|
+
case __acorn.tokTypes._if:
|
385
|
+
this.next();
|
386
|
+
node.test = this.parseParenExpression();
|
387
|
+
node.consequent = this.parseStatement();
|
388
|
+
node.alternate = this.eat(__acorn.tokTypes._else) ? this.parseStatement() : null;
|
389
|
+
return this.finishNode(node, "IfStatement")
|
390
|
+
|
391
|
+
case __acorn.tokTypes._return:
|
392
|
+
this.next();
|
393
|
+
if (this.eat(__acorn.tokTypes.semi) || this.canInsertSemicolon()) { node.argument = null; }
|
394
|
+
else { node.argument = this.parseExpression(); this.semicolon(); }
|
395
|
+
return this.finishNode(node, "ReturnStatement")
|
396
|
+
|
397
|
+
case __acorn.tokTypes._switch:
|
398
|
+
var blockIndent = this.curIndent, line = this.curLineStart;
|
399
|
+
this.next();
|
400
|
+
node.discriminant = this.parseParenExpression();
|
401
|
+
node.cases = [];
|
402
|
+
this.pushCx();
|
403
|
+
this.expect(__acorn.tokTypes.braceL);
|
404
|
+
|
405
|
+
var cur;
|
406
|
+
while (!this.closes(__acorn.tokTypes.braceR, blockIndent, line, true)) {
|
407
|
+
if (this$1.tok.type === __acorn.tokTypes._case || this$1.tok.type === __acorn.tokTypes._default) {
|
408
|
+
var isCase = this$1.tok.type === __acorn.tokTypes._case;
|
409
|
+
if (cur) { this$1.finishNode(cur, "SwitchCase"); }
|
410
|
+
node.cases.push(cur = this$1.startNode());
|
411
|
+
cur.consequent = [];
|
412
|
+
this$1.next();
|
413
|
+
if (isCase) { cur.test = this$1.parseExpression(); }
|
414
|
+
else { cur.test = null; }
|
415
|
+
this$1.expect(__acorn.tokTypes.colon);
|
416
|
+
} else {
|
417
|
+
if (!cur) {
|
418
|
+
node.cases.push(cur = this$1.startNode());
|
419
|
+
cur.consequent = [];
|
420
|
+
cur.test = null;
|
421
|
+
}
|
422
|
+
cur.consequent.push(this$1.parseStatement());
|
423
|
+
}
|
424
|
+
}
|
425
|
+
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
426
|
+
this.popCx();
|
427
|
+
this.eat(__acorn.tokTypes.braceR);
|
428
|
+
return this.finishNode(node, "SwitchStatement")
|
429
|
+
|
430
|
+
case __acorn.tokTypes._throw:
|
431
|
+
this.next();
|
432
|
+
node.argument = this.parseExpression();
|
433
|
+
this.semicolon();
|
434
|
+
return this.finishNode(node, "ThrowStatement")
|
435
|
+
|
436
|
+
case __acorn.tokTypes._try:
|
437
|
+
this.next();
|
438
|
+
node.block = this.parseBlock();
|
439
|
+
node.handler = null;
|
440
|
+
if (this.tok.type === __acorn.tokTypes._catch) {
|
441
|
+
var clause = this.startNode();
|
442
|
+
this.next();
|
443
|
+
this.expect(__acorn.tokTypes.parenL);
|
444
|
+
clause.param = this.toAssignable(this.parseExprAtom(), true);
|
445
|
+
this.expect(__acorn.tokTypes.parenR);
|
446
|
+
clause.body = this.parseBlock();
|
447
|
+
node.handler = this.finishNode(clause, "CatchClause");
|
448
|
+
}
|
449
|
+
node.finalizer = this.eat(__acorn.tokTypes._finally) ? this.parseBlock() : null;
|
450
|
+
if (!node.handler && !node.finalizer) { return node.block }
|
451
|
+
return this.finishNode(node, "TryStatement")
|
452
|
+
|
453
|
+
case __acorn.tokTypes._var:
|
454
|
+
case __acorn.tokTypes._const:
|
455
|
+
return this.parseVar(false, kind || this.tok.value)
|
456
|
+
|
457
|
+
case __acorn.tokTypes._while:
|
458
|
+
this.next();
|
459
|
+
node.test = this.parseParenExpression();
|
460
|
+
node.body = this.parseStatement();
|
461
|
+
return this.finishNode(node, "WhileStatement")
|
462
|
+
|
463
|
+
case __acorn.tokTypes._with:
|
464
|
+
this.next();
|
465
|
+
node.object = this.parseParenExpression();
|
466
|
+
node.body = this.parseStatement();
|
467
|
+
return this.finishNode(node, "WithStatement")
|
468
|
+
|
469
|
+
case __acorn.tokTypes.braceL:
|
470
|
+
return this.parseBlock()
|
471
|
+
|
472
|
+
case __acorn.tokTypes.semi:
|
473
|
+
this.next();
|
474
|
+
return this.finishNode(node, "EmptyStatement")
|
475
|
+
|
476
|
+
case __acorn.tokTypes._class:
|
477
|
+
return this.parseClass(true)
|
478
|
+
|
479
|
+
case __acorn.tokTypes._import:
|
480
|
+
return this.parseImport()
|
481
|
+
|
482
|
+
case __acorn.tokTypes._export:
|
483
|
+
return this.parseExport()
|
484
|
+
|
485
|
+
default:
|
486
|
+
if (this.toks.isAsyncFunction()) {
|
487
|
+
this.next();
|
488
|
+
this.next();
|
489
|
+
return this.parseFunction(node, true, true)
|
490
|
+
}
|
491
|
+
var expr = this.parseExpression();
|
492
|
+
if (isDummy(expr)) {
|
493
|
+
this.next();
|
494
|
+
if (this.tok.type === __acorn.tokTypes.eof) { return this.finishNode(node, "EmptyStatement") }
|
495
|
+
return this.parseStatement()
|
496
|
+
} else if (starttype === __acorn.tokTypes.name && expr.type === "Identifier" && this.eat(__acorn.tokTypes.colon)) {
|
497
|
+
node.body = this.parseStatement();
|
498
|
+
node.label = expr;
|
499
|
+
return this.finishNode(node, "LabeledStatement")
|
500
|
+
} else {
|
501
|
+
node.expression = expr;
|
502
|
+
this.semicolon();
|
503
|
+
return this.finishNode(node, "ExpressionStatement")
|
504
|
+
}
|
505
|
+
}
|
506
|
+
};
|
507
|
+
|
508
|
+
lp$1.parseBlock = function() {
|
509
|
+
var this$1 = this;
|
510
|
+
|
511
|
+
var node = this.startNode();
|
512
|
+
this.pushCx();
|
513
|
+
this.expect(__acorn.tokTypes.braceL);
|
514
|
+
var blockIndent = this.curIndent, line = this.curLineStart;
|
515
|
+
node.body = [];
|
516
|
+
while (!this.closes(__acorn.tokTypes.braceR, blockIndent, line, true))
|
517
|
+
{ node.body.push(this$1.parseStatement()); }
|
518
|
+
this.popCx();
|
519
|
+
this.eat(__acorn.tokTypes.braceR);
|
520
|
+
return this.finishNode(node, "BlockStatement")
|
521
|
+
};
|
522
|
+
|
523
|
+
lp$1.parseFor = function(node, init) {
|
524
|
+
node.init = init;
|
525
|
+
node.test = node.update = null;
|
526
|
+
if (this.eat(__acorn.tokTypes.semi) && this.tok.type !== __acorn.tokTypes.semi) { node.test = this.parseExpression(); }
|
527
|
+
if (this.eat(__acorn.tokTypes.semi) && this.tok.type !== __acorn.tokTypes.parenR) { node.update = this.parseExpression(); }
|
528
|
+
this.popCx();
|
529
|
+
this.expect(__acorn.tokTypes.parenR);
|
530
|
+
node.body = this.parseStatement();
|
531
|
+
return this.finishNode(node, "ForStatement")
|
532
|
+
};
|
533
|
+
|
534
|
+
lp$1.parseForIn = function(node, init) {
|
535
|
+
var type = this.tok.type === __acorn.tokTypes._in ? "ForInStatement" : "ForOfStatement";
|
536
|
+
this.next();
|
537
|
+
node.left = init;
|
538
|
+
node.right = this.parseExpression();
|
539
|
+
this.popCx();
|
540
|
+
this.expect(__acorn.tokTypes.parenR);
|
541
|
+
node.body = this.parseStatement();
|
542
|
+
return this.finishNode(node, type)
|
543
|
+
};
|
544
|
+
|
545
|
+
lp$1.parseVar = function(noIn, kind) {
|
546
|
+
var this$1 = this;
|
547
|
+
|
548
|
+
var node = this.startNode();
|
549
|
+
node.kind = kind;
|
550
|
+
this.next();
|
551
|
+
node.declarations = [];
|
552
|
+
do {
|
553
|
+
var decl = this$1.startNode();
|
554
|
+
decl.id = this$1.options.ecmaVersion >= 6 ? this$1.toAssignable(this$1.parseExprAtom(), true) : this$1.parseIdent();
|
555
|
+
decl.init = this$1.eat(__acorn.tokTypes.eq) ? this$1.parseMaybeAssign(noIn) : null;
|
556
|
+
node.declarations.push(this$1.finishNode(decl, "VariableDeclarator"));
|
557
|
+
} while (this.eat(__acorn.tokTypes.comma))
|
558
|
+
if (!node.declarations.length) {
|
559
|
+
var decl$1 = this.startNode();
|
560
|
+
decl$1.id = this.dummyIdent();
|
561
|
+
node.declarations.push(this.finishNode(decl$1, "VariableDeclarator"));
|
562
|
+
}
|
563
|
+
if (!noIn) { this.semicolon(); }
|
564
|
+
return this.finishNode(node, "VariableDeclaration")
|
565
|
+
};
|
566
|
+
|
567
|
+
lp$1.parseClass = function(isStatement) {
|
568
|
+
var this$1 = this;
|
569
|
+
|
570
|
+
var node = this.startNode();
|
571
|
+
this.next();
|
572
|
+
if (this.tok.type === __acorn.tokTypes.name) { node.id = this.parseIdent(); }
|
573
|
+
else if (isStatement === true) { node.id = this.dummyIdent(); }
|
574
|
+
else { node.id = null; }
|
575
|
+
node.superClass = this.eat(__acorn.tokTypes._extends) ? this.parseExpression() : null;
|
576
|
+
node.body = this.startNode();
|
577
|
+
node.body.body = [];
|
578
|
+
this.pushCx();
|
579
|
+
var indent = this.curIndent + 1, line = this.curLineStart;
|
580
|
+
this.eat(__acorn.tokTypes.braceL);
|
581
|
+
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; }
|
582
|
+
while (!this.closes(__acorn.tokTypes.braceR, indent, line)) {
|
583
|
+
if (this$1.semicolon()) { continue }
|
584
|
+
var method = this$1.startNode(), isGenerator = (void 0), isAsync = (void 0);
|
585
|
+
if (this$1.options.ecmaVersion >= 6) {
|
586
|
+
method.static = false;
|
587
|
+
isGenerator = this$1.eat(__acorn.tokTypes.star);
|
588
|
+
}
|
589
|
+
this$1.parsePropertyName(method);
|
590
|
+
if (isDummy(method.key)) { if (isDummy(this$1.parseMaybeAssign())) { this$1.next(); } this$1.eat(__acorn.tokTypes.comma); continue }
|
591
|
+
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" &&
|
592
|
+
(this$1.tok.type != __acorn.tokTypes.parenL && this$1.tok.type != __acorn.tokTypes.braceL)) {
|
593
|
+
method.static = true;
|
594
|
+
isGenerator = this$1.eat(__acorn.tokTypes.star);
|
595
|
+
this$1.parsePropertyName(method);
|
596
|
+
} else {
|
597
|
+
method.static = false;
|
598
|
+
}
|
599
|
+
if (!method.computed &&
|
600
|
+
method.key.type === "Identifier" && method.key.name === "async" && this$1.tok.type !== __acorn.tokTypes.parenL &&
|
601
|
+
!this$1.canInsertSemicolon()) {
|
602
|
+
isAsync = true;
|
603
|
+
isGenerator = this$1.options.ecmaVersion >= 9 && this$1.eat(__acorn.tokTypes.star);
|
604
|
+
this$1.parsePropertyName(method);
|
605
|
+
} else {
|
606
|
+
isAsync = false;
|
607
|
+
}
|
608
|
+
if (this$1.options.ecmaVersion >= 5 && method.key.type === "Identifier" &&
|
609
|
+
!method.computed && (method.key.name === "get" || method.key.name === "set") &&
|
610
|
+
this$1.tok.type !== __acorn.tokTypes.parenL && this$1.tok.type !== __acorn.tokTypes.braceL) {
|
611
|
+
method.kind = method.key.name;
|
612
|
+
this$1.parsePropertyName(method);
|
613
|
+
method.value = this$1.parseMethod(false);
|
614
|
+
} else {
|
615
|
+
if (!method.computed && !method.static && !isGenerator && !isAsync && (
|
616
|
+
method.key.type === "Identifier" && method.key.name === "constructor" ||
|
617
|
+
method.key.type === "Literal" && method.key.value === "constructor")) {
|
618
|
+
method.kind = "constructor";
|
619
|
+
} else {
|
620
|
+
method.kind = "method";
|
621
|
+
}
|
622
|
+
method.value = this$1.parseMethod(isGenerator, isAsync);
|
623
|
+
}
|
624
|
+
node.body.body.push(this$1.finishNode(method, "MethodDefinition"));
|
625
|
+
}
|
626
|
+
this.popCx();
|
627
|
+
if (!this.eat(__acorn.tokTypes.braceR)) {
|
628
|
+
// If there is no closing brace, make the node span to the start
|
629
|
+
// of the next token (this is useful for Tern)
|
630
|
+
this.last.end = this.tok.start;
|
631
|
+
if (this.options.locations) { this.last.loc.end = this.tok.loc.start; }
|
632
|
+
}
|
633
|
+
this.semicolon();
|
634
|
+
this.finishNode(node.body, "ClassBody");
|
635
|
+
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
636
|
+
};
|
637
|
+
|
638
|
+
lp$1.parseFunction = function(node, isStatement, isAsync) {
|
639
|
+
var oldInAsync = this.inAsync;
|
640
|
+
this.initFunction(node);
|
641
|
+
if (this.options.ecmaVersion >= 6) {
|
642
|
+
node.generator = this.eat(__acorn.tokTypes.star);
|
643
|
+
}
|
644
|
+
if (this.options.ecmaVersion >= 8) {
|
645
|
+
node.async = !!isAsync;
|
646
|
+
}
|
647
|
+
if (this.tok.type === __acorn.tokTypes.name) { node.id = this.parseIdent(); }
|
648
|
+
else if (isStatement === true) { node.id = this.dummyIdent(); }
|
649
|
+
this.inAsync = node.async;
|
650
|
+
node.params = this.parseFunctionParams();
|
651
|
+
node.body = this.parseBlock();
|
652
|
+
this.toks.adaptDirectivePrologue(node.body.body);
|
653
|
+
this.inAsync = oldInAsync;
|
654
|
+
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
|
655
|
+
};
|
656
|
+
|
657
|
+
lp$1.parseExport = function() {
|
658
|
+
var node = this.startNode();
|
659
|
+
this.next();
|
660
|
+
if (this.eat(__acorn.tokTypes.star)) {
|
661
|
+
node.source = this.eatContextual("from") ? this.parseExprAtom() : this.dummyString();
|
662
|
+
return this.finishNode(node, "ExportAllDeclaration")
|
663
|
+
}
|
664
|
+
if (this.eat(__acorn.tokTypes._default)) {
|
665
|
+
// export default (function foo() {}) // This is FunctionExpression.
|
666
|
+
var isAsync;
|
667
|
+
if (this.tok.type === __acorn.tokTypes._function || (isAsync = this.toks.isAsyncFunction())) {
|
668
|
+
var fNode = this.startNode();
|
669
|
+
this.next();
|
670
|
+
if (isAsync) { this.next(); }
|
671
|
+
node.declaration = this.parseFunction(fNode, "nullableID", isAsync);
|
672
|
+
} else if (this.tok.type === __acorn.tokTypes._class) {
|
673
|
+
node.declaration = this.parseClass("nullableID");
|
674
|
+
} else {
|
675
|
+
node.declaration = this.parseMaybeAssign();
|
676
|
+
this.semicolon();
|
677
|
+
}
|
678
|
+
return this.finishNode(node, "ExportDefaultDeclaration")
|
679
|
+
}
|
680
|
+
if (this.tok.type.keyword || this.toks.isLet() || this.toks.isAsyncFunction()) {
|
681
|
+
node.declaration = this.parseStatement();
|
682
|
+
node.specifiers = [];
|
683
|
+
node.source = null;
|
684
|
+
} else {
|
685
|
+
node.declaration = null;
|
686
|
+
node.specifiers = this.parseExportSpecifierList();
|
687
|
+
node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
|
688
|
+
this.semicolon();
|
689
|
+
}
|
690
|
+
return this.finishNode(node, "ExportNamedDeclaration")
|
691
|
+
};
|
692
|
+
|
693
|
+
lp$1.parseImport = function() {
|
694
|
+
var node = this.startNode();
|
695
|
+
this.next();
|
696
|
+
if (this.tok.type === __acorn.tokTypes.string) {
|
697
|
+
node.specifiers = [];
|
698
|
+
node.source = this.parseExprAtom();
|
699
|
+
} else {
|
700
|
+
var elt;
|
701
|
+
if (this.tok.type === __acorn.tokTypes.name && this.tok.value !== "from") {
|
702
|
+
elt = this.startNode();
|
703
|
+
elt.local = this.parseIdent();
|
704
|
+
this.finishNode(elt, "ImportDefaultSpecifier");
|
705
|
+
this.eat(__acorn.tokTypes.comma);
|
706
|
+
}
|
707
|
+
node.specifiers = this.parseImportSpecifierList();
|
708
|
+
node.source = this.eatContextual("from") && this.tok.type == __acorn.tokTypes.string ? this.parseExprAtom() : this.dummyString();
|
709
|
+
if (elt) { node.specifiers.unshift(elt); }
|
710
|
+
}
|
711
|
+
this.semicolon();
|
712
|
+
return this.finishNode(node, "ImportDeclaration")
|
713
|
+
};
|
714
|
+
|
715
|
+
lp$1.parseImportSpecifierList = function() {
|
716
|
+
var this$1 = this;
|
717
|
+
|
718
|
+
var elts = [];
|
719
|
+
if (this.tok.type === __acorn.tokTypes.star) {
|
720
|
+
var elt = this.startNode();
|
721
|
+
this.next();
|
722
|
+
elt.local = this.eatContextual("as") ? this.parseIdent() : this.dummyIdent();
|
723
|
+
elts.push(this.finishNode(elt, "ImportNamespaceSpecifier"));
|
724
|
+
} else {
|
725
|
+
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart;
|
726
|
+
this.pushCx();
|
727
|
+
this.eat(__acorn.tokTypes.braceL);
|
728
|
+
if (this.curLineStart > continuedLine) { continuedLine = this.curLineStart; }
|
729
|
+
while (!this.closes(__acorn.tokTypes.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
730
|
+
var elt$1 = this$1.startNode();
|
731
|
+
if (this$1.eat(__acorn.tokTypes.star)) {
|
732
|
+
elt$1.local = this$1.eatContextual("as") ? this$1.parseIdent() : this$1.dummyIdent();
|
733
|
+
this$1.finishNode(elt$1, "ImportNamespaceSpecifier");
|
734
|
+
} else {
|
735
|
+
if (this$1.isContextual("from")) { break }
|
736
|
+
elt$1.imported = this$1.parseIdent();
|
737
|
+
if (isDummy(elt$1.imported)) { break }
|
738
|
+
elt$1.local = this$1.eatContextual("as") ? this$1.parseIdent() : elt$1.imported;
|
739
|
+
this$1.finishNode(elt$1, "ImportSpecifier");
|
740
|
+
}
|
741
|
+
elts.push(elt$1);
|
742
|
+
this$1.eat(__acorn.tokTypes.comma);
|
743
|
+
}
|
744
|
+
this.eat(__acorn.tokTypes.braceR);
|
745
|
+
this.popCx();
|
746
|
+
}
|
747
|
+
return elts
|
748
|
+
};
|
749
|
+
|
750
|
+
lp$1.parseExportSpecifierList = function() {
|
751
|
+
var this$1 = this;
|
752
|
+
|
753
|
+
var elts = [];
|
754
|
+
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart;
|
755
|
+
this.pushCx();
|
756
|
+
this.eat(__acorn.tokTypes.braceL);
|
757
|
+
if (this.curLineStart > continuedLine) { continuedLine = this.curLineStart; }
|
758
|
+
while (!this.closes(__acorn.tokTypes.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
759
|
+
if (this$1.isContextual("from")) { break }
|
760
|
+
var elt = this$1.startNode();
|
761
|
+
elt.local = this$1.parseIdent();
|
762
|
+
if (isDummy(elt.local)) { break }
|
763
|
+
elt.exported = this$1.eatContextual("as") ? this$1.parseIdent() : elt.local;
|
764
|
+
this$1.finishNode(elt, "ExportSpecifier");
|
765
|
+
elts.push(elt);
|
766
|
+
this$1.eat(__acorn.tokTypes.comma);
|
767
|
+
}
|
768
|
+
this.eat(__acorn.tokTypes.braceR);
|
769
|
+
this.popCx();
|
770
|
+
return elts
|
771
|
+
};
|
772
|
+
|
773
|
+
var lp$2 = LooseParser.prototype;
|
774
|
+
|
775
|
+
lp$2.checkLVal = function(expr) {
|
776
|
+
if (!expr) { return expr }
|
777
|
+
switch (expr.type) {
|
778
|
+
case "Identifier":
|
779
|
+
case "MemberExpression":
|
780
|
+
return expr
|
781
|
+
|
782
|
+
case "ParenthesizedExpression":
|
783
|
+
expr.expression = this.checkLVal(expr.expression);
|
784
|
+
return expr
|
785
|
+
|
786
|
+
default:
|
787
|
+
return this.dummyIdent()
|
788
|
+
}
|
789
|
+
};
|
790
|
+
|
791
|
+
lp$2.parseExpression = function(noIn) {
|
792
|
+
var this$1 = this;
|
793
|
+
|
794
|
+
var start = this.storeCurrentPos();
|
795
|
+
var expr = this.parseMaybeAssign(noIn);
|
796
|
+
if (this.tok.type === __acorn.tokTypes.comma) {
|
797
|
+
var node = this.startNodeAt(start);
|
798
|
+
node.expressions = [expr];
|
799
|
+
while (this.eat(__acorn.tokTypes.comma)) { node.expressions.push(this$1.parseMaybeAssign(noIn)); }
|
800
|
+
return this.finishNode(node, "SequenceExpression")
|
801
|
+
}
|
802
|
+
return expr
|
803
|
+
};
|
804
|
+
|
805
|
+
lp$2.parseParenExpression = function() {
|
806
|
+
this.pushCx();
|
807
|
+
this.expect(__acorn.tokTypes.parenL);
|
808
|
+
var val = this.parseExpression();
|
809
|
+
this.popCx();
|
810
|
+
this.expect(__acorn.tokTypes.parenR);
|
811
|
+
return val
|
812
|
+
};
|
813
|
+
|
814
|
+
lp$2.parseMaybeAssign = function(noIn) {
|
815
|
+
if (this.toks.isContextual("yield")) {
|
816
|
+
var node = this.startNode();
|
817
|
+
this.next();
|
818
|
+
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type != __acorn.tokTypes.star && !this.tok.type.startsExpr)) {
|
819
|
+
node.delegate = false;
|
820
|
+
node.argument = null;
|
821
|
+
} else {
|
822
|
+
node.delegate = this.eat(__acorn.tokTypes.star);
|
823
|
+
node.argument = this.parseMaybeAssign();
|
824
|
+
}
|
825
|
+
return this.finishNode(node, "YieldExpression")
|
826
|
+
}
|
827
|
+
|
828
|
+
var start = this.storeCurrentPos();
|
829
|
+
var left = this.parseMaybeConditional(noIn);
|
830
|
+
if (this.tok.type.isAssign) {
|
831
|
+
var node$1 = this.startNodeAt(start);
|
832
|
+
node$1.operator = this.tok.value;
|
833
|
+
node$1.left = this.tok.type === __acorn.tokTypes.eq ? this.toAssignable(left) : this.checkLVal(left);
|
834
|
+
this.next();
|
835
|
+
node$1.right = this.parseMaybeAssign(noIn);
|
836
|
+
return this.finishNode(node$1, "AssignmentExpression")
|
837
|
+
}
|
838
|
+
return left
|
839
|
+
};
|
840
|
+
|
841
|
+
lp$2.parseMaybeConditional = function(noIn) {
|
842
|
+
var start = this.storeCurrentPos();
|
843
|
+
var expr = this.parseExprOps(noIn);
|
844
|
+
if (this.eat(__acorn.tokTypes.question)) {
|
845
|
+
var node = this.startNodeAt(start);
|
846
|
+
node.test = expr;
|
847
|
+
node.consequent = this.parseMaybeAssign();
|
848
|
+
node.alternate = this.expect(__acorn.tokTypes.colon) ? this.parseMaybeAssign(noIn) : this.dummyIdent();
|
849
|
+
return this.finishNode(node, "ConditionalExpression")
|
850
|
+
}
|
851
|
+
return expr
|
852
|
+
};
|
853
|
+
|
854
|
+
lp$2.parseExprOps = function(noIn) {
|
855
|
+
var start = this.storeCurrentPos();
|
856
|
+
var indent = this.curIndent, line = this.curLineStart;
|
857
|
+
return this.parseExprOp(this.parseMaybeUnary(false), start, -1, noIn, indent, line)
|
858
|
+
};
|
859
|
+
|
860
|
+
lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
|
861
|
+
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) { return left }
|
862
|
+
var prec = this.tok.type.binop;
|
863
|
+
if (prec != null && (!noIn || this.tok.type !== __acorn.tokTypes._in)) {
|
864
|
+
if (prec > minPrec) {
|
865
|
+
var node = this.startNodeAt(start);
|
866
|
+
node.left = left;
|
867
|
+
node.operator = this.tok.value;
|
868
|
+
this.next();
|
869
|
+
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) {
|
870
|
+
node.right = this.dummyIdent();
|
871
|
+
} else {
|
872
|
+
var rightStart = this.storeCurrentPos();
|
873
|
+
node.right = this.parseExprOp(this.parseMaybeUnary(false), rightStart, prec, noIn, indent, line);
|
874
|
+
}
|
875
|
+
this.finishNode(node, /&&|\|\|/.test(node.operator) ? "LogicalExpression" : "BinaryExpression");
|
876
|
+
return this.parseExprOp(node, start, minPrec, noIn, indent, line)
|
877
|
+
}
|
878
|
+
}
|
879
|
+
return left
|
880
|
+
};
|
881
|
+
|
882
|
+
lp$2.parseMaybeUnary = function(sawUnary) {
|
883
|
+
var this$1 = this;
|
884
|
+
|
885
|
+
var start = this.storeCurrentPos(), expr;
|
886
|
+
if (this.options.ecmaVersion >= 8 && this.inAsync && this.toks.isContextual("await")) {
|
887
|
+
expr = this.parseAwait();
|
888
|
+
sawUnary = true;
|
889
|
+
} else if (this.tok.type.prefix) {
|
890
|
+
var node = this.startNode(), update = this.tok.type === __acorn.tokTypes.incDec;
|
891
|
+
if (!update) { sawUnary = true; }
|
892
|
+
node.operator = this.tok.value;
|
893
|
+
node.prefix = true;
|
894
|
+
this.next();
|
895
|
+
node.argument = this.parseMaybeUnary(true);
|
896
|
+
if (update) { node.argument = this.checkLVal(node.argument); }
|
897
|
+
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
898
|
+
} else if (this.tok.type === __acorn.tokTypes.ellipsis) {
|
899
|
+
var node$1 = this.startNode();
|
900
|
+
this.next();
|
901
|
+
node$1.argument = this.parseMaybeUnary(sawUnary);
|
902
|
+
expr = this.finishNode(node$1, "SpreadElement");
|
903
|
+
} else {
|
904
|
+
expr = this.parseExprSubscripts();
|
905
|
+
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
|
906
|
+
var node$2 = this$1.startNodeAt(start);
|
907
|
+
node$2.operator = this$1.tok.value;
|
908
|
+
node$2.prefix = false;
|
909
|
+
node$2.argument = this$1.checkLVal(expr);
|
910
|
+
this$1.next();
|
911
|
+
expr = this$1.finishNode(node$2, "UpdateExpression");
|
912
|
+
}
|
913
|
+
}
|
914
|
+
|
915
|
+
if (!sawUnary && this.eat(__acorn.tokTypes.starstar)) {
|
916
|
+
var node$3 = this.startNodeAt(start);
|
917
|
+
node$3.operator = "**";
|
918
|
+
node$3.left = expr;
|
919
|
+
node$3.right = this.parseMaybeUnary(false);
|
920
|
+
return this.finishNode(node$3, "BinaryExpression")
|
921
|
+
}
|
922
|
+
|
923
|
+
return expr
|
924
|
+
};
|
925
|
+
|
926
|
+
lp$2.parseExprSubscripts = function() {
|
927
|
+
var start = this.storeCurrentPos();
|
928
|
+
return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart)
|
929
|
+
};
|
930
|
+
|
931
|
+
lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
932
|
+
var this$1 = this;
|
933
|
+
|
934
|
+
for (;;) {
|
935
|
+
if (this$1.curLineStart != line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) {
|
936
|
+
if (this$1.tok.type == __acorn.tokTypes.dot && this$1.curIndent == startIndent)
|
937
|
+
{ --startIndent; }
|
938
|
+
else
|
939
|
+
{ return base }
|
940
|
+
}
|
941
|
+
|
942
|
+
var maybeAsyncArrow = base.type === "Identifier" && base.name === "async" && !this$1.canInsertSemicolon();
|
943
|
+
|
944
|
+
if (this$1.eat(__acorn.tokTypes.dot)) {
|
945
|
+
var node = this$1.startNodeAt(start);
|
946
|
+
node.object = base;
|
947
|
+
if (this$1.curLineStart != line && this$1.curIndent <= startIndent && this$1.tokenStartsLine())
|
948
|
+
{ node.property = this$1.dummyIdent(); }
|
949
|
+
else
|
950
|
+
{ node.property = this$1.parsePropertyAccessor() || this$1.dummyIdent(); }
|
951
|
+
node.computed = false;
|
952
|
+
base = this$1.finishNode(node, "MemberExpression");
|
953
|
+
} else if (this$1.tok.type == __acorn.tokTypes.bracketL) {
|
954
|
+
this$1.pushCx();
|
955
|
+
this$1.next();
|
956
|
+
var node$1 = this$1.startNodeAt(start);
|
957
|
+
node$1.object = base;
|
958
|
+
node$1.property = this$1.parseExpression();
|
959
|
+
node$1.computed = true;
|
960
|
+
this$1.popCx();
|
961
|
+
this$1.expect(__acorn.tokTypes.bracketR);
|
962
|
+
base = this$1.finishNode(node$1, "MemberExpression");
|
963
|
+
} else if (!noCalls && this$1.tok.type == __acorn.tokTypes.parenL) {
|
964
|
+
var exprList = this$1.parseExprList(__acorn.tokTypes.parenR);
|
965
|
+
if (maybeAsyncArrow && this$1.eat(__acorn.tokTypes.arrow))
|
966
|
+
{ return this$1.parseArrowExpression(this$1.startNodeAt(start), exprList, true) }
|
967
|
+
var node$2 = this$1.startNodeAt(start);
|
968
|
+
node$2.callee = base;
|
969
|
+
node$2.arguments = exprList;
|
970
|
+
base = this$1.finishNode(node$2, "CallExpression");
|
971
|
+
} else if (this$1.tok.type == __acorn.tokTypes.backQuote) {
|
972
|
+
var node$3 = this$1.startNodeAt(start);
|
973
|
+
node$3.tag = base;
|
974
|
+
node$3.quasi = this$1.parseTemplate();
|
975
|
+
base = this$1.finishNode(node$3, "TaggedTemplateExpression");
|
976
|
+
} else {
|
977
|
+
return base
|
978
|
+
}
|
979
|
+
}
|
980
|
+
};
|
981
|
+
|
982
|
+
lp$2.parseExprAtom = function() {
|
983
|
+
var node;
|
984
|
+
switch (this.tok.type) {
|
985
|
+
case __acorn.tokTypes._this:
|
986
|
+
case __acorn.tokTypes._super:
|
987
|
+
var type = this.tok.type === __acorn.tokTypes._this ? "ThisExpression" : "Super";
|
988
|
+
node = this.startNode();
|
989
|
+
this.next();
|
990
|
+
return this.finishNode(node, type)
|
991
|
+
|
992
|
+
case __acorn.tokTypes.name:
|
993
|
+
var start = this.storeCurrentPos();
|
994
|
+
var id = this.parseIdent();
|
995
|
+
var isAsync = false;
|
996
|
+
if (id.name === "async" && !this.canInsertSemicolon()) {
|
997
|
+
if (this.eat(__acorn.tokTypes._function))
|
998
|
+
{ return this.parseFunction(this.startNodeAt(start), false, true) }
|
999
|
+
if (this.tok.type === __acorn.tokTypes.name) {
|
1000
|
+
id = this.parseIdent();
|
1001
|
+
isAsync = true;
|
1002
|
+
}
|
1003
|
+
}
|
1004
|
+
return this.eat(__acorn.tokTypes.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id], isAsync) : id
|
1005
|
+
|
1006
|
+
case __acorn.tokTypes.regexp:
|
1007
|
+
node = this.startNode();
|
1008
|
+
var val = this.tok.value;
|
1009
|
+
node.regex = {pattern: val.pattern, flags: val.flags};
|
1010
|
+
node.value = val.value;
|
1011
|
+
node.raw = this.input.slice(this.tok.start, this.tok.end);
|
1012
|
+
this.next();
|
1013
|
+
return this.finishNode(node, "Literal")
|
1014
|
+
|
1015
|
+
case __acorn.tokTypes.num: case __acorn.tokTypes.string:
|
1016
|
+
node = this.startNode();
|
1017
|
+
node.value = this.tok.value;
|
1018
|
+
node.raw = this.input.slice(this.tok.start, this.tok.end);
|
1019
|
+
this.next();
|
1020
|
+
return this.finishNode(node, "Literal")
|
1021
|
+
|
1022
|
+
case __acorn.tokTypes._null: case __acorn.tokTypes._true: case __acorn.tokTypes._false:
|
1023
|
+
node = this.startNode();
|
1024
|
+
node.value = this.tok.type === __acorn.tokTypes._null ? null : this.tok.type === __acorn.tokTypes._true;
|
1025
|
+
node.raw = this.tok.type.keyword;
|
1026
|
+
this.next();
|
1027
|
+
return this.finishNode(node, "Literal")
|
1028
|
+
|
1029
|
+
case __acorn.tokTypes.parenL:
|
1030
|
+
var parenStart = this.storeCurrentPos();
|
1031
|
+
this.next();
|
1032
|
+
var inner = this.parseExpression();
|
1033
|
+
this.expect(__acorn.tokTypes.parenR);
|
1034
|
+
if (this.eat(__acorn.tokTypes.arrow)) {
|
1035
|
+
// (a,)=>a // SequenceExpression makes dummy in the last hole. Drop the dummy.
|
1036
|
+
var params = inner.expressions || [inner];
|
1037
|
+
if (params.length && isDummy(params[params.length - 1]))
|
1038
|
+
{ params.pop(); }
|
1039
|
+
return this.parseArrowExpression(this.startNodeAt(parenStart), params)
|
1040
|
+
}
|
1041
|
+
if (this.options.preserveParens) {
|
1042
|
+
var par = this.startNodeAt(parenStart);
|
1043
|
+
par.expression = inner;
|
1044
|
+
inner = this.finishNode(par, "ParenthesizedExpression");
|
1045
|
+
}
|
1046
|
+
return inner
|
1047
|
+
|
1048
|
+
case __acorn.tokTypes.bracketL:
|
1049
|
+
node = this.startNode();
|
1050
|
+
node.elements = this.parseExprList(__acorn.tokTypes.bracketR, true);
|
1051
|
+
return this.finishNode(node, "ArrayExpression")
|
1052
|
+
|
1053
|
+
case __acorn.tokTypes.braceL:
|
1054
|
+
return this.parseObj()
|
1055
|
+
|
1056
|
+
case __acorn.tokTypes._class:
|
1057
|
+
return this.parseClass(false)
|
1058
|
+
|
1059
|
+
case __acorn.tokTypes._function:
|
1060
|
+
node = this.startNode();
|
1061
|
+
this.next();
|
1062
|
+
return this.parseFunction(node, false)
|
1063
|
+
|
1064
|
+
case __acorn.tokTypes._new:
|
1065
|
+
return this.parseNew()
|
1066
|
+
|
1067
|
+
case __acorn.tokTypes.backQuote:
|
1068
|
+
return this.parseTemplate()
|
1069
|
+
|
1070
|
+
default:
|
1071
|
+
return this.dummyIdent()
|
1072
|
+
}
|
1073
|
+
};
|
1074
|
+
|
1075
|
+
lp$2.parseNew = function() {
|
1076
|
+
var node = this.startNode(), startIndent = this.curIndent, line = this.curLineStart;
|
1077
|
+
var meta = this.parseIdent(true);
|
1078
|
+
if (this.options.ecmaVersion >= 6 && this.eat(__acorn.tokTypes.dot)) {
|
1079
|
+
node.meta = meta;
|
1080
|
+
node.property = this.parseIdent(true);
|
1081
|
+
return this.finishNode(node, "MetaProperty")
|
1082
|
+
}
|
1083
|
+
var start = this.storeCurrentPos();
|
1084
|
+
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
|
1085
|
+
if (this.tok.type == __acorn.tokTypes.parenL) {
|
1086
|
+
node.arguments = this.parseExprList(__acorn.tokTypes.parenR);
|
1087
|
+
} else {
|
1088
|
+
node.arguments = [];
|
1089
|
+
}
|
1090
|
+
return this.finishNode(node, "NewExpression")
|
1091
|
+
};
|
1092
|
+
|
1093
|
+
lp$2.parseTemplateElement = function() {
|
1094
|
+
var elem = this.startNode();
|
1095
|
+
|
1096
|
+
// The loose parser accepts invalid unicode escapes even in untagged templates.
|
1097
|
+
if (this.tok.type === __acorn.tokTypes.invalidTemplate) {
|
1098
|
+
elem.value = {
|
1099
|
+
raw: this.tok.value,
|
1100
|
+
cooked: null
|
1101
|
+
};
|
1102
|
+
} else {
|
1103
|
+
elem.value = {
|
1104
|
+
raw: this.input.slice(this.tok.start, this.tok.end).replace(/\r\n?/g, "\n"),
|
1105
|
+
cooked: this.tok.value
|
1106
|
+
};
|
1107
|
+
}
|
1108
|
+
this.next();
|
1109
|
+
elem.tail = this.tok.type === __acorn.tokTypes.backQuote;
|
1110
|
+
return this.finishNode(elem, "TemplateElement")
|
1111
|
+
};
|
1112
|
+
|
1113
|
+
lp$2.parseTemplate = function() {
|
1114
|
+
var this$1 = this;
|
1115
|
+
|
1116
|
+
var node = this.startNode();
|
1117
|
+
this.next();
|
1118
|
+
node.expressions = [];
|
1119
|
+
var curElt = this.parseTemplateElement();
|
1120
|
+
node.quasis = [curElt];
|
1121
|
+
while (!curElt.tail) {
|
1122
|
+
this$1.next();
|
1123
|
+
node.expressions.push(this$1.parseExpression());
|
1124
|
+
if (this$1.expect(__acorn.tokTypes.braceR)) {
|
1125
|
+
curElt = this$1.parseTemplateElement();
|
1126
|
+
} else {
|
1127
|
+
curElt = this$1.startNode();
|
1128
|
+
curElt.value = {cooked: "", raw: ""};
|
1129
|
+
curElt.tail = true;
|
1130
|
+
this$1.finishNode(curElt, "TemplateElement");
|
1131
|
+
}
|
1132
|
+
node.quasis.push(curElt);
|
1133
|
+
}
|
1134
|
+
this.expect(__acorn.tokTypes.backQuote);
|
1135
|
+
return this.finishNode(node, "TemplateLiteral")
|
1136
|
+
};
|
1137
|
+
|
1138
|
+
lp$2.parseObj = function() {
|
1139
|
+
var this$1 = this;
|
1140
|
+
|
1141
|
+
var node = this.startNode();
|
1142
|
+
node.properties = [];
|
1143
|
+
this.pushCx();
|
1144
|
+
var indent = this.curIndent + 1, line = this.curLineStart;
|
1145
|
+
this.eat(__acorn.tokTypes.braceL);
|
1146
|
+
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; }
|
1147
|
+
while (!this.closes(__acorn.tokTypes.braceR, indent, line)) {
|
1148
|
+
var prop = this$1.startNode(), isGenerator = (void 0), isAsync = (void 0), start = (void 0);
|
1149
|
+
if (this$1.options.ecmaVersion >= 9 && this$1.eat(__acorn.tokTypes.ellipsis)) {
|
1150
|
+
prop.argument = this$1.parseMaybeAssign();
|
1151
|
+
node.properties.push(this$1.finishNode(prop, "SpreadElement"));
|
1152
|
+
this$1.eat(__acorn.tokTypes.comma);
|
1153
|
+
continue
|
1154
|
+
}
|
1155
|
+
if (this$1.options.ecmaVersion >= 6) {
|
1156
|
+
start = this$1.storeCurrentPos();
|
1157
|
+
prop.method = false;
|
1158
|
+
prop.shorthand = false;
|
1159
|
+
isGenerator = this$1.eat(__acorn.tokTypes.star);
|
1160
|
+
}
|
1161
|
+
this$1.parsePropertyName(prop);
|
1162
|
+
if (this$1.toks.isAsyncProp(prop)) {
|
1163
|
+
isAsync = true;
|
1164
|
+
isGenerator = this$1.options.ecmaVersion >= 9 && this$1.eat(__acorn.tokTypes.star);
|
1165
|
+
this$1.parsePropertyName(prop);
|
1166
|
+
} else {
|
1167
|
+
isAsync = false;
|
1168
|
+
}
|
1169
|
+
if (isDummy(prop.key)) { if (isDummy(this$1.parseMaybeAssign())) { this$1.next(); } this$1.eat(__acorn.tokTypes.comma); continue }
|
1170
|
+
if (this$1.eat(__acorn.tokTypes.colon)) {
|
1171
|
+
prop.kind = "init";
|
1172
|
+
prop.value = this$1.parseMaybeAssign();
|
1173
|
+
} else if (this$1.options.ecmaVersion >= 6 && (this$1.tok.type === __acorn.tokTypes.parenL || this$1.tok.type === __acorn.tokTypes.braceL)) {
|
1174
|
+
prop.kind = "init";
|
1175
|
+
prop.method = true;
|
1176
|
+
prop.value = this$1.parseMethod(isGenerator, isAsync);
|
1177
|
+
} else if (this$1.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
|
1178
|
+
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
|
1179
|
+
(this$1.tok.type != __acorn.tokTypes.comma && this$1.tok.type != __acorn.tokTypes.braceR && this$1.tok.type != __acorn.tokTypes.eq)) {
|
1180
|
+
prop.kind = prop.key.name;
|
1181
|
+
this$1.parsePropertyName(prop);
|
1182
|
+
prop.value = this$1.parseMethod(false);
|
1183
|
+
} else {
|
1184
|
+
prop.kind = "init";
|
1185
|
+
if (this$1.options.ecmaVersion >= 6) {
|
1186
|
+
if (this$1.eat(__acorn.tokTypes.eq)) {
|
1187
|
+
var assign = this$1.startNodeAt(start);
|
1188
|
+
assign.operator = "=";
|
1189
|
+
assign.left = prop.key;
|
1190
|
+
assign.right = this$1.parseMaybeAssign();
|
1191
|
+
prop.value = this$1.finishNode(assign, "AssignmentExpression");
|
1192
|
+
} else {
|
1193
|
+
prop.value = prop.key;
|
1194
|
+
}
|
1195
|
+
} else {
|
1196
|
+
prop.value = this$1.dummyIdent();
|
1197
|
+
}
|
1198
|
+
prop.shorthand = true;
|
1199
|
+
}
|
1200
|
+
node.properties.push(this$1.finishNode(prop, "Property"));
|
1201
|
+
this$1.eat(__acorn.tokTypes.comma);
|
1202
|
+
}
|
1203
|
+
this.popCx();
|
1204
|
+
if (!this.eat(__acorn.tokTypes.braceR)) {
|
1205
|
+
// If there is no closing brace, make the node span to the start
|
1206
|
+
// of the next token (this is useful for Tern)
|
1207
|
+
this.last.end = this.tok.start;
|
1208
|
+
if (this.options.locations) { this.last.loc.end = this.tok.loc.start; }
|
1209
|
+
}
|
1210
|
+
return this.finishNode(node, "ObjectExpression")
|
1211
|
+
};
|
1212
|
+
|
1213
|
+
lp$2.parsePropertyName = function(prop) {
|
1214
|
+
if (this.options.ecmaVersion >= 6) {
|
1215
|
+
if (this.eat(__acorn.tokTypes.bracketL)) {
|
1216
|
+
prop.computed = true;
|
1217
|
+
prop.key = this.parseExpression();
|
1218
|
+
this.expect(__acorn.tokTypes.bracketR);
|
1219
|
+
return
|
1220
|
+
} else {
|
1221
|
+
prop.computed = false;
|
1222
|
+
}
|
1223
|
+
}
|
1224
|
+
var key = (this.tok.type === __acorn.tokTypes.num || this.tok.type === __acorn.tokTypes.string) ? this.parseExprAtom() : this.parseIdent();
|
1225
|
+
prop.key = key || this.dummyIdent();
|
1226
|
+
};
|
1227
|
+
|
1228
|
+
lp$2.parsePropertyAccessor = function() {
|
1229
|
+
if (this.tok.type === __acorn.tokTypes.name || this.tok.type.keyword) { return this.parseIdent() }
|
1230
|
+
};
|
1231
|
+
|
1232
|
+
lp$2.parseIdent = function() {
|
1233
|
+
var name = this.tok.type === __acorn.tokTypes.name ? this.tok.value : this.tok.type.keyword;
|
1234
|
+
if (!name) { return this.dummyIdent() }
|
1235
|
+
var node = this.startNode();
|
1236
|
+
this.next();
|
1237
|
+
node.name = name;
|
1238
|
+
return this.finishNode(node, "Identifier")
|
1239
|
+
};
|
1240
|
+
|
1241
|
+
lp$2.initFunction = function(node) {
|
1242
|
+
node.id = null;
|
1243
|
+
node.params = [];
|
1244
|
+
if (this.options.ecmaVersion >= 6) {
|
1245
|
+
node.generator = false;
|
1246
|
+
node.expression = false;
|
1247
|
+
}
|
1248
|
+
if (this.options.ecmaVersion >= 8)
|
1249
|
+
{ node.async = false; }
|
1250
|
+
};
|
1251
|
+
|
1252
|
+
// Convert existing expression atom to assignable pattern
|
1253
|
+
// if possible.
|
1254
|
+
|
1255
|
+
lp$2.toAssignable = function(node, binding) {
|
1256
|
+
var this$1 = this;
|
1257
|
+
|
1258
|
+
if (!node || node.type == "Identifier" || (node.type == "MemberExpression" && !binding)) {
|
1259
|
+
// Okay
|
1260
|
+
} else if (node.type == "ParenthesizedExpression") {
|
1261
|
+
this.toAssignable(node.expression, binding);
|
1262
|
+
} else if (this.options.ecmaVersion < 6) {
|
1263
|
+
return this.dummyIdent()
|
1264
|
+
} else if (node.type == "ObjectExpression") {
|
1265
|
+
node.type = "ObjectPattern";
|
1266
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
1267
|
+
{
|
1268
|
+
var prop = list[i];
|
1269
|
+
|
1270
|
+
this$1.toAssignable(prop, binding);
|
1271
|
+
}
|
1272
|
+
} else if (node.type == "ArrayExpression") {
|
1273
|
+
node.type = "ArrayPattern";
|
1274
|
+
this.toAssignableList(node.elements, binding);
|
1275
|
+
} else if (node.type == "Property") {
|
1276
|
+
this.toAssignable(node.value, binding);
|
1277
|
+
} else if (node.type == "SpreadElement") {
|
1278
|
+
node.type = "RestElement";
|
1279
|
+
this.toAssignable(node.argument, binding);
|
1280
|
+
} else if (node.type == "AssignmentExpression") {
|
1281
|
+
node.type = "AssignmentPattern";
|
1282
|
+
delete node.operator;
|
1283
|
+
} else {
|
1284
|
+
return this.dummyIdent()
|
1285
|
+
}
|
1286
|
+
return node
|
1287
|
+
};
|
1288
|
+
|
1289
|
+
lp$2.toAssignableList = function(exprList, binding) {
|
1290
|
+
var this$1 = this;
|
1291
|
+
|
1292
|
+
for (var i = 0, list = exprList; i < list.length; i += 1)
|
1293
|
+
{
|
1294
|
+
var expr = list[i];
|
1295
|
+
|
1296
|
+
this$1.toAssignable(expr, binding);
|
1297
|
+
}
|
1298
|
+
return exprList
|
1299
|
+
};
|
1300
|
+
|
1301
|
+
lp$2.parseFunctionParams = function(params) {
|
1302
|
+
params = this.parseExprList(__acorn.tokTypes.parenR);
|
1303
|
+
return this.toAssignableList(params, true)
|
1304
|
+
};
|
1305
|
+
|
1306
|
+
lp$2.parseMethod = function(isGenerator, isAsync) {
|
1307
|
+
var node = this.startNode(), oldInAsync = this.inAsync;
|
1308
|
+
this.initFunction(node);
|
1309
|
+
if (this.options.ecmaVersion >= 6)
|
1310
|
+
{ node.generator = !!isGenerator; }
|
1311
|
+
if (this.options.ecmaVersion >= 8)
|
1312
|
+
{ node.async = !!isAsync; }
|
1313
|
+
this.inAsync = node.async;
|
1314
|
+
node.params = this.parseFunctionParams();
|
1315
|
+
node.body = this.parseBlock();
|
1316
|
+
this.toks.adaptDirectivePrologue(node.body.body);
|
1317
|
+
this.inAsync = oldInAsync;
|
1318
|
+
return this.finishNode(node, "FunctionExpression")
|
1319
|
+
};
|
1320
|
+
|
1321
|
+
lp$2.parseArrowExpression = function(node, params, isAsync) {
|
1322
|
+
var oldInAsync = this.inAsync;
|
1323
|
+
this.initFunction(node);
|
1324
|
+
if (this.options.ecmaVersion >= 8)
|
1325
|
+
{ node.async = !!isAsync; }
|
1326
|
+
this.inAsync = node.async;
|
1327
|
+
node.params = this.toAssignableList(params, true);
|
1328
|
+
node.expression = this.tok.type !== __acorn.tokTypes.braceL;
|
1329
|
+
if (node.expression) {
|
1330
|
+
node.body = this.parseMaybeAssign();
|
1331
|
+
} else {
|
1332
|
+
node.body = this.parseBlock();
|
1333
|
+
this.toks.adaptDirectivePrologue(node.body.body);
|
1334
|
+
}
|
1335
|
+
this.inAsync = oldInAsync;
|
1336
|
+
return this.finishNode(node, "ArrowFunctionExpression")
|
1337
|
+
};
|
1338
|
+
|
1339
|
+
lp$2.parseExprList = function(close, allowEmpty) {
|
1340
|
+
var this$1 = this;
|
1341
|
+
|
1342
|
+
this.pushCx();
|
1343
|
+
var indent = this.curIndent, line = this.curLineStart, elts = [];
|
1344
|
+
this.next(); // Opening bracket
|
1345
|
+
while (!this.closes(close, indent + 1, line)) {
|
1346
|
+
if (this$1.eat(__acorn.tokTypes.comma)) {
|
1347
|
+
elts.push(allowEmpty ? null : this$1.dummyIdent());
|
1348
|
+
continue
|
1349
|
+
}
|
1350
|
+
var elt = this$1.parseMaybeAssign();
|
1351
|
+
if (isDummy(elt)) {
|
1352
|
+
if (this$1.closes(close, indent, line)) { break }
|
1353
|
+
this$1.next();
|
1354
|
+
} else {
|
1355
|
+
elts.push(elt);
|
1356
|
+
}
|
1357
|
+
this$1.eat(__acorn.tokTypes.comma);
|
1358
|
+
}
|
1359
|
+
this.popCx();
|
1360
|
+
if (!this.eat(close)) {
|
1361
|
+
// If there is no closing brace, make the node span to the start
|
1362
|
+
// of the next token (this is useful for Tern)
|
1363
|
+
this.last.end = this.tok.start;
|
1364
|
+
if (this.options.locations) { this.last.loc.end = this.tok.loc.start; }
|
1365
|
+
}
|
1366
|
+
return elts
|
1367
|
+
};
|
1368
|
+
|
1369
|
+
lp$2.parseAwait = function() {
|
1370
|
+
var node = this.startNode();
|
1371
|
+
this.next();
|
1372
|
+
node.argument = this.parseMaybeUnary();
|
1373
|
+
return this.finishNode(node, "AwaitExpression")
|
1374
|
+
};
|
1375
|
+
|
1376
|
+
// Acorn: Loose parser
|
1377
|
+
//
|
1378
|
+
// This module provides an alternative parser (`parse_dammit`) that
|
1379
|
+
// exposes that same interface as `parse`, but will try to parse
|
1380
|
+
// anything as JavaScript, repairing syntax error the best it can.
|
1381
|
+
// There are circumstances in which it will raise an error and give
|
1382
|
+
// up, but they are very rare. The resulting AST will be a mostly
|
1383
|
+
// valid JavaScript AST (as per the [Mozilla parser API][api], except
|
1384
|
+
// that:
|
1385
|
+
//
|
1386
|
+
// - Return outside functions is allowed
|
1387
|
+
//
|
1388
|
+
// - Label consistency (no conflicts, break only to existing labels)
|
1389
|
+
// is not enforced.
|
1390
|
+
//
|
1391
|
+
// - Bogus Identifier nodes with a name of `"✖"` are inserted whenever
|
1392
|
+
// the parser got too confused to return anything meaningful.
|
1393
|
+
//
|
1394
|
+
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
|
1395
|
+
//
|
1396
|
+
// The expected use for this is to *first* try `acorn.parse`, and only
|
1397
|
+
// if that fails switch to `parse_dammit`. The loose parser might
|
1398
|
+
// parse badly indented code incorrectly, so **don't** use it as
|
1399
|
+
// your default parser.
|
1400
|
+
//
|
1401
|
+
// Quite a lot of acorn.js is duplicated here. The alternative was to
|
1402
|
+
// add a *lot* of extra cruft to that file, making it less readable
|
1403
|
+
// and slower. Copying and editing the code allowed me to make
|
1404
|
+
// invasive changes and simplifications without creating a complicated
|
1405
|
+
// tangle.
|
1406
|
+
|
1407
|
+
__acorn.defaultOptions.tabSize = 4;
|
1408
|
+
|
1409
|
+
// eslint-disable-next-line camelcase
|
1410
|
+
function parse_dammit(input, options) {
|
1411
|
+
return new LooseParser(input, options).parse()
|
1412
|
+
}
|
1413
|
+
|
1414
|
+
__acorn.addLooseExports(parse_dammit, LooseParser, pluginsLoose);
|
1415
|
+
|
1416
|
+
exports.parse_dammit = parse_dammit;
|
1417
|
+
exports.LooseParser = LooseParser;
|
1418
|
+
exports.pluginsLoose = pluginsLoose;
|
1419
|
+
|
1420
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
1421
|
+
|
1422
|
+
})));
|