diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 3c078e9f9..000000000 --- a/.babelrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "presets": [ - "es2015" - ] -} diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 7e119d954..000000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -/dist -/docs -/example -/tutorials diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 21a45027a..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - root: true, - parserOptions: { - ecmaVersion: 2017, - sourceType: "module" - }, - plugins: ["prettier"], - extends: ["eslint:recommended", "prettier"], - env: { - browser: true, - node: true, - mocha: true, - jest: true, - es6: true - }, - rules: { - "prefer-const": "error", - "no-var": "error", - "prettier/prettier": "error" - } -}; diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..5d7399c15 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: ichiriac # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..9dcd15831 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..debaac9da --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,54 @@ +name: Node CI + +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node-version: [18.x, 20.x, 22.x] + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: npm install, test + run: | + yarn + yarn test + + - name: type check + run: | + yarn build-types + [ $(git diff types.d.ts | wc -l) -gt 0 ] && echo 'Diff exists in types.d.ts. Please change jsdoc.' && exit 1 + tsc --noEmit types.d.ts + + - name: install valgrind + run: sudo apt-get install -y valgrind + + - name: benchmark + run: python cachegrind.py node test/benchmark2.js > output.txt + + - name: Download previous benchmark result + uses: actions/cache@v1 + with: + path: ./cache + key: ${{ runner.os }}-${{matrix.node-version}}-benchmark + + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + tool: "customSmallerIsBetter" + output-file-path: output.txt + external-data-json-path: ./cache/benchmark-data.json + alert-threshold: "105%" + fail-on-alert: true + env: + CI: true diff --git a/.gitignore b/.gitignore index d0b732c12..e376a463b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,9 @@ /nbproject /coverage /.vscode +/vendor +/dist *.swp +composer.lock +composer.json +.idea/ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 000000000..a742ac63a --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +yarpm test diff --git a/.jsdoc.json b/.jsdoc.json index 3575686ed..42435962f 100644 --- a/.jsdoc.json +++ b/.jsdoc.json @@ -24,7 +24,7 @@ } }, "opts": { - "template": "node_modules/jsdoc-template", + "template": "./node_modules/jsdoc-template/", "tutorials": "tutorials", "destination": "docs", "readme": "README.md", diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c80fc0b4d..000000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: node_js -node_js: - - '6' -cache: - bundler: true - directories: - - node_modules # NPM package -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build -notifications: - email: false - webhooks: - urls: - - https://webhooks.gitter.im/e/f1d48355795bf25a8f9a - on_success: change - on_failure: always - on_start: never -script: npm run lint && npm run cover -after_success: cat /home/travis/build/glayzzle/php-parser/coverage/lcov.info | /home/travis/build/glayzzle/php-parser/node_modules/coveralls/bin/coveralls.js -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT diff --git a/README.md b/README.md index 103fccc05..e1e605e43 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,12 @@

php-parser

- -Coverage Status -

-

This javascript library parses PHP code and convert it to AST.

+

This JavaScript library parses PHP code and converts it to an AST.

-Installation ------------- +## Installation This library is distributed with [npm](https://www.npmjs.com/package/php-parser) : @@ -18,45 +14,42 @@ This library is distributed with [npm](https://www.npmjs.com/package/php-parser) npm install php-parser --save ``` -Usage ------ +## Usage ```js // initialize the php parser factory class -var fs = require('fs'); -var path = require('path'); -var engine = require('php-parser'); +const fs = require("fs"); +const path = require("path"); +const engine = require("php-parser"); // initialize a new parser instance -var parser = new engine({ +const parser = new engine({ // some options : parser: { extractDoc: true, - php7: true + php7: true, }, ast: { - withPositions: true - } + withPositions: true, + }, }); // Retrieve the AST from the specified source -var eval = parser.parseEval('echo "Hello World";'); +const eval = parser.parseEval('echo "Hello World";'); // Retrieve an array of tokens (same as php function token_get_all) -var tokens = parser.tokenGetAll(' You can add here your own project by opening an issue request. ## License This library is released under BSD-3 license clause. - -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fglayzzle%2Fphp-parser.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fglayzzle%2Fphp-parser?ref=badge_large) diff --git a/RELEASE.md b/RELEASE.md index 1d53d32db..5b0ae9b01 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,52 @@ # Releases +## 3.0.0-prerelease.9 : (2019-08-15) +- #291 : Incorrect parsing of backslash-prefixed use declarations +- #278 : 3.0 - Confusing commentsBlocks references +- #256 : invalid ast for multiple properties +- #255 : better ast for `constant` node +- #250 : Leading comments are treated as trailing comments to the previous function body +- #248 : broken ast for `$$$$$` +- #247 : invalid ast for `silent` +- #246 : `resolution` for `classreference` doesn't work properly for `FULL_QUALIFIED_NAME` +- #242 : feat: improve `Declare` node and introduce `DeclareDirective` node +- #199 : [bug] comment location overlaps with node location for `static` node +- #192 : [bug] encapsed and staticlookup +- #180 : bug in parser with single function +- #174 : Don't output `null` for last element in `list/array` +- #128 : Don't have curly for propertylookup in offset + +## 3.0.0-prerelease.8 : (2019-01-07) + - #243 : Regression in prerelease 7 with echo + - #239 : [bug] call should be in ExpressionStatement + - #235 : invalid ast for `self` and `parent` + - #234 : regression with parens in `3.0.0-prerelease.7` + - #230 : `resolvePrecedence` break location for `bin` nodes + - #207 : [feature] use `identifier` for `class/interface/trait` name + - #202 : [bug] comment position in lookup + - #194 : [feature] implement trailingComments on nodes + - #185 : [bug] parens and staticlookup + - #182 : strange with parens, staticlookup and offsetlookup + - #181 : strange with parens and unary + - #172 : cast precedence + - #167 : staticlookup is broken with curly + +## 3.0.0-prerelease.7 : (2018-11-10) + - #220 : regression in `rc-6` + - #210 : [bug] invalid ast for `const` enhancement + - #204 : [bug] invalid start offset encapsed AST bug + - #201 : [bug] curly in staticlookup bug + - #175 : impossible detect curly in `encapsed` AST enhancement + - #165 : declare doesn't support inline nodes investigating + +Many thanks to @evilebottnawi for his help + +## 3.0.0-prerelease.6 : (2018-10-21) + - impl #196 : identifier for function/method name + - fix #183 : `static` parsed as constref + - fix #188 : `constref` vs `identifier` + - fix #113 : Unhandled native identifiers + ## 3.0.0-alpha3 : (2018-08-15) - fix #168 : End location of `if` without semicolon - impl #147 : Node informations about Binary and unicode strings diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 000000000..53fb44a4d --- /dev/null +++ b/babel.config.js @@ -0,0 +1,11 @@ +module.exports = function (api) { + api.cache(true); + + const presets = ["@babel/preset-env"]; + const plugins = []; + + return { + presets, + plugins, + }; +}; diff --git a/cachegrind.py b/cachegrind.py new file mode 100644 index 000000000..ce1c38024 --- /dev/null +++ b/cachegrind.py @@ -0,0 +1,137 @@ +""" +Proof-of-concept: run_with_cachegrind a program under Cachegrind, combining all the various +metrics into one single performance metric. + +Requires Python 3. + +License: https://opensource.org/licenses/MIT + +## Features + +* Disables ASLR. +* Sets consistent cache sizes. +* Calculates a combined performance metric. + +For more information see the detailed write up at: + +https://pythonspeed.com/articles/consistent-benchmarking-in-ci/ + +## Usage + +This script has no compatibility guarnatees, I recommend copying it into your +repository. To use: + +$ python3 cachegrind.py ./yourprogram --yourparam=yourvalues + +If you're benchmarking Python, make sure to set PYTHONHASHSEED to a fixed value +(e.g. `export PYTHONHASHSEED=1234`). Other languages may have similar +requirements to reduce variability. + +The last line printed will be a combined performance metric, but you can tweak +the script to extract more info, or use it as a library. + +Copyright © 2020, Hyphenated Enterprises LLC. +""" + +import json +from typing import List, Dict +from subprocess import check_call, check_output +import sys +from tempfile import NamedTemporaryFile + +ARCH = check_output(["uname", "-m"]).strip() + + +def run_with_cachegrind(args_list: List[str]) -> Dict[str, int]: + """ + Run the the given program and arguments under Cachegrind, parse the + Cachegrind specs. + + For now we just ignore program output, and in general this is not robust. + """ + temp_file = NamedTemporaryFile("r+") + check_call([ + # Disable ASLR: + "setarch", + ARCH, + "-R", + "valgrind", + "--tool=cachegrind", + # Set some reasonable L1 and LL values, based on Haswell. You can set + # your own, important part is that they are consistent across runs, + # instead of the default of copying from the current machine. + "--I1=32768,8,64", + "--D1=32768,8,64", + "--LL=8388608,16,64", + "--cachegrind-out-file=" + temp_file.name, + ] + args_list) + return parse_cachegrind_output(temp_file) + + +def parse_cachegrind_output(temp_file): + # Parse the output file: + lines = iter(temp_file) + for line in lines: + if line.startswith("events: "): + header = line[len("events: "):].strip() + break + for line in lines: + last_line = line + assert last_line.startswith("summary: ") + last_line = last_line[len("summary:"):].strip() + return dict(zip(header.split(), [int(i) for i in last_line.split()])) + + +def get_counts(cg_results: Dict[str, int]) -> Dict[str, int]: + """ + Given the result of run_with_cachegrind(), figure out the parameters we will use for final + estimate. + + We pretend there's no L2 since Cachegrind doesn't currently support it. + + Caveats: we're not including time to process instructions, only time to + access instruction cache(s), so we're assuming time to fetch and run_with_cachegrind + instruction is the same as time to retrieve data if they're both to L1 + cache. + """ + result = {} + d = cg_results + + ram_hits = d["DLmr"] + d["DLmw"] + d["ILmr"] + + l3_hits = d["I1mr"] + d["D1mw"] + d["D1mr"] - ram_hits + + total_memory_rw = d["Ir"] + d["Dr"] + d["Dw"] + l1_hits = total_memory_rw - l3_hits - ram_hits + assert total_memory_rw == l1_hits + l3_hits + ram_hits + + result["l1"] = l1_hits + result["l3"] = l3_hits + result["ram"] = ram_hits + + return result + + +def combined_instruction_estimate(counts: Dict[str, int]) -> int: + """ + Given the result of run_with_cachegrind(), return estimate of total time to run_with_cachegrind. + + Multipliers were determined empirically, but some research suggests they're + a reasonable approximation for cache time ratios. L3 is probably too low, + but then we're not simulating L2... + """ + return counts["l1"] + (5 * counts["l3"]) + (35 * counts["ram"]) + + +def github_action_benchmark_json(value): + return json.dumps([ + { + "name": "score", + "unit": "", + "value": value, + } + ]) + + +if __name__ == "__main__": + print(github_action_benchmark_json(combined_instruction_estimate(get_counts(run_with_cachegrind(sys.argv[1:]))))) diff --git a/dist/php-parser.js b/dist/php-parser.js deleted file mode 100644 index f2ee9fdc0..000000000 --- a/dist/php-parser.js +++ /dev/null @@ -1,11106 +0,0 @@ -/*! - * - * Package: php-parser - * Parse PHP code and returns its AST - * Build: cba3a756af7de70ce1fd - 2018-10-7 - * License: BSD-3-Clause - * Author: Ioan CHIRIAC - * - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["PhpParser"] = factory(); - else - root["PhpParser"] = factory(); -})(window, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 123); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "statement"; - -/** - * Any statement. - * @constructor Statement - * @extends {Node} - */ -module.exports = Node.extends(KIND, function Statement(kind, docs, location) { - Node.apply(this, [kind || KIND, docs, location]); -}); - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -/** - * A generic AST node - * @constructor Node - * @property {Location|null} loc - * @property {Comment[]} leadingComments - * @property {Comment[]?} trailingComments - * @property {String} kind - */ - -var Node = function Node(kind, docs, location) { - this.kind = kind; - if (docs) { - this.leadingComments = docs; - } - if (location) { - this.loc = location; - } -}; - -/** - * Attach comments to current node - * @param {*} docs - */ -Node.prototype.setTrailingComments = function (docs) { - this.trailingComments = docs; -}; - -/** - * Includes current token position of the parser - * @param {*} parser - */ -Node.prototype.includeToken = function (parser) { - if (this.loc) { - if (this.loc.end) { - this.loc.end.line = parser.lexer.yylloc.last_line; - this.loc.end.column = parser.lexer.yylloc.last_column; - this.loc.end.offset = parser.lexer.offset; - } - if (parser.ast.withSource) { - this.loc.source = parser.lexer._input.substring(this.loc.start.offset, parser.lexer.offset); - } - } - return this; -}; - -/** - * Helper for extending the Node class - * @param {String} type - * @param {Function} constructor - * @return {Function} - */ -Node.extends = function (type, constructor) { - constructor.prototype = Object.create(this.prototype); - constructor.extends = this.extends; - constructor.prototype.constructor = constructor; - constructor.kind = type; - return constructor; -}; - -module.exports = Node; - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "expression"; - -/** - * Any expression node. Since the left-hand side of an assignment may - * be any expression in general, an expression can also be a pattern. - * @constructor Expression - * @extends {Node} - */ -module.exports = Node.extends(KIND, function Expression(kind, docs, location) { - Node.apply(this, [kind || KIND, docs, location]); -}); - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "declaration"; - -var IS_UNDEFINED = ""; -var IS_PUBLIC = "public"; -var IS_PROTECTED = "protected"; -var IS_PRIVATE = "private"; - -/** - * A declaration statement (function, class, interface...) - * @constructor Declaration - * @extends {Statement} - * @property {string} name - */ -var Declaration = Statement.extends(KIND, function Declaration(kind, name, docs, location) { - Statement.apply(this, [kind || KIND, docs, location]); - this.name = name; -}); - -/** - * Generic flags parser - * @param {Integer[]} flags - * @return {void} - */ -Declaration.prototype.parseFlags = function (flags) { - this.isAbstract = flags[2] === 1; - this.isFinal = flags[2] === 2; - if (this.kind !== "class") { - if (flags[0] === -1) { - this.visibility = IS_UNDEFINED; - } else if (flags[0] === null) { - this.visibility = null; - } else if (flags[0] === 0) { - this.visibility = IS_PUBLIC; - } else if (flags[0] === 1) { - this.visibility = IS_PROTECTED; - } else if (flags[0] === 2) { - this.visibility = IS_PRIVATE; - } - this.isStatic = flags[1] === 1; - } -}; - -module.exports = Declaration; - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Expr = __webpack_require__(2); -var KIND = "literal"; - -/** - * Defines an array structure - * @constructor Literal - * @extends {Expression} - * @property {string} raw - * @property {Node|string|number|boolean|null} value - */ -module.exports = Expr.extends(KIND, function Literal(kind, value, raw, docs, location) { - Expr.apply(this, [kind || KIND, docs, location]); - this.value = value; - if (raw) { - this.raw = raw; - } -}); - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "sys"; - -/** - * Defines system based call - * @constructor Sys - * @extends {Statement} - * @property {Node[]} arguments - */ -module.exports = Statement.extends(KIND, function Sys(kind, args, docs, location) { - Statement.apply(this, [kind || KIND, docs, location]); - this.arguments = args; -}); - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Expr = __webpack_require__(2); -var KIND = "operation"; - -/** - * Defines binary operations - * @constructor Operation - * @extends {Expression} - */ -module.exports = Expr.extends(KIND, function Operation(kind, docs, location) { - Expr.apply(this, [kind || KIND, docs, location]); -}); - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Expr = __webpack_require__(2); -var KIND = "lookup"; - -/** - * Lookup on an offset in the specified object - * @constructor Lookup - * @extends {Expression} - * @property {Expression} what - * @property {Expression} offset - */ -module.exports = Expr.extends(KIND, function Lookup(kind, what, offset, docs, location) { - Expr.apply(this, [kind || KIND, docs, location]); - this.what = what; - this.offset = offset; -}); - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "block"; - -/** - * A block statement, i.e., a sequence of statements surrounded by braces. - * @constructor Block - * @extends {Statement} - * @property {Node[]} children - */ -module.exports = Statement.extends(KIND, function Block(kind, children, docs, location) { - Statement.apply(this, [kind || KIND, docs, location]); - this.children = children.filter(Boolean); -}); - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); - -/** - * Abstract documentation node (ComentLine or CommentBlock) - * @constructor Comment - * @extends {Node} - * @property {String} value - */ -module.exports = Node.extends("comment", function Comment(kind, value, docs, location) { - Node.apply(this, [kind, docs, location]); - this.value = value; -}); - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Declaration = __webpack_require__(3); -var KIND = "function"; - -/** - * Defines a classic function - * @constructor Function - * @extends {Declaration} - * @property {Parameter[]} arguments - * @property {Identifier} type - * @property {boolean} byref - * @property {boolean} nullable - * @property {Block|null} body - */ -module.exports = Declaration.extends(KIND, function _Function(name, args, byref, type, nullable, docs, location) { - Declaration.apply(this, [KIND, name, docs, location]); - this.arguments = args; - this.byref = byref; - this.type = type; - this.nullable = nullable; - this.body = null; -}); - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Declaration = __webpack_require__(3); -var KIND = "constant"; - -/** - * Defines a namespace constant - * @constructor Constant - * @extends {Declaration} - * @property {Node|null} value - */ -module.exports = Declaration.extends(KIND, function Constant(name, value, docs, location) { - Declaration.apply(this, [KIND, name, docs, location]); - this.value = value; -}); - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Expression = __webpack_require__(2); -var KIND = "yieldfrom"; - -/** - * Defines a yield from generator statement - * @constructor YieldFrom - * @extends {Expression} - * @property {Expression} value - * @see http://php.net/manual/en/language.generators.syntax.php - */ -module.exports = Expression.extends(KIND, function YieldFrom(value, docs, location) { - Expression.apply(this, [KIND, docs, location]); - this.value = value; -}); - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Expression = __webpack_require__(2); -var KIND = "yield"; - -/** - * Defines a yield generator statement - * @constructor Yield - * @extends {Expression} - * @property {Expression|Null} value - * @property {Expression|Null} key - * @see http://php.net/manual/en/language.generators.syntax.php - */ -module.exports = Expression.extends(KIND, function Yield(value, key, docs, location) { - Expression.apply(this, [KIND, docs, location]); - this.value = value; - this.key = key; -}); - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "while"; - -/** - * Defines a while statement - * @constructor While - * @extends {Statement} - * @property {Expression} test - * @property {Statement} body - * @property {boolean} shortForm - */ -module.exports = Statement.extends(KIND, function While(test, body, shortForm, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.body = body; - this.shortForm = shortForm; -}); - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Expr = __webpack_require__(2); -var KIND = "variadic"; - -/** - * Introduce a list of items into the arguments of the call - * @constructor variadic - * @extends {Expression} - * @property {Array|Expression} what - * @see https://wiki.php.net/rfc/argument_unpacking - */ -module.exports = Expr.extends(KIND, function variadic(what, docs, location) { - Expr.apply(this, [KIND, docs, location]); - this.what = what; -}); - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Expr = __webpack_require__(2); -var KIND = "variable"; - -/** - * Any expression node. Since the left-hand side of an assignment may - * be any expression in general, an expression can also be a pattern. - * @constructor Variable - * @extends {Expression} - * @example - * // PHP code : - * &$foo - * // AST output - * { - * "kind": "variable", - * "name": "foo", - * "byref": true, - * "curly": false - * } - * @property {String|Node} name The variable name (can be a complex expression when the name is resolved dynamically) - * @property {boolean} byref Indicate if the variable reference is used, ex `&$foo` - * @property {boolean} curly Indicate if the name is defined between curlies, ex `${foo}` - */ -module.exports = Expr.extends(KIND, function Variable(name, byref, curly, docs, location) { - Expr.apply(this, [KIND, docs, location]); - this.name = name; - this.byref = byref || false; - this.curly = curly || false; -}); - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "useitem"; - -/** - * Defines a use statement (from namespace) - * @constructor UseItem - * @extends {Statement} - * @property {String} name - * @property {String|null} type - Possible value : function, const - * @property {String|null} alias - * @see {Namespace} - * @see http://php.net/manual/en/language.namespaces.importing.php - */ -var UseItem = Statement.extends(KIND, function UseItem(name, alias, type, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.name = name; - this.alias = alias; - this.type = type; -}); - -/** - * Importing a constant - * @constant {String} TYPE_CONST - */ -UseItem.TYPE_CONST = "const"; -/** - * Importing a function - * @constant {String} TYPE_FUNC - */ -UseItem.TYPE_FUNCTION = "function"; - -module.exports = UseItem; - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "usegroup"; - -/** - * Defines a use statement (with a list of use items) - * @constructor UseGroup - * @extends {Statement} - * @property {String|null} name - * @property {String|null} type - Possible value : function, const - * @property {UseItem[]} item - * @see {Namespace} - * @see http://php.net/manual/en/language.namespaces.importing.php - */ -module.exports = Statement.extends(KIND, function UseGroup(name, type, items, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.name = name; - this.type = type; - this.items = items; -}); - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Sys = __webpack_require__(5); -var KIND = "unset"; - -/** - * Deletes references to a list of variables - * @constructor Unset - * @extends {Sys} - */ -module.exports = Sys.extends(KIND, function Unset(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); -}); - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Operation = __webpack_require__(6); -var KIND = "unary"; - -/** - * Unary operations - * @constructor Unary - * @extends {Operation} - * @property {String} type - * @property {Expression} what - */ -module.exports = Operation.extends(KIND, function Unary(type, what, docs, location) { - Operation.apply(this, [KIND, docs, location]); - this.type = type; - this.what = what; -}); - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "try"; - -/** - * Defines a try statement - * @constructor Try - * @extends {Statement} - * @property {Block} body - * @property {Catch[]} catches - * @property {Block} allways - */ -module.exports = Statement.extends(KIND, function Try(body, catches, always, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.body = body; - this.catches = catches; - this.always = always; -}); - -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "traituse"; - -/** - * Defines a trait usage - * @constructor TraitUse - * @extends {Node} - * @property {Identifier[]} traits - * @property {Node[]|null} adaptations - */ -module.exports = Node.extends(KIND, function TraitUse(traits, adaptations, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.traits = traits; - this.adaptations = adaptations; -}); - -/***/ }), -/* 23 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "traitprecedence"; - -/** - * Defines a trait alias - * @constructor TraitPrecedence - * @extends {Node} - * @property {Identifier|null} trait - * @property {string} method - * @property {Identifier[]} instead - */ -module.exports = Node.extends(KIND, function TraitPrecedence(trait, method, instead, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.trait = trait; - this.method = method; - this.instead = instead; -}); - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "traitalias"; - -var IS_UNDEFINED = ""; -var IS_PUBLIC = "public"; -var IS_PROTECTED = "protected"; -var IS_PRIVATE = "private"; - -/** - * Defines a trait alias - * @constructor TraitAlias - * @extends {Node} - * @property {Identifier|null} trait - * @property {string} method - * @property {string|null} as - * @property {string|null} visibility - */ -module.exports = Node.extends(KIND, function TraitAlias(trait, method, as, flags, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.trait = trait; - this.method = method; - this.as = as; - this.visibility = IS_UNDEFINED; - if (flags) { - if (flags[0] === 0) { - this.visibility = IS_PUBLIC; - } else if (flags[0] === 1) { - this.visibility = IS_PROTECTED; - } else if (flags[0] === 2) { - this.visibility = IS_PRIVATE; - } - } -}); - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Declaration = __webpack_require__(3); -var KIND = "trait"; - -/** - * A trait definition - * @constructor Trait - * @extends {Declaration} - * @property {Identifier|null} extends - * @property {Identifier[]} implements - * @property {Declaration[]} body - */ -module.exports = Declaration.extends(KIND, function Trait(name, ext, impl, body, docs, location) { - Declaration.apply(this, [KIND, name, docs, location]); - this.extends = ext; - this.implements = impl; - this.body = body; -}); - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "throw"; - -/** - * Defines a throw statement - * @constructor Throw - * @extends {Statement} - * @property {Expression} what - */ -module.exports = Statement.extends(KIND, function Throw(what, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.what = what; -}); - -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "switch"; - -/** - * Defines a switch statement - * @constructor Switch - * @extends {Statement} - * @property {Expression} test - * @property {Block} body - * @property {boolean} shortForm - */ -module.exports = Statement.extends(KIND, function Switch(test, body, shortForm, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.body = body; - this.shortForm = shortForm; -}); - -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Literal = __webpack_require__(4); -var KIND = "string"; - -/** - * Defines a string (simple ou double quoted) - chars are already escaped - * @constructor String - * @extends {Literal} - * @property {boolean} unicode - * @property {boolean} isDoubleQuote - * @see {Encapsed} - */ -module.exports = Literal.extends(KIND, function String(isDoubleQuote, value, unicode, raw, docs, location) { - Literal.apply(this, [KIND, value, raw, docs, location]); - this.unicode = unicode; - this.isDoubleQuote = isDoubleQuote; -}); - -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Lookup = __webpack_require__(7); -var KIND = "staticlookup"; - -/** - * Lookup to a static property - * @constructor StaticLookup - * @extends {Lookup} - */ -module.exports = Lookup.extends(KIND, function StaticLookup(what, offset, docs, location) { - Lookup.apply(this, [KIND, what, offset, docs, location]); -}); - -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "static"; - -/** - * Declares a static variable into the current scope - * @constructor Static - * @extends {Statement} - * @property {Variable[]|Assign[]} items - */ -module.exports = Statement.extends(KIND, function Static(items, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.items = items; -}); - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "silent"; - -/** - * Avoids to show/log warnings & notices from the inner expression - * @constructor Silent - * @extends {Statement} - * @property {Expression} expr - */ -module.exports = Statement.extends(KIND, function Silent(expr, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.expr = expr; -}); - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "return"; - -/** - * A continue statement - * @constructor Return - * @extends {Node} - * @property {Expression|null} expr - */ -module.exports = Node.extends(KIND, function Return(expr, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.expr = expr; -}); - -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "retif"; - -/** - * Defines a short if statement that returns a value - * @constructor RetIf - * @extends {Statement} - * @property {Expression} test - * @property {Expression} trueExpr - * @property {Expression} falseExpr - */ -module.exports = Statement.extends(KIND, function RetIf(test, trueExpr, falseExpr, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.trueExpr = trueExpr; - this.falseExpr = falseExpr; -}); - -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Lookup = __webpack_require__(7); -var KIND = "propertylookup"; - -/** - * Lookup to an object property - * @constructor PropertyLookup - * @extends {Lookup} - */ -module.exports = Lookup.extends(KIND, function PropertyLookup(what, offset, docs, location) { - Lookup.apply(this, [KIND, what, offset, docs, location]); -}); - -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Declaration = __webpack_require__(3); -var KIND = "property"; - -/** - * Defines a class property - * @constructor Property - * @extends {Declaration} - * @property {boolean} isFinal - * @property {boolean} isStatic - * @property {string} visibility - * @property {Node|null} value - */ -module.exports = Declaration.extends(KIND, function Property(name, value, flags, docs, location) { - Declaration.apply(this, [KIND, name, docs, location]); - this.value = value; - this.parseFlags(flags); -}); - -/***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Block = __webpack_require__(8); -var KIND = "program"; - -/** - * The main program node - * @constructor Program - * @extends {Block} - * @property {Error[]} errors - * @property {Doc[]?} comments - * @property {String[]?} tokens - */ -module.exports = Block.extends(KIND, function Program(children, errors, comments, tokens, docs, location) { - Block.apply(this, [KIND, children, docs, location]); - this.errors = errors; - if (comments) { - this.comments = comments; - } - if (tokens) { - this.tokens = tokens; - } -}); - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Sys = __webpack_require__(5); -var KIND = "print"; - -/** - * Outputs - * @constructor Print - * @extends {Sys} - */ -module.exports = Sys.extends(KIND, function Print(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); -}); - -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Operation = __webpack_require__(6); -var KIND = "pre"; - -/** - * Defines a pre operation `++$i` or `--$i` - * @constructor Pre - * @extends {Operation} - * @property {String} type - * @property {Variable} what - */ -module.exports = Operation.extends(KIND, function Pre(type, what, docs, location) { - Operation.apply(this, [KIND, docs, location]); - this.type = type; - this.what = what; -}); - -/***/ }), -/* 39 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Operation = __webpack_require__(6); -var KIND = "post"; - -/** - * Defines a post operation `$i++` or `$i--` - * @constructor Post - * @extends {Operation} - * @property {String} type - * @property {Variable} what - */ -module.exports = Operation.extends(KIND, function Post(type, what, docs, location) { - Operation.apply(this, [KIND, docs, location]); - this.type = type; - this.what = what; -}); - -/***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Declaration = __webpack_require__(3); -var KIND = "parameter"; - -/** - * Defines a function parameter - * @constructor Parameter - * @extends {Declaration} - * @property {Identifier|null} type - * @property {Node|null} value - * @property {boolean} byref - * @property {boolean} variadic - * @property {boolean} nullable - */ -module.exports = Declaration.extends(KIND, function Parameter(name, type, value, isRef, isVariadic, nullable, docs, location) { - Declaration.apply(this, [KIND, name, docs, location]); - this.value = value; - this.type = type; - this.byref = isRef; - this.variadic = isVariadic; - this.nullable = nullable; -}); - -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Lookup = __webpack_require__(7); -var KIND = "offsetlookup"; - -/** - * Lookup on an offset in an array - * @constructor OffsetLookup - * @extends {Lookup} - */ -module.exports = Lookup.extends(KIND, function OffsetLookup(what, offset, docs, location) { - Lookup.apply(this, [KIND, what, offset, docs, location]); -}); - -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Literal = __webpack_require__(4); -var KIND = "number"; - -/** - * Defines a numeric value - * @constructor Number - * @extends {Literal} - */ -module.exports = Literal.extends(KIND, function Number(value, raw, docs, location) { - Literal.apply(this, [KIND, value, raw, docs, location]); -}); - -/***/ }), -/* 43 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Literal = __webpack_require__(4); -var KIND = "nowdoc"; - -/** - * Defines a nowdoc string - * @constructor NowDoc - * @extends {Literal} - * @property {String} label - * @property {String} raw - * @property {Boolean} quote - */ -module.exports = Literal.extends(KIND, function Nowdoc(value, raw, label, quote, docs, location) { - Literal.apply(this, [KIND, value, raw, docs, location]); - this.label = label; - this.quote = quote; -}); - -/***/ }), -/* 44 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "new"; - -/** - * Creates a new instance of the specified class - * @constructor New - * @extends {Statement} - * @property {Identifier|Variable|Class} what - * @property {Arguments[]} arguments - */ -module.exports = Statement.extends(KIND, function New(what, args, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.what = what; - this.arguments = args; -}); - -/***/ }), -/* 45 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Block = __webpack_require__(8); -var KIND = "namespace"; - -/** - * The main program node - * @constructor Namespace - * @extends {Block} - * @property {String} name - * @property {Boolean} withBrackets - */ -module.exports = Block.extends(KIND, function Namespace(name, children, withBrackets, docs, location) { - Block.apply(this, [KIND, children, docs, location]); - this.name = name; - this.withBrackets = withBrackets || false; -}); - -/***/ }), -/* 46 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var fn = __webpack_require__(10); -var KIND = "method"; - -/** - * Defines a class/interface/trait method - * @constructor Method - * @extends {Function} - * @property {boolean} isAbstract - * @property {boolean} isFinal - * @property {boolean} isStatic - * @property {string} visibility - */ -module.exports = fn.extends(KIND, function Method() { - fn.apply(this, arguments); - this.kind = KIND; -}); - -/***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Literal = __webpack_require__(4); -var KIND = "magic"; - -/** - * Defines magic constant - * @constructor Magic - * @extends {Literal} - */ -module.exports = Literal.extends(KIND, function Magic(value, raw, docs, location) { - Literal.apply(this, [KIND, value, raw, docs, location]); -}); - -/***/ }), -/* 48 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Sys = __webpack_require__(5); -var KIND = "list"; - -/** - * Defines list assignment - * @constructor List - * @extends {Sys} - * @property {boolean} shortForm - */ -module.exports = Sys.extends(KIND, function List(items, shortForm, docs, location) { - Sys.apply(this, [KIND, items, docs, location]); - this.shortForm = shortForm; -}); - -/***/ }), -/* 49 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "label"; - -/** - * A label statement (referenced by goto) - * @constructor Label - * @extends {Node} - * @property {String} name - */ -module.exports = Node.extends(KIND, function Label(name, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.name = name; -}); - -/***/ }), -/* 50 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Sys = __webpack_require__(5); -var KIND = "isset"; - -/** - * Defines an isset call - * @constructor Isset - * @extends {Sys} - */ -module.exports = Sys.extends(KIND, function Isset(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); -}); - -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Declaration = __webpack_require__(3); -var KIND = "interface"; - -/** - * An interface definition - * @constructor Interface - * @extends {Declaration} - * @property {Identifier[]} extends - * @property {Declaration[]} body - */ -module.exports = Declaration.extends(KIND, function Interface(name, ext, body, docs, location) { - Declaration.apply(this, [KIND, name, docs, location]); - this.extends = ext; - this.body = body; -}); - -/***/ }), -/* 52 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Literal = __webpack_require__(4); -var KIND = "inline"; - -/** - * Defines inline html output (treated as echo output) - * @constructor Inline - * @extends {Literal} - */ -module.exports = Literal.extends(KIND, function Inline(value, raw, docs, location) { - Literal.apply(this, [KIND, value, raw, docs, location]); -}); - -/***/ }), -/* 53 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "include"; - -/** - * Defines system include call - * @constructor Include - * @extends {Statement} - * @property {Node} target - * @property {boolean} once - * @property {boolean} require - */ -module.exports = Statement.extends(KIND, function Include(once, require, target, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.once = once; - this.require = require; - this.target = target; -}); - -/***/ }), -/* 54 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "if"; - -/** - * Defines a if statement - * @constructor If - * @extends {Statement} - * @property {Expression} test - * @property {Block} body - * @property {Block|If|null} alternate - * @property {boolean} shortForm - */ -module.exports = Statement.extends(KIND, function If(test, body, alternate, shortForm, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.body = body; - this.alternate = alternate; - this.shortForm = shortForm; -}); - -/***/ }), -/* 55 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "identifier"; - -/** - * Defines an identifier node - * @constructor Identifier - * @extends {Node} - * @property {string} name - * @property {string} resolution - */ -var Identifier = Node.extends(KIND, function Identifier(name, isRelative, docs, location) { - Node.apply(this, [KIND, docs, location]); - if (isRelative) { - this.resolution = Identifier.RELATIVE_NAME; - } else if (name.length === 1) { - this.resolution = Identifier.UNQUALIFIED_NAME; - } else if (name[0] === "") { - this.resolution = Identifier.FULL_QUALIFIED_NAME; - } else { - this.resolution = Identifier.QUALIFIED_NAME; - } - this.name = name.join("\\"); -}); - -/** - * This is an identifier without a namespace separator, such as Foo - * @constant {String} UNQUALIFIED_NAME - */ -Identifier.UNQUALIFIED_NAME = "uqn"; -/** - * This is an identifier with a namespace separator, such as Foo\Bar - * @constant {String} QUALIFIED_NAME - */ -Identifier.QUALIFIED_NAME = "qn"; -/** - * This is an identifier with a namespace separator that begins with - * a namespace separator, such as \Foo\Bar. The namespace \Foo is also - * a fully qualified name. - * @constant {String} FULL_QUALIFIED_NAME - */ -Identifier.FULL_QUALIFIED_NAME = "fqn"; -/** - * This is an identifier starting with namespace, such as namespace\Foo\Bar. - * @constant {String} RELATIVE_NAME - */ -Identifier.RELATIVE_NAME = "rn"; - -module.exports = Identifier; - -/***/ }), -/* 56 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "halt"; - -/** - * Halts the compiler execution - * @constructor Halt - * @extends {Statement} - * @property {String} after - String after the halt statement - * @see http://php.net/manual/en/function.halt-compiler.php - */ -module.exports = Statement.extends(KIND, function Halt(after, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.after = after; -}); - -/***/ }), -/* 57 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "goto"; - -/** - * Defines goto statement - * @constructor Goto - * @extends {Statement} - * @property {String} label - * @see {Label} - */ -module.exports = Statement.extends(KIND, function Goto(label, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.label = label; -}); - -/***/ }), -/* 58 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "global"; - -/** - * Imports a variable from the global scope - * @constructor Global - * @extends {Statement} - * @property {Variable[]} items - */ -module.exports = Statement.extends(KIND, function Global(items, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.items = items; -}); - -/***/ }), -/* 59 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "foreach"; - -/** - * Defines a foreach iterator - * @constructor Foreach - * @extends {Statement} - * @property {Expression} source - * @property {Expression|null} key - * @property {Expression} value - * @property {Statement} body - * @property {boolean} shortForm - * @see http://php.net/manual/en/control-structures.foreach.php - */ -module.exports = Statement.extends(KIND, function Foreach(source, key, value, body, shortForm, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.source = source; - this.key = key; - this.value = value; - this.shortForm = shortForm; - this.body = body; -}); - -/***/ }), -/* 60 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "for"; - -/** - * Defines a for iterator - * @constructor For - * @extends {Statement} - * @property {Expression[]} init - * @property {Expression[]} test - * @property {Expression[]} increment - * @property {Statement} body - * @property {boolean} shortForm - * @see http://php.net/manual/en/control-structures.for.php - */ -module.exports = Statement.extends(KIND, function For(init, test, increment, body, shortForm, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.init = init; - this.test = test; - this.increment = increment; - this.shortForm = shortForm; - this.body = body; -}); - -/***/ }), -/* 61 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "expressionstatement"; - -/** - * Defines an expression based statement - * @constructor ExpressionStatement - * @extends {Statement} - * @property {Expression} expression - */ -module.exports = Statement.extends(KIND, function ExpressionStatement(expr, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.expression = expr; -}); - -/***/ }), -/* 62 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "exit"; - -/** - * Defines an exit / die call - * @constructor Exit - * @extends {Statement} - * @property {Node|null} status - * @property {Boolean} useDie - */ -module.exports = Statement.extends(KIND, function Exit(status, useDie, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.status = status; - this.useDie = useDie; -}); - -/***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "eval"; - -/** - * Defines an eval statement - * @constructor Eval - * @extends {Statement} - * @property {Node} source - */ -module.exports = Statement.extends(KIND, function Eval(source, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.source = source; -}); - -/***/ }), -/* 64 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "error"; - -/** - * Defines an error node (used only on silentMode) - * @constructor Error - * @extends {Node} - * @property {string} message - * @property {number} line - * @property {number|string} token - * @property {string|array} expected - */ -module.exports = Node.extends(KIND, function Error(message, token, line, expected, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.message = message; - this.token = token; - this.line = line; - this.expected = expected; -}); - -/***/ }), -/* 65 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Node = __webpack_require__(1); -var KIND = "entry"; - -/** - * An array entry - see [Array](#array) - * @constructor Entry - * @extends {Node} - * @property {Node|null} key The entry key/offset - * @property {Node} value The entry value - */ -module.exports = Node.extends(KIND, function Entry(key, value, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.key = key; - this.value = value; -}); - -/***/ }), -/* 66 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Literal = __webpack_require__(4); -var KIND = "encapsed"; - -/** - * Defines an encapsed string (contains expressions) - * @constructor Encapsed - * @extends {Literal} - * @property {String} type - Defines the type of encapsed string (shell, heredoc, string) - * @property {String|Null} label - The heredoc label, defined only when the type is heredoc - */ -var Encapsed = Literal.extends(KIND, function Encapsed(value, raw, type, docs, location) { - Literal.apply(this, [KIND, value, raw, docs, location]); - this.type = type; -}); - -/** - * The node is a double quote string : - * ```php - * bar_$baz; - * ``` - * @constant {String} TYPE_OFFSET - `offset` - */ -Encapsed.TYPE_OFFSET = "offset"; - -module.exports = Encapsed; - -/***/ }), -/* 67 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Sys = __webpack_require__(5); -var KIND = "empty"; - -/** - * Defines an empty check call - * @constructor Empty - * @extends {Sys} - */ -module.exports = Sys.extends(KIND, function Empty(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); -}); - -/***/ }), -/* 68 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Sys = __webpack_require__(5); -var KIND = "echo"; - -/** - * Defines system based call - * @constructor Echo - * @property {boolean} shortForm - * @extends {Sys} - */ -module.exports = Sys.extends(KIND, function Echo(args, shortForm, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); - this.shortForm = shortForm; -}); - -/***/ }), -/* 69 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Statement = __webpack_require__(0); -var KIND = "do"; - -/** - * Defines a do/while statement - * @constructor Do - * @extends {Statement} - * @property {Expression} test - * @property {Statement} body - */ -module.exports = Statement.extends(KIND, function Do(test, body, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.body = body; -}); - -/***/ }), -/* 70 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Block = __webpack_require__(8); -var KIND = "declare"; - -/** - * The declare construct is used to set execution directives for a block of code - * @constructor Declare - * @extends {Block} - * @property {Expression[]} what - * @property {String} mode - * @see http://php.net/manual/en/control-structures.declare.php - */ -var Declare = Block.extends(KIND, function Declare(what, body, mode, docs, location) { - Block.apply(this, [KIND, body, docs, location]); - this.what = what; - this.mode = mode; -}); - -/** - * The node is declared as a short tag syntax : - * ```php - * 'bar', 3] - * - * // AST structure : - * { - * "kind": "array", - * "shortForm": true - * "items": [ - * {"kind": "number", "value": "1"}, - * { - * "kind": "entry", - * "key": {"kind": "string", "value": "foo", "isDoubleQuote": false}, - * "value": {"kind": "string", "value": "bar", "isDoubleQuote": false} - * }, - * {"kind": "number", "value": "3"} - * ] - * } - * @extends {Expression} - * @property {Entry|Expr|Variable} items List of array items - * @property {boolean} shortForm Indicate if the short array syntax is used, ex `[]` instead `array()` - */ -module.exports = Expr.extends(KIND, function Array(shortForm, items, docs, location) { - Expr.apply(this, [KIND, docs, location]); - this.items = items; - this.shortForm = shortForm; -}); - -/***/ }), -/* 88 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -/** - * Each Position object consists of a line number (1-indexed) and a column number (0-indexed): - * @constructor Position - * @property {Number} line - * @property {Number} column - * @property {Number} offset - */ - -var Position = function Position(line, column, offset) { - this.line = line; - this.column = column; - this.offset = offset; -}; - -module.exports = Position; - -/***/ }), -/* 89 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -/** - * Defines the location of the node (with it's source contents as string) - * @constructor Location - * @property {String|null} source - * @property {Position} start - * @property {Position} end - */ - -var Location = function Location(source, start, end) { - this.source = source; - this.start = start; - this.end = end; -}; - -module.exports = Location; - -/***/ }), -/* 90 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var Location = __webpack_require__(89); -var Position = __webpack_require__(88); - -/** - * ## Class hierarchy - * - * - [Location](#location) - * - [Position](#position) - * - [Node](#node) - * - [Identifier](#identifier) - * - [TraitUse](#traituse) - * - [TraitAlias](#traitalias) - * - [TraitPrecedence](#traitprecedence) - * - [Entry](#entry) - * - [Case](#case) - * - [Label](#label) - * - [Comment](#comment) - * - [CommentLine](#commentline) - * - [CommentBlock](#commentblock) - * - [Error](#error) - * - [Expression](#expression) - * - [Array](#array) - * - [Variable](#variable) - * - [Variadic](#variadic) - * - [ConstRef](#constref) - * - [Yield](#yield) - * - [YieldFrom](#yieldfrom) - * - [Lookup](#lookup) - * - [PropertyLookup](#propertylookup) - * - [StaticLookup](#staticlookup) - * - [OffsetLookup](#offsetlookup) - * - [Operation](#operation) - * - [Pre](#pre) - * - [Post](#post) - * - [Bin](#bin) - * - [Unary](#unary) - * - [Cast](#cast) - * - [Literal](#literal) - * - [Boolean](#boolean) - * - [String](#string) - * - [Number](#number) - * - [Inline](#inline) - * - [Magic](#magic) - * - [Nowdoc](#nowdoc) - * - [Encapsed](#encapsed) - * - [Statement](#statement) - * - [Eval](#eval) - * - [Exit](#exit) - * - [Halt](#halt) - * - [Clone](#clone) - * - [Declare](#declare) - * - [Global](#global) - * - [Static](#static) - * - [Include](#include) - * - [Assign](#assign) - * - [RetIf](#retif) - * - [If](#if) - * - [Do](#do) - * - [While](#while) - * - [For](#for) - * - [Foreach](#foreach) - * - [Switch](#switch) - * - [Goto](#goto) - * - [Silent](#silent) - * - [Try](#try) - * - [Catch](#catch) - * - [Throw](#throw) - * - [Call](#call) - * - [Closure](#closure) - * - [New](#new) - * - [UseGroup](#usegroup) - * - [UseItem](#useitem) - * - [Block](#block) - * - [Program](#program) - * - [Namespace](#namespace) - * - [Sys](#sys) - * - [Echo](#echo) - * - [List](#list) - * - [Print](#print) - * - [Isset](#isset) - * - [Unset](#unset) - * - [Empty](#empty) - * - [Declaration](#declaration) - * - [Class](#class) - * - [Interface](#interface) - * - [Trait](#trait) - * - [Constant](#constant) - * - [ClassConstant](#classconstant) - * - [Function](#function) - * - [Method](#method) - * - [Parameter](#parameter) - * - [Property](#property) - * --- - */ - -/** - * The AST builder class - * @constructor AST - * @tutorial AST - * @property {Boolean} withPositions - Should locate any node (by default false) - * @property {Boolean} withSource - Should extract the node original code (by default false) - */ -var AST = function AST(withPositions, withSource) { - this.withPositions = withPositions; - this.withSource = withSource; -}; - -/** - * Create a position node from specified parser - * including it's lexer current state - * @param {Parser} - * @return {Position} - * @private - */ -AST.prototype.position = function (parser) { - return new Position(parser.lexer.yylloc.first_line, parser.lexer.yylloc.first_column, parser.lexer.yylloc.first_offset); -}; - -// operators in ascending order of precedence -AST.precedence = {}; -[["or"], ["xor"], ["and"], ["="], ["?"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "!=", "===", "!==", /* '<>', */"<=>"], ["<", "<=", ">", ">="], ["<<", ">>"], ["+", "-", "."], ["*", "/", "%"], ["!"], ["instanceof"] -// TODO: typecasts -// TODO: [ (array) -// TODO: clone, new -].forEach(function (list, index) { - list.forEach(function (operator) { - AST.precedence[operator] = index + 1; - }); -}); - -/** - * Check and fix precence, by default using right - */ -AST.prototype.resolvePrecedence = function (result) { - var buffer = void 0, - lLevel = void 0, - rLevel = void 0; - // handling precendence - if (result.kind === "bin") { - if (result.right && !result.right.parenthesizedExpression) { - if (result.right.kind === "bin") { - lLevel = AST.precedence[result.type]; - rLevel = AST.precedence[result.right.type]; - if (lLevel && rLevel && rLevel <= lLevel) { - // https://github.com/glayzzle/php-parser/issues/79 - // shift precedence - buffer = result.right; - result.right = result.right.left; - buffer.left = this.resolvePrecedence(result); - result = buffer; - } - } else if (result.right.kind === "retif") { - lLevel = AST.precedence[result.type]; - rLevel = AST.precedence["?"]; - if (lLevel && rLevel && rLevel <= lLevel) { - buffer = result.right; - result.right = result.right.test; - buffer.test = this.resolvePrecedence(result); - result = buffer; - } - } - } - } else if (result.kind === "unary") { - // https://github.com/glayzzle/php-parser/issues/75 - if (result.what && !result.what.parenthesizedExpression) { - // unary precedence is allways lower - if (result.what.kind === "bin") { - buffer = result.what; - result.what = result.what.left; - buffer.left = this.resolvePrecedence(result); - result = buffer; - } else if (result.what.kind === "retif") { - buffer = result.what; - result.what = result.what.test; - buffer.test = this.resolvePrecedence(result); - result = buffer; - } - } - } else if (result.kind === "retif") { - // https://github.com/glayzzle/php-parser/issues/77 - if (result.falseExpr && result.falseExpr.kind === "retif" && !result.falseExpr.parenthesizedExpression) { - buffer = result.falseExpr; - result.falseExpr = buffer.test; - buffer.test = this.resolvePrecedence(result); - result = buffer; - } - } else if (result.kind === "assign") { - // https://github.com/glayzzle/php-parser/issues/81 - if (result.right && result.right.kind === "bin" && !result.right.parenthesizedExpression) { - lLevel = AST.precedence["="]; - rLevel = AST.precedence[result.right.type]; - // only shifts with and, xor, or - if (lLevel && rLevel && rLevel < lLevel) { - buffer = result.right; - result.right = result.right.left; - buffer.left = result; - result = buffer; - } - } - } - return result; -}; - -/** - * Prepares an AST node - * @param {String|null} kind - Defines the node type - * (if null, the kind must be passed at the function call) - * @param {Parser} parser - The parser instance (use for extracting locations) - * @return {Function} - */ -AST.prototype.prepare = function (kind, docs, parser) { - var start = null; - if (this.withPositions || this.withSource) { - start = this.position(parser); - } - var self = this; - // returns the node - var result = function result() { - var location = null; - var args = Array.prototype.slice.call(arguments); - args.push(docs); - if (typeof result.preBuild === "function") { - result.preBuild(arguments); - } - if (self.withPositions || self.withSource) { - var src = null; - if (self.withSource) { - src = parser.lexer._input.substring(start.offset, parser.prev[2]); - } - if (self.withPositions) { - location = new Location(src, start, new Position(parser.prev[0], parser.prev[1], parser.prev[2])); - } else { - location = new Location(src, null, null); - } - // last argument is allways the location - args.push(location); - } - // handle lazy kind definitions - if (!kind) { - kind = args.shift(); - } - // build the object - var node = self[kind]; - if (typeof node !== "function") { - throw new Error('Undefined node "' + kind + '"'); - } - var astNode = Object.create(node.prototype); - node.apply(astNode, args); - result.instance = astNode; - if (result.trailingComments) { - // buffer of trailingComments - astNode.trailingComments = result.trailingComments; - } - return self.resolvePrecedence(astNode); - }; - /** - * Helper to change a node kind - * @param {String} newKind - */ - result.setKind = function (newKind) { - kind = newKind; - }; - /** - * Sets a list of trailing comments - * @param {*} docs - */ - result.setTrailingComments = function (docs) { - if (result.instance) { - // already created - result.instance.setTrailingComments(docs); - } else { - result.trailingComments = docs; - } - }; - /** - * Release a node without using it on the AST - */ - result.destroy = function (target) { - if (docs) { - // release current docs stack - if (target) { - if (!target.leadingComments) { - target.leadingComments = docs; - } else { - target.leadingComments = docs.concat(target.leadingComments); - } - } else { - parser._docIndex = parser._docs.length - docs.length; - } - } - }; - return result; -}; - -// Define all AST nodes -[__webpack_require__(87), __webpack_require__(86), __webpack_require__(85), __webpack_require__(8), __webpack_require__(84), __webpack_require__(83), __webpack_require__(82), __webpack_require__(81), __webpack_require__(80), __webpack_require__(79), __webpack_require__(78), __webpack_require__(77), __webpack_require__(76), __webpack_require__(75), __webpack_require__(9), __webpack_require__(74), __webpack_require__(73), __webpack_require__(11), __webpack_require__(72), __webpack_require__(71), __webpack_require__(3), __webpack_require__(70), __webpack_require__(69), __webpack_require__(68), __webpack_require__(67), __webpack_require__(66), __webpack_require__(65), __webpack_require__(64), __webpack_require__(63), __webpack_require__(62), __webpack_require__(2), __webpack_require__(61), __webpack_require__(60), __webpack_require__(59), __webpack_require__(10), __webpack_require__(58), __webpack_require__(57), __webpack_require__(56), __webpack_require__(55), __webpack_require__(54), __webpack_require__(53), __webpack_require__(52), __webpack_require__(51), __webpack_require__(50), __webpack_require__(49), __webpack_require__(48), __webpack_require__(4), __webpack_require__(7), __webpack_require__(47), __webpack_require__(46), __webpack_require__(45), __webpack_require__(44), __webpack_require__(1), __webpack_require__(43), __webpack_require__(42), __webpack_require__(41), __webpack_require__(6), __webpack_require__(40), __webpack_require__(39), __webpack_require__(38), __webpack_require__(37), __webpack_require__(36), __webpack_require__(35), __webpack_require__(34), __webpack_require__(33), __webpack_require__(32), __webpack_require__(31), __webpack_require__(0), __webpack_require__(30), __webpack_require__(29), __webpack_require__(28), __webpack_require__(27), __webpack_require__(5), __webpack_require__(26), __webpack_require__(25), __webpack_require__(24), __webpack_require__(23), __webpack_require__(22), __webpack_require__(21), __webpack_require__(20), __webpack_require__(19), __webpack_require__(18), __webpack_require__(17), __webpack_require__(16), __webpack_require__(15), __webpack_require__(14), __webpack_require__(13), __webpack_require__(12)].forEach(function (ctor) { - AST.prototype[ctor.kind] = ctor; -}); - -module.exports = AST; - -/***/ }), -/* 91 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -/** - * PHP AST Tokens - * @type {Object} - */ - -module.exports = { - values: { - 101: "T_HALT_COMPILER", - 102: "T_USE", - 103: "T_ENCAPSED_AND_WHITESPACE", - 104: "T_OBJECT_OPERATOR", - 105: "T_STRING", - 106: "T_DOLLAR_OPEN_CURLY_BRACES", - 107: "T_STRING_VARNAME", - 108: "T_CURLY_OPEN", - 109: "T_NUM_STRING", - 110: "T_ISSET", - 111: "T_EMPTY", - 112: "T_INCLUDE", - 113: "T_INCLUDE_ONCE", - 114: "T_EVAL", - 115: "T_REQUIRE", - 116: "T_REQUIRE_ONCE", - 117: "T_NAMESPACE", - 118: "T_NS_SEPARATOR", - 119: "T_AS", - 120: "T_IF", - 121: "T_ENDIF", - 122: "T_WHILE", - 123: "T_DO", - 124: "T_FOR", - 125: "T_SWITCH", - 126: "T_BREAK", - 127: "T_CONTINUE", - 128: "T_RETURN", - 129: "T_GLOBAL", - 130: "T_STATIC", - 131: "T_ECHO", - 132: "T_INLINE_HTML", - 133: "T_UNSET", - 134: "T_FOREACH", - 135: "T_DECLARE", - 136: "T_TRY", - 137: "T_THROW", - 138: "T_GOTO", - 139: "T_FINALLY", - 140: "T_CATCH", - 141: "T_ENDDECLARE", - 142: "T_LIST", - 143: "T_CLONE", - 144: "T_PLUS_EQUAL", - 145: "T_MINUS_EQUAL", - 146: "T_MUL_EQUAL", - 147: "T_DIV_EQUAL", - 148: "T_CONCAT_EQUAL", - 149: "T_MOD_EQUAL", - 150: "T_AND_EQUAL", - 151: "T_OR_EQUAL", - 152: "T_XOR_EQUAL", - 153: "T_SL_EQUAL", - 154: "T_SR_EQUAL", - 155: "T_INC", - 156: "T_DEC", - 157: "T_BOOLEAN_OR", - 158: "T_BOOLEAN_AND", - 159: "T_LOGICAL_OR", - 160: "T_LOGICAL_AND", - 161: "T_LOGICAL_XOR", - 162: "T_SL", - 163: "T_SR", - 164: "T_IS_IDENTICAL", - 165: "T_IS_NOT_IDENTICAL", - 166: "T_IS_EQUAL", - 167: "T_IS_NOT_EQUAL", - 168: "T_IS_SMALLER_OR_EQUAL", - 169: "T_IS_GREATER_OR_EQUAL", - 170: "T_INSTANCEOF", - 171: "T_INT_CAST", - 172: "T_DOUBLE_CAST", - 173: "T_STRING_CAST", - 174: "T_ARRAY_CAST", - 175: "T_OBJECT_CAST", - 176: "T_BOOL_CAST", - 177: "T_UNSET_CAST", - 178: "T_EXIT", - 179: "T_PRINT", - 180: "T_YIELD", - 181: "T_YIELD_FROM", - 182: "T_FUNCTION", - 183: "T_DOUBLE_ARROW", - 184: "T_DOUBLE_COLON", - 185: "T_ARRAY", - 186: "T_CALLABLE", - 187: "T_CLASS", - 188: "T_ABSTRACT", - 189: "T_TRAIT", - 190: "T_FINAL", - 191: "T_EXTENDS", - 192: "T_INTERFACE", - 193: "T_IMPLEMENTS", - 194: "T_VAR", - 195: "T_PUBLIC", - 196: "T_PROTECTED", - 197: "T_PRIVATE", - 198: "T_CONST", - 199: "T_NEW", - 200: "T_INSTEADOF", - 201: "T_ELSEIF", - 202: "T_ELSE", - 203: "T_ENDSWITCH", - 204: "T_CASE", - 205: "T_DEFAULT", - 206: "T_ENDFOR", - 207: "T_ENDFOREACH", - 208: "T_ENDWHILE", - 209: "T_CONSTANT_ENCAPSED_STRING", - 210: "T_LNUMBER", - 211: "T_DNUMBER", - 212: "T_LINE", - 213: "T_FILE", - 214: "T_DIR", - 215: "T_TRAIT_C", - 216: "T_METHOD_C", - 217: "T_FUNC_C", - 218: "T_NS_C", - 219: "T_START_HEREDOC", - 220: "T_END_HEREDOC", - 221: "T_CLASS_C", - 222: "T_VARIABLE", - 223: "T_OPEN_TAG", - 224: "T_OPEN_TAG_WITH_ECHO", - 225: "T_CLOSE_TAG", - 226: "T_WHITESPACE", - 227: "T_COMMENT", - 228: "T_DOC_COMMENT", - 229: "T_ELLIPSIS", - 230: "T_COALESCE", - 231: "T_POW", - 232: "T_POW_EQUAL", - 233: "T_SPACESHIP" - }, - names: { - T_HALT_COMPILER: 101, - T_USE: 102, - T_ENCAPSED_AND_WHITESPACE: 103, - T_OBJECT_OPERATOR: 104, - T_STRING: 105, - T_DOLLAR_OPEN_CURLY_BRACES: 106, - T_STRING_VARNAME: 107, - T_CURLY_OPEN: 108, - T_NUM_STRING: 109, - T_ISSET: 110, - T_EMPTY: 111, - T_INCLUDE: 112, - T_INCLUDE_ONCE: 113, - T_EVAL: 114, - T_REQUIRE: 115, - T_REQUIRE_ONCE: 116, - T_NAMESPACE: 117, - T_NS_SEPARATOR: 118, - T_AS: 119, - T_IF: 120, - T_ENDIF: 121, - T_WHILE: 122, - T_DO: 123, - T_FOR: 124, - T_SWITCH: 125, - T_BREAK: 126, - T_CONTINUE: 127, - T_RETURN: 128, - T_GLOBAL: 129, - T_STATIC: 130, - T_ECHO: 131, - T_INLINE_HTML: 132, - T_UNSET: 133, - T_FOREACH: 134, - T_DECLARE: 135, - T_TRY: 136, - T_THROW: 137, - T_GOTO: 138, - T_FINALLY: 139, - T_CATCH: 140, - T_ENDDECLARE: 141, - T_LIST: 142, - T_CLONE: 143, - T_PLUS_EQUAL: 144, - T_MINUS_EQUAL: 145, - T_MUL_EQUAL: 146, - T_DIV_EQUAL: 147, - T_CONCAT_EQUAL: 148, - T_MOD_EQUAL: 149, - T_AND_EQUAL: 150, - T_OR_EQUAL: 151, - T_XOR_EQUAL: 152, - T_SL_EQUAL: 153, - T_SR_EQUAL: 154, - T_INC: 155, - T_DEC: 156, - T_BOOLEAN_OR: 157, - T_BOOLEAN_AND: 158, - T_LOGICAL_OR: 159, - T_LOGICAL_AND: 160, - T_LOGICAL_XOR: 161, - T_SL: 162, - T_SR: 163, - T_IS_IDENTICAL: 164, - T_IS_NOT_IDENTICAL: 165, - T_IS_EQUAL: 166, - T_IS_NOT_EQUAL: 167, - T_IS_SMALLER_OR_EQUAL: 168, - T_IS_GREATER_OR_EQUAL: 169, - T_INSTANCEOF: 170, - T_INT_CAST: 171, - T_DOUBLE_CAST: 172, - T_STRING_CAST: 173, - T_ARRAY_CAST: 174, - T_OBJECT_CAST: 175, - T_BOOL_CAST: 176, - T_UNSET_CAST: 177, - T_EXIT: 178, - T_PRINT: 179, - T_YIELD: 180, - T_YIELD_FROM: 181, - T_FUNCTION: 182, - T_DOUBLE_ARROW: 183, - T_DOUBLE_COLON: 184, - T_ARRAY: 185, - T_CALLABLE: 186, - T_CLASS: 187, - T_ABSTRACT: 188, - T_TRAIT: 189, - T_FINAL: 190, - T_EXTENDS: 191, - T_INTERFACE: 192, - T_IMPLEMENTS: 193, - T_VAR: 194, - T_PUBLIC: 195, - T_PROTECTED: 196, - T_PRIVATE: 197, - T_CONST: 198, - T_NEW: 199, - T_INSTEADOF: 200, - T_ELSEIF: 201, - T_ELSE: 202, - T_ENDSWITCH: 203, - T_CASE: 204, - T_DEFAULT: 205, - T_ENDFOR: 206, - T_ENDFOREACH: 207, - T_ENDWHILE: 208, - T_CONSTANT_ENCAPSED_STRING: 209, - T_LNUMBER: 210, - T_DNUMBER: 211, - T_LINE: 212, - T_FILE: 213, - T_DIR: 214, - T_TRAIT_C: 215, - T_METHOD_C: 216, - T_FUNC_C: 217, - T_NS_C: 218, - T_START_HEREDOC: 219, - T_END_HEREDOC: 220, - T_CLASS_C: 221, - T_VARIABLE: 222, - T_OPEN_TAG: 223, - T_OPEN_TAG_WITH_ECHO: 224, - T_CLOSE_TAG: 225, - T_WHITESPACE: 226, - T_COMMENT: 227, - T_DOC_COMMENT: 228, - T_ELLIPSIS: 229, - T_COALESCE: 230, - T_POW: 231, - T_POW_EQUAL: 232, - T_SPACESHIP: 233 - } -}; - -/***/ }), -/* 92 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * Reads a variable - * - * ```ebnf - * variable ::= &? ...complex @todo - * ``` - * - * Some samples of parsed code : - * ```php - * &$var // simple var - * $var // simple var - * classname::CONST_NAME // dynamic class name with const retrieval - * foo() // function call - * $var->func()->property // chained calls - * ``` - */ - read_variable: function read_variable(read_only, encapsed, byref) { - var result = void 0; - - // check the byref flag - if (!byref && this.token === "&") { - byref = true; - this.next(); - } - - // reads the entry point - if (this.is([this.tok.T_VARIABLE, "$"])) { - result = this.read_reference_variable(encapsed, byref); - } else if (this.is([this.tok.T_NS_SEPARATOR, this.tok.T_STRING, this.tok.T_NAMESPACE])) { - result = this.node(); - var name = this.read_namespace_name(); - if (this.token != this.tok.T_DOUBLE_COLON && this.token != "(") { - // @see parser.js line 130 : resolves a conflict with scalar - var literal = name.name.toLowerCase(); - if (literal === "true") { - result = result("boolean", true, name.name); - } else if (literal === "false") { - result = result("boolean", false, name.name); - } else { - // @todo null keyword ? - result = result("constref", name); - } - } else { - // @fixme possible #193 bug - result = name; - } - } else if (this.token === this.tok.T_STATIC) { - result = this.node("constref"); - this.next(); - result = result("static"); - } else { - this.expect("VARIABLE"); - } - - // static mode - if (this.token === this.tok.T_DOUBLE_COLON) { - result = this.read_static_getter(result, encapsed); - } - - return this.recursive_variable_chain_scan(result, read_only, encapsed); - }, - - // resolves a static call - read_static_getter: function read_static_getter(what, encapsed) { - var result = this.node("staticlookup"); - var offset = void 0, - name = void 0; - if (this.next().is([this.tok.T_VARIABLE, "$"])) { - offset = this.read_reference_variable(encapsed, false); - } else if (this.token === this.tok.T_STRING || this.token === this.tok.T_CLASS || this.php7 && this.is("IDENTIFIER")) { - offset = this.node("constref"); - name = this.text(); - this.next(); - offset = offset(name); - } else { - this.error([this.tok.T_VARIABLE, this.tok.T_STRING]); - // graceful mode : set getter as error node and continue - offset = this.node("constref"); - name = this.text(); - this.next(); - offset = offset(name); - } - return result(what, offset); - }, - - recursive_variable_chain_scan: function recursive_variable_chain_scan(result, read_only, encapsed, dereferencable) { - var name = void 0, - node = void 0, - offset = void 0; - recursive_scan_loop: while (this.token != this.EOF) { - switch (this.token) { - case "(": - if (read_only) { - // @fixme : add more informations & test - return result; - } else { - result = this.node("call")(result, this.read_function_argument_list()); - } - break; - case "[": - node = this.node("offsetlookup"); - this.next(); - offset = false; - if (encapsed) { - offset = this.read_encaps_var_offset(); - this.expect("]") && this.next(); - } else { - // callable_variable : https://github.com/php/php-src/blob/493524454d66adde84e00d249d607ecd540de99f/Zend/zend_language_parser.y#L1122 - if (this.token !== "]") { - offset = this.read_expr(); - this.expect("]") && this.next(); - } else { - this.next(); - } - } - result = node(result, offset); - break; - case this.tok.T_DOUBLE_COLON: - // @see https://github.com/glayzzle/php-parser/issues/107#issuecomment-354104574 - if (result.kind === "staticlookup") { - this.error(); - } - - node = this.node("staticlookup"); - if (this.next().token === this.tok.T_STRING || this.php7 && this.is("IDENTIFIER")) { - offset = this.node("constref"); - name = this.text(); - this.next(); - offset = offset(name); - - if (this.token === this.tok.T_OBJECT_OPERATOR) { - this.error(); - } - } else { - this.error(this.tok.T_STRING); - // fallback on a constref node - offset = this.node("constref")(this.text()); - this.next(); - } - result = node(result, offset); - // static lookup dereferencables are limited to staticlookup over functions - if (dereferencable && this.token !== "(") { - this.error("("); - } - break; - case this.tok.T_OBJECT_OPERATOR: - { - node = this.node("propertylookup"); - var what = null; - switch (this.next().token) { - case this.tok.T_STRING: - what = this.node("constref"); - name = this.text(); - this.next(); - what = what(name); - if (this.token === this.tok.T_VARIABLE) { - var inner = this.node("variable"); - name = this.text().substring(1); - this.next(); - what = this.node("encapsed")([what, inner(name, false, false)], null, "offset"); - if (what.loc && what.value[0].loc) { - what.loc.start = what.value[0].loc.start; - } - } else if (this.token === "{") { - var expr = this.next().read_expr(); - this.expect("}") && this.next(); - what = this.node("encapsed")([what, expr], null, "offset"); - if (what.loc && what.value[0].loc) { - what.loc.start = what.value[0].loc.start; - } - } - break; - case this.tok.T_VARIABLE: - what = this.node("variable"); - name = this.text().substring(1); - this.next(); - what = what(name, false, false); - break; - case "$": - this.next().expect(["{", this.tok.T_VARIABLE]); - if (this.token === "{") { - // $obj->${$varname} - what = this.next().read_expr(); - this.expect("}") && this.next(); - } else { - // $obj->$$varname - what = this.read_expr(); - } - break; - case "{": - what = this.next().read_expr(); - this.expect("}") && this.next(); - break; - default: - this.error([this.tok.T_STRING, this.tok.T_VARIABLE]); - // graceful mode : set what as error mode & continue - what = this.node("constref"); - name = this.text(); - this.next(); - what = what(name); - break; - } - result = node(result, what); - break; - } - default: - break recursive_scan_loop; - } - } - return result; - }, - /** - * https://github.com/php/php-src/blob/493524454d66adde84e00d249d607ecd540de99f/Zend/zend_language_parser.y#L1231 - */ - read_encaps_var_offset: function read_encaps_var_offset() { - var offset = this.node(); - if (this.token === this.tok.T_STRING) { - var text = this.text(); - this.next(); - offset = offset("constref", text); - } else if (this.token === this.tok.T_NUM_STRING) { - var num = this.text(); - this.next(); - offset = offset("number", num, null); - } else if (this.token === this.tok.T_VARIABLE) { - var name = this.text().substring(1); - this.next(); - offset = offset("variable", name, false, false); - } else { - this.expect([this.tok.T_STRING, this.tok.T_NUM_STRING, this.tok.T_VARIABLE]); - // fallback : consider as constref - var _text = this.text(); - this.next(); - offset = offset("constref", _text); - } - return offset; - }, - /** - * ```ebnf - * reference_variable ::= simple_variable ('[' OFFSET ']')* | '{' EXPR '}' - * ``` - * - * $foo[123]; // foo is an array ==> gets its entry - * $foo{1}; // foo is a string ==> get the 2nd char offset - * ${'foo'}[123]; // get the dynamic var $foo - * $foo[123]{1}; // gets the 2nd char from the 123 array entry - * - */ - read_reference_variable: function read_reference_variable(encapsed, byref) { - var result = this.read_simple_variable(byref); - var offset = void 0; - while (this.token != this.EOF) { - var node = this.node(); - if (this.token == "[") { - offset = null; - if (encapsed) { - offset = this.next().read_encaps_var_offset(); - } else { - offset = this.next().token === "]" ? null : this.read_dim_offset(); - } - this.expect("]") && this.next(); - result = node("offsetlookup", result, offset); - } else if (this.token == "{" && !encapsed) { - offset = this.next().read_expr(); - this.expect("}") && this.next(); - result = node("offsetlookup", result, offset); - } else { - node.destroy(); - break; - } - } - return result; - }, - /** - * ```ebnf - * simple_variable ::= T_VARIABLE | '$' '{' expr '}' | '$' simple_variable - * ``` - */ - read_simple_variable: function read_simple_variable(byref) { - var result = this.node("variable"); - var name = void 0; - if (this.expect([this.tok.T_VARIABLE, "$"]) && this.token === this.tok.T_VARIABLE) { - // plain variable name - name = this.text().substring(1); - this.next(); - result = result(name, byref, false); - } else { - if (this.token === "$") this.next(); - // dynamic variable name - switch (this.token) { - case "{": - { - var expr = this.next().read_expr(); - this.expect("}") && this.next(); - result = result(expr, byref, true); - break; - } - case "$": - // $$$var - result = result(this.read_simple_variable(false), byref); - break; - case this.tok.T_VARIABLE: - { - // $$var - name = this.text().substring(1); - var node = this.node("variable"); - this.next(); - result = result(node(name, false, false), byref, false); - break; - } - default: - this.error(["{", "$", this.tok.T_VARIABLE]); - // graceful mode - name = this.text(); - this.next(); - result = result(name, byref, false); - } - } - return result; - } -}; - -/***/ }), -/* 93 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * Reads a short form of tokens - * @param {Number} token - The ending token - * @return {Block} - */ - read_short_form: function read_short_form(token) { - var body = this.node("block"); - var items = []; - if (this.expect(":")) this.next(); - while (this.token != this.EOF && this.token !== token) { - items.push(this.read_inner_statement()); - } - if (this.expect(token)) this.next(); - this.expectEndOfStatement(); - return body(null, items); - }, - - /** - * Helper : reads a list of tokens / sample : T_STRING ',' T_STRING ... - * ```ebnf - * list ::= separator? ( item separator )* item - * ``` - */ - read_list: function read_list(item, separator, preserveFirstSeparator) { - var result = []; - - if (this.token == separator) { - if (preserveFirstSeparator) result.push(null); - this.next(); - } - - if (typeof item === "function") { - do { - result.push(item.apply(this, [])); - if (this.token != separator) { - break; - } - } while (this.next().token != this.EOF); - } else { - if (this.expect(item)) { - result.push(this.text()); - } else { - return []; - } - while (this.next().token != this.EOF) { - if (this.token != separator) break; - // trim current separator & check item - if (this.next().token != item) break; - result.push(this.text()); - } - } - return result; - }, - - /** - * Reads a list of names separated by a comma - * - * ```ebnf - * name_list ::= namespace (',' namespace)* - * ``` - * - * Sample code : - * ```php - * 0 ? body(null, items) : null); - } -}; - -/***/ }), -/* 96 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * reading a list of top statements (helper for top_statement*) - * ```ebnf - * top_statements ::= top_statement* - * ``` - */ - read_top_statements: function read_top_statements() { - var result = []; - while (this.token !== this.EOF && this.token !== "}") { - var statement = this.read_top_statement(); - if (statement) { - if (Array.isArray(statement)) { - result = result.concat(statement); - } else { - result.push(statement); - } - } - } - return result; - }, - /** - * reading a top statement - * ```ebnf - * top_statement ::= - * namespace | function | class - * | interface | trait - * | use_statements | const_list - * | statement - * ``` - */ - read_top_statement: function read_top_statement() { - switch (this.token) { - case this.tok.T_FUNCTION: - return this.read_function(false, false); - // optional flags - case this.tok.T_ABSTRACT: - case this.tok.T_FINAL: - { - var flag = this.read_class_scope(); - if (this.token === this.tok.T_CLASS) { - return this.read_class(flag); - } else { - this.error(this.tok.T_CLASS); - this.next(); - return null; - } - } - case this.tok.T_CLASS: - return this.read_class([0, 0, 0]); - case this.tok.T_INTERFACE: - return this.read_interface(); - case this.tok.T_TRAIT: - return this.read_trait(); - case this.tok.T_USE: - return this.read_use_statement(); - case this.tok.T_CONST: - return this.next().read_const_list(); - case this.tok.T_NAMESPACE: - return this.read_namespace(); - case this.tok.T_HALT_COMPILER: - { - var result = this.node("halt"); - if (this.next().expect("(")) this.next(); - if (this.expect(")")) this.next(); - this.expect(";"); - this.lexer.done = true; - return result(this.lexer._input.substring(this.lexer.offset)); - } - default: - return this.read_statement(); - } - }, - /** - * reads a list of simple inner statements (helper for inner_statement*) - * ```ebnf - * inner_statements ::= inner_statement* - * ``` - */ - read_inner_statements: function read_inner_statements() { - var result = []; - while (this.token != this.EOF && this.token !== "}") { - var statement = this.read_inner_statement(); - if (statement) { - if (Array.isArray(statement)) { - result = result.concat(statement); - } else { - result.push(statement); - } - } - } - return result; - }, - /** - * Reads a list of constants declaration - * ```ebnf - * const_list ::= T_CONST T_STRING '=' expr (',' T_STRING '=' expr)* ';' - * ``` - */ - read_const_list: function read_const_list() { - var result = this.read_list(function () { - this.expect(this.tok.T_STRING); - var result = this.node("constant"); - var name = this.text(); - if (this.next().expect("=")) { - return result(name, this.next().read_expr()); - } else { - // fallback - return result(name, null); - } - }, ",", false); - this.expectEndOfStatement(); - return result; - }, - /** - * Reads a list of constants declaration - * ```ebnf - * declare_list ::= T_STRING '=' expr (',' T_STRING '=' expr)* - * ``` - * @retrurn {Object} - */ - read_declare_list: function read_declare_list() { - var result = {}; - while (this.token != this.EOF && this.token !== ")") { - this.expect(this.tok.T_STRING); - var name = this.text().toLowerCase(); - if (this.next().expect("=")) { - result[name] = this.next().read_expr(); - } else { - result[name] = null; - } - if (this.token !== ",") break; - this.next(); - } - return result; - }, - /** - * reads a simple inner statement - * ```ebnf - * inner_statement ::= '{' inner_statements '}' | token - * ``` - */ - read_inner_statement: function read_inner_statement() { - switch (this.token) { - case this.tok.T_FUNCTION: - return this.read_function(false, false); - // optional flags - case this.tok.T_ABSTRACT: - case this.tok.T_FINAL: - { - var flag = this.read_class_scope(); - if (this.token === this.tok.T_CLASS) { - return this.read_class(flag); - } else { - this.error(this.tok.T_CLASS); - // graceful mode : ignore token & go next - this.next(); - return null; - } - } - case this.tok.T_CLASS: - return this.read_class([0, 0, 0]); - case this.tok.T_INTERFACE: - return this.read_interface(); - case this.tok.T_TRAIT: - return this.read_trait(); - case this.tok.T_HALT_COMPILER: - { - this.raiseError("__HALT_COMPILER() can only be used from the outermost scope"); - // fallback : returns a node but does not stop the parsing - var node = this.node("halt"); - this.next().expect("(") && this.next(); - this.expect(")") && this.next(); - node = node(this.lexer._input.substring(this.lexer.offset)); - this.expect(";") && this.next(); - return node; - } - default: - return this.read_statement(); - } - }, - /** - * Reads statements - */ - read_statement: function read_statement() { - var result = void 0, - expr = void 0, - items = void 0, - current = void 0, - label = void 0; - switch (this.token) { - case "{": - return this.read_code_block(false); - - case this.tok.T_IF: - return this.read_if(); - - case this.tok.T_SWITCH: - return this.read_switch(); - - case this.tok.T_FOR: - return this.next().read_for(); - - case this.tok.T_FOREACH: - return this.next().read_foreach(); - - case this.tok.T_WHILE: - return this.next().read_while(); - - case this.tok.T_DO: - return this.next().read_do(); - - case this.tok.T_COMMENT: - return this.read_comment(); - - case this.tok.T_DOC_COMMENT: - return this.read_doc_comment(); - - case this.tok.T_RETURN: - result = this.node("return"); - expr = null; - if (!this.next().is("EOS")) { - expr = this.read_expr(); - } - this.expectEndOfStatement(); - return result(expr); - - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L429 - case this.tok.T_BREAK: - case this.tok.T_CONTINUE: - { - result = this.node(this.token === this.tok.T_CONTINUE ? "continue" : "break"); - var level = null; - this.next(); // look ahead - if (this.token !== ";") { - level = this.read_expr(); - } - this.expectEndOfStatement(); - return result(level); - } - - case this.tok.T_GLOBAL: - result = this.node("global"); - items = this.next().read_list(this.read_simple_variable, ","); - this.expectEndOfStatement(); - return result(items); - - case this.tok.T_STATIC: - current = [this.token, this.lexer.getState()]; - result = this.node("static"); - if (this.next().token === this.tok.T_DOUBLE_COLON) { - // static keyword for a class - this.lexer.tokens.push(current); - expr = this.next().read_expr(); - this.expect(";") && this.next(); - return expr; - } - if (this.token === this.tok.T_FUNCTION) { - return this.read_function(true, [0, 1, 0]); - } - items = this.read_variable_declarations(); - this.expectEndOfStatement(); - return result(items); - - case this.tok.T_ECHO: - { - result = this.node("echo"); - var text = this.text(); - var shortForm = text === " 0 ? this.lexer._input[this.lexer.yylloc.first_offset - 1] : null; - var fixFirstLine = prevChar === "\r" || prevChar === "\n"; - // revert back the first stripped line - if (fixFirstLine) { - if (prevChar === "\n" && this.lexer.yylloc.first_offset > 1 && this.lexer._input[this.lexer.yylloc.first_offset - 2] === "\r") { - prevChar = "\r\n"; - } - } - result = this.node("inline"); - this.next(); - return result(value, fixFirstLine ? prevChar + value : value); - } - - case this.tok.T_UNSET: - result = this.node("unset"); - this.next().expect("(") && this.next(); - items = this.read_list(this.read_variable, ","); - this.expect(")") && this.next(); - this.expect(";") && this.next(); - return result(items); - - case this.tok.T_DECLARE: - { - result = this.node("declare"); - var body = []; - var mode = void 0; - this.next().expect("(") && this.next(); - var what = this.read_declare_list(); - this.expect(")") && this.next(); - if (this.token === ":") { - this.next(); - while (this.token != this.EOF && this.token !== this.tok.T_ENDDECLARE) { - // @todo : check declare_statement from php / not valid - body.push(this.read_top_statement()); - } - this.expect(this.tok.T_ENDDECLARE) && this.next(); - this.expectEndOfStatement(); - mode = this.ast.declare.MODE_SHORT; - } else if (this.token === "{") { - this.next(); - while (this.token != this.EOF && this.token !== "}") { - // @todo : check declare_statement from php / not valid - body.push(this.read_top_statement()); - } - this.expect("}") && this.next(); - mode = this.ast.declare.MODE_BLOCK; - } else { - this.expect(";") && this.next(); - mode = this.ast.declare.MODE_NONE; - } - return result(what, body, mode); - } - - case this.tok.T_TRY: - return this.read_try(); - - case this.tok.T_THROW: - result = this.node("throw"); - expr = this.next().read_expr(); - this.expectEndOfStatement(); - return result(expr); - - case ";": - // ignore this (extra ponctuation) - this.next(); - return null; - - case this.tok.T_STRING: - current = [this.token, this.lexer.getState()]; - label = this.text(); - // AST : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L457 - if (this.next().token === ":") { - result = this.node("label"); - this.next(); - return result(label); - } - - // default fallback expr / T_STRING '::' (etc...) - this.lexer.tokens.push(current); - expr = this.next().read_expr(); - this.expectEndOfStatement(); - return expr; - - case this.tok.T_GOTO: - result = this.node("goto"); - label = null; - if (this.next().expect(this.tok.T_STRING)) { - label = this.text(); - this.next().expectEndOfStatement(); - } - return result(label); - - default: - // default fallback expr - var statement = this.node("expressionstatement"); - expr = this.read_expr(); - this.expectEndOfStatement(expr); - return statement(expr); - } - }, - /** - * ```ebnf - * code_block ::= '{' (inner_statements | top_statements) '}' - * ``` - */ - read_code_block: function read_code_block(top) { - var result = this.node("block"); - this.expect("{") && this.next(); - var body = top ? this.read_top_statements() : this.read_inner_statements(); - this.expect("}") && this.next(); - return result(null, body); - } -}; - -/***/ }), -/* 97 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var specialChar = { - "\\r": "\r", - "\\n": "\n", - "\\t": "\t", - "\\v": String.fromCharCode(11), - "\\e": String.fromCharCode(27), - "\\f": String.fromCharCode(12), - "\\\\": "\\", - "\\$": "$", - '\\"': '"', - "\\'": "'" -}; - -module.exports = { - /** - * Unescape special chars - */ - resolve_special_chars: function resolve_special_chars(text, doubleQuote) { - if (!doubleQuote) { - // single quote fix - return text.replace(/\\['\\]/g, function (seq) { - return specialChar[seq]; - }); - } - return text.replace(/\\[rntvef"'\\$]/g, function (seq) { - return specialChar[seq]; - }); - }, - /** - * ```ebnf - * scalar ::= T_MAGIC_CONST - * | T_LNUMBER | T_DNUMBER - * | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE? T_END_HEREDOC - * | '"' encaps_list '"' - * | T_START_HEREDOC encaps_list T_END_HEREDOC - * | namespace_name (T_DOUBLE_COLON T_STRING)? - * ``` - */ - read_scalar: function read_scalar() { - if (this.is("T_MAGIC_CONST")) { - return this.get_magic_constant(); - } else { - var value = void 0, - node = void 0; - switch (this.token) { - // TEXTS - case this.tok.T_CONSTANT_ENCAPSED_STRING: - { - value = this.node("string"); - var text = this.text(); - var offset = 0; - if (text[0] === "b" || text[0] === "B") { - offset = 1; - } - var isDoubleQuote = text[offset] === '"'; - this.next(); - value = value(isDoubleQuote, this.resolve_special_chars(text.substring(offset + 1, text.length - 1), isDoubleQuote), offset === 1, // unicode flag - text); - if (this.token === this.tok.T_DOUBLE_COLON) { - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1151 - return this.read_static_getter(value); - } else { - // dirrect string - return value; - } - } - case this.tok.T_START_HEREDOC: - if (this.lexer.curCondition === "ST_NOWDOC") { - var start = this.lexer.yylloc.first_offset; - node = this.node("nowdoc"); - value = this.next().text(); - // strip the last line return char - var lastCh = value[value.length - 1]; - if (lastCh === "\n") { - if (value[value.length - 2] === "\r") { - // windows style - value = value.substring(0, value.length - 2); - } else { - // linux style - value = value.substring(0, value.length - 1); - } - } else if (lastCh === "\r") { - // mac style - value = value.substring(0, value.length - 1); - } - this.expect(this.tok.T_ENCAPSED_AND_WHITESPACE) && this.next(); - var raw = this.lexer._input.substring(start, this.lexer.yylloc.last_offset); - node = node(value, raw, this.lexer.heredoc_label, raw[3] === '"' || raw[3] === "'"); - this.expect(this.tok.T_END_HEREDOC) && this.next(); - return node; - } else { - return this.next().read_encapsed_string(this.tok.T_END_HEREDOC); - } - - case '"': - return this.next().read_encapsed_string('"'); - - case 'b"': - case 'B"': - { - this.next(); - this.lexer.yylloc.prev_offset -= 1; - return this.read_encapsed_string('"'); - } - - // NUMERIC - case this.tok.T_LNUMBER: // long - case this.tok.T_DNUMBER: - { - // double - var result = this.node("number"); - value = this.text(); - this.next(); - return result(value, null); - } - - // ARRAYS - case this.tok.T_ARRAY: - // array parser - return this.read_array(); - case "[": - // short array format - return this.read_array(); - default: - { - var err = this.error("SCALAR"); - // graceful mode : ignore token & return error node - this.next(); - return err; - } - } - } - }, - /** - * Handles the dereferencing - */ - read_dereferencable: function read_dereferencable(expr) { - var result = void 0, - offset = void 0; - var node = this.node("offsetlookup"); - if (this.token === "[") { - offset = this.next().read_expr(); - if (this.expect("]")) this.next(); - result = node(expr, offset); - } else if (this.token === this.tok.T_DOLLAR_OPEN_CURLY_BRACES) { - offset = this.read_encapsed_string_item(false); - result = node(expr, offset); - } - return result; - }, - /** - * Reads and extracts an encapsed item - * ```ebnf - * encapsed_string_item ::= T_ENCAPSED_AND_WHITESPACE - * | T_DOLLAR_OPEN_CURLY_BRACES expr '}' - * | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' - * | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' - * | T_CURLY_OPEN variable '}' - * | variable - * | variable '[' expr ']' - * | variable T_OBJECT_OPERATOR T_STRING - * ``` - * @return {String|Variable|Expr|Lookup} - * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1219 - */ - read_encapsed_string_item: function read_encapsed_string_item(isDoubleQuote) { - var result = this.node(), - offset = void 0, - node = void 0, - name = void 0; - - // plain text - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1222 - if (this.token === this.tok.T_ENCAPSED_AND_WHITESPACE) { - var text = this.text(); - this.next(); - result = result("string", false, this.resolve_special_chars(text, isDoubleQuote), false, text); - } else if (this.token === this.tok.T_DOLLAR_OPEN_CURLY_BRACES) { - // dynamic variable name - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1239 - name = null; - if (this.next().token === this.tok.T_STRING_VARNAME) { - var varName = this.text(); - name = this.node("variable"); - this.next(); - // check if lookup an offset - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1243 - if (this.token === "[") { - name = name(varName, false); - node = this.node("offsetlookup"); - offset = this.next().read_expr(); - this.expect("]") && this.next(); - name = node(name, offset); - } else { - name = this.node("constref")(varName); - } - } else { - name = this.read_expr(); - } - this.expect("}") && this.next(); - result = result("variable", name, false, true); - } else if (this.token === this.tok.T_CURLY_OPEN) { - // expression - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1246 - result.destroy(); - result = this.next().read_variable(false, false, false); - if (result.kind === "variable") { - result.curly = true; - } - this.expect("}") && this.next(); - } else if (this.token === this.tok.T_VARIABLE) { - // plain variable - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1231 - result.destroy(); - result = this.read_simple_variable(false); - - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1233 - if (this.token === "[") { - node = this.node("offsetlookup"); - offset = this.next().read_encaps_var_offset(); - this.expect("]") && this.next(); - result = node(result, offset); - } - - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1236 - if (this.token === this.tok.T_OBJECT_OPERATOR) { - node = this.node("propertylookup"); - this.next().expect(this.tok.T_STRING); - var what = this.node("constref"); - name = this.text(); - this.next(); - result = node(result, what(name)); - } - - // error / fallback - } else { - this.expect(this.tok.T_ENCAPSED_AND_WHITESPACE); - var value = this.text(); - this.next(); - // consider it as string - result.destroy(); - result = result("string", false, value, false, value); - } - - return result; - }, - /** - * Reads an encapsed string - */ - read_encapsed_string: function read_encapsed_string(expect) { - var start = this.lexer.yylloc.prev_offset; - var node = this.node("encapsed"); - var value = []; - var type = null; - - if (expect === "`") { - type = this.ast.encapsed.TYPE_SHELL; - } else if (expect === '"') { - type = this.ast.encapsed.TYPE_STRING; - } else { - type = this.ast.encapsed.TYPE_HEREDOC; - } - - // reading encapsed parts - while (this.token !== expect && this.token !== this.EOF) { - value.push(this.read_encapsed_string_item(true)); - } - - this.expect(expect) && this.next(); - node = node(value, this.lexer._input.substring(start - 1, this.lexer.yylloc.first_offset), type); - - if (expect === this.tok.T_END_HEREDOC) { - node.label = this.lexer.heredoc_label; - } - return node; - }, - /** - * Constant token - */ - get_magic_constant: function get_magic_constant() { - var result = this.node("magic"); - var name = this.text(); - this.next(); - return result(name.toUpperCase(), name); - } -}; - -/***/ }), -/* 98 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * Reads a namespace declaration block - * ```ebnf - * namespace ::= T_NAMESPACE namespace_name? '{' - * top_statements - * '}' - * | T_NAMESPACE namespace_name ';' top_statements - * ``` - * @see http://php.net/manual/en/language.namespaces.php - * @return {Namespace} - */ - read_namespace: function read_namespace() { - var result = this.node("namespace"); - var body = void 0; - this.expect(this.tok.T_NAMESPACE) && this.next(); - if (this.token == "{") { - this.currentNamespace = [""]; - body = this.next().read_top_statements(); - this.expect("}") && this.next(); - return result([""], body, true); - } else { - var name = this.read_namespace_name(); - if (this.token == ";") { - this.currentNamespace = name; - body = this.next().read_top_statements(); - this.expect(this.EOF); - return result(name.name, body, false); - } else if (this.token == "{") { - this.currentNamespace = name; - body = this.next().read_top_statements(); - this.expect("}") && this.next(); - return result(name.name, body, true); - } else if (this.token === "(") { - // resolve ambuiguity between namespace & function call - name.resolution = this.ast.identifier.RELATIVE_NAME; - name.name = name.name.substring(1); - return this.node("call")(name, this.read_function_argument_list()); - } else { - this.error(["{", ";"]); - // graceful mode : - this.currentNamespace = name; - body = this.read_top_statements(); - this.expect(this.EOF); - return result(name, body, false); - } - } - }, - /** - * Reads a namespace name - * ```ebnf - * namespace_name ::= T_NS_SEPARATOR? (T_STRING T_NS_SEPARATOR)* T_STRING - * ``` - * @see http://php.net/manual/en/language.namespaces.rules.php - * @return {Identifier} - */ - read_namespace_name: function read_namespace_name() { - var result = this.node("identifier"); - var relative = false; - if (this.token === this.tok.T_NAMESPACE) { - this.next().expect(this.tok.T_NS_SEPARATOR) && this.next(); - relative = true; - } - return result(this.read_list(this.tok.T_STRING, this.tok.T_NS_SEPARATOR, true), relative); - }, - /** - * Reads a use statement - * ```ebnf - * use_statement ::= T_USE - * use_type? use_declarations | - * use_type use_statement '{' use_declarations '}' | - * use_statement '{' use_declarations(=>typed) '}' - * ';' - * ``` - * @see http://php.net/manual/en/language.namespaces.importing.php - * @return {UseGroup} - */ - read_use_statement: function read_use_statement() { - var result = this.node("usegroup"); - var items = []; - var name = null; - this.expect(this.tok.T_USE) && this.next(); - var type = this.read_use_type(); - items.push(this.read_use_declaration(false)); - if (this.token === ",") { - items = items.concat(this.next().read_use_declarations(false)); - } else if (this.token === "{") { - name = items[0].name; - items = this.next().read_use_declarations(type === null); - this.expect("}") && this.next(); - } - result = result(name, type, items); - this.expect(";") && this.next(); - return result; - }, - /** - * Reads a use declaration - * ```ebnf - * use_declaration ::= use_type? namespace_name use_alias - * ``` - * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L380 - * @return {UseItem} - */ - read_use_declaration: function read_use_declaration(typed) { - var result = this.node("useitem"); - var type = null; - if (typed) type = this.read_use_type(); - var name = this.read_namespace_name(); - var alias = this.read_use_alias(); - return result(name.name, alias, type); - }, - /** - * Reads a list of use declarations - * ```ebnf - * use_declarations ::= use_declaration (',' use_declaration)* - * ``` - * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L380 - * @return {UseItem[]} - */ - read_use_declarations: function read_use_declarations(typed) { - var result = [this.read_use_declaration(typed)]; - while (this.token === ",") { - this.next(); - if (typed) { - if (this.token !== this.tok.T_FUNCTION && this.token !== this.tok.T_CONST && this.token !== this.tok.T_STRING) { - break; - } - } else if (this.token !== this.tok.T_STRING) { - break; - } - result.push(this.read_use_declaration(typed)); - } - return result; - }, - /** - * Reads a use statement - * ```ebnf - * use_alias ::= (T_AS T_STRING)? - * ``` - * @return {String|null} - */ - read_use_alias: function read_use_alias() { - var result = null; - if (this.token === this.tok.T_AS) { - if (this.next().expect(this.tok.T_STRING)) { - result = this.text(); - this.next(); - } - } - return result; - }, - /** - * Reads the namespace type declaration - * ```ebnf - * use_type ::= (T_FUNCTION | T_CONST)? - * ``` - * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L335 - * @return {String|null} Possible values : function, const - */ - read_use_type: function read_use_type() { - if (this.token === this.tok.T_FUNCTION) { - this.next(); - return this.ast.useitem.TYPE_FUNCTION; - } else if (this.token === this.tok.T_CONST) { - this.next(); - return this.ast.useitem.TYPE_CONST; - } - return null; - } -}; - -/***/ }), -/* 99 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * ```ebnf - * start ::= (namespace | top_statement)* - * ``` - */ - read_start: function read_start() { - if (this.token == this.tok.T_NAMESPACE) { - return this.read_namespace(); - } else { - return this.read_top_statement(); - } - } -}; - -/***/ }), -/* 100 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * Reads a while statement - * ```ebnf - * while ::= T_WHILE (statement | ':' inner_statement_list T_ENDWHILE ';') - * ``` - * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L587 - * @return {While} - */ - read_while: function read_while() { - var result = this.node("while"); - var test = null; - var body = null; - var shortForm = false; - if (this.expect("(")) this.next(); - test = this.read_expr(); - if (this.expect(")")) this.next(); - if (this.token === ":") { - shortForm = true; - body = this.read_short_form(this.tok.T_ENDWHILE); - } else { - body = this.read_statement(); - } - return result(test, body, shortForm); - }, - /** - * Reads a do / while loop - * ```ebnf - * do ::= T_DO statement T_WHILE '(' expr ')' ';' - * ``` - * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L423 - * @return {Do} - */ - read_do: function read_do() { - var result = this.node("do"); - var test = null; - var body = null; - body = this.read_statement(); - if (this.expect(this.tok.T_WHILE)) { - if (this.next().expect("(")) this.next(); - test = this.read_expr(); - if (this.expect(")")) this.next(); - if (this.expect(";")) this.next(); - } - return result(test, body); - }, - /** - * Read a for incremental loop - * ```ebnf - * for ::= T_FOR '(' for_exprs ';' for_exprs ';' for_exprs ')' for_statement - * for_statement ::= statement | ':' inner_statement_list T_ENDFOR ';' - * for_exprs ::= expr? (',' expr)* - * ``` - * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L425 - * @return {For} - */ - read_for: function read_for() { - var result = this.node("for"); - var init = []; - var test = []; - var increment = []; - var body = null; - var shortForm = false; - if (this.expect("(")) this.next(); - if (this.token !== ";") { - init = this.read_list(this.read_expr, ","); - if (this.expect(";")) this.next(); - } else { - this.next(); - } - if (this.token !== ";") { - test = this.read_list(this.read_expr, ","); - if (this.expect(";")) this.next(); - } else { - this.next(); - } - if (this.token !== ")") { - increment = this.read_list(this.read_expr, ","); - if (this.expect(")")) this.next(); - } else { - this.next(); - } - if (this.token === ":") { - shortForm = true; - body = this.read_short_form(this.tok.T_ENDFOR); - } else { - body = this.read_statement(); - } - return result(init, test, increment, body, shortForm); - }, - /** - * Reads a foreach loop - * ```ebnf - * foreach ::= '(' expr T_AS foreach_variable (T_DOUBLE_ARROW foreach_variable)? ')' statement - * ``` - * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L438 - * @return {Foreach} - */ - read_foreach: function read_foreach() { - var result = this.node("foreach"); - var source = null; - var key = null; - var value = null; - var body = null; - var shortForm = false; - if (this.expect("(")) this.next(); - source = this.read_expr(); - if (this.expect(this.tok.T_AS)) { - this.next(); - value = this.read_foreach_variable(); - if (this.token === this.tok.T_DOUBLE_ARROW) { - key = value; - value = this.next().read_foreach_variable(); - } - } - - // grammatically correct but not supported by PHP - if (key && key.kind === "list") { - this.raiseError("Fatal Error : Cannot use list as key element"); - } - - if (this.expect(")")) this.next(); - - if (this.token === ":") { - shortForm = true; - body = this.read_short_form(this.tok.T_ENDFOREACH); - } else { - body = this.read_statement(); - } - return result(source, key, value, body, shortForm); - }, - /** - * Reads a foreach variable statement - * ```ebnf - * foreach_variable = - * variable | - * '&' variable | - * T_LIST '(' assignment_list ')' | - * '[' assignment_list ']' - * ``` - * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L544 - * @return {Expression} - */ - read_foreach_variable: function read_foreach_variable() { - if (this.token === this.tok.T_LIST || this.token === "[") { - var isShort = this.token === "["; - var result = this.node("list"); - this.next(); - if (!isShort && this.expect("(")) this.next(); - var assignList = this.read_array_pair_list(isShort); - if (this.expect(isShort ? "]" : ")")) this.next(); - return result(assignList, isShort); - } else { - return this.read_variable(false, false, false); - } - } -}; - -/***/ }), -/* 101 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * Reads an IF statement - * - * ```ebnf - * if ::= T_IF '(' expr ')' ':' ... - * ``` - */ - read_if: function read_if() { - var result = this.node("if"); - var body = null; - var alternate = null; - var shortForm = false; - var test = null; - test = this.next().read_if_expr(); - - if (this.token === ":") { - shortForm = true; - this.next(); - body = this.node("block"); - var items = []; - while (this.token !== this.EOF && this.token !== this.tok.T_ENDIF) { - if (this.token === this.tok.T_ELSEIF) { - alternate = this.read_elseif_short(); - break; - } else if (this.token === this.tok.T_ELSE) { - alternate = this.read_else_short(); - break; - } - items.push(this.read_inner_statement()); - } - body = body(null, items); - this.expect(this.tok.T_ENDIF) && this.next(); - this.expectEndOfStatement(); - } else { - body = this.read_statement(); - if (this.token === this.tok.T_ELSEIF) { - alternate = this.read_if(); - } else if (this.token === this.tok.T_ELSE) { - alternate = this.next().read_statement(); - } - } - return result(test, body, alternate, shortForm); - }, - /** - * reads an if expression : '(' expr ')' - */ - read_if_expr: function read_if_expr() { - this.expect("(") && this.next(); - var result = this.read_expr(); - this.expect(")") && this.next(); - return result; - }, - /** - * reads an elseif (expr): statements - */ - read_elseif_short: function read_elseif_short() { - var result = this.node("if"); - var alternate = null; - var test = null; - var body = null; - var items = []; - test = this.next().read_if_expr(); - if (this.expect(":")) this.next(); - body = this.node("block"); - while (this.token != this.EOF && this.token !== this.tok.T_ENDIF) { - if (this.token === this.tok.T_ELSEIF) { - alternate = this.read_elseif_short(); - break; - } else if (this.token === this.tok.T_ELSE) { - alternate = this.read_else_short(); - break; - } - items.push(this.read_inner_statement()); - } - body = body(null, items); - return result(test, body, alternate, true); - }, - /** - * - */ - read_else_short: function read_else_short() { - var body = this.node("block"); - if (this.next().expect(":")) this.next(); - var items = []; - while (this.token != this.EOF && this.token !== this.tok.T_ENDIF) { - items.push(this.read_inner_statement()); - } - return body(null, items); - } -}; - -/***/ }), -/* 102 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * checks if current token is a reference keyword - */ - is_reference: function is_reference() { - if (this.token == "&") { - this.next(); - return true; - } - return false; - }, - /** - * checks if current token is a variadic keyword - */ - is_variadic: function is_variadic() { - if (this.token === this.tok.T_ELLIPSIS) { - this.next(); - return true; - } - return false; - }, - /** - * reading a function - * ```ebnf - * function ::= function_declaration code_block - * ``` - */ - read_function: function read_function(closure, flag) { - var result = this.read_function_declaration(closure ? 1 : flag ? 2 : 0, flag && flag[1] === 1); - if (flag && flag[2] == 1) { - // abstract function : - result.parseFlags(flag); - if (this.expect(";")) { - this.next(); - } - } else { - if (this.expect("{")) { - result.body = this.read_code_block(false); - if (result.loc && result.body.loc) { - result.loc.end = result.body.loc.end; - } - } - if (!closure && flag) { - result.parseFlags(flag); - } - } - return result; - }, - /** - * reads a function declaration (without his body) - * ```ebnf - * function_declaration ::= T_FUNCTION '&'? T_STRING '(' parameter_list ')' - * ``` - */ - read_function_declaration: function read_function_declaration(type, isStatic) { - var nodeName = "function"; - if (type === 1) { - nodeName = "closure"; - } else if (type === 2) { - nodeName = "method"; - } - var result = this.node(nodeName); - - if (this.expect(this.tok.T_FUNCTION)) { - this.next(); - } - var isRef = this.is_reference(); - var name = false, - use = [], - returnType = null, - nullable = false; - if (type !== 1) { - if (type === 2) { - if (this.token === this.tok.T_STRING || this.php7 && this.is("IDENTIFIER")) { - name = this.text(); - this.next(); - } else { - this.error("IDENTIFIER"); - } - } else { - if (this.expect(this.tok.T_STRING)) { - name = this.text(); - } - this.next(); - } - } - if (this.expect("(")) this.next(); - var params = this.read_parameter_list(); - if (this.expect(")")) this.next(); - if (type === 1 && this.token === this.tok.T_USE) { - if (this.next().expect("(")) this.next(); - use = this.read_list(this.read_lexical_var, ","); - if (this.expect(")")) this.next(); - } - if (this.token === ":") { - if (this.next().token === "?") { - nullable = true; - this.next(); - } - returnType = this.read_type(); - } - if (type === 1) { - // closure - return result(params, isRef, use, returnType, nullable, isStatic); - } - return result(name, params, isRef, returnType, nullable); - }, - /** - * ```ebnf - * lexical_var ::= '&'? T_VARIABLE - * ``` - */ - read_lexical_var: function read_lexical_var() { - var result = this.node("variable"); - var isRef = false; - if (this.token === "&") { - isRef = true; - this.next(); - } - this.expect(this.tok.T_VARIABLE); - var name = this.text().substring(1); - this.next(); - return result(name, isRef, false); - }, - /** - * reads a list of parameters - * ```ebnf - * parameter_list ::= (parameter ',')* parameter? - * ``` - */ - read_parameter_list: function read_parameter_list() { - var result = []; - if (this.token != ")") { - while (this.token != this.EOF) { - result.push(this.read_parameter()); - if (this.token == ",") { - this.next(); - } else if (this.token == ")") { - break; - } else { - this.error([",", ")"]); - break; - } - } - } - return result; - }, - /** - * ```ebnf - * parameter ::= type? '&'? T_ELLIPSIS? T_VARIABLE ('=' expr)? - * ``` - * @see https://github.com/php/php-src/blob/493524454d66adde84e00d249d607ecd540de99f/Zend/zend_language_parser.y#L640 - */ - read_parameter: function read_parameter() { - var node = this.node("parameter"); - var name = null; - var value = null; - var type = null; - var nullable = false; - if (this.token === "?") { - this.next(); - nullable = true; - } - type = this.read_type(); - if (nullable && !type) { - this.raiseError("Expecting a type definition combined with nullable operator"); - } - var isRef = this.is_reference(); - var isVariadic = this.is_variadic(); - if (this.expect(this.tok.T_VARIABLE)) { - name = this.text().substring(1); - this.next(); - } - if (this.token == "=") { - value = this.next().read_expr(); - } - return node(name, type, value, isRef, isVariadic, nullable); - }, - /** - * Reads a list of arguments - * ```ebnf - * function_argument_list ::= '(' (argument_list (',' argument_list)*)? ')' - * ``` - */ - read_function_argument_list: function read_function_argument_list() { - var result = []; - var wasVariadic = false; - this.expect("(") && this.next(); - if (this.token !== ")") { - while (this.token != this.EOF) { - var argument = this.read_argument_list(); - if (argument) { - result.push(argument); - if (argument.kind === "variadic") { - wasVariadic = true; - } else if (wasVariadic) { - this.raiseError("Unexpected argument after a variadic argument"); - } - } - if (this.token === ",") { - this.next(); - } else break; - } - } - this.expect(")") && this.next(); - return result; - }, - /** - * ```ebnf - * argument_list ::= T_ELLIPSIS? expr - * ``` - */ - read_argument_list: function read_argument_list() { - if (this.token === this.tok.T_ELLIPSIS) { - return this.node("variadic")(this.next().read_expr()); - } - return this.read_expr(); - }, - /** - * read type hinting - * ```ebnf - * type ::= T_ARRAY | T_CALLABLE | namespace_name - * ``` - */ - read_type: function read_type() { - var result = this.node("identifier"); - switch (this.token) { - case this.tok.T_ARRAY: - this.next(); - return result(["", "array"], false); - case this.tok.T_NAMESPACE: - case this.tok.T_NS_SEPARATOR: - case this.tok.T_STRING: - return this.read_namespace_name(); - case this.tok.T_CALLABLE: - this.next(); - return result(["", "callable"], false); - default: - return null; - } - } -}; - -/***/ }), -/* 103 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - read_expr: function read_expr() { - var result = this.node(); - var expr = this.read_expr_item(); - // binary operations - if (this.token === "|") return result("bin", "|", expr, this.next().read_expr()); - if (this.token === "&") return result("bin", "&", expr, this.next().read_expr()); - if (this.token === "^") return result("bin", "^", expr, this.next().read_expr()); - if (this.token === ".") return result("bin", ".", expr, this.next().read_expr()); - if (this.token === "+") return result("bin", "+", expr, this.next().read_expr()); - if (this.token === "-") return result("bin", "-", expr, this.next().read_expr()); - if (this.token === "*") return result("bin", "*", expr, this.next().read_expr()); - if (this.token === "/") return result("bin", "/", expr, this.next().read_expr()); - if (this.token === "%") return result("bin", "%", expr, this.next().read_expr()); - if (this.token === this.tok.T_POW) return result("bin", "**", expr, this.next().read_expr()); - if (this.token === this.tok.T_SL) return result("bin", "<<", expr, this.next().read_expr()); - if (this.token === this.tok.T_SR) return result("bin", ">>", expr, this.next().read_expr()); - // more binary operations (formerly bool) - if (this.token === this.tok.T_BOOLEAN_OR) return result("bin", "||", expr, this.next().read_expr()); - if (this.token === this.tok.T_LOGICAL_OR) return result("bin", "or", expr, this.next().read_expr()); - if (this.token === this.tok.T_BOOLEAN_AND) return result("bin", "&&", expr, this.next().read_expr()); - if (this.token === this.tok.T_LOGICAL_AND) return result("bin", "and", expr, this.next().read_expr()); - if (this.token === this.tok.T_LOGICAL_XOR) return result("bin", "xor", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_IDENTICAL) return result("bin", "===", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_NOT_IDENTICAL) return result("bin", "!==", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_EQUAL) return result("bin", "==", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_NOT_EQUAL) return result("bin", "!=", expr, this.next().read_expr()); - if (this.token === "<") return result("bin", "<", expr, this.next().read_expr()); - if (this.token === ">") return result("bin", ">", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_SMALLER_OR_EQUAL) return result("bin", "<=", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_GREATER_OR_EQUAL) return result("bin", ">=", expr, this.next().read_expr()); - if (this.token === this.tok.T_SPACESHIP) return result("bin", "<=>", expr, this.next().read_expr()); - if (this.token === this.tok.T_INSTANCEOF) return result("bin", "instanceof", expr, this.next().read_expr()); - - // extra operations : - // $username = $_GET['user'] ?? 'nobody'; - if (this.token === this.tok.T_COALESCE) return result("bin", "??", expr, this.next().read_expr()); - - // extra operations : - // $username = $_GET['user'] ? true : false; - if (this.token === "?") { - var trueArg = null; - if (this.next().token !== ":") { - trueArg = this.read_expr(); - } - this.expect(":") && this.next(); - return result("retif", expr, trueArg, this.read_expr()); - } else { - // see #193 - result.destroy(expr); - } - - return expr; - }, - - /** - * Reads a cast expression - */ - read_expr_cast: function read_expr_cast(type) { - return this.node("cast")(type, this.text(), this.next().read_expr()); - }, - - /** - * ```ebnf - * Reads an expression - * expr ::= @todo - * ``` - */ - read_expr_item: function read_expr_item() { - var result = void 0, - expr = void 0; - if (this.token === "@") return this.node("silent")(this.next().read_expr()); - if (this.token === "+") return this.node("unary")("+", this.next().read_expr()); - if (this.token === "!") return this.node("unary")("!", this.next().read_expr()); - if (this.token === "~") return this.node("unary")("~", this.next().read_expr()); - - if (this.token === "-") { - result = this.node(); - this.next(); - if (this.token === this.tok.T_LNUMBER || this.token === this.tok.T_DNUMBER) { - // negative number - result = result("number", "-" + this.text(), null); - this.next(); - return result; - } - return result("unary", "-", this.read_expr()); - } - - if (this.token === "(") { - expr = this.next().read_expr(); - expr.parenthesizedExpression = true; - this.expect(")") && this.next(); - return this.handleDereferencable(expr); - } - - if (this.token === "`") { - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1048 - return this.next().read_encapsed_string("`"); - } - - if (this.token === this.tok.T_LIST) { - var assign = null; - var isInner = this.innerList; - result = this.node("list"); - if (!isInner) { - assign = this.node("assign"); - } - if (this.next().expect("(")) { - this.next(); - } - - if (!this.innerList) this.innerList = true; - - // reads inner items - var assignList = this.read_array_pair_list(false); - if (this.expect(")")) { - this.next(); - } - - // check if contains at least one assignment statement - var hasItem = false; - for (var i = 0; i < assignList.length; i++) { - if (assignList[i] !== null) { - hasItem = true; - break; - } - } - if (!hasItem) { - this.raiseError("Fatal Error : Cannot use empty list on line " + this.lexer.yylloc.first_line); - } - - // handles the node resolution - if (!isInner) { - this.innerList = false; - if (this.expect("=")) { - return assign(result(assignList, false), this.next().read_expr(), "="); - } else { - // error fallback : list($a, $b); - return result(assignList, false); - } - } else { - return result(assignList, false); - } - } - - if (this.token === this.tok.T_CLONE) return this.node("clone")(this.next().read_expr()); - - switch (this.token) { - case this.tok.T_INC: - return this.node("pre")("+", this.next().read_variable(false, false, false)); - - case this.tok.T_DEC: - return this.node("pre")("-", this.next().read_variable(false, false, false)); - - case this.tok.T_NEW: - return this.next().read_new_expr(); - - case this.tok.T_ISSET: - { - result = this.node("isset"); - if (this.next().expect("(")) { - this.next(); - } - var args = this.read_list(this.read_expr, ","); - if (this.expect(")")) { - this.next(); - } - return result(args); - } - case this.tok.T_EMPTY: - { - result = this.node("empty"); - if (this.next().expect("(")) { - this.next(); - } - var arg = this.read_expr(); - if (this.expect(")")) { - this.next(); - } - return result([arg]); - } - case this.tok.T_INCLUDE: - return this.node("include")(false, false, this.next().read_expr()); - - case this.tok.T_INCLUDE_ONCE: - return this.node("include")(true, false, this.next().read_expr()); - - case this.tok.T_REQUIRE: - return this.node("include")(false, true, this.next().read_expr()); - - case this.tok.T_REQUIRE_ONCE: - return this.node("include")(true, true, this.next().read_expr()); - - case this.tok.T_EVAL: - result = this.node("eval"); - if (this.next().expect("(")) { - this.next(); - } - expr = this.read_expr(); - if (this.expect(")")) { - this.next(); - } - return result(expr); - - case this.tok.T_INT_CAST: - return this.read_expr_cast("int"); - - case this.tok.T_DOUBLE_CAST: - return this.read_expr_cast("float"); - - case this.tok.T_STRING_CAST: - return this.read_expr_cast(this.text().indexOf("binary") !== -1 ? "binary" : "string"); - - case this.tok.T_ARRAY_CAST: - return this.read_expr_cast("array"); - - case this.tok.T_OBJECT_CAST: - return this.read_expr_cast("object"); - - case this.tok.T_BOOL_CAST: - return this.read_expr_cast("bool"); - - case this.tok.T_UNSET_CAST: - return this.read_expr_cast("unset"); - - case this.tok.T_EXIT: - { - var useDie = this.lexer.yytext.toLowerCase() === "die"; - result = this.node("exit"); - var status = null; - if (this.next().token === "(") { - if (this.next().token !== ")") { - status = this.read_expr(); - if (this.expect(")")) { - this.next(); - } - } else { - this.next(); - } - } - return result(status, useDie); - } - - case this.tok.T_PRINT: - return this.node("print")(this.next().read_expr()); - - // T_YIELD (expr (T_DOUBLE_ARROW expr)?)? - case this.tok.T_YIELD: - { - var value = null; - var key = null; - result = this.node("yield"); - if (this.next().is("EXPR")) { - // reads the yield return value - value = this.read_expr(); - if (this.token === this.tok.T_DOUBLE_ARROW) { - // reads the yield returned key - key = value; - value = this.next().read_expr(); - } - } - return result(value, key); - } - - // T_YIELD_FROM expr - case this.tok.T_YIELD_FROM: - result = this.node("yieldfrom"); - expr = this.next().read_expr(); - return result(expr); - - case this.tok.T_FUNCTION: - return this.read_function(true); - - case this.tok.T_STATIC: - { - var backup = [this.token, this.lexer.getState()]; - if (this.next().token === this.tok.T_FUNCTION) { - // handles static function - return this.read_function(true, [0, 1, 0]); - } else { - // rollback - this.lexer.tokens.push(backup); - this.next(); - } - } - } - - // SCALAR | VARIABLE - if (this.is("VARIABLE")) { - result = this.node(); - expr = this.read_variable(false, false, false); - - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L877 - // should accept only a variable - var isConst = expr.kind === "constref" || expr.kind === "staticlookup" && expr.offset.kind === "constref"; - - // VARIABLES SPECIFIC OPERATIONS - switch (this.token) { - case "=": - { - if (isConst) this.error("VARIABLE"); - var right = void 0; - if (this.next().token == "&") { - if (this.next().token === this.tok.T_NEW) { - right = this.next().read_new_expr(); - } else { - right = this.read_variable(false, false, true); - } - } else { - right = this.read_expr(); - } - return result("assign", expr, right, "="); - } - - // operations : - case this.tok.T_PLUS_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "+="); - - case this.tok.T_MINUS_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "-="); - - case this.tok.T_MUL_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "*="); - - case this.tok.T_POW_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "**="); - - case this.tok.T_DIV_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "/="); - - case this.tok.T_CONCAT_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), ".="); - - case this.tok.T_MOD_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "%="); - - case this.tok.T_AND_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "&="); - - case this.tok.T_OR_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "|="); - - case this.tok.T_XOR_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "^="); - - case this.tok.T_SL_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), "<<="); - - case this.tok.T_SR_EQUAL: - if (isConst) this.error("VARIABLE"); - return result("assign", expr, this.next().read_expr(), ">>="); - - case this.tok.T_INC: - if (isConst) this.error("VARIABLE"); - this.next(); - return result("post", "+", expr); - case this.tok.T_DEC: - if (isConst) this.error("VARIABLE"); - this.next(); - return result("post", "-", expr); - default: - // see #193 - result.destroy(expr); - } - } else if (this.is("SCALAR")) { - result = this.node(); - expr = this.read_scalar(); - if (expr.kind === "array" && expr.shortForm && this.token === "=") { - // list assign - var list = this.node("list")(expr.items, true); - if (expr.loc) list.loc = expr.loc; - var _right = this.next().read_expr(); - return result("assign", list, _right, "="); - } else { - // see #189 - swap docs on nodes - result.destroy(expr); - } - // classic array - return this.handleDereferencable(expr); - } else { - this.error("EXPR"); - this.next(); - } - - // returns variable | scalar - return expr; - }, - /** - * ```ebnf - * new_expr ::= T_NEW (namespace_name function_argument_list) | (T_CLASS ... class declaration) - * ``` - * https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L850 - */ - read_new_expr: function read_new_expr() { - var result = this.node("new"); - var args = []; - if (this.token === this.tok.T_CLASS) { - var what = this.node("class"); - // Annonymous class declaration - var propExtends = null, - propImplements = null, - body = null; - if (this.next().token === "(") { - args = this.read_function_argument_list(); - } - if (this.token == this.tok.T_EXTENDS) { - propExtends = this.next().read_namespace_name(); - } - if (this.token == this.tok.T_IMPLEMENTS) { - propImplements = this.next().read_name_list(); - } - if (this.expect("{")) { - body = this.next().read_class_body(); - } - return result(what(null, propExtends, propImplements, body, [0, 0, 0]), args); - } - // Already existing class - var name = this.read_class_name_reference(); - if (this.token === "(") { - args = this.read_function_argument_list(); - } - return result(name, args); - }, - /** - * Reads a class name - * ```ebnf - * class_name_reference ::= namespace_name | variable - * ``` - */ - read_class_name_reference: function read_class_name_reference() { - if (this.token === this.tok.T_NS_SEPARATOR || this.token === this.tok.T_STRING || this.token === this.tok.T_NAMESPACE) { - var result = this.read_namespace_name(); - if (this.token === this.tok.T_DOUBLE_COLON) { - result = this.read_static_getter(result); - } - return result; - } else if (this.is("VARIABLE")) { - return this.read_variable(true, false, false); - } else { - this.expect([this.tok.T_STRING, "VARIABLE"]); - } - }, - handleDereferencable: function handleDereferencable(expr) { - while (this.token !== this.EOF) { - if (this.token === this.tok.T_OBJECT_OPERATOR || this.token === this.tok.T_DOUBLE_COLON) { - expr = this.recursive_variable_chain_scan(expr, false, false, true); - } else if (this.token === this.tok.T_CURLY_OPEN || this.token === "[") { - expr = this.read_dereferencable(expr); - } else if (this.token === "(") { - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1118 - expr = this.node("call")(expr, this.read_function_argument_list()); - } else { - return expr; - } - } - return expr; - } -}; - -/***/ }), -/* 104 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * Comments with // or # or / * ... * / - */ - read_comment: function read_comment() { - var text = this.text(); - var result = this.ast.prepare(text.substring(0, 2) === "/*" ? "commentblock" : "commentline", null, this); - // handle location on comment - var prev = this.prev; - this.prev = [this.lexer.yylloc.last_line, this.lexer.yylloc.last_column, this.lexer.offset]; - this.lex(); - result = result(text); - this.prev = prev; - return result; - }, - /** - * Comments with / ** ... * / - */ - read_doc_comment: function read_doc_comment() { - var result = this.ast.prepare("commentblock", null, this); - var text = this.text(); - var prev = this.prev; - this.prev = [this.lexer.yylloc.last_line, this.lexer.yylloc.last_column, this.lexer.offset]; - this.lex(); - result = result(text); - this.prev = prev; - return result; - } -}; - -/***/ }), -/* 105 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * reading a class - * ```ebnf - * class ::= class_scope? T_CLASS T_STRING (T_EXTENDS NAMESPACE_NAME)? (T_IMPLEMENTS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' CLASS_BODY '}' - * ``` - */ - read_class: function read_class(flag) { - var result = this.node("class"); - this.expect(this.tok.T_CLASS); - this.next().expect(this.tok.T_STRING); - var propName = this.text(); - var propExtends = null; - var propImplements = null; - if (this.next().token == this.tok.T_EXTENDS) { - propExtends = this.next().read_namespace_name(); - } - if (this.token == this.tok.T_IMPLEMENTS) { - propImplements = this.next().read_name_list(); - } - this.expect("{"); - var body = this.next().read_class_body(); - return result(propName, propExtends, propImplements, body, flag); - }, - /** - * Read the class visibility - * ```ebnf - * class_scope ::= (T_FINAL | T_ABSTRACT)? - * ``` - */ - read_class_scope: function read_class_scope() { - var result = this.token; - if (result == this.tok.T_FINAL) { - this.next(); - return [0, 0, 2]; - } else if (result == this.tok.T_ABSTRACT) { - this.next(); - return [0, 0, 1]; - } - return [0, 0, 0]; - }, - /** - * Reads a class body - * ```ebnf - * class_body ::= (member_flags? (T_VAR | T_STRING | T_FUNCTION))* - * ``` - */ - read_class_body: function read_class_body() { - var result = []; - - while (this.token !== this.EOF && this.token !== "}") { - if (this.token === this.tok.T_COMMENT) { - result.push(this.read_comment()); - continue; - } - - if (this.token === this.tok.T_DOC_COMMENT) { - result.push(this.read_doc_comment()); - continue; - } - - // check T_USE trait - if (this.token === this.tok.T_USE) { - result = result.concat(this.next().read_trait_use_statement()); - continue; - } - - // read member flags - var flags = this.read_member_flags(false); - - // check constant - if (this.token === this.tok.T_CONST) { - var constants = this.read_constant_list(flags); - if (this.expect(";")) { - this.next(); - } - result = result.concat(constants); - continue; - } - - // jump over T_VAR then land on T_VARIABLE - if (this.token === this.tok.T_VAR) { - this.next().expect(this.tok.T_VARIABLE); - flags[0] = null; // public (as null) - flags[1] = 0; // non static var - } - - if (this.token === this.tok.T_VARIABLE) { - // reads a variable - var variables = this.read_variable_list(flags); - this.expect(";"); - this.next(); - result = result.concat(variables); - } else if (this.token === this.tok.T_FUNCTION) { - // reads a function - result.push(this.read_function(false, flags)); - } else { - // raise an error - this.error([this.tok.T_CONST, this.tok.T_VARIABLE, this.tok.T_FUNCTION]); - // ignore token - this.next(); - } - } - this.expect("}"); - this.next(); - return result; - }, - /** - * Reads variable list - * ```ebnf - * variable_list ::= (variable_declaration ',')* variable_declaration - * ``` - */ - read_variable_list: function read_variable_list(flags) { - return this.read_list( - /** - * Reads a variable declaration - * - * ```ebnf - * variable_declaration ::= T_VARIABLE '=' scalar - * ``` - */ - function read_variable_declaration() { - var result = this.node("property"); - this.expect(this.tok.T_VARIABLE); - var name = this.text().substring(1); // ignore $ - this.next(); - if (this.token === ";" || this.token === ",") { - return result(name, null, flags); - } else if (this.token === "=") { - // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L815 - return result(name, this.next().read_expr(), flags); - } else { - this.expect([",", ";", "="]); - return result(name, null, flags); - } - }, ","); - }, - /** - * Reads constant list - * ```ebnf - * constant_list ::= T_CONST (constant_declaration ',')* constant_declaration - * ``` - */ - read_constant_list: function read_constant_list(flags) { - if (this.expect(this.tok.T_CONST)) { - this.next(); - } - return this.read_list( - /** - * Reads a constant declaration - * - * ```ebnf - * constant_declaration ::= (T_STRING | IDENTIFIER) '=' expr - * ``` - * @return {Constant} [:link:](AST.md#constant) - */ - function read_constant_declaration() { - var result = this.node("classconstant"); - var name = null; - var value = null; - if (this.token === this.tok.T_STRING || this.php7 && this.is("IDENTIFIER")) { - name = this.text(); - this.next(); - } else { - this.expect("IDENTIFIER"); - } - if (this.expect("=")) { - value = this.next().read_expr(); - } - return result(name, value, flags); - }, ","); - }, - /** - * Read member flags - * @return array - * 1st index : 0 => public, 1 => protected, 2 => private - * 2nd index : 0 => instance member, 1 => static member - * 3rd index : 0 => normal, 1 => abstract member, 2 => final member - */ - read_member_flags: function read_member_flags(asInterface) { - var result = [-1, -1, -1]; - if (this.is("T_MEMBER_FLAGS")) { - var idx = 0, - val = 0; - do { - switch (this.token) { - case this.tok.T_PUBLIC: - idx = 0; - val = 0; - break; - case this.tok.T_PROTECTED: - idx = 0; - val = 1; - break; - case this.tok.T_PRIVATE: - idx = 0; - val = 2; - break; - case this.tok.T_STATIC: - idx = 1; - val = 1; - break; - case this.tok.T_ABSTRACT: - idx = 2; - val = 1; - break; - case this.tok.T_FINAL: - idx = 2; - val = 2; - break; - } - if (asInterface) { - if (idx == 0 && val == 2) { - // an interface can't be private - this.expect([this.tok.T_PUBLIC, this.tok.T_PROTECTED]); - val = -1; - } else if (idx == 2 && val == 1) { - // an interface cant be abstract - this.error(); - val = -1; - } - } - if (result[idx] !== -1) { - // already defined flag - this.error(); - } else if (val !== -1) { - result[idx] = val; - } - } while (this.next().is("T_MEMBER_FLAGS")); - } - - if (result[1] == -1) result[1] = 0; - if (result[2] == -1) result[2] = 0; - return result; - }, - /** - * reading an interface - * ```ebnf - * interface ::= T_INTERFACE T_STRING (T_EXTENDS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' INTERFACE_BODY '}' - * ``` - */ - read_interface: function read_interface() { - var result = this.node("interface"); - var name = null; - var body = null; - var propExtends = null; - if (this.expect(this.tok.T_INTERFACE)) { - this.next(); - } - if (this.expect(this.tok.T_STRING)) { - name = this.text(); - this.next(); - } - if (this.token === this.tok.T_EXTENDS) { - propExtends = this.next().read_name_list(); - } - if (this.expect("{")) { - body = this.next().read_interface_body(); - } - return result(name, propExtends, body); - }, - /** - * Reads an interface body - * ```ebnf - * interface_body ::= (member_flags? (T_CONST | T_FUNCTION))* - * ``` - */ - read_interface_body: function read_interface_body() { - var result = []; - - while (this.token !== this.EOF && this.token !== "}") { - if (this.token === this.tok.T_COMMENT) { - result.push(this.read_comment()); - continue; - } - - if (this.token === this.tok.T_DOC_COMMENT) { - result.push(this.read_doc_comment()); - continue; - } - - // read member flags - var flags = this.read_member_flags(true); - - // check constant - if (this.token == this.tok.T_CONST) { - var constants = this.read_constant_list(flags); - if (this.expect(";")) { - this.next(); - } - result = result.concat(constants); - } else if (this.token === this.tok.T_FUNCTION) { - // reads a function - var method = this.read_function_declaration(2, flags); - method.parseFlags(flags); - result.push(method); - if (this.expect(";")) { - this.next(); - } - } else { - // raise an error - this.error([this.tok.T_CONST, this.tok.T_FUNCTION]); - this.next(); - } - } - if (this.expect("}")) { - this.next(); - } - return result; - }, - /** - * reading a trait - * ```ebnf - * trait ::= T_TRAIT T_STRING (T_EXTENDS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' FUNCTION* '}' - * ``` - */ - read_trait: function read_trait() { - var result = this.node("trait"); - var propName = null; - var propExtends = null; - var propImplements = null; - var body = null; - if (this.expect(this.tok.T_TRAIT)) { - this.next(); - } - if (this.expect(this.tok.T_STRING)) { - propName = this.text(); - } - if (this.next().token == this.tok.T_EXTENDS) { - propExtends = this.next().read_namespace_name(); - } - if (this.token == this.tok.T_IMPLEMENTS) { - propImplements = this.next().read_name_list(); - } - if (this.expect("{")) { - body = this.next().read_class_body(); - } - return result(propName, propExtends, propImplements, body); - }, - /** - * reading a use statement - * ```ebnf - * trait_use_statement ::= namespace_name (',' namespace_name)* ('{' trait_use_alias '}')? - * ``` - */ - read_trait_use_statement: function read_trait_use_statement() { - // defines use statements - var node = this.node("traituse"); - var traits = [this.read_namespace_name()]; - var adaptations = null; - while (this.token === ",") { - traits.push(this.next().read_namespace_name()); - } - if (this.token === "{") { - adaptations = []; - // defines alias statements - while (this.next().token !== this.EOF) { - if (this.token === "}") break; - adaptations.push(this.read_trait_use_alias()); - this.expect(";"); - } - if (this.expect("}")) { - this.next(); - } - } else { - if (this.expect(";")) { - this.next(); - } - } - return node(traits, adaptations); - }, - /** - * Reading trait alias - * ```ebnf - * trait_use_alias ::= namespace_name ( T_DOUBLE_COLON T_STRING )? (T_INSTEADOF namespace_name) | (T_AS member_flags? T_STRING) - * ``` - * name list : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L303 - * trait adaptation : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L742 - */ - read_trait_use_alias: function read_trait_use_alias() { - var node = this.node(); - var trait = null; - var method = void 0; - - if (this.is("IDENTIFIER")) { - method = this.text(); - this.next(); - } else { - method = this.read_namespace_name(); - - if (this.token === this.tok.T_DOUBLE_COLON) { - this.next(); - if (this.token === this.tok.T_STRING || this.php7 && this.is("IDENTIFIER")) { - trait = method; - method = this.text(); - this.next(); - } else { - this.expect(this.tok.T_STRING); - } - } else { - // convert identifier as string - method = method.name; - } - } - - // handle trait precedence - if (this.token === this.tok.T_INSTEADOF) { - return node("traitprecedence", trait, method, this.next().read_name_list()); - } else if (this.token === this.tok.T_AS) { - // handle trait alias - var flags = null; - var alias = null; - if (this.next().is("T_MEMBER_FLAGS")) { - flags = this.read_member_flags(); - } - - if (this.token === this.tok.T_STRING || this.php7 && this.is("IDENTIFIER")) { - alias = this.text(); - this.next(); - } else if (flags === false) { - // no visibility flags and no name => too bad - this.expect(this.tok.T_STRING); - } - - return node("traitalias", trait, method, alias, flags); - } - - // handle errors - this.expect([this.tok.T_AS, this.tok.T_INSTEADOF]); - return node("traitalias", trait, method, null, null); - } -}; - -/***/ }), -/* 106 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var ArrayExpr = "array"; -var ArrayEntry = "entry"; - -module.exports = { - /** - * Parse an array - * ```ebnf - * array ::= T_ARRAY '(' array_pair_list ')' | - * '[' array_pair_list ']' - * ``` - */ - read_array: function read_array() { - var expect = null; - var shortForm = false; - var result = this.node(ArrayExpr); - - if (this.token === this.tok.T_ARRAY) { - this.next().expect("("); - expect = ")"; - } else { - shortForm = true; - expect = "]"; - } - var items = []; - if (this.next().token !== expect) { - items = this.read_array_pair_list(shortForm); - } - // check non empty entries - /*for(let i = 0, size = items.length - 1; i < size; i++) { - if (items[i] === null) { - this.raiseError( - "Cannot use empty array elements in arrays" - ); - } - }*/ - this.expect(expect); - this.next(); - return result(shortForm, items); - }, - /** - * Reads an array of items - * ```ebnf - * array_pair_list ::= array_pair (',' array_pair?)* - * ``` - */ - read_array_pair_list: function read_array_pair_list(shortForm) { - var self = this; - return this.read_list(function () { - return self.read_array_pair(shortForm); - }, ",", true); - }, - /** - * Reads an entry - * array_pair: - * expr T_DOUBLE_ARROW expr - * | expr - * | expr T_DOUBLE_ARROW '&' variable - * | '&' variable - * | expr T_DOUBLE_ARROW T_LIST '(' array_pair_list ')' - * | T_LIST '(' array_pair_list ')' - */ - read_array_pair: function read_array_pair(shortForm) { - if (this.token === "," || !shortForm && this.token === ")" || shortForm && this.token === "]") { - return null; - } - if (this.token === "&") { - return this.next().read_variable(true, false, true); - } else { - var entry = this.node(ArrayEntry); - var expr = this.read_expr(); - if (this.token === this.tok.T_DOUBLE_ARROW) { - if (this.next().token === "&") { - return entry(expr, this.next().read_variable(true, false, true)); - } else { - return entry(expr, this.read_expr()); - } - } - return expr; - } - }, - /** - * ```ebnf - * dim_offset ::= expr? - * ``` - */ - read_dim_offset: function read_dim_offset() { - if (this.token == "]") return false; - return this.read_expr(); - } -}; - -/***/ }), -/* 107 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -/** - * @private - */ - -function isNumber(n) { - return n != "." && n != "," && !isNaN(parseFloat(n)) && isFinite(n); -} - -/** - * The PHP Parser class that build the AST tree from the lexer - * - * @class - * @tutorial Parser - * @property {Lexer} lexer - current lexer instance - * @property {AST} ast - the AST factory instance - * @property {Integer|String} token - current token - * @property {Boolean} extractDoc - should extract documentation as AST node - * @property {Boolean} extractTokens - should extract each token - * @property {Boolean} suppressErrors - should ignore parsing errors and continue - * @property {Boolean} debug - should output debug informations - */ -var parser = function parser(lexer, ast) { - this.lexer = lexer; - this.ast = ast; - this.tok = lexer.tok; - this.EOF = lexer.EOF; - this.token = null; - this.prev = null; - this.debug = false; - this.php7 = true; - this.extractDoc = false; - this.extractTokens = false; - this.suppressErrors = false; - var mapIt = function mapIt(item) { - return [item, null]; - }; - this.entries = { - IDENTIFIER: new Map([this.tok.T_ABSTRACT, this.tok.T_ARRAY, this.tok.T_AS, this.tok.T_BREAK, this.tok.T_CALLABLE, this.tok.T_CASE, this.tok.T_CATCH, this.tok.T_CLASS, this.tok.T_CLASS_C, this.tok.T_CLONE, this.tok.T_CONST, this.tok.T_CONTINUE, this.tok.T_DECLARE, this.tok.T_DEFAULT, this.tok.T_DIR, this.tok.T_DO, this.tok.T_ECHO, this.tok.T_ELSE, this.tok.T_ELSEIF, this.tok.T_EMPTY, this.tok.T_ENDDECLARE, this.tok.T_ENDFOR, this.tok.T_ENDFOREACH, this.tok.T_ENDIF, this.tok.T_ENDSWITCH, this.tok.T_ENDWHILE, this.tok.T_EVAL, this.tok.T_EXIT, this.tok.T_EXTENDS, this.tok.T_FILE, this.tok.T_FINAL, this.tok.T_FINALLY, this.tok.T_FUNC_C, this.tok.T_FOR, this.tok.T_FOREACH, this.tok.T_FUNCTION, this.tok.T_GLOBAL, this.tok.T_GOTO, this.tok.T_IF, this.tok.T_IMPLEMENTS, this.tok.T_INCLUDE, this.tok.T_INCLUDE_ONCE, this.tok.T_INSTANCEOF, this.tok.T_INSTEADOF, this.tok.T_INTERFACE, this.tok.T_ISSET, this.tok.T_LINE, this.tok.T_LIST, this.tok.T_LOGICAL_AND, this.tok.T_LOGICAL_OR, this.tok.T_LOGICAL_XOR, this.tok.T_METHOD_C, this.tok.T_NAMESPACE, this.tok.T_NEW, this.tok.T_NS_C, this.tok.T_PRINT, this.tok.T_PRIVATE, this.tok.T_PROTECTED, this.tok.T_PUBLIC, this.tok.T_REQUIRE, this.tok.T_REQUIRE_ONCE, this.tok.T_RETURN, this.tok.T_STATIC, this.tok.T_SWITCH, this.tok.T_THROW, this.tok.T_TRAIT, this.tok.T_TRY, this.tok.T_UNSET, this.tok.T_USE, this.tok.T_VAR, this.tok.T_WHILE, this.tok.T_YIELD].map(mapIt)), - VARIABLE: new Map([this.tok.T_VARIABLE, "$", "&", this.tok.T_NS_SEPARATOR, this.tok.T_STRING, this.tok.T_NAMESPACE, this.tok.T_STATIC].map(mapIt)), - SCALAR: new Map([this.tok.T_CONSTANT_ENCAPSED_STRING, this.tok.T_START_HEREDOC, this.tok.T_LNUMBER, this.tok.T_DNUMBER, this.tok.T_ARRAY, "[", this.tok.T_CLASS_C, this.tok.T_TRAIT_C, this.tok.T_FUNC_C, this.tok.T_METHOD_C, this.tok.T_LINE, this.tok.T_FILE, this.tok.T_DIR, this.tok.T_NS_C, '"', 'b"', 'B"', "-", this.tok.T_NS_SEPARATOR].map(mapIt)), - T_MAGIC_CONST: new Map([this.tok.T_CLASS_C, this.tok.T_TRAIT_C, this.tok.T_FUNC_C, this.tok.T_METHOD_C, this.tok.T_LINE, this.tok.T_FILE, this.tok.T_DIR, this.tok.T_NS_C].map(mapIt)), - T_MEMBER_FLAGS: new Map([this.tok.T_PUBLIC, this.tok.T_PRIVATE, this.tok.T_PROTECTED, this.tok.T_STATIC, this.tok.T_ABSTRACT, this.tok.T_FINAL].map(mapIt)), - EOS: new Map([";", this.EOF, this.tok.T_INLINE_HTML].map(mapIt)), - EXPR: new Map(["@", "-", "+", "!", "~", "(", "`", this.tok.T_LIST, this.tok.T_CLONE, this.tok.T_INC, this.tok.T_DEC, this.tok.T_NEW, this.tok.T_ISSET, this.tok.T_EMPTY, this.tok.T_INCLUDE, this.tok.T_INCLUDE_ONCE, this.tok.T_REQUIRE, this.tok.T_REQUIRE_ONCE, this.tok.T_EVAL, this.tok.T_INT_CAST, this.tok.T_DOUBLE_CAST, this.tok.T_STRING_CAST, this.tok.T_ARRAY_CAST, this.tok.T_OBJECT_CAST, this.tok.T_BOOL_CAST, this.tok.T_UNSET_CAST, this.tok.T_EXIT, this.tok.T_PRINT, this.tok.T_YIELD, this.tok.T_STATIC, this.tok.T_FUNCTION, - // using VARIABLES : - this.tok.T_VARIABLE, "$", this.tok.T_NS_SEPARATOR, this.tok.T_STRING, - // using SCALAR : - this.tok.T_STRING, // @see variable.js line 45 > conflict with variable = shift/reduce :) - this.tok.T_CONSTANT_ENCAPSED_STRING, this.tok.T_START_HEREDOC, this.tok.T_LNUMBER, this.tok.T_DNUMBER, this.tok.T_ARRAY, "[", this.tok.T_CLASS_C, this.tok.T_TRAIT_C, this.tok.T_FUNC_C, this.tok.T_METHOD_C, this.tok.T_LINE, this.tok.T_FILE, this.tok.T_DIR, this.tok.T_NS_C].map(mapIt)) - }; -}; - -/** - * helper : gets a token name - */ -parser.prototype.getTokenName = function (token) { - if (!isNumber(token)) { - return "'" + token + "'"; - } else { - if (token == this.EOF) return "the end of file (EOF)"; - return this.lexer.engine.tokens.values[token]; - } -}; - -/** - * main entry point : converts a source code to AST - */ -parser.prototype.parse = function (code, filename) { - this._errors = []; - this.filename = filename || "eval"; - this.currentNamespace = [""]; - if (this.extractDoc) { - this._docs = []; - } else { - this._docs = null; - } - if (this.extractTokens) { - this._tokens = []; - } else { - this._tokens = null; - } - this._docIndex = 0; - this.lexer.setInput(code); - this.lexer.all_tokens = this.extractTokens; - this.lexer.comment_tokens = this.extractDoc; - this.length = this.lexer._input.length; - this.innerList = false; - this.innerListForm = false; - var program = this.node("program"); - var childs = []; - this.next(); - while (this.token != this.EOF) { - var node = this.read_start(); - if (node !== null && node !== undefined) { - if (Array.isArray(node)) { - childs = childs.concat(node); - } else { - childs.push(node); - } - } - } - // #176 : register latest position - this.prev = [this.lexer.yylloc.last_line, this.lexer.yylloc.last_column, this.lexer.offset]; - return program(childs, this._errors, this._docs, this._tokens); -}; - -/** - * Raise an error - */ -parser.prototype.raiseError = function (message, msgExpect, expect, token) { - message += " on line " + this.lexer.yylloc.first_line; - if (!this.suppressErrors) { - var err = new SyntaxError(message, this.filename, this.lexer.yylloc.first_line); - err.lineNumber = this.lexer.yylloc.first_line; - err.fileName = this.filename; - err.columnNumber = this.lexer.yylloc.first_column; - throw err; - } - // Error node : - var node = this.ast.prepare("error", null, this)(message, token, this.lexer.yylloc.first_line, expect); - this._errors.push(node); - return node; -}; - -/** - * handling errors - */ -parser.prototype.error = function (expect) { - var msg = "Parse Error : syntax error"; - var token = this.getTokenName(this.token); - var msgExpect = ""; - - if (this.token !== this.EOF) { - if (isNumber(this.token)) { - var symbol = this.text(); - if (symbol.length > 10) { - symbol = symbol.substring(0, 7) + "..."; - } - token = "'" + symbol + "' (" + token + ")"; - } - msg += ", unexpected " + token; - } - if (expect && !Array.isArray(expect)) { - if (isNumber(expect) || expect.length === 1) { - msgExpect = ", expecting " + this.getTokenName(expect); - } - msg += msgExpect; - } - return this.raiseError(msg, msgExpect, expect, token); -}; - -/** - * Creates a new AST node - */ -parser.prototype.node = function (name) { - if (this.extractDoc) { - var docs = null; - if (this._docIndex < this._docs.length) { - docs = this._docs.slice(this._docIndex); - this._docIndex = this._docs.length; - if (this.debug) { - console.log(new Error("Append docs on " + name)); - console.log(docs); - } - } - var node = this.ast.prepare(name, docs, this); - /** - * TOKENS : - * node1 commentA token commmentB node2 commentC token commentD node3 commentE token - * - * AST : - * structure:S1 [ - * left: node1 ( trail: commentA ), - * right: structure:S2 [ - * node2 (lead: commentB, trail: commentC), - * node3 (lead: commentD) - * ], - * trail: commentE - * ] - * - * Algorithm : - * - * Attach the last comments on parent of current node - * If a new node is started and the parent has a trailing comment - * the move it on previous node - * - * start S2 - * start node1 - * consume node1 & set commentA as trailingComment on S2 - * start S2 - * S1 has a trailingComment, attach it on node1 - * ... - * NOTE : As the trailingComment Behavior depends on AST, it will be build on - * the AST layer - last child node will keep it's trailingComment nodes - */ - node.preBuild = function () { - // inject leading comment on current node - if (this._docIndex < this._docs.length) { - node.setTrailingComments(this._docs.slice(this._docIndex)); - this._docIndex = this._docs.length; - } - }.bind(this); - return node; - } - return this.ast.prepare(name, null, this); -}; - -/** - * expects an end of statement or end of file - * @return {boolean} - */ -parser.prototype.expectEndOfStatement = function (node) { - if (this.token === ";") { - // include only real ';' statements - // https://github.com/glayzzle/php-parser/issues/164 - if (node && this.lexer.yytext === ";") { - node.includeToken(this); - } - } else if (this.token !== this.tok.T_INLINE_HTML && this.token !== this.EOF) { - this.error(";"); - return false; - } - this.next(); - return true; -}; - -/** outputs some debug information on current token **/ -var ignoreStack = ["parser.next", "parser.node", "parser.showlog"]; -parser.prototype.showlog = function () { - var stack = new Error().stack.split("\n"); - var line = void 0; - for (var offset = 2; offset < stack.length; offset++) { - line = stack[offset].trim(); - var found = false; - for (var i = 0; i < ignoreStack.length; i++) { - if (line.substring(3, 3 + ignoreStack[i].length) === ignoreStack[i]) { - found = true; - break; - } - } - if (!found) { - break; - } - } - // eslint-disable-next-line no-console - console.log("Line " + this.lexer.yylloc.first_line + " : " + this.getTokenName(this.token) + ">" + this.lexer.yytext + "<" + " @-->" + line); - return this; -}; - -/** - * Force the parser to check the current token. - * - * If the current token does not match to expected token, - * the an error will be raised. - * - * If the suppressError mode is activated, then the error will - * be added to the program error stack and this function will return `false`. - * - * @param {String|Number} token - * @return {boolean} - * @throws Error - */ -parser.prototype.expect = function (token) { - if (Array.isArray(token)) { - if (token.indexOf(this.token) === -1) { - this.error(token); - return false; - } - } else if (this.token != token) { - this.error(token); - return false; - } - return true; -}; - -/** - * Returns the current token contents - * @return {String} - */ -parser.prototype.text = function () { - return this.lexer.yytext; -}; - -/** consume the next token **/ -parser.prototype.next = function () { - // prepare the back command - if (this.token !== ";" || this.lexer.yytext === ";") { - // ignore '?>' from automated resolution - // https://github.com/glayzzle/php-parser/issues/168 - this.prev = [this.lexer.yylloc.last_line, this.lexer.yylloc.last_column, this.lexer.offset]; - } - - // eating the token - this.lex(); - - // showing the debug - if (this.debug) { - this.showlog(); - } - - // handling comments - if (this.extractDoc) { - while (this.token === this.tok.T_COMMENT || this.token === this.tok.T_DOC_COMMENT) { - // APPEND COMMENTS - if (this.token === this.tok.T_COMMENT) { - this._docs.push(this.read_comment()); - } else { - this._docs.push(this.read_doc_comment()); - } - } - } - - return this; -}; - -/** - * Eating a token - */ -parser.prototype.lex = function () { - // append on token stack - if (this.extractTokens) { - do { - // the token - this.token = this.lexer.lex() || this.EOF; - if (this.token === this.EOF) return this; - var entry = this.lexer.yytext; - if (this.lexer.engine.tokens.values.hasOwnProperty(this.token)) { - entry = [this.lexer.engine.tokens.values[this.token], entry, this.lexer.yylloc.first_line, this.lexer.yylloc.first_offset, this.lexer.offset]; - } else { - entry = [null, entry, this.lexer.yylloc.first_line, this.lexer.yylloc.first_offset, this.lexer.offset]; - } - this._tokens.push(entry); - if (this.token === this.tok.T_CLOSE_TAG) { - // https://github.com/php/php-src/blob/7ff186434e82ee7be7c59d0db9a976641cf7b09c/Zend/zend_compile.c#L1680 - this.token = ";"; - return this; - } else if (this.token === this.tok.T_OPEN_TAG_WITH_ECHO) { - this.token = this.tok.T_ECHO; - return this; - } - } while (this.token === this.tok.T_WHITESPACE || // ignore white space - !this.extractDoc && (this.token === this.tok.T_COMMENT || // ignore single lines comments - this.token === this.tok.T_DOC_COMMENT) || // ignore doc comments - // ignore open tags - this.token === this.tok.T_OPEN_TAG); - } else { - this.token = this.lexer.lex() || this.EOF; - } - return this; -}; - -/** - * Check if token is of specified type - */ -parser.prototype.is = function (type) { - if (Array.isArray(type)) { - return type.indexOf(this.token) !== -1; - } - return this.entries[type].has(this.token); -}; - -// extends the parser with syntax files -[__webpack_require__(106), __webpack_require__(105), __webpack_require__(104), __webpack_require__(103), __webpack_require__(102), __webpack_require__(101), __webpack_require__(100), __webpack_require__(99), __webpack_require__(98), __webpack_require__(97), __webpack_require__(96), __webpack_require__(95), __webpack_require__(94), __webpack_require__(93), __webpack_require__(92)].forEach(function (ext) { - for (var k in ext) { - parser.prototype[k] = ext[k]; - } -}); - -module.exports = parser; - -/***/ }), -/* 108 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var tokens = ";:,.\\[]()|^&+-/*=%!~$<>?@"; - -module.exports = { - // check if the char can be a numeric - is_NUM: function is_NUM() { - var ch = this._input.charCodeAt(this.offset - 1); - return ch > 47 && ch < 58; - }, - - // check if current char can be a label - is_LABEL: function is_LABEL() { - var ch = this._input.charCodeAt(this.offset - 1); - return ch > 96 && ch < 123 || ch > 64 && ch < 91 || ch === 95 || ch > 47 && ch < 58 || ch > 126; - }, - - // check if current char can be a label - is_LABEL_START: function is_LABEL_START() { - var ch = this._input.charCodeAt(this.offset - 1); - return ch > 96 && ch < 123 || ch > 64 && ch < 91 || ch === 95 || ch > 126; - }, - - // reads each char of the label - consume_LABEL: function consume_LABEL() { - while (this.offset < this.size) { - var ch = this.input(); - if (!this.is_LABEL()) { - if (ch) this.unput(1); - break; - } - } - return this; - }, - - // check if current char is a token char - is_TOKEN: function is_TOKEN() { - var ch = this._input[this.offset - 1]; - return tokens.indexOf(ch) !== -1; - }, - // check if current char is a whitespace - is_WHITESPACE: function is_WHITESPACE() { - var ch = this._input[this.offset - 1]; - return ch === " " || ch === "\t" || ch === "\n" || ch === "\r"; - }, - // check if current char is a whitespace (without newlines) - is_TABSPACE: function is_TABSPACE() { - var ch = this._input[this.offset - 1]; - return ch === " " || ch === "\t"; - }, - // consume all whitespaces (excluding newlines) - consume_TABSPACE: function consume_TABSPACE() { - while (this.offset < this.size) { - var ch = this.input(); - if (!this.is_TABSPACE()) { - if (ch) this.unput(1); - break; - } - } - return this; - }, - // check if current char can be a hexadecimal number - is_HEX: function is_HEX() { - var ch = this._input.charCodeAt(this.offset - 1); - return ch > 47 && ch < 58 || ch > 64 && ch < 71 || ch > 96 && ch < 103; - } -}; - -/***/ }), -/* 109 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - T_STRING: function T_STRING() { - var token = this.yytext.toLowerCase(); - var id = this.keywords[token]; - if (typeof id !== "number") { - if (token === "yield") { - if (this.php7 && this.tryMatch(" from")) { - this.consume(5); - id = this.tok.T_YIELD_FROM; - } else { - id = this.tok.T_YIELD; - } - } else { - id = this.tok.T_STRING; - if (token === "b" || token === "B") { - var ch = this.input(1); - if (ch === '"') { - return this.ST_DOUBLE_QUOTES(); - } else if (ch === "'") { - return this.T_CONSTANT_ENCAPSED_STRING(); - } else if (ch) { - this.unput(1); - } - } - } - } - return id; - }, - // reads a custom token - consume_TOKEN: function consume_TOKEN() { - var ch = this._input[this.offset - 1]; - var fn = this.tokenTerminals[ch]; - if (fn) { - return fn.apply(this, []); - } else { - return this.yytext; - } - }, - // list of special char tokens - tokenTerminals: { - $: function $() { - this.offset++; - if (this.is_LABEL_START()) { - this.offset--; - this.consume_LABEL(); - return this.tok.T_VARIABLE; - } else { - this.offset--; - return "$"; - } - }, - "-": function _() { - var nchar = this._input[this.offset]; - if (nchar === ">") { - this.begin("ST_LOOKING_FOR_PROPERTY").input(); - return this.tok.T_OBJECT_OPERATOR; - } else if (nchar === "-") { - this.input(); - return this.tok.T_DEC; - } else if (nchar === "=") { - this.input(); - return this.tok.T_MINUS_EQUAL; - } - return "-"; - }, - "\\": function _() { - return this.tok.T_NS_SEPARATOR; - }, - "/": function _() { - if (this._input[this.offset] === "=") { - this.input(); - return this.tok.T_DIV_EQUAL; - } - return "/"; - }, - ":": function _() { - if (this._input[this.offset] === ":") { - this.input(); - return this.tok.T_DOUBLE_COLON; - } else { - return ":"; - } - }, - "(": function _() { - var initial = this.offset; - this.input(); - if (this.is_TABSPACE()) { - this.consume_TABSPACE().input(); - } - if (this.is_LABEL_START()) { - var yylen = this.yytext.length; - this.consume_LABEL(); - var castToken = this.yytext.substring(yylen - 1).toLowerCase(); - var castId = this.castKeywords[castToken]; - if (typeof castId === "number") { - this.input(); - if (this.is_TABSPACE()) { - this.consume_TABSPACE().input(); - } - if (this._input[this.offset - 1] === ")") { - return castId; - } - } - } - // revert the check - this.unput(this.offset - initial); - return "("; - }, - "=": function _() { - var nchar = this._input[this.offset]; - if (nchar === ">") { - this.input(); - return this.tok.T_DOUBLE_ARROW; - } else if (nchar === "=") { - if (this._input[this.offset + 1] === "=") { - this.consume(2); - return this.tok.T_IS_IDENTICAL; - } else { - this.input(); - return this.tok.T_IS_EQUAL; - } - } - return "="; - }, - "+": function _() { - var nchar = this._input[this.offset]; - if (nchar === "+") { - this.input(); - return this.tok.T_INC; - } else if (nchar === "=") { - this.input(); - return this.tok.T_PLUS_EQUAL; - } - return "+"; - }, - "!": function _() { - if (this._input[this.offset] === "=") { - if (this._input[this.offset + 1] === "=") { - this.consume(2); - return this.tok.T_IS_NOT_IDENTICAL; - } else { - this.input(); - return this.tok.T_IS_NOT_EQUAL; - } - } - return "!"; - }, - "?": function _() { - if (this.php7 && this._input[this.offset] === "?") { - this.input(); - return this.tok.T_COALESCE; - } - return "?"; - }, - "<": function _() { - var nchar = this._input[this.offset]; - if (nchar === "<") { - nchar = this._input[this.offset + 1]; - if (nchar === "=") { - this.consume(2); - return this.tok.T_SL_EQUAL; - } else if (nchar === "<") { - if (this.is_HEREDOC()) { - return this.tok.T_START_HEREDOC; - } - } - this.input(); - return this.tok.T_SL; - } else if (nchar === "=") { - this.input(); - if (this.php7 && this._input[this.offset] === ">") { - this.input(); - return this.tok.T_SPACESHIP; - } else { - return this.tok.T_IS_SMALLER_OR_EQUAL; - } - } else if (nchar === ">") { - this.input(); - return this.tok.T_IS_NOT_EQUAL; - } - return "<"; - }, - ">": function _() { - var nchar = this._input[this.offset]; - if (nchar === "=") { - this.input(); - return this.tok.T_IS_GREATER_OR_EQUAL; - } else if (nchar === ">") { - nchar = this._input[this.offset + 1]; - if (nchar === "=") { - this.consume(2); - return this.tok.T_SR_EQUAL; - } else { - this.input(); - return this.tok.T_SR; - } - } - return ">"; - }, - "*": function _() { - var nchar = this._input[this.offset]; - if (nchar === "=") { - this.input(); - return this.tok.T_MUL_EQUAL; - } else if (nchar === "*") { - this.input(); - if (this._input[this.offset] === "=") { - this.input(); - return this.tok.T_POW_EQUAL; - } else { - return this.tok.T_POW; - } - } - return "*"; - }, - ".": function _() { - var nchar = this._input[this.offset]; - if (nchar === "=") { - this.input(); - return this.tok.T_CONCAT_EQUAL; - } else if (nchar === "." && this._input[this.offset + 1] === ".") { - this.consume(2); - return this.tok.T_ELLIPSIS; - } - return "."; - }, - "%": function _() { - if (this._input[this.offset] === "=") { - this.input(); - return this.tok.T_MOD_EQUAL; - } - return "%"; - }, - "&": function _() { - var nchar = this._input[this.offset]; - if (nchar === "=") { - this.input(); - return this.tok.T_AND_EQUAL; - } else if (nchar === "&") { - this.input(); - return this.tok.T_BOOLEAN_AND; - } - return "&"; - }, - "|": function _() { - var nchar = this._input[this.offset]; - if (nchar === "=") { - this.input(); - return this.tok.T_OR_EQUAL; - } else if (nchar === "|") { - this.input(); - return this.tok.T_BOOLEAN_OR; - } - return "|"; - }, - "^": function _() { - if (this._input[this.offset] === "=") { - this.input(); - return this.tok.T_XOR_EQUAL; - } - return "^"; - } - } -}; - -/***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - T_CONSTANT_ENCAPSED_STRING: function T_CONSTANT_ENCAPSED_STRING() { - var ch = void 0; - while (this.offset < this.size) { - ch = this.input(); - if (ch == "\\") { - this.input(); - } else if (ch == "'") { - break; - } - } - return this.tok.T_CONSTANT_ENCAPSED_STRING; - }, - // check if matching a HEREDOC state - is_HEREDOC: function is_HEREDOC() { - var revert = this.offset; - if (this._input[this.offset - 1] === "<" && this._input[this.offset] === "<" && this._input[this.offset + 1] === "<") { - this.offset += 3; - - // optional tabs / spaces - if (this.is_TABSPACE()) { - while (this.offset < this.size) { - this.offset++; - if (!this.is_TABSPACE()) { - break; - } - } - } - - // optional quotes - var tChar = this._input[this.offset - 1]; - if (tChar === "'" || tChar === '"') { - this.offset++; - } else { - tChar = null; - } - - // required label - if (this.is_LABEL_START()) { - var yyoffset = this.offset - 1; - while (this.offset < this.size) { - this.offset++; - if (!this.is_LABEL()) { - break; - } - } - var yylabel = this._input.substring(yyoffset, this.offset - 1); - if (!tChar || tChar === this._input[this.offset - 1]) { - // required ending quote - if (tChar) this.offset++; - // require newline - if (this._input[this.offset - 1] === "\r" || this._input[this.offset - 1] === "\n") { - // go go go - this.heredoc_label = yylabel; - yyoffset = this.offset - revert; - this.offset = revert; - this.consume(yyoffset); - if (tChar === "'") { - this.begin("ST_NOWDOC"); - } else { - this.begin("ST_HEREDOC"); - } - return this.tok.T_START_HEREDOC; - } - } - } - } - this.offset = revert; - return false; - }, - ST_DOUBLE_QUOTES: function ST_DOUBLE_QUOTES() { - var ch = void 0; - while (this.offset < this.size) { - ch = this.input(); - if (ch == "\\") { - this.input(); - } else if (ch == '"') { - break; - } else if (ch == "$") { - ch = this.input(); - if (ch == "{" || this.is_LABEL_START()) { - this.unput(2); - break; - } - if (ch) this.unput(1); - } else if (ch == "{") { - ch = this.input(); - if (ch == "$") { - this.unput(2); - break; - } - if (ch) this.unput(1); - } - } - if (ch == '"') { - return this.tok.T_CONSTANT_ENCAPSED_STRING; - } else { - var prefix = 1; - if (this.yytext[0] === "b" || this.yytext[0] === "B") { - prefix = 2; - } - if (this.yytext.length > 2) { - this.appendToken(this.tok.T_ENCAPSED_AND_WHITESPACE, this.yytext.length - prefix); - } - this.unput(this.yytext.length - prefix); - this.begin("ST_DOUBLE_QUOTES"); - return this.yytext; - } - }, - - // check if its a DOC end sequence - isDOC_MATCH: function isDOC_MATCH() { - // @fixme : check if out of text limits - if (this._input.substring(this.offset - 1, this.offset - 1 + this.heredoc_label.length) === this.heredoc_label) { - var ch = this._input[this.offset - 1 + this.heredoc_label.length]; - if (ch === "\n" || ch === "\r" || ch === ";") { - return true; - } - } - return false; - }, - - matchST_NOWDOC: function matchST_NOWDOC() { - /** edge case : empty now doc **/ - if (this.isDOC_MATCH()) { - // @fixme : never reached (may be caused by quotes) - this.consume(this.heredoc_label.length); - this.popState(); - return this.tok.T_END_HEREDOC; - } - /** SCANNING CONTENTS **/ - var ch = this._input[this.offset - 1]; - while (this.offset < this.size) { - if (ch === "\n" || ch === "\r") { - ch = this.input(); - if (this.isDOC_MATCH()) { - this.unput(1).popState(); - this.appendToken(this.tok.T_END_HEREDOC, this.heredoc_label.length); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } - } else { - ch = this.input(); - } - } - // too bad ! reached end of document (will get a parse error) - return this.tok.T_ENCAPSED_AND_WHITESPACE; - }, - - matchST_HEREDOC: function matchST_HEREDOC() { - /** edge case : empty here doc **/ - var ch = this.input(); - if (this.isDOC_MATCH()) { - this.consume(this.heredoc_label.length - 1); - this.popState(); - return this.tok.T_END_HEREDOC; - } - /** SCANNING CONTENTS **/ - while (this.offset < this.size) { - if (ch === "\\") { - ch = this.input(); // ignore next - if (ch !== "\n" && ch !== "\r") { - ch = this.input(); - } - } - - if (ch === "\n" || ch === "\r") { - ch = this.input(); - if (this.isDOC_MATCH()) { - this.unput(1).popState(); - this.appendToken(this.tok.T_END_HEREDOC, this.heredoc_label.length); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } - } else if (ch === "$") { - ch = this.input(); - if (ch === "{") { - // start of ${ - this.begin("ST_LOOKING_FOR_VARNAME"); - if (this.yytext.length > 2) { - this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES, 2); - this.unput(2); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else { - return this.tok.T_DOLLAR_OPEN_CURLY_BRACES; - } - } else if (this.is_LABEL_START()) { - // start of $var... - var yyoffset = this.offset; - var next = this.consume_VARIABLE(); - if (this.yytext.length > this.offset - yyoffset + 2) { - this.appendToken(next, this.offset - yyoffset + 2); - this.unput(this.offset - yyoffset + 2); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else { - return next; - } - //console.log(this.yytext); - } - } else if (ch === "{") { - ch = this.input(); - if (ch === "$") { - // start of {$... - this.begin("ST_IN_SCRIPTING"); - if (this.yytext.length > 2) { - this.appendToken(this.tok.T_CURLY_OPEN, 1); - this.unput(2); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else { - this.unput(1); - return this.tok.T_CURLY_OPEN; - } - } - } else { - ch = this.input(); - } - } - - // too bad ! reached end of document (will get a parse error) - return this.tok.T_ENCAPSED_AND_WHITESPACE; - }, - - consume_VARIABLE: function consume_VARIABLE() { - this.consume_LABEL(); - var ch = this.input(); - if (ch == "[") { - this.unput(1); - this.begin("ST_VAR_OFFSET"); - return this.tok.T_VARIABLE; - } else if (ch === "-") { - if (this.input() === ">") { - this.input(); - if (this.is_LABEL_START()) { - this.begin("ST_LOOKING_FOR_PROPERTY"); - } - this.unput(3); - return this.tok.T_VARIABLE; - } else { - this.unput(2); - } - } else { - if (ch) this.unput(1); - } - return this.tok.T_VARIABLE; - }, - // HANDLES BACKQUOTES - matchST_BACKQUOTE: function matchST_BACKQUOTE() { - var ch = this.input(); - if (ch === "$") { - ch = this.input(); - if (ch === "{") { - this.begin("ST_LOOKING_FOR_VARNAME"); - return this.tok.T_DOLLAR_OPEN_CURLY_BRACES; - } else if (this.is_LABEL_START()) { - var tok = this.consume_VARIABLE(); - return tok; - } - } else if (ch === "{") { - if (this._input[this.offset] === "$") { - this.begin("ST_IN_SCRIPTING"); - return this.tok.T_CURLY_OPEN; - } - } else if (ch === "`") { - this.popState(); - return "`"; - } - - // any char - while (this.offset < this.size) { - if (ch === "\\") { - this.input(); - } else if (ch === "`") { - this.unput(1); - this.popState(); - this.appendToken("`", 1); - break; - } else if (ch === "$") { - ch = this.input(); - if (ch === "{") { - this.begin("ST_LOOKING_FOR_VARNAME"); - if (this.yytext.length > 2) { - this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES, 2); - this.unput(2); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else { - return this.tok.T_DOLLAR_OPEN_CURLY_BRACES; - } - } else if (this.is_LABEL_START()) { - // start of $var... - var yyoffset = this.offset; - var next = this.consume_VARIABLE(); - if (this.yytext.length > this.offset - yyoffset + 2) { - this.appendToken(next, this.offset - yyoffset + 2); - this.unput(this.offset - yyoffset + 2); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else { - return next; - } - } - continue; - } else if (ch === "{") { - ch = this.input(); - if (ch === "$") { - // start of {$... - this.begin("ST_IN_SCRIPTING"); - if (this.yytext.length > 2) { - this.appendToken(this.tok.T_CURLY_OPEN, 1); - this.unput(2); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else { - this.unput(1); - return this.tok.T_CURLY_OPEN; - } - } - continue; - } - ch = this.input(); - } - return this.tok.T_ENCAPSED_AND_WHITESPACE; - }, - - matchST_DOUBLE_QUOTES: function matchST_DOUBLE_QUOTES() { - var ch = this.input(); - if (ch === "$") { - ch = this.input(); - if (ch === "{") { - this.begin("ST_LOOKING_FOR_VARNAME"); - return this.tok.T_DOLLAR_OPEN_CURLY_BRACES; - } else if (this.is_LABEL_START()) { - var tok = this.consume_VARIABLE(); - return tok; - } - } else if (ch === "{") { - if (this._input[this.offset] === "$") { - this.begin("ST_IN_SCRIPTING"); - return this.tok.T_CURLY_OPEN; - } - } else if (ch === '"') { - this.popState(); - return '"'; - } - - // any char - while (this.offset < this.size) { - if (ch === "\\") { - this.input(); - } else if (ch === '"') { - this.unput(1); - this.popState(); - this.appendToken('"', 1); - break; - } else if (ch === "$") { - ch = this.input(); - if (ch === "{") { - this.begin("ST_LOOKING_FOR_VARNAME"); - if (this.yytext.length > 2) { - this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES, 2); - this.unput(2); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else { - return this.tok.T_DOLLAR_OPEN_CURLY_BRACES; - } - } else if (this.is_LABEL_START()) { - // start of $var... - var yyoffset = this.offset; - var next = this.consume_VARIABLE(); - if (this.yytext.length > this.offset - yyoffset + 2) { - this.appendToken(next, this.offset - yyoffset + 2); - this.unput(this.offset - yyoffset + 2); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else { - return next; - } - } - if (ch) this.unput(1); - } else if (ch === "{") { - ch = this.input(); - if (ch === "$") { - // start of {$... - this.begin("ST_IN_SCRIPTING"); - if (this.yytext.length > 2) { - this.appendToken(this.tok.T_CURLY_OPEN, 1); - this.unput(2); - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else { - // @fixme : yytext = '"{$' (this.yytext.length > 3) - this.unput(1); - return this.tok.T_CURLY_OPEN; - } - } - if (ch) this.unput(1); - } - ch = this.input(); - } - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } -}; - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - matchST_IN_SCRIPTING: function matchST_IN_SCRIPTING() { - var ch = this.input(); - switch (ch) { - case " ": - case "\t": - case "\n": - case "\r": - case "\r\n": - return this.T_WHITESPACE(); - case "#": - return this.T_COMMENT(); - case "/": - if (this._input[this.offset] === "/") { - return this.T_COMMENT(); - } else if (this._input[this.offset] === "*") { - this.input(); - return this.T_DOC_COMMENT(); - } - return this.consume_TOKEN(); - case "'": - return this.T_CONSTANT_ENCAPSED_STRING(); - case '"': - return this.ST_DOUBLE_QUOTES(); - case "`": - this.begin("ST_BACKQUOTE"); - return "`"; - case "?": - if (!this.aspTagMode && this.tryMatch(">")) { - this.input(); - var nextCH = this._input[this.offset]; - if (nextCH === "\n" || nextCH === "\r") this.input(); - if (this.conditionStack.length > 1) { - this.begin("INITIAL"); - } - return this.tok.T_CLOSE_TAG; - } - return this.consume_TOKEN(); - case "%": - if (this.aspTagMode && this._input[this.offset] === ">") { - this.input(); // consume the '>' - ch = this._input[this.offset]; // read next - if (ch === "\n" || ch === "\r") { - this.input(); // consume the newline - } - this.aspTagMode = false; - if (this.conditionStack.length > 1) { - this.begin("INITIAL"); - } - return this.tok.T_CLOSE_TAG; - } - return this.consume_TOKEN(); - case "{": - this.begin("ST_IN_SCRIPTING"); - return "{"; - case "}": - if (this.conditionStack.length > 2) { - // Return to HEREDOC/ST_DOUBLE_QUOTES mode - this.popState(); - } - return "}"; - default: - if (ch === ".") { - ch = this.input(); - if (this.is_NUM()) { - return this.consume_NUM(); - } else { - if (ch) this.unput(1); - } - } - if (this.is_NUM()) { - return this.consume_NUM(); - } else if (this.is_LABEL_START()) { - return this.consume_LABEL().T_STRING(); - } else if (this.is_TOKEN()) { - return this.consume_TOKEN(); - } - } - throw new Error('Bad terminal sequence "' + ch + '" at line ' + this.yylineno + " (offset " + this.offset + ")"); - }, - - T_WHITESPACE: function T_WHITESPACE() { - while (this.offset < this.size) { - var ch = this.input(); - if (ch === " " || ch === "\t" || ch === "\n" || ch === "\r") { - continue; - } - if (ch) this.unput(1); - break; - } - return this.tok.T_WHITESPACE; - } -}; - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - matchST_LOOKING_FOR_PROPERTY: function matchST_LOOKING_FOR_PROPERTY() { - var ch = this.input(); - if (ch === "-") { - ch = this.input(); - if (ch === ">") { - // https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1296 - return this.tok.T_OBJECT_OPERATOR; - } - if (ch) this.unput(1); - } else if (this.is_WHITESPACE()) { - return this.tok.T_WHITESPACE; - } else if (this.is_LABEL_START()) { - // https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1300 - this.consume_LABEL(); - this.popState(); - return this.tok.T_STRING; - } - // https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1306 - this.popState(); - if (ch) this.unput(1); - return false; - }, - matchST_LOOKING_FOR_VARNAME: function matchST_LOOKING_FOR_VARNAME() { - var ch = this.input(); - - // SHIFT STATE - this.popState(); - this.begin("ST_IN_SCRIPTING"); - - if (this.is_LABEL_START()) { - this.consume_LABEL(); - ch = this.input(); - if (ch === "[" || ch === "}") { - this.unput(1); - return this.tok.T_STRING_VARNAME; - } else { - // any char (that's started with a label sequence) - this.unput(this.yytext.length); - } - } else { - // any char (thats not a label start sequence) - if (ch) this.unput(1); - } - // stops looking for a varname and starts the scripting mode - return false; - }, - matchST_VAR_OFFSET: function matchST_VAR_OFFSET() { - var ch = this.input(); - if (this.is_NUM()) { - this.consume_NUM(); - return this.tok.T_NUM_STRING; - } else if (ch === "]") { - this.popState(); - return "]"; - } else if (ch === "$") { - this.input(); - if (this.is_LABEL_START()) { - this.consume_LABEL(); - return this.tok.T_VARIABLE; - } else { - throw new Error("Unexpected terminal"); - } - } else if (this.is_LABEL_START()) { - this.consume_LABEL(); - return this.tok.T_STRING; - } else if (this.is_WHITESPACE() || ch === "\\" || ch === "'" || ch === "#") { - return this.tok.T_ENCAPSED_AND_WHITESPACE; - } else if (ch === "[" || ch === "{" || ch === "}" || ch === '"' || ch === "`" || this.is_TOKEN()) { - return ch; - } else { - throw new Error("Unexpected terminal"); - } - } -}; - -/***/ }), -/* 113 */ -/***/ (function(module, exports) { - -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - - -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -/* istanbul ignore else */ - -var MAX_LENGTH_OF_LONG = 10; -var long_min_digits = "2147483648"; -if (process.arch == "x64") { - MAX_LENGTH_OF_LONG = 19; - long_min_digits = "9223372036854775808"; -} - -module.exports = { - consume_NUM: function consume_NUM() { - var ch = this.yytext[0]; - var hasPoint = this.yytext[0] === "."; - if (ch === "0") { - ch = this.input(); - // check if hexa - if (ch === "x" || ch === "X") { - ch = this.input(); - if (this.is_HEX()) { - return this.consume_HNUM(); - } else { - this.unput(ch ? 2 : 1); - } - } else if (ch === "b" || ch === "B") { - ch = this.input(); - if (ch === "0" || ch === "1") { - return this.consume_BNUM(); - } else { - this.unput(ch ? 2 : 1); - } - } else if (!this.is_NUM()) { - if (ch) this.unput(1); - } - } - - while (this.offset < this.size) { - ch = this.input(); - if (!this.is_NUM()) { - if (ch === "." && !hasPoint) { - hasPoint = true; - } else if (ch === "e" || ch === "E") { - ch = this.input(); - if (ch === "+" || ch === "-") { - ch = this.input(); - if (this.is_NUM()) { - this.consume_LNUM(); - return this.tok.T_DNUMBER; - } else { - this.unput(ch ? 3 : 2); - break; - } - } else if (this.is_NUM()) { - this.consume_LNUM(); - return this.tok.T_DNUMBER; - } else { - this.unput(ch ? 2 : 1); - break; - } - } else { - if (ch) this.unput(1); - break; - } - } - } - if (hasPoint) { - return this.tok.T_DNUMBER; - } else if (this.yytext.length < MAX_LENGTH_OF_LONG - 1) { - return this.tok.T_LNUMBER; - } else { - if (this.yytext.length < MAX_LENGTH_OF_LONG || this.yytext.length == MAX_LENGTH_OF_LONG && this.yytext < long_min_digits) { - return this.tok.T_LNUMBER; - } - return this.tok.T_DNUMBER; - } - }, - // read hexa - consume_HNUM: function consume_HNUM() { - while (this.offset < this.size) { - var ch = this.input(); - if (!this.is_HEX()) { - if (ch) this.unput(1); - break; - } - } - return this.tok.T_LNUMBER; - }, - // read a generic number - consume_LNUM: function consume_LNUM() { - while (this.offset < this.size) { - var ch = this.input(); - if (!this.is_NUM()) { - if (ch) this.unput(1); - break; - } - } - return this.tok.T_LNUMBER; - }, - // read binary - consume_BNUM: function consume_BNUM() { - var ch = void 0; - while (this.offset < this.size) { - ch = this.input(); - if (ch !== "0" && ch !== "1") { - if (ch) this.unput(1); - break; - } - } - return this.tok.T_LNUMBER; - } -}; -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(113))) - -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - nextINITIAL: function nextINITIAL() { - if (this.conditionStack.length > 1 && this.conditionStack[this.conditionStack.length - 1] === "INITIAL") { - // Return to HEREDOC/ST_DOUBLE_QUOTES mode - this.popState(); - } else { - this.begin("ST_IN_SCRIPTING"); - } - return this; - }, - matchINITIAL: function matchINITIAL() { - while (this.offset < this.size) { - var ch = this.input(); - if (ch == "<") { - ch = this.ahead(1); - if (ch == "?") { - if (this.tryMatch("?=")) { - this.unput(1).appendToken(this.tok.T_OPEN_TAG_WITH_ECHO, 3).nextINITIAL(); - break; - } else if (this.tryMatchCaseless("?php")) { - ch = this._input[this.offset + 4]; - if (ch === " " || ch === "\t" || ch === "\n" || ch === "\r") { - this.unput(1).appendToken(this.tok.T_OPEN_TAG, 6).nextINITIAL(); - break; - } - } - if (this.short_tags) { - this.unput(1).appendToken(this.tok.T_OPEN_TAG, 2).nextINITIAL(); - break; - } - } else if (this.asp_tags && ch == "%") { - if (this.tryMatch("%=")) { - this.aspTagMode = true; - this.unput(1).appendToken(this.tok.T_OPEN_TAG_WITH_ECHO, 3).nextINITIAL(); - break; - } else { - this.aspTagMode = true; - this.unput(1).appendToken(this.tok.T_OPEN_TAG, 2).nextINITIAL(); - break; - } - } - } - } - if (this.yytext.length > 0) { - return this.tok.T_INLINE_HTML; - } else { - return false; - } - } -}; - -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -module.exports = { - /** - * Reads a single line comment - */ - T_COMMENT: function T_COMMENT() { - while (this.offset < this.size) { - var ch = this.input(); - if (ch === "\n" || ch === "\r") { - return this.tok.T_COMMENT; - } else if (ch === "?" && !this.aspTagMode && this._input[this.offset] === ">") { - this.unput(1); - return this.tok.T_COMMENT; - } else if (ch === "%" && this.aspTagMode && this._input[this.offset] === ">") { - this.unput(1); - return this.tok.T_COMMENT; - } - } - return this.tok.T_COMMENT; - }, - /** - * Behaviour : https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1927 - */ - T_DOC_COMMENT: function T_DOC_COMMENT() { - var ch = this.input(); - var token = this.tok.T_COMMENT; - if (ch === "*") { - // started with '/*' , check is next is '*' - ch = this.input(); - if (this.is_WHITESPACE()) { - // check if next is WHITESPACE - token = this.tok.T_DOC_COMMENT; - } - if (ch === "/") { - return token; - } else { - this.unput(1); // reset - } - } - while (this.offset < this.size) { - ch = this.input(); - if (ch === "*" && this._input[this.offset] === "/") { - this.input(); - break; - } - } - return token; - } -}; - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -/** - * This is the php lexer. It will tokenize the string for helping the - * parser to build the AST from its grammar. - * - * @class - * @property {Integer} EOF - * @property {Boolean} all_tokens defines if all tokens must be retrieved (used by token_get_all only) - * @property {Boolean} comment_tokens extracts comments tokens - * @property {Boolean} mode_eval enables the evald mode (ignore opening tags) - * @property {Boolean} asp_tags disables by default asp tags mode - * @property {Boolean} short_tags enables by default short tags mode - * @property {Object} keywords List of php keyword - * @property {Object} castKeywords List of php keywords for type casting - */ - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var lexer = function lexer(engine) { - this.engine = engine; - this.tok = this.engine.tokens.names; - this.EOF = 1; - this.debug = false; - this.all_tokens = true; - this.comment_tokens = false; - this.mode_eval = false; - this.asp_tags = false; - this.short_tags = true; - this.php7 = true; - this.yyprevcol = 0; - this.keywords = { - __class__: this.tok.T_CLASS_C, - __trait__: this.tok.T_TRAIT_C, - __function__: this.tok.T_FUNC_C, - __method__: this.tok.T_METHOD_C, - __line__: this.tok.T_LINE, - __file__: this.tok.T_FILE, - __dir__: this.tok.T_DIR, - __namespace__: this.tok.T_NS_C, - exit: this.tok.T_EXIT, - die: this.tok.T_EXIT, - function: this.tok.T_FUNCTION, - const: this.tok.T_CONST, - return: this.tok.T_RETURN, - try: this.tok.T_TRY, - catch: this.tok.T_CATCH, - finally: this.tok.T_FINALLY, - throw: this.tok.T_THROW, - if: this.tok.T_IF, - elseif: this.tok.T_ELSEIF, - endif: this.tok.T_ENDIF, - else: this.tok.T_ELSE, - while: this.tok.T_WHILE, - endwhile: this.tok.T_ENDWHILE, - do: this.tok.T_DO, - for: this.tok.T_FOR, - endfor: this.tok.T_ENDFOR, - foreach: this.tok.T_FOREACH, - endforeach: this.tok.T_ENDFOREACH, - declare: this.tok.T_DECLARE, - enddeclare: this.tok.T_ENDDECLARE, - instanceof: this.tok.T_INSTANCEOF, - as: this.tok.T_AS, - switch: this.tok.T_SWITCH, - endswitch: this.tok.T_ENDSWITCH, - case: this.tok.T_CASE, - default: this.tok.T_DEFAULT, - break: this.tok.T_BREAK, - continue: this.tok.T_CONTINUE, - goto: this.tok.T_GOTO, - echo: this.tok.T_ECHO, - print: this.tok.T_PRINT, - class: this.tok.T_CLASS, - interface: this.tok.T_INTERFACE, - trait: this.tok.T_TRAIT, - extends: this.tok.T_EXTENDS, - implements: this.tok.T_IMPLEMENTS, - new: this.tok.T_NEW, - clone: this.tok.T_CLONE, - var: this.tok.T_VAR, - eval: this.tok.T_EVAL, - include: this.tok.T_INCLUDE, - include_once: this.tok.T_INCLUDE_ONCE, - require: this.tok.T_REQUIRE, - require_once: this.tok.T_REQUIRE_ONCE, - namespace: this.tok.T_NAMESPACE, - use: this.tok.T_USE, - insteadof: this.tok.T_INSTEADOF, - global: this.tok.T_GLOBAL, - isset: this.tok.T_ISSET, - empty: this.tok.T_EMPTY, - __halt_compiler: this.tok.T_HALT_COMPILER, - static: this.tok.T_STATIC, - abstract: this.tok.T_ABSTRACT, - final: this.tok.T_FINAL, - private: this.tok.T_PRIVATE, - protected: this.tok.T_PROTECTED, - public: this.tok.T_PUBLIC, - unset: this.tok.T_UNSET, - list: this.tok.T_LIST, - array: this.tok.T_ARRAY, - callable: this.tok.T_CALLABLE, - or: this.tok.T_LOGICAL_OR, - and: this.tok.T_LOGICAL_AND, - xor: this.tok.T_LOGICAL_XOR - }; - this.castKeywords = { - int: this.tok.T_INT_CAST, - integer: this.tok.T_INT_CAST, - real: this.tok.T_DOUBLE_CAST, - double: this.tok.T_DOUBLE_CAST, - float: this.tok.T_DOUBLE_CAST, - string: this.tok.T_STRING_CAST, - binary: this.tok.T_STRING_CAST, - array: this.tok.T_ARRAY_CAST, - object: this.tok.T_OBJECT_CAST, - bool: this.tok.T_BOOL_CAST, - boolean: this.tok.T_BOOL_CAST, - unset: this.tok.T_UNSET_CAST - }; -}; - -/** - * Initialize the lexer with the specified input - */ -lexer.prototype.setInput = function (input) { - this._input = input; - this.size = input.length; - this.yylineno = 1; - this.offset = 0; - this.yyprevcol = 0; - this.yytext = ""; - this.yylloc = { - first_offset: 0, - first_line: 1, - first_column: 0, - prev_offset: 0, - prev_line: 1, - prev_column: 0, - last_line: 1, - last_column: 0 - }; - this.tokens = []; - this.done = this.offset >= this.size; - if (!this.all_tokens && this.mode_eval) { - this.conditionStack = ["INITIAL"]; - this.begin("ST_IN_SCRIPTING"); - } else { - this.conditionStack = []; - this.begin("INITIAL"); - } - return this; -}; - -/** - * consumes and returns one char from the input - */ -lexer.prototype.input = function () { - var ch = this._input[this.offset]; - if (!ch) return ""; - this.yytext += ch; - this.offset++; - if (ch === "\r" && this._input[this.offset] === "\n") { - this.yytext += "\n"; - this.offset++; - } - if (ch === "\n" || ch === "\r") { - this.yylloc.last_line = ++this.yylineno; - this.yyprevcol = this.yylloc.last_column; - this.yylloc.last_column = 0; - } else { - this.yylloc.last_column++; - } - return ch; -}; - -/** - * revert eating specified size - */ -lexer.prototype.unput = function (size) { - if (size === 1) { - // 1 char unput (most cases) - this.offset--; - if (this._input[this.offset] === "\n" && this._input[this.offset - 1] === "\r") { - this.offset--; - size++; - } - if (this._input[this.offset] === "\r" || this._input[this.offset] === "\n") { - this.yylloc.last_line--; - this.yylineno--; - this.yylloc.last_column = this.yyprevcol; - } else { - this.yylloc.last_column--; - } - this.yytext = this.yytext.substring(0, this.yytext.length - size); - } else if (size > 0) { - this.offset -= size; - if (size < this.yytext.length) { - this.yytext = this.yytext.substring(0, this.yytext.length - size); - // re-calculate position - this.yylloc.last_line = this.yylloc.first_line; - this.yylloc.last_column = this.yyprevcol = this.yylloc.first_column; - for (var i = 0; i < this.yytext.length; i++) { - var c = this.yytext[i]; - if (c === "\r") { - c = this.yytext[++i]; - this.yyprevcol = this.yylloc.last_column; - this.yylloc.last_line++; - this.yylloc.last_column = 0; - if (c !== "\n") { - if (c === "\r") { - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - } - } else if (c === "\n") { - this.yyprevcol = this.yylloc.last_column; - this.yylloc.last_line++; - this.yylloc.last_column = 0; - } else { - this.yylloc.last_column++; - } - } - this.yylineno = this.yylloc.last_line; - } else { - // reset full text - this.yytext = ""; - this.yylloc.last_line = this.yylineno = this.yylloc.first_line; - this.yylloc.last_column = this.yylloc.first_column; - } - } - - return this; -}; - -// check if the text matches -lexer.prototype.tryMatch = function (text) { - return text === this.ahead(text.length); -}; - -// check if the text matches -lexer.prototype.tryMatchCaseless = function (text) { - return text === this.ahead(text.length).toLowerCase(); -}; - -// look ahead -lexer.prototype.ahead = function (size) { - var text = this._input.substring(this.offset, this.offset + size); - if (text[text.length - 1] === "\r" && this._input[this.offset + size + 1] === "\n") { - text += "\n"; - } - return text; -}; - -// consume the specified size -lexer.prototype.consume = function (size) { - for (var i = 0; i < size; i++) { - var ch = this._input[this.offset]; - if (!ch) break; - this.yytext += ch; - this.offset++; - if (ch === "\r" && this._input[this.offset] === "\n") { - this.yytext += "\n"; - this.offset++; - i++; - } - if (ch === "\n" || ch === "\r") { - this.yylloc.last_line = ++this.yylineno; - this.yyprevcol = this.yylloc.last_column; - this.yylloc.last_column = 0; - } else { - this.yylloc.last_column++; - } - } - return this; -}; - -/** - * Gets the current state - */ -lexer.prototype.getState = function () { - return { - yytext: this.yytext, - offset: this.offset, - yylineno: this.yylineno, - yyprevcol: this.yyprevcol, - yylloc: { - first_offset: this.yylloc.first_offset, - first_line: this.yylloc.first_line, - first_column: this.yylloc.first_column, - last_line: this.yylloc.last_line, - last_column: this.yylloc.last_column - } - }; -}; - -/** - * Sets the current lexer state - */ -lexer.prototype.setState = function (state) { - this.yytext = state.yytext; - this.offset = state.offset; - this.yylineno = state.yylineno; - this.yyprevcol = state.yyprevcol; - this.yylloc = state.yylloc; - return this; -}; - -// prepend next token -lexer.prototype.appendToken = function (value, ahead) { - this.tokens.push([value, ahead]); - return this; -}; - -// return next match that has a token -lexer.prototype.lex = function () { - this.yylloc.prev_offset = this.offset; - this.yylloc.prev_line = this.yylloc.last_line; - this.yylloc.prev_column = this.yylloc.last_column; - var token = this.next() || this.lex(); - if (!this.all_tokens) { - while (token === this.tok.T_WHITESPACE || // ignore white space - !this.comment_tokens && (token === this.tok.T_COMMENT || // ignore single lines comments - token === this.tok.T_DOC_COMMENT) || // ignore doc comments - // ignore open tags - token === this.tok.T_OPEN_TAG) { - token = this.next() || this.lex(); - } - if (token == this.tok.T_OPEN_TAG_WITH_ECHO) { - // https://github.com/php/php-src/blob/7ff186434e82ee7be7c59d0db9a976641cf7b09c/Zend/zend_compile.c#L1683 - // open tag with echo statement - return this.tok.T_ECHO; - } else if (token === this.tok.T_CLOSE_TAG) { - // https://github.com/php/php-src/blob/7ff186434e82ee7be7c59d0db9a976641cf7b09c/Zend/zend_compile.c#L1680 - return ";"; /* implicit ; */ - } - } - if (!this.yylloc.prev_offset) { - this.yylloc.prev_offset = this.yylloc.first_offset; - this.yylloc.prev_line = this.yylloc.first_line; - this.yylloc.prev_column = this.yylloc.first_column; - } - /*else if (this.yylloc.prev_offset === this.offset && this.offset !== this.size) { - throw new Error('Infinite loop @ ' + this.offset + ' / ' + this.size); - }*/ - return token; -}; - -// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) -lexer.prototype.begin = function (condition) { - this.conditionStack.push(condition); - this.curCondition = condition; - this.stateCb = this["match" + condition]; - if (typeof this.stateCb !== "function") { - throw new Error('Undefined condition state "' + condition + '"'); - } - return this; -}; - -// pop the previously active lexer condition state off the condition stack -lexer.prototype.popState = function () { - var n = this.conditionStack.length - 1; - var condition = n > 0 ? this.conditionStack.pop() : this.conditionStack[0]; - this.curCondition = this.conditionStack[this.conditionStack.length - 1]; - this.stateCb = this["match" + this.curCondition]; - if (typeof this.stateCb !== "function") { - throw new Error('Undefined condition state "' + this.curCondition + '"'); - } - return condition; -}; - -// return next match in input -lexer.prototype.next = function () { - var token = void 0; - if (!this._input) { - this.done = true; - } - this.yylloc.first_offset = this.offset; - this.yylloc.first_line = this.yylloc.last_line; - this.yylloc.first_column = this.yylloc.last_column; - this.yytext = ""; - if (this.done) { - this.yylloc.prev_offset = this.yylloc.first_offset; - this.yylloc.prev_line = this.yylloc.first_line; - this.yylloc.prev_column = this.yylloc.first_column; - return this.EOF; - } - if (this.tokens.length > 0) { - token = this.tokens.shift(); - if (_typeof(token[1]) === "object") { - this.setState(token[1]); - } else { - this.consume(token[1]); - } - token = token[0]; - } else { - token = this.stateCb.apply(this, []); - } - if (this.offset >= this.size && this.tokens.length === 0) { - this.done = true; - } - if (this.debug) { - var tName = token; - if (typeof tName === "number") { - tName = this.engine.tokens.values[tName]; - } else { - tName = '"' + tName + '"'; - } - var e = new Error(tName + "\tfrom " + this.yylloc.first_line + "," + this.yylloc.first_column + "\t - to " + this.yylloc.last_line + "," + this.yylloc.last_column + '\t"' + this.yytext + '"'); - // eslint-disable-next-line no-console - console.error(e.stack); - } - return token; -}; - -// extends the lexer with states -[__webpack_require__(116), __webpack_require__(115), __webpack_require__(114), __webpack_require__(112), __webpack_require__(111), __webpack_require__(110), __webpack_require__(109), __webpack_require__(108)].forEach(function (ext) { - for (var k in ext) { - lexer.prototype[k] = ext[k]; - } -}); - -module.exports = lexer; - -/***/ }), -/* 118 */ -/***/ (function(module, exports) { - -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - - -/***/ }), -/* 119 */ -/***/ (function(module, exports) { - -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - for (var i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - - -/***/ }), -/* 121 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1, eval)("this"); -} catch (e) { - // This works if the window reference is available - if (typeof window === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) {/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - - - -var base64 = __webpack_require__(120) -var ieee754 = __webpack_require__(119) -var isArray = __webpack_require__(118) - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Due to various browser bugs, sometimes the Object implementation will be used even - * when the browser supports typed arrays. - * - * Note: - * - * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they - * get the Object implementation, which is slower but behaves correctly. - */ -Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined - ? global.TYPED_ARRAY_SUPPORT - : typedArraySupport() - -/* - * Export kMaxLength after typed array support is determined. - */ -exports.kMaxLength = kMaxLength() - -function typedArraySupport () { - try { - var arr = new Uint8Array(1) - arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} - return arr.foo() === 42 && // typed array instances can be augmented - typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` - arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` - } catch (e) { - return false - } -} - -function kMaxLength () { - return Buffer.TYPED_ARRAY_SUPPORT - ? 0x7fffffff - : 0x3fffffff -} - -function createBuffer (that, length) { - if (kMaxLength() < length) { - throw new RangeError('Invalid typed array length') - } - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = new Uint8Array(length) - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - if (that === null) { - that = new Buffer(length) - } - that.length = length - } - - return that -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { - return new Buffer(arg, encodingOrOffset, length) - } - - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new Error( - 'If encoding is specified then the first argument must be a string' - ) - } - return allocUnsafe(this, arg) - } - return from(this, arg, encodingOrOffset, length) -} - -Buffer.poolSize = 8192 // not used by this implementation - -// TODO: Legacy, not needed anymore. Remove in next major version. -Buffer._augment = function (arr) { - arr.__proto__ = Buffer.prototype - return arr -} - -function from (that, value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - return fromArrayBuffer(that, value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(that, value, encodingOrOffset) - } - - return fromObject(that, value) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(null, value, encodingOrOffset, length) -} - -if (Buffer.TYPED_ARRAY_SUPPORT) { - Buffer.prototype.__proto__ = Uint8Array.prototype - Buffer.__proto__ = Uint8Array - if (typeof Symbol !== 'undefined' && Symbol.species && - Buffer[Symbol.species] === Buffer) { - // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true - }) - } -} - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') - } else if (size < 0) { - throw new RangeError('"size" argument must not be negative') - } -} - -function alloc (that, size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(that, size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(that, size).fill(fill, encoding) - : createBuffer(that, size).fill(fill) - } - return createBuffer(that, size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(null, size, fill, encoding) -} - -function allocUnsafe (that, size) { - assertSize(size) - that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < size; ++i) { - that[i] = 0 - } - } - return that -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(null, size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(null, size) -} - -function fromString (that, string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - var length = byteLength(string, encoding) | 0 - that = createBuffer(that, length) - - var actual = that.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - that = that.slice(0, actual) - } - - return that -} - -function fromArrayLike (that, array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - that = createBuffer(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -function fromArrayBuffer (that, array, byteOffset, length) { - array.byteLength // this throws if `array` is not a valid ArrayBuffer - - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('\'length\' is out of bounds') - } - - if (byteOffset === undefined && length === undefined) { - array = new Uint8Array(array) - } else if (length === undefined) { - array = new Uint8Array(array, byteOffset) - } else { - array = new Uint8Array(array, byteOffset, length) - } - - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = array - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - that = fromArrayLike(that, array) - } - return that -} - -function fromObject (that, obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - that = createBuffer(that, len) - - if (that.length === 0) { - return that - } - - obj.copy(that, 0, 0, len) - return that - } - - if (obj) { - if ((typeof ArrayBuffer !== 'undefined' && - obj.buffer instanceof ArrayBuffer) || 'length' in obj) { - if (typeof obj.length !== 'number' || isnan(obj.length)) { - return createBuffer(that, 0) - } - return fromArrayLike(that, obj) - } - - if (obj.type === 'Buffer' && isArray(obj.data)) { - return fromArrayLike(that, obj.data) - } - } - - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') -} - -function checked (length) { - // Note: cannot use `length < kMaxLength()` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= kMaxLength()) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + kMaxLength().toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return !!(b != null && b._isBuffer) -} - -Buffer.compare = function compare (a, b) { - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError('Arguments must be Buffers') - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && - (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - string = '' + string - } - - var len = string.length - if (len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - case undefined: - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect -// Buffer instances. -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length | 0 - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } - return '' -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (!Buffer.isBuffer(target)) { - throw new TypeError('Argument must be a Buffer') - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (isNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (Buffer.TYPED_ARRAY_SUPPORT && - typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - // must be an even number of digits - var strLen = string.length - if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (isNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset | 0 - if (isFinite(length)) { - length = length | 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - // legacy write(string, encoding, offset, length) - remove in v0.13 - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf - if (Buffer.TYPED_ARRAY_SUPPORT) { - newBuf = this.subarray(start, end) - newBuf.__proto__ = Buffer.prototype - } else { - var sliceLen = end - start - newBuf = new Buffer(sliceLen, undefined) - for (var i = 0; i < sliceLen; ++i) { - newBuf[i] = this[i + start] - } - } - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - this[offset] = (value & 0xff) - return offset + 1 -} - -function objectWriteUInt16 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { - buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> - (littleEndian ? i : 1 - i) * 8 - } -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -function objectWriteUInt32 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffffffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { - buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff - } -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - var i - - if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { - // ascending copy from start - for (i = 0; i < len; ++i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, start + len), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if (code < 256) { - val = code - } - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : utf8ToBytes(new Buffer(val, encoding).toString()) - var len = bytes.length - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -function isnan (val) { - return val !== val // eslint-disable-line no-self-compare -} - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(121))) - -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(Buffer) {/*! - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var lexer = __webpack_require__(117); -var parser = __webpack_require__(107); -var tokens = __webpack_require__(91); -var AST = __webpack_require__(90); - -/** - * @private - */ -function combine(src, to) { - var keys = Object.keys(src); - var i = keys.length; - while (i--) { - var k = keys[i]; - var val = src[k]; - if (val === null) { - delete to[k]; - } else if (typeof val === "function") { - to[k] = val.bind(to); - } else if (Array.isArray(val)) { - to[k] = Array.isArray(to[k]) ? to[k].concat(val) : val; - } else if ((typeof val === "undefined" ? "undefined" : _typeof(val)) === "object") { - to[k] = _typeof(to[k]) === "object" ? combine(val, to[k]) : val; - } else { - to[k] = val; - } - } - return to; -} - -/** - * Initialise a new parser instance with the specified options - * - * @class - * @tutorial Engine - * @example - * var parser = require('php-parser'); - * var instance = new parser({ - * parser: { - * extractDoc: true, - * suppressErrors: true, - * php7: true - * }, - * ast: { - * withPositions: true - * }, - * lexer: { - * short_tags: true, - * asp_tags: true - * } - * }); - * - * var evalAST = instance.parseEval('some php code'); - * var codeAST = instance.parseCode(' Note that the output tokens are *STRICLY* similar to PHP function `token_get_all` - * @param {String} buffer - * @return {String[]} - Each item can be a string or an array with following informations [token_name, text, line_number] - */ -engine.prototype.tokenGetAll = function (buffer) { - this.lexer.mode_eval = false; - this.lexer.all_tokens = true; - buffer = getStringBuffer(buffer); - var EOF = this.lexer.EOF; - var names = this.tokens.values; - this.lexer.setInput(buffer); - var token = this.lexer.lex() || EOF; - var result = []; - while (token != EOF) { - var entry = this.lexer.yytext; - if (names.hasOwnProperty(token)) { - entry = [names[token], entry, this.lexer.yylloc.first_line]; - } - result.push(entry); - token = this.lexer.lex() || EOF; - } - return result; -}; - -// exports the function -module.exports = engine; - -// makes libraries public -module.exports.tokens = tokens; -module.exports.lexer = lexer; -module.exports.AST = AST; -module.exports.parser = parser; -module.exports.combine = combine; - -// allow the default export in index.d.ts -module.exports.default = engine; -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(122).Buffer)) - -/***/ }) -/******/ ])["default"]; -}); \ No newline at end of file diff --git a/dist/php-parser.min.js b/dist/php-parser.min.js deleted file mode 100644 index dcf6fdf44..000000000 --- a/dist/php-parser.min.js +++ /dev/null @@ -1,23 +0,0 @@ -/*! - * - * Package: php-parser - * Parse PHP code and returns its AST - * Build: cba3a756af7de70ce1fd - 2018-10-7 - * License: BSD-3-Clause - * Author: Ioan CHIRIAC - * - */ -!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory():"function"==typeof define&&define.amd?define([],factory):"object"==typeof exports?exports.PhpParser=factory():root.PhpParser=factory()}(window,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.t=function(value,mode){if(1&mode&&(value=__webpack_require__(value)),8&mode)return value;if(4&mode&&"object"==typeof value&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,"default",{enumerable:!0,value:value}),2&mode&&"string"!=typeof value)for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=123)}([function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("statement",function(kind,docs,location){Node.apply(this,[kind||"statement",docs,location])})},function(module,exports,__webpack_require__){"use strict";var Node=function(kind,docs,location){this.kind=kind,docs&&(this.leadingComments=docs),location&&(this.loc=location)};Node.prototype.setTrailingComments=function(docs){this.trailingComments=docs},Node.prototype.includeToken=function(parser){return this.loc&&(this.loc.end&&(this.loc.end.line=parser.lexer.yylloc.last_line,this.loc.end.column=parser.lexer.yylloc.last_column,this.loc.end.offset=parser.lexer.offset),parser.ast.withSource&&(this.loc.source=parser.lexer._input.substring(this.loc.start.offset,parser.lexer.offset))),this},Node.extends=function(type,constructor){return constructor.prototype=Object.create(this.prototype),constructor.extends=this.extends,constructor.prototype.constructor=constructor,constructor.kind=type,constructor},module.exports=Node},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("expression",function(kind,docs,location){Node.apply(this,[kind||"expression",docs,location])})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0),Declaration=Statement.extends("declaration",function(kind,name,docs,location){Statement.apply(this,[kind||"declaration",docs,location]),this.name=name});Declaration.prototype.parseFlags=function(flags){this.isAbstract=1===flags[2],this.isFinal=2===flags[2],"class"!==this.kind&&(-1===flags[0]?this.visibility="":null===flags[0]?this.visibility=null:0===flags[0]?this.visibility="public":1===flags[0]?this.visibility="protected":2===flags[0]&&(this.visibility="private"),this.isStatic=1===flags[1])},module.exports=Declaration},function(module,exports,__webpack_require__){"use strict";var Expr=__webpack_require__(2);module.exports=Expr.extends("literal",function(kind,value,raw,docs,location){Expr.apply(this,[kind||"literal",docs,location]),this.value=value,raw&&(this.raw=raw)})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("sys",function(kind,args,docs,location){Statement.apply(this,[kind||"sys",docs,location]),this.arguments=args})},function(module,exports,__webpack_require__){"use strict";var Expr=__webpack_require__(2);module.exports=Expr.extends("operation",function(kind,docs,location){Expr.apply(this,[kind||"operation",docs,location])})},function(module,exports,__webpack_require__){"use strict";var Expr=__webpack_require__(2);module.exports=Expr.extends("lookup",function(kind,what,offset,docs,location){Expr.apply(this,[kind||"lookup",docs,location]),this.what=what,this.offset=offset})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("block",function(kind,children,docs,location){Statement.apply(this,[kind||"block",docs,location]),this.children=children.filter(Boolean)})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("comment",function(kind,value,docs,location){Node.apply(this,[kind,docs,location]),this.value=value})},function(module,exports,__webpack_require__){"use strict";var Declaration=__webpack_require__(3);module.exports=Declaration.extends("function",function(name,args,byref,type,nullable,docs,location){Declaration.apply(this,["function",name,docs,location]),this.arguments=args,this.byref=byref,this.type=type,this.nullable=nullable,this.body=null})},function(module,exports,__webpack_require__){"use strict";var Declaration=__webpack_require__(3);module.exports=Declaration.extends("constant",function(name,value,docs,location){Declaration.apply(this,["constant",name,docs,location]),this.value=value})},function(module,exports,__webpack_require__){"use strict";var Expression=__webpack_require__(2);module.exports=Expression.extends("yieldfrom",function(value,docs,location){Expression.apply(this,["yieldfrom",docs,location]),this.value=value})},function(module,exports,__webpack_require__){"use strict";var Expression=__webpack_require__(2);module.exports=Expression.extends("yield",function(value,key,docs,location){Expression.apply(this,["yield",docs,location]),this.value=value,this.key=key})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("while",function(test,body,shortForm,docs,location){Statement.apply(this,["while",docs,location]),this.test=test,this.body=body,this.shortForm=shortForm})},function(module,exports,__webpack_require__){"use strict";var Expr=__webpack_require__(2);module.exports=Expr.extends("variadic",function(what,docs,location){Expr.apply(this,["variadic",docs,location]),this.what=what})},function(module,exports,__webpack_require__){"use strict";var Expr=__webpack_require__(2);module.exports=Expr.extends("variable",function(name,byref,curly,docs,location){Expr.apply(this,["variable",docs,location]),this.name=name,this.byref=byref||!1,this.curly=curly||!1})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0),UseItem=Statement.extends("useitem",function(name,alias,type,docs,location){Statement.apply(this,["useitem",docs,location]),this.name=name,this.alias=alias,this.type=type});UseItem.TYPE_CONST="const",UseItem.TYPE_FUNCTION="function",module.exports=UseItem},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("usegroup",function(name,type,items,docs,location){Statement.apply(this,["usegroup",docs,location]),this.name=name,this.type=type,this.items=items})},function(module,exports,__webpack_require__){"use strict";var Sys=__webpack_require__(5);module.exports=Sys.extends("unset",function(args,docs,location){Sys.apply(this,["unset",args,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Operation=__webpack_require__(6);module.exports=Operation.extends("unary",function(type,what,docs,location){Operation.apply(this,["unary",docs,location]),this.type=type,this.what=what})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("try",function(body,catches,always,docs,location){Statement.apply(this,["try",docs,location]),this.body=body,this.catches=catches,this.always=always})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("traituse",function(traits,adaptations,docs,location){Node.apply(this,["traituse",docs,location]),this.traits=traits,this.adaptations=adaptations})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1),KIND="traitprecedence";module.exports=Node.extends(KIND,function(trait,method,instead,docs,location){Node.apply(this,[KIND,docs,location]),this.trait=trait,this.method=method,this.instead=instead})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("traitalias",function(trait,method,as,flags,docs,location){Node.apply(this,["traitalias",docs,location]),this.trait=trait,this.method=method,this.as=as,this.visibility="",flags&&(0===flags[0]?this.visibility="public":1===flags[0]?this.visibility="protected":2===flags[0]&&(this.visibility="private"))})},function(module,exports,__webpack_require__){"use strict";var Declaration=__webpack_require__(3);module.exports=Declaration.extends("trait",function(name,ext,impl,body,docs,location){Declaration.apply(this,["trait",name,docs,location]),this.extends=ext,this.implements=impl,this.body=body})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("throw",function(what,docs,location){Statement.apply(this,["throw",docs,location]),this.what=what})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("switch",function(test,body,shortForm,docs,location){Statement.apply(this,["switch",docs,location]),this.test=test,this.body=body,this.shortForm=shortForm})},function(module,exports,__webpack_require__){"use strict";var Literal=__webpack_require__(4);module.exports=Literal.extends("string",function(isDoubleQuote,value,unicode,raw,docs,location){Literal.apply(this,["string",value,raw,docs,location]),this.unicode=unicode,this.isDoubleQuote=isDoubleQuote})},function(module,exports,__webpack_require__){"use strict";var Lookup=__webpack_require__(7);module.exports=Lookup.extends("staticlookup",function(what,offset,docs,location){Lookup.apply(this,["staticlookup",what,offset,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("static",function(items,docs,location){Statement.apply(this,["static",docs,location]),this.items=items})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("silent",function(expr,docs,location){Statement.apply(this,["silent",docs,location]),this.expr=expr})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("return",function(expr,docs,location){Node.apply(this,["return",docs,location]),this.expr=expr})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("retif",function(test,trueExpr,falseExpr,docs,location){Statement.apply(this,["retif",docs,location]),this.test=test,this.trueExpr=trueExpr,this.falseExpr=falseExpr})},function(module,exports,__webpack_require__){"use strict";var Lookup=__webpack_require__(7),KIND="propertylookup";module.exports=Lookup.extends(KIND,function(what,offset,docs,location){Lookup.apply(this,[KIND,what,offset,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Declaration=__webpack_require__(3);module.exports=Declaration.extends("property",function(name,value,flags,docs,location){Declaration.apply(this,["property",name,docs,location]),this.value=value,this.parseFlags(flags)})},function(module,exports,__webpack_require__){"use strict";var Block=__webpack_require__(8);module.exports=Block.extends("program",function(children,errors,comments,tokens,docs,location){Block.apply(this,["program",children,docs,location]),this.errors=errors,comments&&(this.comments=comments),tokens&&(this.tokens=tokens)})},function(module,exports,__webpack_require__){"use strict";var Sys=__webpack_require__(5);module.exports=Sys.extends("print",function(args,docs,location){Sys.apply(this,["print",args,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Operation=__webpack_require__(6);module.exports=Operation.extends("pre",function(type,what,docs,location){Operation.apply(this,["pre",docs,location]),this.type=type,this.what=what})},function(module,exports,__webpack_require__){"use strict";var Operation=__webpack_require__(6);module.exports=Operation.extends("post",function(type,what,docs,location){Operation.apply(this,["post",docs,location]),this.type=type,this.what=what})},function(module,exports,__webpack_require__){"use strict";var Declaration=__webpack_require__(3);module.exports=Declaration.extends("parameter",function(name,type,value,isRef,isVariadic,nullable,docs,location){Declaration.apply(this,["parameter",name,docs,location]),this.value=value,this.type=type,this.byref=isRef,this.variadic=isVariadic,this.nullable=nullable})},function(module,exports,__webpack_require__){"use strict";var Lookup=__webpack_require__(7);module.exports=Lookup.extends("offsetlookup",function(what,offset,docs,location){Lookup.apply(this,["offsetlookup",what,offset,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Literal=__webpack_require__(4);module.exports=Literal.extends("number",function(value,raw,docs,location){Literal.apply(this,["number",value,raw,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Literal=__webpack_require__(4);module.exports=Literal.extends("nowdoc",function(value,raw,label,quote,docs,location){Literal.apply(this,["nowdoc",value,raw,docs,location]),this.label=label,this.quote=quote})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("new",function(what,args,docs,location){Statement.apply(this,["new",docs,location]),this.what=what,this.arguments=args})},function(module,exports,__webpack_require__){"use strict";var Block=__webpack_require__(8);module.exports=Block.extends("namespace",function(name,children,withBrackets,docs,location){Block.apply(this,["namespace",children,docs,location]),this.name=name,this.withBrackets=withBrackets||!1})},function(module,exports,__webpack_require__){"use strict";var fn=__webpack_require__(10);module.exports=fn.extends("method",function(){fn.apply(this,arguments),this.kind="method"})},function(module,exports,__webpack_require__){"use strict";var Literal=__webpack_require__(4);module.exports=Literal.extends("magic",function(value,raw,docs,location){Literal.apply(this,["magic",value,raw,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Sys=__webpack_require__(5);module.exports=Sys.extends("list",function(items,shortForm,docs,location){Sys.apply(this,["list",items,docs,location]),this.shortForm=shortForm})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("label",function(name,docs,location){Node.apply(this,["label",docs,location]),this.name=name})},function(module,exports,__webpack_require__){"use strict";var Sys=__webpack_require__(5);module.exports=Sys.extends("isset",function(args,docs,location){Sys.apply(this,["isset",args,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Declaration=__webpack_require__(3);module.exports=Declaration.extends("interface",function(name,ext,body,docs,location){Declaration.apply(this,["interface",name,docs,location]),this.extends=ext,this.body=body})},function(module,exports,__webpack_require__){"use strict";var Literal=__webpack_require__(4);module.exports=Literal.extends("inline",function(value,raw,docs,location){Literal.apply(this,["inline",value,raw,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("include",function(once,require,target,docs,location){Statement.apply(this,["include",docs,location]),this.once=once,this.require=require,this.target=target})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("if",function(test,body,alternate,shortForm,docs,location){Statement.apply(this,["if",docs,location]),this.test=test,this.body=body,this.alternate=alternate,this.shortForm=shortForm})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1),Identifier=Node.extends("identifier",function Identifier(name,isRelative,docs,location){Node.apply(this,["identifier",docs,location]),isRelative?this.resolution=Identifier.RELATIVE_NAME:1===name.length?this.resolution=Identifier.UNQUALIFIED_NAME:""===name[0]?this.resolution=Identifier.FULL_QUALIFIED_NAME:this.resolution=Identifier.QUALIFIED_NAME,this.name=name.join("\\")});Identifier.UNQUALIFIED_NAME="uqn",Identifier.QUALIFIED_NAME="qn",Identifier.FULL_QUALIFIED_NAME="fqn",Identifier.RELATIVE_NAME="rn",module.exports=Identifier},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("halt",function(after,docs,location){Statement.apply(this,["halt",docs,location]),this.after=after})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("goto",function(label,docs,location){Statement.apply(this,["goto",docs,location]),this.label=label})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("global",function(items,docs,location){Statement.apply(this,["global",docs,location]),this.items=items})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("foreach",function(source,key,value,body,shortForm,docs,location){Statement.apply(this,["foreach",docs,location]),this.source=source,this.key=key,this.value=value,this.shortForm=shortForm,this.body=body})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("for",function(init,test,increment,body,shortForm,docs,location){Statement.apply(this,["for",docs,location]),this.init=init,this.test=test,this.increment=increment,this.shortForm=shortForm,this.body=body})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0),KIND="expressionstatement";module.exports=Statement.extends(KIND,function(expr,docs,location){Statement.apply(this,[KIND,docs,location]),this.expression=expr})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("exit",function(status,useDie,docs,location){Statement.apply(this,["exit",docs,location]),this.status=status,this.useDie=useDie})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("eval",function(source,docs,location){Statement.apply(this,["eval",docs,location]),this.source=source})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("error",function(message,token,line,expected,docs,location){Node.apply(this,["error",docs,location]),this.message=message,this.token=token,this.line=line,this.expected=expected})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("entry",function(key,value,docs,location){Node.apply(this,["entry",docs,location]),this.key=key,this.value=value})},function(module,exports,__webpack_require__){"use strict";var Literal=__webpack_require__(4),Encapsed=Literal.extends("encapsed",function(value,raw,type,docs,location){Literal.apply(this,["encapsed",value,raw,docs,location]),this.type=type});Encapsed.TYPE_STRING="string",Encapsed.TYPE_SHELL="shell",Encapsed.TYPE_HEREDOC="heredoc",Encapsed.TYPE_OFFSET="offset",module.exports=Encapsed},function(module,exports,__webpack_require__){"use strict";var Sys=__webpack_require__(5);module.exports=Sys.extends("empty",function(args,docs,location){Sys.apply(this,["empty",args,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Sys=__webpack_require__(5);module.exports=Sys.extends("echo",function(args,shortForm,docs,location){Sys.apply(this,["echo",args,docs,location]),this.shortForm=shortForm})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("do",function(test,body,docs,location){Statement.apply(this,["do",docs,location]),this.test=test,this.body=body})},function(module,exports,__webpack_require__){"use strict";var Block=__webpack_require__(8),Declare=Block.extends("declare",function(what,body,mode,docs,location){Block.apply(this,["declare",body,docs,location]),this.what=what,this.mode=mode});Declare.MODE_SHORT="short",Declare.MODE_BLOCK="block",Declare.MODE_NONE="none",module.exports=Declare},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("continue",function(level,docs,location){Node.apply(this,["continue",docs,location]),this.level=level})},function(module,exports,__webpack_require__){"use strict";var Expr=__webpack_require__(2);module.exports=Expr.extends("constref",function(identifier,docs,location){Expr.apply(this,["constref",docs,location]),this.name=identifier})},function(module,exports,__webpack_require__){"use strict";var Comment=__webpack_require__(9);module.exports=Comment.extends("commentline",function(value,docs,location){Comment.apply(this,["commentline",value,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Comment=__webpack_require__(9);module.exports=Comment.extends("commentblock",function(value,docs,location){Comment.apply(this,["commentblock",value,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("closure",function(args,byref,uses,type,nullable,isStatic,docs,location){Statement.apply(this,["closure",docs,location]),this.uses=uses,this.arguments=args,this.byref=byref,this.type=type,this.nullable=nullable,this.isStatic=isStatic||!1,this.body=null})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("clone",function(what,docs,location){Statement.apply(this,["clone",docs,location]),this.what=what})},function(module,exports,__webpack_require__){"use strict";var Constant=__webpack_require__(11),KIND="classconstant";module.exports=Constant.extends(KIND,function(name,value,flags,docs,location){Constant.apply(this,[name,value,docs,location]),this.kind=KIND,this.parseFlags(flags)})},function(module,exports,__webpack_require__){"use strict";var Declaration=__webpack_require__(3);module.exports=Declaration.extends("class",function(name,ext,impl,body,flags,docs,location){Declaration.apply(this,["class",name,docs,location]),this.isAnonymous=!name,this.extends=ext,this.implements=impl,this.body=body,this.parseFlags(flags)})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("catch",function(body,what,variable,docs,location){Statement.apply(this,["catch",docs,location]),this.body=body,this.what=what,this.variable=variable})},function(module,exports,__webpack_require__){"use strict";var Operation=__webpack_require__(6);module.exports=Operation.extends("cast",function(type,raw,what,docs,location){Operation.apply(this,["cast",docs,location]),this.type=type,this.raw=raw,this.what=what})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("case",function(test,body,docs,location){Node.apply(this,["case",docs,location]),this.test=test,this.body=body})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("call",function(what,args,docs,location){Statement.apply(this,["call",docs,location]),this.what=what,this.arguments=args})},function(module,exports,__webpack_require__){"use strict";var Node=__webpack_require__(1);module.exports=Node.extends("break",function(level,docs,location){Node.apply(this,["break",docs,location]),this.level=level})},function(module,exports,__webpack_require__){"use strict";var Literal=__webpack_require__(4);module.exports=Literal.extends("boolean",function(value,raw,docs,location){Literal.apply(this,["boolean",value,raw,docs,location])})},function(module,exports,__webpack_require__){"use strict";var Operation=__webpack_require__(6);module.exports=Operation.extends("bin",function(type,left,right,docs,location){Operation.apply(this,["bin",docs,location]),this.type=type,this.left=left,this.right=right})},function(module,exports,__webpack_require__){"use strict";var Statement=__webpack_require__(0);module.exports=Statement.extends("assign",function(left,right,operator,docs,location){Statement.apply(this,["assign",docs,location]),this.operator=operator,this.left=left,this.right=right})},function(module,exports,__webpack_require__){"use strict";var Expr=__webpack_require__(2);module.exports=Expr.extends("array",function(shortForm,items,docs,location){Expr.apply(this,["array",docs,location]),this.items=items,this.shortForm=shortForm})},function(module,exports,__webpack_require__){"use strict";module.exports=function(line,column,offset){this.line=line,this.column=column,this.offset=offset}},function(module,exports,__webpack_require__){"use strict";module.exports=function(source,start,end){this.source=source,this.start=start,this.end=end}},function(module,exports,__webpack_require__){"use strict";var Location=__webpack_require__(89),Position=__webpack_require__(88),AST=function(withPositions,withSource){this.withPositions=withPositions,this.withSource=withSource};AST.prototype.position=function(parser){return new Position(parser.lexer.yylloc.first_line,parser.lexer.yylloc.first_column,parser.lexer.yylloc.first_offset)},AST.precedence={},[["or"],["xor"],["and"],["="],["?"],["??"],["||"],["&&"],["|"],["^"],["&"],["==","!=","===","!==","<=>"],["<","<=",">",">="],["<<",">>"],["+","-","."],["*","/","%"],["!"],["instanceof"]].forEach(function(list,index){list.forEach(function(operator){AST.precedence[operator]=index+1})}),AST.prototype.resolvePrecedence=function(result){var buffer=void 0,lLevel=void 0,rLevel=void 0;return"bin"===result.kind?result.right&&!result.right.parenthesizedExpression&&("bin"===result.right.kind?(lLevel=AST.precedence[result.type],rLevel=AST.precedence[result.right.type],lLevel&&rLevel&&rLevel<=lLevel&&(buffer=result.right,result.right=result.right.left,buffer.left=this.resolvePrecedence(result),result=buffer)):"retif"===result.right.kind&&(lLevel=AST.precedence[result.type],rLevel=AST.precedence["?"],lLevel&&rLevel&&rLevel<=lLevel&&(buffer=result.right,result.right=result.right.test,buffer.test=this.resolvePrecedence(result),result=buffer))):"unary"===result.kind?result.what&&!result.what.parenthesizedExpression&&("bin"===result.what.kind?(buffer=result.what,result.what=result.what.left,buffer.left=this.resolvePrecedence(result),result=buffer):"retif"===result.what.kind&&(buffer=result.what,result.what=result.what.test,buffer.test=this.resolvePrecedence(result),result=buffer)):"retif"===result.kind?result.falseExpr&&"retif"===result.falseExpr.kind&&!result.falseExpr.parenthesizedExpression&&(buffer=result.falseExpr,result.falseExpr=buffer.test,buffer.test=this.resolvePrecedence(result),result=buffer):"assign"===result.kind&&result.right&&"bin"===result.right.kind&&!result.right.parenthesizedExpression&&(lLevel=AST.precedence["="],rLevel=AST.precedence[result.right.type],lLevel&&rLevel&&rLevel0?body(null,items):null)}}},function(module,exports,__webpack_require__){"use strict";module.exports={read_top_statements:function(){for(var result=[];this.token!==this.EOF&&"}"!==this.token;){var statement=this.read_top_statement();statement&&(Array.isArray(statement)?result=result.concat(statement):result.push(statement))}return result},read_top_statement:function(){switch(this.token){case this.tok.T_FUNCTION:return this.read_function(!1,!1);case this.tok.T_ABSTRACT:case this.tok.T_FINAL:var flag=this.read_class_scope();return this.token===this.tok.T_CLASS?this.read_class(flag):(this.error(this.tok.T_CLASS),this.next(),null);case this.tok.T_CLASS:return this.read_class([0,0,0]);case this.tok.T_INTERFACE:return this.read_interface();case this.tok.T_TRAIT:return this.read_trait();case this.tok.T_USE:return this.read_use_statement();case this.tok.T_CONST:return this.next().read_const_list();case this.tok.T_NAMESPACE:return this.read_namespace();case this.tok.T_HALT_COMPILER:var result=this.node("halt");return this.next().expect("(")&&this.next(),this.expect(")")&&this.next(),this.expect(";"),this.lexer.done=!0,result(this.lexer._input.substring(this.lexer.offset));default:return this.read_statement()}},read_inner_statements:function(){for(var result=[];this.token!=this.EOF&&"}"!==this.token;){var statement=this.read_inner_statement();statement&&(Array.isArray(statement)?result=result.concat(statement):result.push(statement))}return result},read_const_list:function(){var result=this.read_list(function(){this.expect(this.tok.T_STRING);var result=this.node("constant"),name=this.text();return this.next().expect("=")?result(name,this.next().read_expr()):result(name,null)},",",!1);return this.expectEndOfStatement(),result},read_declare_list:function(){for(var result={};this.token!=this.EOF&&")"!==this.token;){this.expect(this.tok.T_STRING);var name=this.text().toLowerCase();if(this.next().expect("=")?result[name]=this.next().read_expr():result[name]=null,","!==this.token)break;this.next()}return result},read_inner_statement:function(){switch(this.token){case this.tok.T_FUNCTION:return this.read_function(!1,!1);case this.tok.T_ABSTRACT:case this.tok.T_FINAL:var flag=this.read_class_scope();return this.token===this.tok.T_CLASS?this.read_class(flag):(this.error(this.tok.T_CLASS),this.next(),null);case this.tok.T_CLASS:return this.read_class([0,0,0]);case this.tok.T_INTERFACE:return this.read_interface();case this.tok.T_TRAIT:return this.read_trait();case this.tok.T_HALT_COMPILER:this.raiseError("__HALT_COMPILER() can only be used from the outermost scope");var node=this.node("halt");return this.next().expect("(")&&this.next(),this.expect(")")&&this.next(),node=node(this.lexer._input.substring(this.lexer.offset)),this.expect(";")&&this.next(),node;default:return this.read_statement()}},read_statement:function(){var result=void 0,expr=void 0,items=void 0,current=void 0,label=void 0;switch(this.token){case"{":return this.read_code_block(!1);case this.tok.T_IF:return this.read_if();case this.tok.T_SWITCH:return this.read_switch();case this.tok.T_FOR:return this.next().read_for();case this.tok.T_FOREACH:return this.next().read_foreach();case this.tok.T_WHILE:return this.next().read_while();case this.tok.T_DO:return this.next().read_do();case this.tok.T_COMMENT:return this.read_comment();case this.tok.T_DOC_COMMENT:return this.read_doc_comment();case this.tok.T_RETURN:return result=this.node("return"),expr=null,this.next().is("EOS")||(expr=this.read_expr()),this.expectEndOfStatement(),result(expr);case this.tok.T_BREAK:case this.tok.T_CONTINUE:result=this.node(this.token===this.tok.T_CONTINUE?"continue":"break");var level=null;return this.next(),";"!==this.token&&(level=this.read_expr()),this.expectEndOfStatement(),result(level);case this.tok.T_GLOBAL:return result=this.node("global"),items=this.next().read_list(this.read_simple_variable,","),this.expectEndOfStatement(),result(items);case this.tok.T_STATIC:return current=[this.token,this.lexer.getState()],result=this.node("static"),this.next().token===this.tok.T_DOUBLE_COLON?(this.lexer.tokens.push(current),expr=this.next().read_expr(),this.expect(";")&&this.next(),expr):this.token===this.tok.T_FUNCTION?this.read_function(!0,[0,1,0]):(items=this.read_variable_declarations(),this.expectEndOfStatement(),result(items));case this.tok.T_ECHO:result=this.node("echo");var text=this.text(),shortForm="0?this.lexer._input[this.lexer.yylloc.first_offset-1]:null,fixFirstLine="\r"===prevChar||"\n"===prevChar;return fixFirstLine&&"\n"===prevChar&&this.lexer.yylloc.first_offset>1&&"\r"===this.lexer._input[this.lexer.yylloc.first_offset-2]&&(prevChar="\r\n"),result=this.node("inline"),this.next(),result(value,fixFirstLine?prevChar+value:value);case this.tok.T_UNSET:return result=this.node("unset"),this.next().expect("(")&&this.next(),items=this.read_list(this.read_variable,","),this.expect(")")&&this.next(),this.expect(";")&&this.next(),result(items);case this.tok.T_DECLARE:result=this.node("declare");var body=[],mode=void 0;this.next().expect("(")&&this.next();var what=this.read_declare_list();if(this.expect(")")&&this.next(),":"===this.token){for(this.next();this.token!=this.EOF&&this.token!==this.tok.T_ENDDECLARE;)body.push(this.read_top_statement());this.expect(this.tok.T_ENDDECLARE)&&this.next(),this.expectEndOfStatement(),mode=this.ast.declare.MODE_SHORT}else if("{"===this.token){for(this.next();this.token!=this.EOF&&"}"!==this.token;)body.push(this.read_top_statement());this.expect("}")&&this.next(),mode=this.ast.declare.MODE_BLOCK}else this.expect(";")&&this.next(),mode=this.ast.declare.MODE_NONE;return result(what,body,mode);case this.tok.T_TRY:return this.read_try();case this.tok.T_THROW:return result=this.node("throw"),expr=this.next().read_expr(),this.expectEndOfStatement(),result(expr);case";":return this.next(),null;case this.tok.T_STRING:return current=[this.token,this.lexer.getState()],label=this.text(),":"===this.next().token?(result=this.node("label"),this.next(),result(label)):(this.lexer.tokens.push(current),expr=this.next().read_expr(),this.expectEndOfStatement(),expr);case this.tok.T_GOTO:return result=this.node("goto"),label=null,this.next().expect(this.tok.T_STRING)&&(label=this.text(),this.next().expectEndOfStatement()),result(label);default:var statement=this.node("expressionstatement");return expr=this.read_expr(),this.expectEndOfStatement(expr),statement(expr)}},read_code_block:function(top){var result=this.node("block");this.expect("{")&&this.next();var body=top?this.read_top_statements():this.read_inner_statements();return this.expect("}")&&this.next(),result(null,body)}}},function(module,exports,__webpack_require__){"use strict";var specialChar={"\\r":"\r","\\n":"\n","\\t":"\t","\\v":String.fromCharCode(11),"\\e":String.fromCharCode(27),"\\f":String.fromCharCode(12),"\\\\":"\\","\\$":"$",'\\"':'"',"\\'":"'"};module.exports={resolve_special_chars:function(text,doubleQuote){return doubleQuote?text.replace(/\\[rntvef"'\\$]/g,function(seq){return specialChar[seq]}):text.replace(/\\['\\]/g,function(seq){return specialChar[seq]})},read_scalar:function(){if(this.is("T_MAGIC_CONST"))return this.get_magic_constant();var value=void 0,node=void 0;switch(this.token){case this.tok.T_CONSTANT_ENCAPSED_STRING:value=this.node("string");var text=this.text(),offset=0;"b"!==text[0]&&"B"!==text[0]||(offset=1);var isDoubleQuote='"'===text[offset];return this.next(),value=value(isDoubleQuote,this.resolve_special_chars(text.substring(offset+1,text.length-1),isDoubleQuote),1===offset,text),this.token===this.tok.T_DOUBLE_COLON?this.read_static_getter(value):value;case this.tok.T_START_HEREDOC:if("ST_NOWDOC"===this.lexer.curCondition){var start=this.lexer.yylloc.first_offset;node=this.node("nowdoc");var lastCh=(value=this.next().text())[value.length-1];"\n"===lastCh?value="\r"===value[value.length-2]?value.substring(0,value.length-2):value.substring(0,value.length-1):"\r"===lastCh&&(value=value.substring(0,value.length-1)),this.expect(this.tok.T_ENCAPSED_AND_WHITESPACE)&&this.next();var raw=this.lexer._input.substring(start,this.lexer.yylloc.last_offset);return node=node(value,raw,this.lexer.heredoc_label,'"'===raw[3]||"'"===raw[3]),this.expect(this.tok.T_END_HEREDOC)&&this.next(),node}return this.next().read_encapsed_string(this.tok.T_END_HEREDOC);case'"':return this.next().read_encapsed_string('"');case'b"':case'B"':return this.next(),this.lexer.yylloc.prev_offset-=1,this.read_encapsed_string('"');case this.tok.T_LNUMBER:case this.tok.T_DNUMBER:var result=this.node("number");return value=this.text(),this.next(),result(value,null);case this.tok.T_ARRAY:case"[":return this.read_array();default:var err=this.error("SCALAR");return this.next(),err}},read_dereferencable:function(expr){var result=void 0,offset=void 0,node=this.node("offsetlookup");return"["===this.token?(offset=this.next().read_expr(),this.expect("]")&&this.next(),result=node(expr,offset)):this.token===this.tok.T_DOLLAR_OPEN_CURLY_BRACES&&(result=node(expr,offset=this.read_encapsed_string_item(!1))),result},read_encapsed_string_item:function(isDoubleQuote){var result=this.node(),offset=void 0,node=void 0,name=void 0;if(this.token===this.tok.T_ENCAPSED_AND_WHITESPACE){var text=this.text();this.next(),result=result("string",!1,this.resolve_special_chars(text,isDoubleQuote),!1,text)}else if(this.token===this.tok.T_DOLLAR_OPEN_CURLY_BRACES){if(name=null,this.next().token===this.tok.T_STRING_VARNAME){var varName=this.text();name=this.node("variable"),this.next(),"["===this.token?(name=name(varName,!1),node=this.node("offsetlookup"),offset=this.next().read_expr(),this.expect("]")&&this.next(),name=node(name,offset)):name=this.node("constref")(varName)}else name=this.read_expr();this.expect("}")&&this.next(),result=result("variable",name,!1,!0)}else if(this.token===this.tok.T_CURLY_OPEN)result.destroy(),"variable"===(result=this.next().read_variable(!1,!1,!1)).kind&&(result.curly=!0),this.expect("}")&&this.next();else if(this.token===this.tok.T_VARIABLE){if(result.destroy(),result=this.read_simple_variable(!1),"["===this.token&&(node=this.node("offsetlookup"),offset=this.next().read_encaps_var_offset(),this.expect("]")&&this.next(),result=node(result,offset)),this.token===this.tok.T_OBJECT_OPERATOR){node=this.node("propertylookup"),this.next().expect(this.tok.T_STRING);var what=this.node("constref");name=this.text(),this.next(),result=node(result,what(name))}}else{this.expect(this.tok.T_ENCAPSED_AND_WHITESPACE);var value=this.text();this.next(),result.destroy(),result=result("string",!1,value,!1,value)}return result},read_encapsed_string:function(expect){var start=this.lexer.yylloc.prev_offset,node=this.node("encapsed"),value=[],type=null;for(type="`"===expect?this.ast.encapsed.TYPE_SHELL:'"'===expect?this.ast.encapsed.TYPE_STRING:this.ast.encapsed.TYPE_HEREDOC;this.token!==expect&&this.token!==this.EOF;)value.push(this.read_encapsed_string_item(!0));return this.expect(expect)&&this.next(),node=node(value,this.lexer._input.substring(start-1,this.lexer.yylloc.first_offset),type),expect===this.tok.T_END_HEREDOC&&(node.label=this.lexer.heredoc_label),node},get_magic_constant:function(){var result=this.node("magic"),name=this.text();return this.next(),result(name.toUpperCase(),name)}}},function(module,exports,__webpack_require__){"use strict";module.exports={read_namespace:function(){var result=this.node("namespace"),body=void 0;if(this.expect(this.tok.T_NAMESPACE)&&this.next(),"{"==this.token)return this.currentNamespace=[""],body=this.next().read_top_statements(),this.expect("}")&&this.next(),result([""],body,!0);var name=this.read_namespace_name();return";"==this.token?(this.currentNamespace=name,body=this.next().read_top_statements(),this.expect(this.EOF),result(name.name,body,!1)):"{"==this.token?(this.currentNamespace=name,body=this.next().read_top_statements(),this.expect("}")&&this.next(),result(name.name,body,!0)):"("===this.token?(name.resolution=this.ast.identifier.RELATIVE_NAME,name.name=name.name.substring(1),this.node("call")(name,this.read_function_argument_list())):(this.error(["{",";"]),this.currentNamespace=name,body=this.read_top_statements(),this.expect(this.EOF),result(name,body,!1))},read_namespace_name:function(){var result=this.node("identifier"),relative=!1;return this.token===this.tok.T_NAMESPACE&&(this.next().expect(this.tok.T_NS_SEPARATOR)&&this.next(),relative=!0),result(this.read_list(this.tok.T_STRING,this.tok.T_NS_SEPARATOR,!0),relative)},read_use_statement:function(){var result=this.node("usegroup"),items=[],name=null;this.expect(this.tok.T_USE)&&this.next();var type=this.read_use_type();return items.push(this.read_use_declaration(!1)),","===this.token?items=items.concat(this.next().read_use_declarations(!1)):"{"===this.token&&(name=items[0].name,items=this.next().read_use_declarations(null===type),this.expect("}")&&this.next()),result=result(name,type,items),this.expect(";")&&this.next(),result},read_use_declaration:function(typed){var result=this.node("useitem"),type=null;typed&&(type=this.read_use_type());var name=this.read_namespace_name(),alias=this.read_use_alias();return result(name.name,alias,type)},read_use_declarations:function(typed){for(var result=[this.read_use_declaration(typed)];","===this.token;){if(this.next(),typed){if(this.token!==this.tok.T_FUNCTION&&this.token!==this.tok.T_CONST&&this.token!==this.tok.T_STRING)break}else if(this.token!==this.tok.T_STRING)break;result.push(this.read_use_declaration(typed))}return result},read_use_alias:function(){var result=null;return this.token===this.tok.T_AS&&this.next().expect(this.tok.T_STRING)&&(result=this.text(),this.next()),result},read_use_type:function(){return this.token===this.tok.T_FUNCTION?(this.next(),this.ast.useitem.TYPE_FUNCTION):this.token===this.tok.T_CONST?(this.next(),this.ast.useitem.TYPE_CONST):null}}},function(module,exports,__webpack_require__){"use strict";module.exports={read_start:function(){return this.token==this.tok.T_NAMESPACE?this.read_namespace():this.read_top_statement()}}},function(module,exports,__webpack_require__){"use strict";module.exports={read_while:function(){var test,result=this.node("while"),body=null,shortForm=!1;return this.expect("(")&&this.next(),test=this.read_expr(),this.expect(")")&&this.next(),":"===this.token?(shortForm=!0,body=this.read_short_form(this.tok.T_ENDWHILE)):body=this.read_statement(),result(test,body,shortForm)},read_do:function(){var body,result=this.node("do"),test=null;return body=this.read_statement(),this.expect(this.tok.T_WHILE)&&(this.next().expect("(")&&this.next(),test=this.read_expr(),this.expect(")")&&this.next(),this.expect(";")&&this.next()),result(test,body)},read_for:function(){var result=this.node("for"),init=[],test=[],increment=[],body=null,shortForm=!1;return this.expect("(")&&this.next(),";"!==this.token?(init=this.read_list(this.read_expr,","),this.expect(";")&&this.next()):this.next(),";"!==this.token?(test=this.read_list(this.read_expr,","),this.expect(";")&&this.next()):this.next(),")"!==this.token?(increment=this.read_list(this.read_expr,","),this.expect(")")&&this.next()):this.next(),":"===this.token?(shortForm=!0,body=this.read_short_form(this.tok.T_ENDFOR)):body=this.read_statement(),result(init,test,increment,body,shortForm)},read_foreach:function(){var source,result=this.node("foreach"),key=null,value=null,body=null,shortForm=!1;return this.expect("(")&&this.next(),source=this.read_expr(),this.expect(this.tok.T_AS)&&(this.next(),value=this.read_foreach_variable(),this.token===this.tok.T_DOUBLE_ARROW&&(key=value,value=this.next().read_foreach_variable())),key&&"list"===key.kind&&this.raiseError("Fatal Error : Cannot use list as key element"),this.expect(")")&&this.next(),":"===this.token?(shortForm=!0,body=this.read_short_form(this.tok.T_ENDFOREACH)):body=this.read_statement(),result(source,key,value,body,shortForm)},read_foreach_variable:function(){if(this.token===this.tok.T_LIST||"["===this.token){var isShort="["===this.token,result=this.node("list");this.next(),!isShort&&this.expect("(")&&this.next();var assignList=this.read_array_pair_list(isShort);return this.expect(isShort?"]":")")&&this.next(),result(assignList,isShort)}return this.read_variable(!1,!1,!1)}}},function(module,exports,__webpack_require__){"use strict";module.exports={read_if:function(){var test,result=this.node("if"),body=null,alternate=null,shortForm=!1;if(test=this.next().read_if_expr(),":"===this.token){shortForm=!0,this.next(),body=this.node("block");for(var items=[];this.token!==this.EOF&&this.token!==this.tok.T_ENDIF;){if(this.token===this.tok.T_ELSEIF){alternate=this.read_elseif_short();break}if(this.token===this.tok.T_ELSE){alternate=this.read_else_short();break}items.push(this.read_inner_statement())}body=body(null,items),this.expect(this.tok.T_ENDIF)&&this.next(),this.expectEndOfStatement()}else body=this.read_statement(),this.token===this.tok.T_ELSEIF?alternate=this.read_if():this.token===this.tok.T_ELSE&&(alternate=this.next().read_statement());return result(test,body,alternate,shortForm)},read_if_expr:function(){this.expect("(")&&this.next();var result=this.read_expr();return this.expect(")")&&this.next(),result},read_elseif_short:function(){var test,result=this.node("if"),alternate=null,body=null,items=[];for(test=this.next().read_if_expr(),this.expect(":")&&this.next(),body=this.node("block");this.token!=this.EOF&&this.token!==this.tok.T_ENDIF;){if(this.token===this.tok.T_ELSEIF){alternate=this.read_elseif_short();break}if(this.token===this.tok.T_ELSE){alternate=this.read_else_short();break}items.push(this.read_inner_statement())}return result(test,body=body(null,items),alternate,!0)},read_else_short:function(){var body=this.node("block");this.next().expect(":")&&this.next();for(var items=[];this.token!=this.EOF&&this.token!==this.tok.T_ENDIF;)items.push(this.read_inner_statement());return body(null,items)}}},function(module,exports,__webpack_require__){"use strict";module.exports={is_reference:function(){return"&"==this.token&&(this.next(),!0)},is_variadic:function(){return this.token===this.tok.T_ELLIPSIS&&(this.next(),!0)},read_function:function(closure,flag){var result=this.read_function_declaration(closure?1:flag?2:0,flag&&1===flag[1]);return flag&&1==flag[2]?(result.parseFlags(flag),this.expect(";")&&this.next()):(this.expect("{")&&(result.body=this.read_code_block(!1),result.loc&&result.body.loc&&(result.loc.end=result.body.loc.end)),!closure&&flag&&result.parseFlags(flag)),result},read_function_declaration:function(type,isStatic){var nodeName="function";1===type?nodeName="closure":2===type&&(nodeName="method");var result=this.node(nodeName);this.expect(this.tok.T_FUNCTION)&&this.next();var isRef=this.is_reference(),name=!1,use=[],returnType=null,nullable=!1;1!==type&&(2===type?this.token===this.tok.T_STRING||this.php7&&this.is("IDENTIFIER")?(name=this.text(),this.next()):this.error("IDENTIFIER"):(this.expect(this.tok.T_STRING)&&(name=this.text()),this.next())),this.expect("(")&&this.next();var params=this.read_parameter_list();return this.expect(")")&&this.next(),1===type&&this.token===this.tok.T_USE&&(this.next().expect("(")&&this.next(),use=this.read_list(this.read_lexical_var,","),this.expect(")")&&this.next()),":"===this.token&&("?"===this.next().token&&(nullable=!0,this.next()),returnType=this.read_type()),1===type?result(params,isRef,use,returnType,nullable,isStatic):result(name,params,isRef,returnType,nullable)},read_lexical_var:function(){var result=this.node("variable"),isRef=!1;"&"===this.token&&(isRef=!0,this.next()),this.expect(this.tok.T_VARIABLE);var name=this.text().substring(1);return this.next(),result(name,isRef,!1)},read_parameter_list:function(){var result=[];if(")"!=this.token)for(;this.token!=this.EOF;){if(result.push(this.read_parameter()),","!=this.token){if(")"==this.token)break;this.error([",",")"]);break}this.next()}return result},read_parameter:function(){var type,node=this.node("parameter"),name=null,value=null,nullable=!1;"?"===this.token&&(this.next(),nullable=!0),type=this.read_type(),nullable&&!type&&this.raiseError("Expecting a type definition combined with nullable operator");var isRef=this.is_reference(),isVariadic=this.is_variadic();return this.expect(this.tok.T_VARIABLE)&&(name=this.text().substring(1),this.next()),"="==this.token&&(value=this.next().read_expr()),node(name,type,value,isRef,isVariadic,nullable)},read_function_argument_list:function(){var result=[],wasVariadic=!1;if(this.expect("(")&&this.next(),")"!==this.token)for(;this.token!=this.EOF;){var argument=this.read_argument_list();if(argument&&(result.push(argument),"variadic"===argument.kind?wasVariadic=!0:wasVariadic&&this.raiseError("Unexpected argument after a variadic argument")),","!==this.token)break;this.next()}return this.expect(")")&&this.next(),result},read_argument_list:function(){return this.token===this.tok.T_ELLIPSIS?this.node("variadic")(this.next().read_expr()):this.read_expr()},read_type:function(){var result=this.node("identifier");switch(this.token){case this.tok.T_ARRAY:return this.next(),result(["","array"],!1);case this.tok.T_NAMESPACE:case this.tok.T_NS_SEPARATOR:case this.tok.T_STRING:return this.read_namespace_name();case this.tok.T_CALLABLE:return this.next(),result(["","callable"],!1);default:return null}}}},function(module,exports,__webpack_require__){"use strict";module.exports={read_expr:function(){var result=this.node(),expr=this.read_expr_item();if("|"===this.token)return result("bin","|",expr,this.next().read_expr());if("&"===this.token)return result("bin","&",expr,this.next().read_expr());if("^"===this.token)return result("bin","^",expr,this.next().read_expr());if("."===this.token)return result("bin",".",expr,this.next().read_expr());if("+"===this.token)return result("bin","+",expr,this.next().read_expr());if("-"===this.token)return result("bin","-",expr,this.next().read_expr());if("*"===this.token)return result("bin","*",expr,this.next().read_expr());if("/"===this.token)return result("bin","/",expr,this.next().read_expr());if("%"===this.token)return result("bin","%",expr,this.next().read_expr());if(this.token===this.tok.T_POW)return result("bin","**",expr,this.next().read_expr());if(this.token===this.tok.T_SL)return result("bin","<<",expr,this.next().read_expr());if(this.token===this.tok.T_SR)return result("bin",">>",expr,this.next().read_expr());if(this.token===this.tok.T_BOOLEAN_OR)return result("bin","||",expr,this.next().read_expr());if(this.token===this.tok.T_LOGICAL_OR)return result("bin","or",expr,this.next().read_expr());if(this.token===this.tok.T_BOOLEAN_AND)return result("bin","&&",expr,this.next().read_expr());if(this.token===this.tok.T_LOGICAL_AND)return result("bin","and",expr,this.next().read_expr());if(this.token===this.tok.T_LOGICAL_XOR)return result("bin","xor",expr,this.next().read_expr());if(this.token===this.tok.T_IS_IDENTICAL)return result("bin","===",expr,this.next().read_expr());if(this.token===this.tok.T_IS_NOT_IDENTICAL)return result("bin","!==",expr,this.next().read_expr());if(this.token===this.tok.T_IS_EQUAL)return result("bin","==",expr,this.next().read_expr());if(this.token===this.tok.T_IS_NOT_EQUAL)return result("bin","!=",expr,this.next().read_expr());if("<"===this.token)return result("bin","<",expr,this.next().read_expr());if(">"===this.token)return result("bin",">",expr,this.next().read_expr());if(this.token===this.tok.T_IS_SMALLER_OR_EQUAL)return result("bin","<=",expr,this.next().read_expr());if(this.token===this.tok.T_IS_GREATER_OR_EQUAL)return result("bin",">=",expr,this.next().read_expr());if(this.token===this.tok.T_SPACESHIP)return result("bin","<=>",expr,this.next().read_expr());if(this.token===this.tok.T_INSTANCEOF)return result("bin","instanceof",expr,this.next().read_expr());if(this.token===this.tok.T_COALESCE)return result("bin","??",expr,this.next().read_expr());if("?"===this.token){var trueArg=null;return":"!==this.next().token&&(trueArg=this.read_expr()),this.expect(":")&&this.next(),result("retif",expr,trueArg,this.read_expr())}return result.destroy(expr),expr},read_expr_cast:function(type){return this.node("cast")(type,this.text(),this.next().read_expr())},read_expr_item:function(){var result=void 0,expr=void 0;if("@"===this.token)return this.node("silent")(this.next().read_expr());if("+"===this.token)return this.node("unary")("+",this.next().read_expr());if("!"===this.token)return this.node("unary")("!",this.next().read_expr());if("~"===this.token)return this.node("unary")("~",this.next().read_expr());if("-"===this.token)return result=this.node(),this.next(),this.token===this.tok.T_LNUMBER||this.token===this.tok.T_DNUMBER?(result=result("number","-"+this.text(),null),this.next(),result):result("unary","-",this.read_expr());if("("===this.token)return(expr=this.next().read_expr()).parenthesizedExpression=!0,this.expect(")")&&this.next(),this.handleDereferencable(expr);if("`"===this.token)return this.next().read_encapsed_string("`");if(this.token===this.tok.T_LIST){var assign=null,isInner=this.innerList;result=this.node("list"),isInner||(assign=this.node("assign")),this.next().expect("(")&&this.next(),this.innerList||(this.innerList=!0);var assignList=this.read_array_pair_list(!1);this.expect(")")&&this.next();for(var hasItem=!1,i=0;i>=");case this.tok.T_INC:return isConst&&this.error("VARIABLE"),this.next(),result("post","+",expr);case this.tok.T_DEC:return isConst&&this.error("VARIABLE"),this.next(),result("post","-",expr);default:result.destroy(expr)}}else{if(this.is("SCALAR")){if(result=this.node(),"array"===(expr=this.read_scalar()).kind&&expr.shortForm&&"="===this.token){var list=this.node("list")(expr.items,!0);return expr.loc&&(list.loc=expr.loc),result("assign",list,this.next().read_expr(),"=")}return result.destroy(expr),this.handleDereferencable(expr)}this.error("EXPR"),this.next()}return expr},read_new_expr:function(){var result=this.node("new"),args=[];if(this.token===this.tok.T_CLASS){var what=this.node("class"),propExtends=null,propImplements=null,body=null;return"("===this.next().token&&(args=this.read_function_argument_list()),this.token==this.tok.T_EXTENDS&&(propExtends=this.next().read_namespace_name()),this.token==this.tok.T_IMPLEMENTS&&(propImplements=this.next().read_name_list()),this.expect("{")&&(body=this.next().read_class_body()),result(what(null,propExtends,propImplements,body,[0,0,0]),args)}var name=this.read_class_name_reference();return"("===this.token&&(args=this.read_function_argument_list()),result(name,args)},read_class_name_reference:function(){if(this.token===this.tok.T_NS_SEPARATOR||this.token===this.tok.T_STRING||this.token===this.tok.T_NAMESPACE){var result=this.read_namespace_name();return this.token===this.tok.T_DOUBLE_COLON&&(result=this.read_static_getter(result)),result}if(this.is("VARIABLE"))return this.read_variable(!0,!1,!1);this.expect([this.tok.T_STRING,"VARIABLE"])},handleDereferencable:function(expr){for(;this.token!==this.EOF;)if(this.token===this.tok.T_OBJECT_OPERATOR||this.token===this.tok.T_DOUBLE_COLON)expr=this.recursive_variable_chain_scan(expr,!1,!1,!0);else if(this.token===this.tok.T_CURLY_OPEN||"["===this.token)expr=this.read_dereferencable(expr);else{if("("!==this.token)return expr;expr=this.node("call")(expr,this.read_function_argument_list())}return expr}}},function(module,exports,__webpack_require__){"use strict";module.exports={read_comment:function(){var text=this.text(),result=this.ast.prepare("/*"===text.substring(0,2)?"commentblock":"commentline",null,this),prev=this.prev;return this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset],this.lex(),result=result(text),this.prev=prev,result},read_doc_comment:function(){var result=this.ast.prepare("commentblock",null,this),text=this.text(),prev=this.prev;return this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset],this.lex(),result=result(text),this.prev=prev,result}}},function(module,exports,__webpack_require__){"use strict";module.exports={read_class:function(flag){var result=this.node("class");this.expect(this.tok.T_CLASS),this.next().expect(this.tok.T_STRING);var propName=this.text(),propExtends=null,propImplements=null;return this.next().token==this.tok.T_EXTENDS&&(propExtends=this.next().read_namespace_name()),this.token==this.tok.T_IMPLEMENTS&&(propImplements=this.next().read_name_list()),this.expect("{"),result(propName,propExtends,propImplements,this.next().read_class_body(),flag)},read_class_scope:function(){var result=this.token;return result==this.tok.T_FINAL?(this.next(),[0,0,2]):result==this.tok.T_ABSTRACT?(this.next(),[0,0,1]):[0,0,0]},read_class_body:function(){for(var result=[];this.token!==this.EOF&&"}"!==this.token;)if(this.token!==this.tok.T_COMMENT)if(this.token!==this.tok.T_DOC_COMMENT)if(this.token!==this.tok.T_USE){var flags=this.read_member_flags(!1);if(this.token!==this.tok.T_CONST)if(this.token===this.tok.T_VAR&&(this.next().expect(this.tok.T_VARIABLE),flags[0]=null,flags[1]=0),this.token===this.tok.T_VARIABLE){var variables=this.read_variable_list(flags);this.expect(";"),this.next(),result=result.concat(variables)}else this.token===this.tok.T_FUNCTION?result.push(this.read_function(!1,flags)):(this.error([this.tok.T_CONST,this.tok.T_VARIABLE,this.tok.T_FUNCTION]),this.next());else{var constants=this.read_constant_list(flags);this.expect(";")&&this.next(),result=result.concat(constants)}}else result=result.concat(this.next().read_trait_use_statement());else result.push(this.read_doc_comment());else result.push(this.read_comment());return this.expect("}"),this.next(),result},read_variable_list:function(flags){return this.read_list(function(){var result=this.node("property");this.expect(this.tok.T_VARIABLE);var name=this.text().substring(1);return this.next(),";"===this.token||","===this.token?result(name,null,flags):"="===this.token?result(name,this.next().read_expr(),flags):(this.expect([",",";","="]),result(name,null,flags))},",")},read_constant_list:function(flags){return this.expect(this.tok.T_CONST)&&this.next(),this.read_list(function(){var result=this.node("classconstant"),name=null,value=null;return this.token===this.tok.T_STRING||this.php7&&this.is("IDENTIFIER")?(name=this.text(),this.next()):this.expect("IDENTIFIER"),this.expect("=")&&(value=this.next().read_expr()),result(name,value,flags)},",")},read_member_flags:function(asInterface){var result=[-1,-1,-1];if(this.is("T_MEMBER_FLAGS")){var idx=0,val=0;do{switch(this.token){case this.tok.T_PUBLIC:idx=0,val=0;break;case this.tok.T_PROTECTED:idx=0,val=1;break;case this.tok.T_PRIVATE:idx=0,val=2;break;case this.tok.T_STATIC:idx=1,val=1;break;case this.tok.T_ABSTRACT:idx=2,val=1;break;case this.tok.T_FINAL:idx=2,val=2}asInterface&&(0==idx&&2==val?(this.expect([this.tok.T_PUBLIC,this.tok.T_PROTECTED]),val=-1):2==idx&&1==val&&(this.error(),val=-1)),-1!==result[idx]?this.error():-1!==val&&(result[idx]=val)}while(this.next().is("T_MEMBER_FLAGS"))}return-1==result[1]&&(result[1]=0),-1==result[2]&&(result[2]=0),result},read_interface:function(){var result=this.node("interface"),name=null,body=null,propExtends=null;return this.expect(this.tok.T_INTERFACE)&&this.next(),this.expect(this.tok.T_STRING)&&(name=this.text(),this.next()),this.token===this.tok.T_EXTENDS&&(propExtends=this.next().read_name_list()),this.expect("{")&&(body=this.next().read_interface_body()),result(name,propExtends,body)},read_interface_body:function(){for(var result=[];this.token!==this.EOF&&"}"!==this.token;)if(this.token!==this.tok.T_COMMENT)if(this.token!==this.tok.T_DOC_COMMENT){var flags=this.read_member_flags(!0);if(this.token==this.tok.T_CONST){var constants=this.read_constant_list(flags);this.expect(";")&&this.next(),result=result.concat(constants)}else if(this.token===this.tok.T_FUNCTION){var method=this.read_function_declaration(2,flags);method.parseFlags(flags),result.push(method),this.expect(";")&&this.next()}else this.error([this.tok.T_CONST,this.tok.T_FUNCTION]),this.next()}else result.push(this.read_doc_comment());else result.push(this.read_comment());return this.expect("}")&&this.next(),result},read_trait:function(){var result=this.node("trait"),propName=null,propExtends=null,propImplements=null,body=null;return this.expect(this.tok.T_TRAIT)&&this.next(),this.expect(this.tok.T_STRING)&&(propName=this.text()),this.next().token==this.tok.T_EXTENDS&&(propExtends=this.next().read_namespace_name()),this.token==this.tok.T_IMPLEMENTS&&(propImplements=this.next().read_name_list()),this.expect("{")&&(body=this.next().read_class_body()),result(propName,propExtends,propImplements,body)},read_trait_use_statement:function(){for(var node=this.node("traituse"),traits=[this.read_namespace_name()],adaptations=null;","===this.token;)traits.push(this.next().read_namespace_name());if("{"===this.token){for(adaptations=[];this.next().token!==this.EOF&&"}"!==this.token;)adaptations.push(this.read_trait_use_alias()),this.expect(";");this.expect("}")&&this.next()}else this.expect(";")&&this.next();return node(traits,adaptations)},read_trait_use_alias:function(){var node=this.node(),trait=null,method=void 0;if(this.is("IDENTIFIER")?(method=this.text(),this.next()):(method=this.read_namespace_name(),this.token===this.tok.T_DOUBLE_COLON?(this.next(),this.token===this.tok.T_STRING||this.php7&&this.is("IDENTIFIER")?(trait=method,method=this.text(),this.next()):this.expect(this.tok.T_STRING)):method=method.name),this.token===this.tok.T_INSTEADOF)return node("traitprecedence",trait,method,this.next().read_name_list());if(this.token===this.tok.T_AS){var flags=null,alias=null;return this.next().is("T_MEMBER_FLAGS")&&(flags=this.read_member_flags()),this.token===this.tok.T_STRING||this.php7&&this.is("IDENTIFIER")?(alias=this.text(),this.next()):!1===flags&&this.expect(this.tok.T_STRING),node("traitalias",trait,method,alias,flags)}return this.expect([this.tok.T_AS,this.tok.T_INSTEADOF]),node("traitalias",trait,method,null,null)}}},function(module,exports,__webpack_require__){"use strict";module.exports={read_array:function(){var expect=null,shortForm=!1,result=this.node("array");this.token===this.tok.T_ARRAY?(this.next().expect("("),expect=")"):(shortForm=!0,expect="]");var items=[];return this.next().token!==expect&&(items=this.read_array_pair_list(shortForm)),this.expect(expect),this.next(),result(shortForm,items)},read_array_pair_list:function(shortForm){var self=this;return this.read_list(function(){return self.read_array_pair(shortForm)},",",!0)},read_array_pair:function(shortForm){if(","===this.token||!shortForm&&")"===this.token||shortForm&&"]"===this.token)return null;if("&"===this.token)return this.next().read_variable(!0,!1,!0);var entry=this.node("entry"),expr=this.read_expr();return this.token===this.tok.T_DOUBLE_ARROW?"&"===this.next().token?entry(expr,this.next().read_variable(!0,!1,!0)):entry(expr,this.read_expr()):expr},read_dim_offset:function(){return"]"!=this.token&&this.read_expr()}}},function(module,exports,__webpack_require__){"use strict";function isNumber(n){return"."!=n&&","!=n&&!isNaN(parseFloat(n))&&isFinite(n)}var parser=function(lexer,ast){this.lexer=lexer,this.ast=ast,this.tok=lexer.tok,this.EOF=lexer.EOF,this.token=null,this.prev=null,this.debug=!1,this.php7=!0,this.extractDoc=!1,this.extractTokens=!1,this.suppressErrors=!1;var mapIt=function(item){return[item,null]};this.entries={IDENTIFIER:new Map([this.tok.T_ABSTRACT,this.tok.T_ARRAY,this.tok.T_AS,this.tok.T_BREAK,this.tok.T_CALLABLE,this.tok.T_CASE,this.tok.T_CATCH,this.tok.T_CLASS,this.tok.T_CLASS_C,this.tok.T_CLONE,this.tok.T_CONST,this.tok.T_CONTINUE,this.tok.T_DECLARE,this.tok.T_DEFAULT,this.tok.T_DIR,this.tok.T_DO,this.tok.T_ECHO,this.tok.T_ELSE,this.tok.T_ELSEIF,this.tok.T_EMPTY,this.tok.T_ENDDECLARE,this.tok.T_ENDFOR,this.tok.T_ENDFOREACH,this.tok.T_ENDIF,this.tok.T_ENDSWITCH,this.tok.T_ENDWHILE,this.tok.T_EVAL,this.tok.T_EXIT,this.tok.T_EXTENDS,this.tok.T_FILE,this.tok.T_FINAL,this.tok.T_FINALLY,this.tok.T_FUNC_C,this.tok.T_FOR,this.tok.T_FOREACH,this.tok.T_FUNCTION,this.tok.T_GLOBAL,this.tok.T_GOTO,this.tok.T_IF,this.tok.T_IMPLEMENTS,this.tok.T_INCLUDE,this.tok.T_INCLUDE_ONCE,this.tok.T_INSTANCEOF,this.tok.T_INSTEADOF,this.tok.T_INTERFACE,this.tok.T_ISSET,this.tok.T_LINE,this.tok.T_LIST,this.tok.T_LOGICAL_AND,this.tok.T_LOGICAL_OR,this.tok.T_LOGICAL_XOR,this.tok.T_METHOD_C,this.tok.T_NAMESPACE,this.tok.T_NEW,this.tok.T_NS_C,this.tok.T_PRINT,this.tok.T_PRIVATE,this.tok.T_PROTECTED,this.tok.T_PUBLIC,this.tok.T_REQUIRE,this.tok.T_REQUIRE_ONCE,this.tok.T_RETURN,this.tok.T_STATIC,this.tok.T_SWITCH,this.tok.T_THROW,this.tok.T_TRAIT,this.tok.T_TRY,this.tok.T_UNSET,this.tok.T_USE,this.tok.T_VAR,this.tok.T_WHILE,this.tok.T_YIELD].map(mapIt)),VARIABLE:new Map([this.tok.T_VARIABLE,"$","&",this.tok.T_NS_SEPARATOR,this.tok.T_STRING,this.tok.T_NAMESPACE,this.tok.T_STATIC].map(mapIt)),SCALAR:new Map([this.tok.T_CONSTANT_ENCAPSED_STRING,this.tok.T_START_HEREDOC,this.tok.T_LNUMBER,this.tok.T_DNUMBER,this.tok.T_ARRAY,"[",this.tok.T_CLASS_C,this.tok.T_TRAIT_C,this.tok.T_FUNC_C,this.tok.T_METHOD_C,this.tok.T_LINE,this.tok.T_FILE,this.tok.T_DIR,this.tok.T_NS_C,'"','b"','B"',"-",this.tok.T_NS_SEPARATOR].map(mapIt)),T_MAGIC_CONST:new Map([this.tok.T_CLASS_C,this.tok.T_TRAIT_C,this.tok.T_FUNC_C,this.tok.T_METHOD_C,this.tok.T_LINE,this.tok.T_FILE,this.tok.T_DIR,this.tok.T_NS_C].map(mapIt)),T_MEMBER_FLAGS:new Map([this.tok.T_PUBLIC,this.tok.T_PRIVATE,this.tok.T_PROTECTED,this.tok.T_STATIC,this.tok.T_ABSTRACT,this.tok.T_FINAL].map(mapIt)),EOS:new Map([";",this.EOF,this.tok.T_INLINE_HTML].map(mapIt)),EXPR:new Map(["@","-","+","!","~","(","`",this.tok.T_LIST,this.tok.T_CLONE,this.tok.T_INC,this.tok.T_DEC,this.tok.T_NEW,this.tok.T_ISSET,this.tok.T_EMPTY,this.tok.T_INCLUDE,this.tok.T_INCLUDE_ONCE,this.tok.T_REQUIRE,this.tok.T_REQUIRE_ONCE,this.tok.T_EVAL,this.tok.T_INT_CAST,this.tok.T_DOUBLE_CAST,this.tok.T_STRING_CAST,this.tok.T_ARRAY_CAST,this.tok.T_OBJECT_CAST,this.tok.T_BOOL_CAST,this.tok.T_UNSET_CAST,this.tok.T_EXIT,this.tok.T_PRINT,this.tok.T_YIELD,this.tok.T_STATIC,this.tok.T_FUNCTION,this.tok.T_VARIABLE,"$",this.tok.T_NS_SEPARATOR,this.tok.T_STRING,this.tok.T_STRING,this.tok.T_CONSTANT_ENCAPSED_STRING,this.tok.T_START_HEREDOC,this.tok.T_LNUMBER,this.tok.T_DNUMBER,this.tok.T_ARRAY,"[",this.tok.T_CLASS_C,this.tok.T_TRAIT_C,this.tok.T_FUNC_C,this.tok.T_METHOD_C,this.tok.T_LINE,this.tok.T_FILE,this.tok.T_DIR,this.tok.T_NS_C].map(mapIt))}};parser.prototype.getTokenName=function(token){return isNumber(token)?token==this.EOF?"the end of file (EOF)":this.lexer.engine.tokens.values[token]:"'"+token+"'"},parser.prototype.parse=function(code,filename){this._errors=[],this.filename=filename||"eval",this.currentNamespace=[""],this.extractDoc?this._docs=[]:this._docs=null,this.extractTokens?this._tokens=[]:this._tokens=null,this._docIndex=0,this.lexer.setInput(code),this.lexer.all_tokens=this.extractTokens,this.lexer.comment_tokens=this.extractDoc,this.length=this.lexer._input.length,this.innerList=!1,this.innerListForm=!1;var program=this.node("program"),childs=[];for(this.next();this.token!=this.EOF;){var node=this.read_start();null!==node&&void 0!==node&&(Array.isArray(node)?childs=childs.concat(node):childs.push(node))}return this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset],program(childs,this._errors,this._docs,this._tokens)},parser.prototype.raiseError=function(message,msgExpect,expect,token){if(message+=" on line "+this.lexer.yylloc.first_line,!this.suppressErrors){var err=new SyntaxError(message,this.filename,this.lexer.yylloc.first_line);throw err.lineNumber=this.lexer.yylloc.first_line,err.fileName=this.filename,err.columnNumber=this.lexer.yylloc.first_column,err}var node=this.ast.prepare("error",null,this)(message,token,this.lexer.yylloc.first_line,expect);return this._errors.push(node),node},parser.prototype.error=function(expect){var msg="Parse Error : syntax error",token=this.getTokenName(this.token),msgExpect="";if(this.token!==this.EOF){if(isNumber(this.token)){var symbol=this.text();symbol.length>10&&(symbol=symbol.substring(0,7)+"..."),token="'"+symbol+"' ("+token+")"}msg+=", unexpected "+token}return expect&&!Array.isArray(expect)&&((isNumber(expect)||1===expect.length)&&(msgExpect=", expecting "+this.getTokenName(expect)),msg+=msgExpect),this.raiseError(msg,msgExpect,expect,token)},parser.prototype.node=function(name){if(this.extractDoc){var docs=null;this._docIndex"+this.lexer.yytext+"< @--\x3e"+line),this},parser.prototype.expect=function(token){if(Array.isArray(token)){if(-1===token.indexOf(this.token))return this.error(token),!1}else if(this.token!=token)return this.error(token),!1;return!0},parser.prototype.text=function(){return this.lexer.yytext},parser.prototype.next=function(){if(";"===this.token&&";"!==this.lexer.yytext||(this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset]),this.lex(),this.debug&&this.showlog(),this.extractDoc)for(;this.token===this.tok.T_COMMENT||this.token===this.tok.T_DOC_COMMENT;)this.token===this.tok.T_COMMENT?this._docs.push(this.read_comment()):this._docs.push(this.read_doc_comment());return this},parser.prototype.lex=function(){if(this.extractTokens)do{if(this.token=this.lexer.lex()||this.EOF,this.token===this.EOF)return this;var entry=this.lexer.yytext;if(entry=this.lexer.engine.tokens.values.hasOwnProperty(this.token)?[this.lexer.engine.tokens.values[this.token],entry,this.lexer.yylloc.first_line,this.lexer.yylloc.first_offset,this.lexer.offset]:[null,entry,this.lexer.yylloc.first_line,this.lexer.yylloc.first_offset,this.lexer.offset],this._tokens.push(entry),this.token===this.tok.T_CLOSE_TAG)return this.token=";",this;if(this.token===this.tok.T_OPEN_TAG_WITH_ECHO)return this.token=this.tok.T_ECHO,this}while(this.token===this.tok.T_WHITESPACE||!this.extractDoc&&(this.token===this.tok.T_COMMENT||this.token===this.tok.T_DOC_COMMENT)||this.token===this.tok.T_OPEN_TAG);else this.token=this.lexer.lex()||this.EOF;return this},parser.prototype.is=function(type){return Array.isArray(type)?-1!==type.indexOf(this.token):this.entries[type].has(this.token)},[__webpack_require__(106),__webpack_require__(105),__webpack_require__(104),__webpack_require__(103),__webpack_require__(102),__webpack_require__(101),__webpack_require__(100),__webpack_require__(99),__webpack_require__(98),__webpack_require__(97),__webpack_require__(96),__webpack_require__(95),__webpack_require__(94),__webpack_require__(93),__webpack_require__(92)].forEach(function(ext){for(var k in ext)parser.prototype[k]=ext[k]}),module.exports=parser},function(module,exports,__webpack_require__){"use strict";module.exports={is_NUM:function(){var ch=this._input.charCodeAt(this.offset-1);return ch>47&&ch<58},is_LABEL:function(){var ch=this._input.charCodeAt(this.offset-1);return ch>96&&ch<123||ch>64&&ch<91||95===ch||ch>47&&ch<58||ch>126},is_LABEL_START:function(){var ch=this._input.charCodeAt(this.offset-1);return ch>96&&ch<123||ch>64&&ch<91||95===ch||ch>126},consume_LABEL:function(){for(;this.offset?@".indexOf(ch)},is_WHITESPACE:function(){var ch=this._input[this.offset-1];return" "===ch||"\t"===ch||"\n"===ch||"\r"===ch},is_TABSPACE:function(){var ch=this._input[this.offset-1];return" "===ch||"\t"===ch},consume_TABSPACE:function(){for(;this.offset47&&ch<58||ch>64&&ch<71||ch>96&&ch<103}}},function(module,exports,__webpack_require__){"use strict";module.exports={T_STRING:function(){var token=this.yytext.toLowerCase(),id=this.keywords[token];if("number"!=typeof id)if("yield"===token)this.php7&&this.tryMatch(" from")?(this.consume(5),id=this.tok.T_YIELD_FROM):id=this.tok.T_YIELD;else if(id=this.tok.T_STRING,"b"===token||"B"===token){var ch=this.input(1);if('"'===ch)return this.ST_DOUBLE_QUOTES();if("'"===ch)return this.T_CONSTANT_ENCAPSED_STRING();ch&&this.unput(1)}return id},consume_TOKEN:function(){var ch=this._input[this.offset-1],fn=this.tokenTerminals[ch];return fn?fn.apply(this,[]):this.yytext},tokenTerminals:{$:function(){return this.offset++,this.is_LABEL_START()?(this.offset--,this.consume_LABEL(),this.tok.T_VARIABLE):(this.offset--,"$")},"-":function(){var nchar=this._input[this.offset];return">"===nchar?(this.begin("ST_LOOKING_FOR_PROPERTY").input(),this.tok.T_OBJECT_OPERATOR):"-"===nchar?(this.input(),this.tok.T_DEC):"="===nchar?(this.input(),this.tok.T_MINUS_EQUAL):"-"},"\\":function(){return this.tok.T_NS_SEPARATOR},"/":function(){return"="===this._input[this.offset]?(this.input(),this.tok.T_DIV_EQUAL):"/"},":":function(){return":"===this._input[this.offset]?(this.input(),this.tok.T_DOUBLE_COLON):":"},"(":function(){var initial=this.offset;if(this.input(),this.is_TABSPACE()&&this.consume_TABSPACE().input(),this.is_LABEL_START()){var yylen=this.yytext.length;this.consume_LABEL();var castToken=this.yytext.substring(yylen-1).toLowerCase(),castId=this.castKeywords[castToken];if("number"==typeof castId&&(this.input(),this.is_TABSPACE()&&this.consume_TABSPACE().input(),")"===this._input[this.offset-1]))return castId}return this.unput(this.offset-initial),"("},"=":function(){var nchar=this._input[this.offset];return">"===nchar?(this.input(),this.tok.T_DOUBLE_ARROW):"="===nchar?"="===this._input[this.offset+1]?(this.consume(2),this.tok.T_IS_IDENTICAL):(this.input(),this.tok.T_IS_EQUAL):"="},"+":function(){var nchar=this._input[this.offset];return"+"===nchar?(this.input(),this.tok.T_INC):"="===nchar?(this.input(),this.tok.T_PLUS_EQUAL):"+"},"!":function(){return"="===this._input[this.offset]?"="===this._input[this.offset+1]?(this.consume(2),this.tok.T_IS_NOT_IDENTICAL):(this.input(),this.tok.T_IS_NOT_EQUAL):"!"},"?":function(){return this.php7&&"?"===this._input[this.offset]?(this.input(),this.tok.T_COALESCE):"?"},"<":function(){var nchar=this._input[this.offset];return"<"===nchar?"="===(nchar=this._input[this.offset+1])?(this.consume(2),this.tok.T_SL_EQUAL):"<"===nchar&&this.is_HEREDOC()?this.tok.T_START_HEREDOC:(this.input(),this.tok.T_SL):"="===nchar?(this.input(),this.php7&&">"===this._input[this.offset]?(this.input(),this.tok.T_SPACESHIP):this.tok.T_IS_SMALLER_OR_EQUAL):">"===nchar?(this.input(),this.tok.T_IS_NOT_EQUAL):"<"},">":function(){var nchar=this._input[this.offset];return"="===nchar?(this.input(),this.tok.T_IS_GREATER_OR_EQUAL):">"===nchar?"="===(nchar=this._input[this.offset+1])?(this.consume(2),this.tok.T_SR_EQUAL):(this.input(),this.tok.T_SR):">"},"*":function(){var nchar=this._input[this.offset];return"="===nchar?(this.input(),this.tok.T_MUL_EQUAL):"*"===nchar?(this.input(),"="===this._input[this.offset]?(this.input(),this.tok.T_POW_EQUAL):this.tok.T_POW):"*"},".":function(){var nchar=this._input[this.offset];return"="===nchar?(this.input(),this.tok.T_CONCAT_EQUAL):"."===nchar&&"."===this._input[this.offset+1]?(this.consume(2),this.tok.T_ELLIPSIS):"."},"%":function(){return"="===this._input[this.offset]?(this.input(),this.tok.T_MOD_EQUAL):"%"},"&":function(){var nchar=this._input[this.offset];return"="===nchar?(this.input(),this.tok.T_AND_EQUAL):"&"===nchar?(this.input(),this.tok.T_BOOLEAN_AND):"&"},"|":function(){var nchar=this._input[this.offset];return"="===nchar?(this.input(),this.tok.T_OR_EQUAL):"|"===nchar?(this.input(),this.tok.T_BOOLEAN_OR):"|"},"^":function(){return"="===this._input[this.offset]?(this.input(),this.tok.T_XOR_EQUAL):"^"}}}},function(module,exports,__webpack_require__){"use strict";module.exports={T_CONSTANT_ENCAPSED_STRING:function(){for(var ch=void 0;this.offset2&&this.appendToken(this.tok.T_ENCAPSED_AND_WHITESPACE,this.yytext.length-prefix),this.unput(this.yytext.length-prefix),this.begin("ST_DOUBLE_QUOTES"),this.yytext},isDOC_MATCH:function(){if(this._input.substring(this.offset-1,this.offset-1+this.heredoc_label.length)===this.heredoc_label){var ch=this._input[this.offset-1+this.heredoc_label.length];if("\n"===ch||"\r"===ch||";"===ch)return!0}return!1},matchST_NOWDOC:function(){if(this.isDOC_MATCH())return this.consume(this.heredoc_label.length),this.popState(),this.tok.T_END_HEREDOC;for(var ch=this._input[this.offset-1];this.offset2?(this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES,2),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START()){var yyoffset=this.offset,next=this.consume_VARIABLE();return this.yytext.length>this.offset-yyoffset+2?(this.appendToken(next,this.offset-yyoffset+2),this.unput(this.offset-yyoffset+2),this.tok.T_ENCAPSED_AND_WHITESPACE):next}}else if("{"===ch){if("$"===(ch=this.input()))return this.begin("ST_IN_SCRIPTING"),this.yytext.length>2?(this.appendToken(this.tok.T_CURLY_OPEN,1),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):(this.unput(1),this.tok.T_CURLY_OPEN)}else ch=this.input();return this.tok.T_ENCAPSED_AND_WHITESPACE},consume_VARIABLE:function(){this.consume_LABEL();var ch=this.input();if("["==ch)return this.unput(1),this.begin("ST_VAR_OFFSET"),this.tok.T_VARIABLE;if("-"===ch){if(">"===this.input())return this.input(),this.is_LABEL_START()&&this.begin("ST_LOOKING_FOR_PROPERTY"),this.unput(3),this.tok.T_VARIABLE;this.unput(2)}else ch&&this.unput(1);return this.tok.T_VARIABLE},matchST_BACKQUOTE:function(){var ch=this.input();if("$"===ch){if("{"===(ch=this.input()))return this.begin("ST_LOOKING_FOR_VARNAME"),this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START())return this.consume_VARIABLE()}else if("{"===ch){if("$"===this._input[this.offset])return this.begin("ST_IN_SCRIPTING"),this.tok.T_CURLY_OPEN}else if("`"===ch)return this.popState(),"`";for(;this.offset2?(this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES,2),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START()){var yyoffset=this.offset,next=this.consume_VARIABLE();return this.yytext.length>this.offset-yyoffset+2?(this.appendToken(next,this.offset-yyoffset+2),this.unput(this.offset-yyoffset+2),this.tok.T_ENCAPSED_AND_WHITESPACE):next}continue}if("{"===ch){if("$"===(ch=this.input()))return this.begin("ST_IN_SCRIPTING"),this.yytext.length>2?(this.appendToken(this.tok.T_CURLY_OPEN,1),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):(this.unput(1),this.tok.T_CURLY_OPEN);continue}}ch=this.input()}return this.tok.T_ENCAPSED_AND_WHITESPACE},matchST_DOUBLE_QUOTES:function(){var ch=this.input();if("$"===ch){if("{"===(ch=this.input()))return this.begin("ST_LOOKING_FOR_VARNAME"),this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START())return this.consume_VARIABLE()}else if("{"===ch){if("$"===this._input[this.offset])return this.begin("ST_IN_SCRIPTING"),this.tok.T_CURLY_OPEN}else if('"'===ch)return this.popState(),'"';for(;this.offset2?(this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES,2),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START()){var yyoffset=this.offset,next=this.consume_VARIABLE();return this.yytext.length>this.offset-yyoffset+2?(this.appendToken(next,this.offset-yyoffset+2),this.unput(this.offset-yyoffset+2),this.tok.T_ENCAPSED_AND_WHITESPACE):next}ch&&this.unput(1)}else if("{"===ch){if("$"===(ch=this.input()))return this.begin("ST_IN_SCRIPTING"),this.yytext.length>2?(this.appendToken(this.tok.T_CURLY_OPEN,1),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):(this.unput(1),this.tok.T_CURLY_OPEN);ch&&this.unput(1)}}ch=this.input()}return this.tok.T_ENCAPSED_AND_WHITESPACE}}},function(module,exports,__webpack_require__){"use strict";module.exports={matchST_IN_SCRIPTING:function(){var ch=this.input();switch(ch){case" ":case"\t":case"\n":case"\r":case"\r\n":return this.T_WHITESPACE();case"#":return this.T_COMMENT();case"/":return"/"===this._input[this.offset]?this.T_COMMENT():"*"===this._input[this.offset]?(this.input(),this.T_DOC_COMMENT()):this.consume_TOKEN();case"'":return this.T_CONSTANT_ENCAPSED_STRING();case'"':return this.ST_DOUBLE_QUOTES();case"`":return this.begin("ST_BACKQUOTE"),"`";case"?":if(!this.aspTagMode&&this.tryMatch(">")){this.input();var nextCH=this._input[this.offset];return"\n"!==nextCH&&"\r"!==nextCH||this.input(),this.conditionStack.length>1&&this.begin("INITIAL"),this.tok.T_CLOSE_TAG}return this.consume_TOKEN();case"%":return this.aspTagMode&&">"===this._input[this.offset]?(this.input(),"\n"!==(ch=this._input[this.offset])&&"\r"!==ch||this.input(),this.aspTagMode=!1,this.conditionStack.length>1&&this.begin("INITIAL"),this.tok.T_CLOSE_TAG):this.consume_TOKEN();case"{":return this.begin("ST_IN_SCRIPTING"),"{";case"}":return this.conditionStack.length>2&&this.popState(),"}";default:if("."===ch){if(ch=this.input(),this.is_NUM())return this.consume_NUM();ch&&this.unput(1)}if(this.is_NUM())return this.consume_NUM();if(this.is_LABEL_START())return this.consume_LABEL().T_STRING();if(this.is_TOKEN())return this.consume_TOKEN()}throw new Error('Bad terminal sequence "'+ch+'" at line '+this.yylineno+" (offset "+this.offset+")")},T_WHITESPACE:function(){for(;this.offset"===(ch=this.input()))return this.tok.T_OBJECT_OPERATOR;ch&&this.unput(1)}else{if(this.is_WHITESPACE())return this.tok.T_WHITESPACE;if(this.is_LABEL_START())return this.consume_LABEL(),this.popState(),this.tok.T_STRING}return this.popState(),ch&&this.unput(1),!1},matchST_LOOKING_FOR_VARNAME:function(){var ch=this.input();if(this.popState(),this.begin("ST_IN_SCRIPTING"),this.is_LABEL_START()){if(this.consume_LABEL(),"["===(ch=this.input())||"}"===ch)return this.unput(1),this.tok.T_STRING_VARNAME;this.unput(this.yytext.length)}else ch&&this.unput(1);return!1},matchST_VAR_OFFSET:function(){var ch=this.input();if(this.is_NUM())return this.consume_NUM(),this.tok.T_NUM_STRING;if("]"===ch)return this.popState(),"]";if("$"===ch){if(this.input(),this.is_LABEL_START())return this.consume_LABEL(),this.tok.T_VARIABLE;throw new Error("Unexpected terminal")}if(this.is_LABEL_START())return this.consume_LABEL(),this.tok.T_STRING;if(this.is_WHITESPACE()||"\\"===ch||"'"===ch||"#"===ch)return this.tok.T_ENCAPSED_AND_WHITESPACE;if("["===ch||"{"===ch||"}"===ch||'"'===ch||"`"===ch||this.is_TOKEN())return ch;throw new Error("Unexpected terminal")}}},function(module,exports){var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex1)for(var i=1;i1&&"INITIAL"===this.conditionStack[this.conditionStack.length-1]?this.popState():this.begin("ST_IN_SCRIPTING"),this},matchINITIAL:function(){for(;this.offset0&&this.tok.T_INLINE_HTML}}},function(module,exports,__webpack_require__){"use strict";module.exports={T_COMMENT:function(){for(;this.offset"===this._input[this.offset])return this.unput(1),this.tok.T_COMMENT;if("%"===ch&&this.aspTagMode&&">"===this._input[this.offset])return this.unput(1),this.tok.T_COMMENT}return this.tok.T_COMMENT},T_DOC_COMMENT:function(){var ch=this.input(),token=this.tok.T_COMMENT;if("*"===ch){if(ch=this.input(),this.is_WHITESPACE()&&(token=this.tok.T_DOC_COMMENT),"/"===ch)return token;this.unput(1)}for(;this.offset=this.size,!this.all_tokens&&this.mode_eval?(this.conditionStack=["INITIAL"],this.begin("ST_IN_SCRIPTING")):(this.conditionStack=[],this.begin("INITIAL")),this},lexer.prototype.input=function(){var ch=this._input[this.offset];return ch?(this.yytext+=ch,this.offset++,"\r"===ch&&"\n"===this._input[this.offset]&&(this.yytext+="\n",this.offset++),"\n"===ch||"\r"===ch?(this.yylloc.last_line=++this.yylineno,this.yyprevcol=this.yylloc.last_column,this.yylloc.last_column=0):this.yylloc.last_column++,ch):""},lexer.prototype.unput=function(size){if(1===size)this.offset--,"\n"===this._input[this.offset]&&"\r"===this._input[this.offset-1]&&(this.offset--,size++),"\r"===this._input[this.offset]||"\n"===this._input[this.offset]?(this.yylloc.last_line--,this.yylineno--,this.yylloc.last_column=this.yyprevcol):this.yylloc.last_column--,this.yytext=this.yytext.substring(0,this.yytext.length-size);else if(size>0)if(this.offset-=size,size0?this.conditionStack.pop():this.conditionStack[0];if(this.curCondition=this.conditionStack[this.conditionStack.length-1],this.stateCb=this["match"+this.curCondition],"function"!=typeof this.stateCb)throw new Error('Undefined condition state "'+this.curCondition+'"');return condition},lexer.prototype.next=function(){var token=void 0;if(this._input||(this.done=!0),this.yylloc.first_offset=this.offset,this.yylloc.first_line=this.yylloc.last_line,this.yylloc.first_column=this.yylloc.last_column,this.yytext="",this.done)return this.yylloc.prev_offset=this.yylloc.first_offset,this.yylloc.prev_line=this.yylloc.first_line,this.yylloc.prev_column=this.yylloc.first_column,this.EOF;if(this.tokens.length>0?(token=this.tokens.shift(),"object"===_typeof(token[1])?this.setState(token[1]):this.consume(token[1]),token=token[0]):token=this.stateCb.apply(this,[]),this.offset>=this.size&&0===this.tokens.length&&(this.done=!0),this.debug){var tName=token;tName="number"==typeof tName?this.engine.tokens.values[tName]:'"'+tName+'"';var e=new Error(tName+"\tfrom "+this.yylloc.first_line+","+this.yylloc.first_column+"\t - to "+this.yylloc.last_line+","+this.yylloc.last_column+'\t"'+this.yytext+'"');console.error(e.stack)}return token},[__webpack_require__(116),__webpack_require__(115),__webpack_require__(114),__webpack_require__(112),__webpack_require__(111),__webpack_require__(110),__webpack_require__(109),__webpack_require__(108)].forEach(function(ext){for(var k in ext)lexer.prototype[k]=ext[k]}),module.exports=lexer},function(module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return"[object Array]"==toString.call(arr)}},function(module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),(value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias))*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},function(module,exports,__webpack_require__){"use strict";exports.byteLength=function(b64){var lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1];return 3*(validLen+placeHoldersLen)/4-placeHoldersLen},exports.toByteArray=function(b64){for(var tmp,lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1],arr=new Arr(function(b64,validLen,placeHoldersLen){return 3*(validLen+placeHoldersLen)/4-placeHoldersLen}(0,validLen,placeHoldersLen)),curByte=0,len=placeHoldersLen>0?validLen-4:validLen,i=0;i>16&255,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp;2===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[curByte++]=255&tmp);1===placeHoldersLen&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[curByte++]=tmp>>8&255,arr[curByte++]=255&tmp);return arr},exports.fromByteArray=function(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,parts=[],i=0,len2=len-extraBytes;ilen2?len2:i+16383));1===extraBytes?(tmp=uint8[len-1],parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"="));return parts.join("")};for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var validLen=b64.indexOf("=");return-1===validLen&&(validLen=len),[validLen,validLen===len?0:4-validLen%4]}function encodeChunk(uint8,start,end){for(var tmp,num,output=[],i=start;i>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]);return output.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(g=window)}module.exports=g},function(module,exports,__webpack_require__){"use strict";(function(global){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -var base64=__webpack_require__(120),ieee754=__webpack_require__(119),isArray=__webpack_require__(118);function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer))return string.byteLength;"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case void 0:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(0===buffer.length)return-1;if("string"==typeof byteOffset?(encoding=byteOffset,byteOffset=0):byteOffset>2147483647?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),byteOffset=+byteOffset,isNaN(byteOffset)&&(byteOffset=dir?0:buffer.length-1),byteOffset<0&&(byteOffset=buffer.length+byteOffset),byteOffset>=buffer.length){if(dir)return-1;byteOffset=buffer.length-1}else if(byteOffset<0){if(!dir)return-1;byteOffset=0}if("string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(buffer,val,byteOffset,encoding,dir);if("number"==typeof val)return val&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?dir?Uint8Array.prototype.indexOf.call(buffer,val,byteOffset):Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset):arrayIndexOf(buffer,[val],byteOffset,encoding,dir);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var i,indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&("ucs2"===(encoding=String(encoding).toLowerCase())||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;indexSize=2,arrLength/=2,valLength/=2,byteOffset/=2}function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength&&(byteOffset=arrLength-valLength),i=byteOffset;i>=0;i--){for(var found=!0,j=0;jremaining&&(length=remaining):length=remaining;var strLen=string.length;if(strLen%2!=0)throw new TypeError("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end)switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:128==(192&(secondByte=buf[i+1]))&&(tempCodePoint=(31&firstByte)<<6|63&secondByte)>127&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint);break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128==(192&secondByte)&&128==(192&thirdByte)&&128==(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return function(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);var res="",i=0;for(;ithis.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if((end>>>=0)<=(start>>>=0))return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}.apply(this,arguments)},Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||0===Buffer.compare(this,b)},Buffer.prototype.inspect=function(){var str="",max=exports.INSPECT_MAX_BYTES;return this.length>0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),""},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target))throw new TypeError("Argument must be a Buffer");if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisStart>=thisEnd&&start>=end)return 0;if(thisStart>=thisEnd)return-1;if(start>=end)return 1;if(start>>>=0,end>>>=0,thisStart>>>=0,thisEnd>>>=0,this===target)return 0;for(var x=thisEnd-thisStart,y=end-start,len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;iremaining)&&(length=remaining),string.length>0&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;ilen)&&(end=len);for(var out="",i=start;ilength)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,0,offset,4),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,0,offset,8),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}Buffer.prototype.slice=function(start,end){var newBuf,len=this.length;if(start=~~start,end=void 0===end?len:~~end,start<0?(start+=len)<0&&(start=0):start>len&&(start=len),end<0?(end+=len)<0&&(end=0):end>len&&(end=len),end0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset|=0,byteLength|=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return val>=(mul*=128)&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){(value=+value,offset|=0,byteLength|=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,0);var mul=1,i=0;for(this[offset]=255&value;++i=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset|=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset|=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart=0;--i)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,end=void 0===end?this.length:end>>>0,val||(val=0),"number"==typeof val)for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function base64ToBytes(str){return base64.toByteArray(function(str){if((str=function(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}(str).replace(INVALID_BASE64_RE,"")).length<2)return"";for(;str.length%4!=0;)str+="=";return str}(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}}).call(this,__webpack_require__(121))},function(module,exports,__webpack_require__){"use strict";(function(Buffer){ -/*! - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ -var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},lexer=__webpack_require__(117),parser=__webpack_require__(107),tokens=__webpack_require__(91),AST=__webpack_require__(90);function combine(src,to){for(var keys=Object.keys(src),i=keys.length;i--;){var k=keys[i],val=src[k];null===val?delete to[k]:"function"==typeof val?to[k]=val.bind(to):Array.isArray(val)?to[k]=Array.isArray(to[k])?to[k].concat(val):val:"object"===(void 0===val?"undefined":_typeof(val))?to[k]="object"===_typeof(to[k])?combine(val,to[k]):val:to[k]=val}return to}var engine=function(options){if("function"==typeof this)return new this(options);this.tokens=tokens,this.lexer=new lexer(this),this.ast=new AST,this.parser=new parser(this.lexer,this.ast),options&&"object"===(void 0===options?"undefined":_typeof(options))&&(options.parser&&!1===options.parser.php7&&(options.lexer||(options.lexer={}),options.lexer.php7=!1),combine(options,this))},getStringBuffer=function(buffer){return Buffer.isBuffer(buffer)?buffer.toString():buffer};engine.create=function(options){return new engine(options)},engine.parseEval=function(buffer,options){return new engine(options).parseEval(buffer)},engine.prototype.parseEval=function(buffer){return this.lexer.mode_eval=!0,this.lexer.all_tokens=!1,buffer=getStringBuffer(buffer),this.parser.parse(buffer,"eval")},engine.parseCode=function(buffer,filename,options){return"object"!==(void 0===filename?"undefined":_typeof(filename))||options||(options=filename,filename="unknown"),new engine(options).parseCode(buffer,filename)},engine.prototype.parseCode=function(buffer,filename){return this.lexer.mode_eval=!1,this.lexer.all_tokens=!1,buffer=getStringBuffer(buffer),this.parser.parse(buffer,filename)},engine.tokenGetAll=function(buffer,options){return new engine(options).tokenGetAll(buffer)},engine.prototype.tokenGetAll=function(buffer){this.lexer.mode_eval=!1,this.lexer.all_tokens=!0,buffer=getStringBuffer(buffer);var EOF=this.lexer.EOF,names=this.tokens.values;this.lexer.setInput(buffer);for(var token=this.lexer.lex()||EOF,result=[];token!=EOF;){var entry=this.lexer.yytext;names.hasOwnProperty(token)&&(entry=[names[token],entry,this.lexer.yylloc.first_line]),result.push(entry),token=this.lexer.lex()||EOF}return result},module.exports=engine,module.exports.tokens=tokens,module.exports.lexer=lexer,module.exports.AST=AST,module.exports.parser=parser,module.exports.combine=combine,module.exports.default=engine}).call(this,__webpack_require__(122).Buffer)}]).default}); \ No newline at end of file diff --git a/docs/AST.html b/docs/AST.html index 3599b712c..948c7b6a0 100644 --- a/docs/AST.html +++ b/docs/AST.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -263,7 +266,7 @@
Properties:
@@ -474,7 +477,98 @@
Parameters:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ resolveLocations() +

+
+ + + + + +
+

Includes locations from first & last into the target

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -565,7 +659,98 @@

+
+ + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ swapLocations() +

+
+ + + + + +
+

Change parent node informations after swapping childs

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -608,7 +793,7 @@


@@ -629,6 +814,6 @@

}); - + \ No newline at end of file diff --git a/docs/Array.html b/docs/Array.html index 1a7df9c81..2da285a0e 100644 --- a/docs/Array.html +++ b/docs/Array.html @@ -1,697 +1,816 @@ - - - - - - - - - Array - Documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - -
- -

- Array -

- - - - -
-
- -

- - Array - -

- - - -
- -
-
- - - - - - - - - - - - -

- new Array() -

-
- - - - - -
-

Defines an array structure

-
- - - - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
items - - - - Entry - - - | - - - Expr - - - | - - - Variable - - - - - - - -

List of array items

-
shortForm - - - - boolean - - - - - - - -

Indicate if the short array syntax is used, ex [] instead array()

-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
- - - - - -
Example
- - -
// PHP code :
[1, 'foo' => 'bar', 3]

// AST structure :
{
 "kind": "array",
 "shortForm": true
 "items": [
   {"kind": "number", "value": "1"},
   {
     "kind": "entry",
     "key": {"kind": "string", "value": "foo", "isDoubleQuote": false},
     "value": {"kind": "string", "value": "bar", "isDoubleQuote": false}
   },
   {"kind": "number", "value": "3"}
 ]
}
- - -
- - - -
- - -

Extends

- - - - - - - - - - - - - - - - - - - - -

Methods

- - - - - - - - - - - - - -

- includeToken(parser) -

-
- - - - - -
-

Includes current token position of the parser

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
parser - - - - * - - - - - - - - - -
- - - - - -
- - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

- setTrailingComments(docs) -

-
- - - - - -
-

Attach comments to current node

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
docs - - - - * - - - - - - - - - -
- - - - - -
- - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
- - - - - - - - - - - + + + + + + + + + Array - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ Array +

+ + + + +
+
+ +

+ + Array + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new Array() +

+
+ + + + + +
+

Defines an array structure

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
items + + + + Entry + + + | + + + Expr + + + | + + + Variable + + + + + + + +

List of array items

+
shortForm + + + + boolean + + + + + + + +

Indicate if the short array syntax is used, ex [] instead array()

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
// PHP code :
+[1, 'foo' => 'bar', 3]
+
+// AST structure :
+{
+ "kind": "array",
+ "shortForm": true
+ "items": [
+   {"kind": "number", "value": "1"},
+   {
+     "kind": "entry",
+     "key": {"kind": "string", "value": "foo", "isDoubleQuote": false},
+     "value": {"kind": "string", "value": "bar", "isDoubleQuote": false}
+   },
+   {"kind": "number", "value": "3"}
+ ]
+}
+ + +
+ + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/Assign.html b/docs/Assign.html index 663920095..0a65eac22 100644 --- a/docs/Assign.html +++ b/docs/Assign.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -328,7 +331,7 @@

Extends

@@ -353,6 +356,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -476,7 +579,7 @@
Parameters:
@@ -674,7 +777,7 @@
Parameters:

@@ -695,6 +798,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Bin.html b/docs/Bin.html index bd004b3d3..70c31082a 100644 --- a/docs/Bin.html +++ b/docs/Bin.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -353,6 +356,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -476,7 +579,7 @@
Parameters:
@@ -674,7 +777,7 @@
Parameters:

@@ -695,6 +798,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Block.html b/docs/Block.html index 69bcb91a3..ce990441a 100644 --- a/docs/Block.html +++ b/docs/Block.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Boolean.html b/docs/Boolean.html index d4ed7c447..260130632 100644 --- a/docs/Boolean.html +++ b/docs/Boolean.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Break.html b/docs/Break.html index 01f4ccafa..58e98c2ad 100644 --- a/docs/Break.html +++ b/docs/Break.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -276,7 +279,7 @@

Extends

@@ -301,6 +304,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -424,7 +527,7 @@
Parameters:
@@ -622,7 +725,7 @@
Parameters:

@@ -643,6 +746,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Call.html b/docs/Call.html index 5b1d6970a..49e2277b4 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -311,7 +314,7 @@

Extends

@@ -336,6 +339,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -459,7 +562,7 @@
Parameters:
@@ -657,7 +760,7 @@
Parameters:

@@ -678,6 +781,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Case.html b/docs/Case.html index a74e8ea86..7f5ee4e7a 100644 --- a/docs/Case.html +++ b/docs/Case.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -311,7 +314,7 @@

Extends

@@ -336,6 +339,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -459,7 +562,7 @@
Parameters:
@@ -657,7 +760,7 @@
Parameters:

@@ -678,6 +781,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Cast.html b/docs/Cast.html index 42451eff7..13a42c1ed 100644 --- a/docs/Cast.html +++ b/docs/Cast.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -353,6 +356,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -476,7 +579,7 @@
Parameters:
@@ -674,7 +777,7 @@
Parameters:

@@ -695,6 +798,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Catch.html b/docs/Catch.html index bee2e14e5..ef443b27b 100644 --- a/docs/Catch.html +++ b/docs/Catch.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -364,6 +367,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -487,7 +590,7 @@
Parameters:
@@ -685,7 +788,7 @@
Parameters:

@@ -706,6 +809,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Class.html b/docs/Class.html index 482bcab51..715c17f67 100644 --- a/docs/Class.html +++ b/docs/Class.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -446,6 +449,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -569,7 +672,7 @@
Parameters:
@@ -922,7 +1025,7 @@
Parameters:

@@ -943,6 +1046,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/ClassConstant.html b/docs/ClassConstant.html index e18821d25..2e71f5a8d 100644 --- a/docs/ClassConstant.html +++ b/docs/ClassConstant.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -169,35 +172,6 @@
Properties:
- - - isStatic - - - - - - - boolean - - - - - - - - - - - - - - - - - - - visibility @@ -263,7 +237,7 @@
Properties:
@@ -299,7 +273,7 @@

Extends

@@ -324,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -447,7 +521,7 @@
Parameters:
@@ -568,15 +642,6 @@
Parameters:
- -
Inherited From:
-
- -
@@ -602,7 +667,7 @@
Parameters:
@@ -800,7 +865,7 @@
Parameters:

@@ -821,6 +886,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/ClassReference.html b/docs/ClassReference.html new file mode 100644 index 000000000..2c14ce119 --- /dev/null +++ b/docs/ClassReference.html @@ -0,0 +1,774 @@ + + + + + + + + + ClassReference - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ClassReference +

+ + + + +
+
+ +

+ + ClassReference + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new ClassReference() +

+
+ + + + + +
+

Defines a class reference node

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + + + string + + + + + + + + +
resolution + + + + string + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Clone.html b/docs/Clone.html index 979fa0800..d1e47ed46 100644 --- a/docs/Clone.html +++ b/docs/Clone.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -270,7 +273,7 @@

Extends

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Closure.html b/docs/Closure.html index a0aa9cb60..7d8a2589d 100644 --- a/docs/Closure.html +++ b/docs/Closure.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -450,7 +453,7 @@

Extends

@@ -475,6 +478,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -598,7 +701,7 @@
Parameters:
@@ -796,7 +899,7 @@
Parameters:

@@ -817,6 +920,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Comment.html b/docs/Comment.html index b3ad9c6e8..ffc7148c4 100644 --- a/docs/Comment.html +++ b/docs/Comment.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/CommentBlock.html b/docs/CommentBlock.html index d564de40a..c04b150f2 100644 --- a/docs/CommentBlock.html +++ b/docs/CommentBlock.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/CommentLine.html b/docs/CommentLine.html index 0e27704ee..6910e7416 100644 --- a/docs/CommentLine.html +++ b/docs/CommentLine.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/ConstRef.html b/docs/ConstRef.html index a0bb43f3b..7ee36795b 100644 --- a/docs/ConstRef.html +++ b/docs/ConstRef.html @@ -84,7 +84,7 @@

php-parser

-

Classes

+

Classes

diff --git a/docs/Constant.html b/docs/Constant.html index a50f0ccf0..c68a94821 100644 --- a/docs/Constant.html +++ b/docs/Constant.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -133,7 +136,7 @@

-

Defines a namespace constant

+

Defines a constant

@@ -169,6 +172,35 @@

Properties:
+ + + name + + + + + + + string + + + + + + + + + + + + + + + + + + + value @@ -183,6 +215,24 @@
Properties:
| + + string + + + | + + + number + + + | + + + boolean + + + | + null @@ -276,7 +326,7 @@

Extends

@@ -302,13 +352,13 @@

Methods

- + -

- includeToken(parser) +

+ destroy()

@@ -317,7 +367,7 @@

-

Includes current token position of the parser

+

Destroying an unused node

@@ -326,61 +376,6 @@

-

Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
parser - - - - * - - - - - - - - - -
- - @@ -395,7 +390,7 @@
Parameters:
@@ -424,7 +419,7 @@
Parameters:
@@ -457,13 +452,13 @@
Parameters:
- + -

- parseFlags(flags) → {void} +

+ includeToken(parser)

@@ -472,7 +467,7 @@

-

Generic flags parser

+

Includes current token position of the parser

@@ -505,14 +500,14 @@

Parameters:
- flags + parser - Array.<Integer> + * @@ -550,7 +545,7 @@
Parameters:
@@ -579,7 +574,7 @@
Parameters:
@@ -777,7 +772,7 @@
Parameters:

@@ -798,6 +793,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/ConstantStatement.html b/docs/ConstantStatement.html new file mode 100644 index 000000000..8aa743828 --- /dev/null +++ b/docs/ConstantStatement.html @@ -0,0 +1,745 @@ + + + + + + + + + ConstantStatement - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ConstantStatement +

+ + + + +
+
+ +

+ + ConstantStatement + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new ConstantStatement() +

+
+ + + + + +
+

Declares a constants into the current scope

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
constants + + + + Array.<Constant> + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Continue.html b/docs/Continue.html index d7a9265a3..ffedfd54a 100644 --- a/docs/Continue.html +++ b/docs/Continue.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -276,7 +279,7 @@

Extends

@@ -301,6 +304,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -424,7 +527,7 @@
Parameters:
@@ -622,7 +725,7 @@
Parameters:

@@ -643,6 +746,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Declaration.html b/docs/Declaration.html index 51401eb8b..5903eb71d 100644 --- a/docs/Declaration.html +++ b/docs/Declaration.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -177,6 +180,12 @@
Properties:
+ + Identifier + + + | + string @@ -295,6 +304,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +527,7 @@
Parameters:
@@ -762,7 +871,7 @@
Parameters:

@@ -783,6 +892,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Declare.html b/docs/Declare.html index 03ce88391..f85838c7a 100644 --- a/docs/Declare.html +++ b/docs/Declare.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -171,14 +174,14 @@
Properties:
- what + directives - Array.<Expression> + Array.<Array> @@ -335,6 +338,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -458,7 +561,7 @@
Parameters:
@@ -656,7 +759,7 @@
Parameters:

@@ -677,6 +780,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/DeclareDirective.html b/docs/DeclareDirective.html new file mode 100644 index 000000000..cf92674e2 --- /dev/null +++ b/docs/DeclareDirective.html @@ -0,0 +1,798 @@ + + + + + + + + + DeclareDirective - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ DeclareDirective +

+ + + + +
+
+ +

+ + DeclareDirective + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new DeclareDirective() +

+
+ + + + + +
+

Defines a constant

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + + + Identifier + + + + + + + + +
value + + + + Node + + + | + + + string + + + | + + + number + + + | + + + boolean + + + | + + + null + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Do.html b/docs/Do.html index 988d0b1c8..bb0f4fae7 100644 --- a/docs/Do.html +++ b/docs/Do.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -324,6 +327,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -447,7 +550,7 @@
Parameters:
@@ -645,7 +748,7 @@
Parameters:

@@ -666,6 +769,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Echo.html b/docs/Echo.html index 8773446b0..c57b547c3 100644 --- a/docs/Echo.html +++ b/docs/Echo.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -270,7 +273,7 @@

Extends

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Empty.html b/docs/Empty.html index ce7c657dd..2bcecd6cf 100644 --- a/docs/Empty.html +++ b/docs/Empty.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -212,7 +215,7 @@

Extends

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Encapsed.html b/docs/Encapsed.html index 7fec330b2..dc183fb92 100644 --- a/docs/Encapsed.html +++ b/docs/Encapsed.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -330,6 +333,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -453,7 +556,7 @@
Parameters:
@@ -651,7 +754,7 @@
Parameters:

@@ -672,6 +775,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/EncapsedPart.html b/docs/EncapsedPart.html new file mode 100644 index 000000000..cc81d9ae5 --- /dev/null +++ b/docs/EncapsedPart.html @@ -0,0 +1,745 @@ + + + + + + + + + EncapsedPart - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ EncapsedPart +

+ + + + +
+
+ +

+ + EncapsedPart + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new EncapsedPart() +

+
+ + + + + +
+

Part of Encapsed node

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
what + + + + Expression + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Entry.html b/docs/Entry.html index f3a6b560d..eb1ac24d7 100644 --- a/docs/Entry.html +++ b/docs/Entry.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -305,7 +308,7 @@

Extends

@@ -330,6 +333,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -453,7 +556,7 @@
Parameters:
@@ -651,7 +754,7 @@
Parameters:

@@ -672,6 +775,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Error.html b/docs/Error.html index 6eee96e82..ba158017a 100644 --- a/docs/Error.html +++ b/docs/Error.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -394,6 +397,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -517,7 +620,7 @@
Parameters:
@@ -715,7 +818,7 @@
Parameters:

@@ -736,6 +839,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Eval.html b/docs/Eval.html index b3efb003d..19e54792d 100644 --- a/docs/Eval.html +++ b/docs/Eval.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -270,7 +273,7 @@

Extends

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Exit.html b/docs/Exit.html index 151470556..6fa060802 100644 --- a/docs/Exit.html +++ b/docs/Exit.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -305,7 +308,7 @@

Extends

@@ -330,6 +333,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -453,7 +556,7 @@
Parameters:
@@ -651,7 +754,7 @@
Parameters:

@@ -672,6 +775,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Expression.html b/docs/Expression.html index 0609012e3..6e1300cc9 100644 --- a/docs/Expression.html +++ b/docs/Expression.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -238,6 +241,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -361,7 +464,7 @@
Parameters:
@@ -559,7 +662,7 @@
Parameters:

@@ -580,6 +683,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/ExpressionStatement.html b/docs/ExpressionStatement.html index 85e5d91a0..e3e272290 100644 --- a/docs/ExpressionStatement.html +++ b/docs/ExpressionStatement.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/For.html b/docs/For.html index 071ae0ce0..4ee611899 100644 --- a/docs/For.html +++ b/docs/For.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -422,6 +425,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -545,7 +648,7 @@
Parameters:
@@ -743,7 +846,7 @@
Parameters:

@@ -764,6 +867,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Foreach.html b/docs/Foreach.html index 7c14b19b6..f27971669 100644 --- a/docs/Foreach.html +++ b/docs/Foreach.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -428,6 +431,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -551,7 +654,7 @@
Parameters:
@@ -749,7 +852,7 @@
Parameters:

@@ -770,6 +873,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Function.html b/docs/Function.html index e61a15d29..72013b75f 100644 --- a/docs/Function.html +++ b/docs/Function.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -417,6 +420,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -540,7 +643,7 @@
Parameters:
@@ -893,7 +996,7 @@
Parameters:

@@ -914,6 +1017,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Global_.html b/docs/Global_.html index ffb4c4956..cd410be56 100644 --- a/docs/Global_.html +++ b/docs/Global_.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Goto.html b/docs/Goto.html index c7db50293..aa318e641 100644 --- a/docs/Goto.html +++ b/docs/Goto.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -306,6 +309,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -429,7 +532,7 @@
Parameters:
@@ -627,7 +730,7 @@
Parameters:

@@ -648,6 +751,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Halt.html b/docs/Halt.html index d0d022af2..c18c706c6 100644 --- a/docs/Halt.html +++ b/docs/Halt.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -306,6 +309,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -429,7 +532,7 @@
Parameters:
@@ -627,7 +730,7 @@
Parameters:

@@ -648,6 +751,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Identifier.html b/docs/Identifier.html index b0606c752..a251a1124 100644 --- a/docs/Identifier.html +++ b/docs/Identifier.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -185,35 +188,6 @@
Properties:
- - - - - - - - - - - - - - - - resolution - - - - - - - string - - - - - - @@ -324,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -447,7 +521,7 @@
Parameters:
@@ -645,7 +719,7 @@
Parameters:

@@ -666,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/If.html b/docs/If.html index 4f2764c78..4d118728b 100644 --- a/docs/If.html +++ b/docs/If.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -394,6 +397,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -517,7 +620,7 @@
Parameters:
@@ -715,7 +818,7 @@
Parameters:

@@ -736,6 +839,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Include.html b/docs/Include.html index 7e0770edf..16f60850a 100644 --- a/docs/Include.html +++ b/docs/Include.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -328,7 +331,7 @@

Extends

@@ -353,6 +356,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -476,7 +579,7 @@
Parameters:
@@ -674,7 +777,7 @@
Parameters:

@@ -695,6 +798,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Inline.html b/docs/Inline.html index 880ccf236..f64c5b4da 100644 --- a/docs/Inline.html +++ b/docs/Inline.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Interface.html b/docs/Interface.html index 949c0ad79..b534b0c52 100644 --- a/docs/Interface.html +++ b/docs/Interface.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -324,6 +327,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -447,7 +550,7 @@
Parameters:
@@ -800,7 +903,7 @@
Parameters:

@@ -821,6 +924,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Isset.html b/docs/Isset.html index e2430eb96..2fa731e01 100644 --- a/docs/Isset.html +++ b/docs/Isset.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -212,7 +215,7 @@

Extends

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Label.html b/docs/Label.html index ccfcc9e6a..0d0296e36 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -270,7 +273,7 @@

Extends

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/List.html b/docs/List.html index b6823017f..1cccec583 100644 --- a/docs/List.html +++ b/docs/List.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -270,7 +273,7 @@

Extends

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Literal.html b/docs/Literal.html index e8802d0f5..24dfc1ee9 100644 --- a/docs/Literal.html +++ b/docs/Literal.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -348,6 +351,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -471,7 +574,7 @@
Parameters:
@@ -669,7 +772,7 @@
Parameters:

@@ -690,6 +793,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Location.html b/docs/Location.html index fb9d1c64c..be431f029 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -355,7 +358,7 @@
Properties:

@@ -376,6 +379,6 @@
Properties:
}); - + \ No newline at end of file diff --git a/docs/Lookup.html b/docs/Lookup.html index 8758d820f..0aa9d1e6e 100644 --- a/docs/Lookup.html +++ b/docs/Lookup.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -324,6 +327,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -447,7 +550,7 @@
Parameters:
@@ -645,7 +748,7 @@
Parameters:

@@ -666,6 +769,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Magic.html b/docs/Magic.html index 556a7d134..3e65f311d 100644 --- a/docs/Magic.html +++ b/docs/Magic.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Method.html b/docs/Method.html index fc6c2d5a9..00ae84ada 100644 --- a/docs/Method.html +++ b/docs/Method.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -357,7 +360,7 @@

Extends

@@ -374,475 +377,6 @@

Extends

-

Methods

- - - - - - - - - - - - - -

- includeToken(parser) -

-
- - - - - -
-

Includes current token position of the parser

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
parser - - - - * - - - - - - - - - -
- - - - - -
- - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

- parseFlags(flags) → {void} -

-
- - - - - -
-

Generic flags parser

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
flags - - - - Array.<Integer> - - - - - - - - - -
- - - - - -
- - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

- setTrailingComments(docs) -

-
- - - - - -
-

Attach comments to current node

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
docs - - - - * - - - - - - - - - -
- - - - - -
- - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - @@ -858,7 +392,7 @@
Parameters:

@@ -879,6 +413,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Namespace.html b/docs/Namespace.html index ec28e4ca4..3564c1cee 100644 --- a/docs/Namespace.html +++ b/docs/Namespace.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -324,6 +327,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -447,7 +550,7 @@
Parameters:
@@ -645,7 +748,7 @@
Parameters:

@@ -666,6 +769,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/New.html b/docs/New.html index ef08bbd93..f81f44a04 100644 --- a/docs/New.html +++ b/docs/New.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -311,7 +314,7 @@

Extends

@@ -336,6 +339,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -459,7 +562,7 @@
Parameters:
@@ -657,7 +760,7 @@
Parameters:

@@ -678,6 +781,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Node.html b/docs/Node.html index 1d50e3151..a323a7978 100644 --- a/docs/Node.html +++ b/docs/Node.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -548,7 +551,98 @@
Parameters:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -694,7 +788,7 @@
Parameters:
@@ -883,7 +977,7 @@
Parameters:

@@ -904,6 +998,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Noop.html b/docs/Noop.html new file mode 100644 index 000000000..6cbd18c45 --- /dev/null +++ b/docs/Noop.html @@ -0,0 +1,688 @@ + + + + + + + + + Noop - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ Noop +

+ + + + +
+
+ +

+ + Noop + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new Noop() +

+
+ + + + + +
+

Ignore this node, it implies a no operation block, for example : +[$foo, $bar, /* here a noop node * /]

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/NowDoc.html b/docs/NowDoc.html index 6a07bee94..d13637899 100644 --- a/docs/NowDoc.html +++ b/docs/NowDoc.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -353,6 +356,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -476,7 +579,7 @@
Parameters:
@@ -674,7 +777,7 @@
Parameters:

@@ -695,6 +798,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Number.html b/docs/Number.html index 45a470d64..6ce32c5cb 100644 --- a/docs/Number.html +++ b/docs/Number.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/OffsetLookup.html b/docs/OffsetLookup.html index 7edfd76a3..288e359b5 100644 --- a/docs/OffsetLookup.html +++ b/docs/OffsetLookup.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Operation.html b/docs/Operation.html index a79fb4470..534af2e48 100644 --- a/docs/Operation.html +++ b/docs/Operation.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Parameter.html b/docs/Parameter.html index db1616eeb..b1a606c55 100644 --- a/docs/Parameter.html +++ b/docs/Parameter.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -423,6 +426,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -546,7 +649,7 @@
Parameters:
@@ -899,7 +1002,7 @@
Parameters:

@@ -920,6 +1023,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/ParentReference.html b/docs/ParentReference.html new file mode 100644 index 000000000..c52c77834 --- /dev/null +++ b/docs/ParentReference.html @@ -0,0 +1,687 @@ + + + + + + + + + ParentReference - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ParentReference +

+ + + + +
+
+ +

+ + ParentReference + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new ParentReference() +

+
+ + + + + +
+

Defines a class reference node

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Position.html b/docs/Position.html index 4f23d5150..49acda8ff 100644 --- a/docs/Position.html +++ b/docs/Position.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -349,7 +352,7 @@
Properties:

@@ -370,6 +373,6 @@
Properties:
}); - + \ No newline at end of file diff --git a/docs/Post.html b/docs/Post.html index 993121062..57aa4d8a3 100644 --- a/docs/Post.html +++ b/docs/Post.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -324,6 +327,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -447,7 +550,7 @@
Parameters:
@@ -645,7 +748,7 @@
Parameters:

@@ -666,6 +769,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Pre.html b/docs/Pre.html index 03b619343..213450f9a 100644 --- a/docs/Pre.html +++ b/docs/Pre.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -324,6 +327,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -447,7 +550,7 @@
Parameters:
@@ -645,7 +748,7 @@
Parameters:

@@ -666,6 +769,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Print.html b/docs/Print.html index 68a1774bf..f413a142e 100644 --- a/docs/Print.html +++ b/docs/Print.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -212,7 +215,7 @@

Extends

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Program.html b/docs/Program.html index 266095380..11de01093 100644 --- a/docs/Program.html +++ b/docs/Program.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -377,6 +380,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -500,7 +603,7 @@
Parameters:
@@ -698,7 +801,7 @@
Parameters:

@@ -719,6 +822,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Property.html b/docs/Property.html index b460d352f..399df5d94 100644 --- a/docs/Property.html +++ b/docs/Property.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -171,65 +174,7 @@
Properties:
- isFinal - - - - - - - boolean - - - - - - - - - - - - - - - - - - - - - - isStatic - - - - - - - boolean - - - - - - - - - - - - - - - - - - - - - - visibility + name @@ -363,7 +308,7 @@

Extends

@@ -389,13 +334,13 @@

Methods

- + -

- includeToken(parser) +

+ destroy()

@@ -404,7 +349,7 @@

-

Includes current token position of the parser

+

Destroying an unused node

@@ -413,61 +358,6 @@

-

Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
parser - - - - * - - - - - - - - - -
- - @@ -482,7 +372,7 @@
Parameters:
@@ -511,7 +401,7 @@
Parameters:
@@ -544,13 +434,13 @@
Parameters:
- + -

- parseFlags(flags) → {void} +

+ includeToken(parser)

@@ -559,7 +449,7 @@

-

Generic flags parser

+

Includes current token position of the parser

@@ -592,14 +482,14 @@

Parameters:
- flags + parser - Array.<Integer> + * @@ -637,7 +527,7 @@
Parameters:
@@ -666,7 +556,7 @@
Parameters:
@@ -864,7 +754,7 @@
Parameters:

@@ -885,6 +775,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/PropertyLookup.html b/docs/PropertyLookup.html index 785e74043..d4cf93f11 100644 --- a/docs/PropertyLookup.html +++ b/docs/PropertyLookup.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/PropertyStatement.html b/docs/PropertyStatement.html new file mode 100644 index 000000000..c5b3532e2 --- /dev/null +++ b/docs/PropertyStatement.html @@ -0,0 +1,891 @@ + + + + + + + + + PropertyStatement - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ PropertyStatement +

+ + + + +
+
+ +

+ + PropertyStatement + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new PropertyStatement() +

+
+ + + + + +
+

Declares a properties into the current scope

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
properties + + + + Array.<Property> + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ parseFlags(flags) → {void} +

+
+ + + + + +
+

Generic flags parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
flags + + + + Array.<Integer> + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Reference.html b/docs/Reference.html new file mode 100644 index 000000000..12a00d66d --- /dev/null +++ b/docs/Reference.html @@ -0,0 +1,687 @@ + + + + + + + + + Reference - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ Reference +

+ + + + +
+
+ +

+ + Reference + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new Reference() +

+
+ + + + + +
+

Defines a reference node

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/RetIf.html b/docs/RetIf.html index 5eaa0adb8..ced88f98d 100644 --- a/docs/RetIf.html +++ b/docs/RetIf.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -328,7 +331,7 @@

Extends

@@ -353,6 +356,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -476,7 +579,7 @@
Parameters:
@@ -674,7 +777,7 @@
Parameters:

@@ -695,6 +798,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Return.html b/docs/Return.html index 717427786..65ec6ff44 100644 --- a/docs/Return.html +++ b/docs/Return.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -276,7 +279,7 @@

Extends

@@ -301,6 +304,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -424,7 +527,7 @@
Parameters:
@@ -622,7 +725,7 @@
Parameters:

@@ -643,6 +746,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/SelfReference.html b/docs/SelfReference.html new file mode 100644 index 000000000..6bcadc1e5 --- /dev/null +++ b/docs/SelfReference.html @@ -0,0 +1,687 @@ + + + + + + + + + SelfReference - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ SelfReference +

+ + + + +
+
+ +

+ + SelfReference + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new SelfReference() +

+
+ + + + + +
+

Defines a class reference node

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Silent.html b/docs/Silent.html index b40315ea1..c5580e449 100644 --- a/docs/Silent.html +++ b/docs/Silent.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -270,7 +273,7 @@

Extends

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Statement.html b/docs/Statement.html index 76410d56d..07790815c 100644 --- a/docs/Statement.html +++ b/docs/Statement.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Static.html b/docs/Static.html index 90ad03f4e..3e6dd0df9 100644 --- a/docs/Static.html +++ b/docs/Static.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -171,20 +174,14 @@
Properties:
- items + variables - Array.<Variable> - - - | - - - Array.<Assign> + Array.<StaticVariable> @@ -301,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -424,7 +521,7 @@
Parameters:
@@ -622,7 +719,7 @@
Parameters:

@@ -643,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/StaticLookup.html b/docs/StaticLookup.html index f3edf696c..b21eb7eae 100644 --- a/docs/StaticLookup.html +++ b/docs/StaticLookup.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/StaticReference.html b/docs/StaticReference.html new file mode 100644 index 000000000..5d4225df8 --- /dev/null +++ b/docs/StaticReference.html @@ -0,0 +1,687 @@ + + + + + + + + + StaticReference - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ StaticReference +

+ + + + +
+
+ +

+ + StaticReference + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new StaticReference() +

+
+ + + + + +
+

Defines a class reference node

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/StaticVariable.html b/docs/StaticVariable.html new file mode 100644 index 000000000..6896cf16c --- /dev/null +++ b/docs/StaticVariable.html @@ -0,0 +1,798 @@ + + + + + + + + + StaticVariable - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ StaticVariable +

+ + + + +
+
+ +

+ + StaticVariable + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new StaticVariable() +

+
+ + + + + +
+

Defines a constant

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
variable + + + + Variable + + + + + + + + +
defaultValue + + + + Node + + + | + + + string + + + | + + + number + + + | + + + boolean + + + | + + + null + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/String.html b/docs/String.html index 1e55fc0b6..d88cfb26e 100644 --- a/docs/String.html +++ b/docs/String.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -335,6 +338,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -458,7 +561,7 @@
Parameters:
@@ -656,7 +759,7 @@
Parameters:

@@ -677,6 +780,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Switch.html b/docs/Switch.html index f96eb3945..613389778 100644 --- a/docs/Switch.html +++ b/docs/Switch.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -353,6 +356,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -476,7 +579,7 @@
Parameters:
@@ -674,7 +777,7 @@
Parameters:

@@ -695,6 +798,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Sys.html b/docs/Sys.html index ee24df0ed..74ebd74e5 100644 --- a/docs/Sys.html +++ b/docs/Sys.html @@ -84,7 +84,7 @@

php-parser

-

Classes

+

Classes

diff --git a/docs/Throw.html b/docs/Throw.html index 415343814..d96395628 100644 --- a/docs/Throw.html +++ b/docs/Throw.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -295,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -418,7 +521,7 @@
Parameters:
@@ -616,7 +719,7 @@
Parameters:

@@ -637,6 +740,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Trait.html b/docs/Trait.html index e72272812..6ad67f529 100644 --- a/docs/Trait.html +++ b/docs/Trait.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -169,70 +172,6 @@
Properties:
- - - extends - - - - - - - Identifier - - - | - - - null - - - - - - - - - - - - - - - - - - - - - - implements - - - - - - - Array.<Identifier> - - - - - - - - - - - - - - - - - - - body @@ -359,6 +298,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -482,7 +521,7 @@
Parameters:
@@ -835,7 +874,7 @@
Parameters:

@@ -856,6 +895,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/TraitAlias.html b/docs/TraitAlias.html index ab01ce8c1..47056112b 100644 --- a/docs/TraitAlias.html +++ b/docs/TraitAlias.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -213,7 +216,7 @@
Properties:
- string + Identifier @@ -242,7 +245,7 @@
Properties:
- string + Identifier | @@ -400,6 +403,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -523,7 +626,7 @@
Parameters:
@@ -721,7 +824,7 @@
Parameters:

@@ -742,6 +845,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/TraitPrecedence.html b/docs/TraitPrecedence.html index 75341bd91..4ca9f9788 100644 --- a/docs/TraitPrecedence.html +++ b/docs/TraitPrecedence.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -213,7 +216,7 @@
Properties:
- string + Identifier @@ -359,6 +362,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -482,7 +585,7 @@
Parameters:
@@ -680,7 +783,7 @@
Parameters:

@@ -701,6 +804,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/TraitUse.html b/docs/TraitUse.html index fc8a315b0..395ce8b46 100644 --- a/docs/TraitUse.html +++ b/docs/TraitUse.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -330,6 +333,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -453,7 +556,7 @@
Parameters:
@@ -651,7 +754,7 @@
Parameters:

@@ -672,6 +775,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Try.html b/docs/Try.html index eb2b155ee..ce2d968f7 100644 --- a/docs/Try.html +++ b/docs/Try.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -229,7 +232,7 @@
Properties:
- allways + always @@ -353,6 +356,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -476,7 +579,7 @@
Parameters:
@@ -674,7 +777,7 @@
Parameters:

@@ -695,6 +798,6 @@
Parameters:
}); - + - \ No newline at end of file + diff --git a/docs/TypeReference.html b/docs/TypeReference.html new file mode 100644 index 000000000..1b76732b5 --- /dev/null +++ b/docs/TypeReference.html @@ -0,0 +1,745 @@ + + + + + + + + + TypeReference - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ TypeReference +

+ + + + +
+
+ +

+ + TypeReference + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new TypeReference() +

+
+ + + + + +
+

Defines a class reference node

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + + + string + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Unary.html b/docs/Unary.html index 634dc7e71..4d0139bc6 100644 --- a/docs/Unary.html +++ b/docs/Unary.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -324,6 +327,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -447,7 +550,7 @@
Parameters:
@@ -645,7 +748,7 @@
Parameters:

@@ -666,6 +769,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Unset.html b/docs/Unset.html index 07f042801..24e7c2522 100644 --- a/docs/Unset.html +++ b/docs/Unset.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -212,7 +215,7 @@

Extends

@@ -237,6 +240,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -360,7 +463,7 @@
Parameters:
@@ -558,7 +661,7 @@
Parameters:

@@ -579,6 +682,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/UseGroup.html b/docs/UseGroup.html index ceb54cac6..8b176cf78 100644 --- a/docs/UseGroup.html +++ b/docs/UseGroup.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -380,6 +383,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -503,7 +606,7 @@
Parameters:
@@ -701,7 +804,7 @@
Parameters:

@@ -722,6 +825,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/UseItem.html b/docs/UseItem.html index b650f4bde..37f5035bc 100644 --- a/docs/UseItem.html +++ b/docs/UseItem.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -242,7 +245,7 @@
Properties:
- String + Identifier | @@ -380,6 +383,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -503,7 +606,7 @@
Parameters:
@@ -701,7 +804,7 @@
Parameters:

@@ -722,6 +825,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Variable.html b/docs/Variable.html index 78adf5d30..34c09ced8 100644 --- a/docs/Variable.html +++ b/docs/Variable.html @@ -1,721 +1,832 @@ - - - - - - - - - Variable - Documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - -
- -

- Variable -

- - - - -
-
- -

- - Variable - -

- - - -
- -
-
- - - - - - - - - - - - -

- new Variable() -

-
- - - - - -
+ + + + + + + + + Variable - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ Variable +

+ + + + +
+
+ +

+ + Variable + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new Variable() +

+
+ + + + + +

Any expression node. Since the left-hand side of an assignment may -be any expression in general, an expression can also be a pattern.

-
- - - - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
name - - - - String - - - | - - - Node - - - - - - - -

The variable name (can be a complex expression when the name is resolved dynamically)

-
byref - - - - boolean - - - - - - - -

Indicate if the variable reference is used, ex &$foo

-
curly - - - - boolean - - - - - - - -

Indicate if the name is defined between curlies, ex ${foo}

-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
- - - - - -
Example
- - -
// PHP code :
&$foo
// AST output
{
 "kind": "variable",
 "name": "foo",
 "byref": true,
 "curly": false
}
- - -
- - - -
- - -

Extends

- - - - - - - - - - - - - - - - - - - - -

Methods

- - - - - - - - - - - - - -

- includeToken(parser) -

-
- - - - - -
-

Includes current token position of the parser

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
parser - - - - * - - - - - - - - - -
- - - - - -
- - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

- setTrailingComments(docs) -

-
- - - - - -
-

Attach comments to current node

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
docs - - - - * - - - - - - - - - -
- - - - - -
- - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
- - - - - - - - - - - +be any expression in general, an expression can also be a pattern.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + + + String + + + | + + + Node + + + + + + + +

The variable name (can be a complex expression when the name is resolved dynamically)

+
byref + + + + boolean + + + + + + + +

Indicate if the variable reference is used, ex &$foo

+
curly + + + + boolean + + + + + + + +

Indicate if the name is defined between curlies, ex ${foo}

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
// PHP code :
+&$foo
+// AST output
+{
+ "kind": "variable",
+ "name": "foo",
+ "byref": true,
+ "curly": false
+}
+ + +
+ + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ includeToken(parser) +

+
+ + + + + +
+

Includes current token position of the parser

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parser + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ setTrailingComments(docs) +

+
+ + + + + +
+

Attach comments to current node

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docs + + + + * + + + + + + + + + +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/While.html b/docs/While.html index c863b8995..99b5f8bca 100644 --- a/docs/While.html +++ b/docs/While.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -353,6 +356,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -476,7 +579,7 @@
Parameters:
@@ -674,7 +777,7 @@
Parameters:

@@ -695,6 +798,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/Yield.html b/docs/Yield.html index 75b4ed6f8..bf3ce70dc 100644 --- a/docs/Yield.html +++ b/docs/Yield.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -347,6 +350,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -470,7 +573,7 @@
Parameters:
@@ -668,7 +771,7 @@
Parameters:

@@ -689,6 +792,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/YieldFrom.html b/docs/YieldFrom.html index 2474d1ace..4ca8289fb 100644 --- a/docs/YieldFrom.html +++ b/docs/YieldFrom.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -306,6 +309,106 @@

Methods

+ + + + + + +

+ destroy() +

+
+ + + + + +
+

Destroying an unused node

+
+ + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -429,7 +532,7 @@
Parameters:
@@ -627,7 +730,7 @@
Parameters:

@@ -648,6 +751,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/ast.js.html b/docs/ast.js.html index 8255e701e..b207724c2 100644 --- a/docs/ast.js.html +++ b/docs/ast.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -117,24 +120,45 @@

* - [Location](#location) * - [Position](#position) * - [Node](#node) + * - [Noop](#noop) + * - [StaticVariable](#staticvariable) + * - [EncapsedPart](#encapsedpart) + * - [Constant](#constant) * - [Identifier](#identifier) + * - [Reference](#reference) + * - [TypeReference](#classreference) + * - [ParentReference](#classreference) + * - [StaticReference](#classreference) + * - [SelfReference](#classreference) + * - [ClassReference](#classreference) * - [TraitUse](#traituse) * - [TraitAlias](#traitalias) * - [TraitPrecedence](#traitprecedence) - * - [Entry](#entry) - * - [Case](#case) - * - [Label](#label) * - [Comment](#comment) * - [CommentLine](#commentline) * - [CommentBlock](#commentblock) * - [Error](#error) * - [Expression](#expression) + * - [Entry](#entry) + * - [Closure](#closure) + * - [Silent](#silent) + * - [RetIf](#retif) + * - [New](#new) + * - [Include](#include) + * - [Call](#call) + * - [Eval](#eval) + * - [Exit](#exit) + * - [Clone](#clone) + * - [Assign](#assign) * - [Array](#array) + * - [List](#list) * - [Variable](#variable) * - [Variadic](#variadic) - * - [ConstRef](#constref) * - [Yield](#yield) * - [YieldFrom](#yieldfrom) + * - [Print](#print) + * - [Isset](#isset) + * - [Empty](#empty) * - [Lookup](#lookup) * - [PropertyLookup](#propertylookup) * - [StaticLookup](#staticlookup) @@ -154,16 +178,19 @@

* - [Nowdoc](#nowdoc) * - [Encapsed](#encapsed) * - [Statement](#statement) - * - [Eval](#eval) - * - [Exit](#exit) + * - [ConstantStatement](#constantstatement) + * - [ClassConstant](#classconstant) + * - [Return](#return) + * - [Label](#label) + * - [Continue](#continue) + * - [Case](#case) + * - [Break](#break) + * - [Echo](#echo) + * - [Unset](#unset) * - [Halt](#halt) - * - [Clone](#clone) * - [Declare](#declare) * - [Global](#global) * - [Static](#static) - * - [Include](#include) - * - [Assign](#assign) - * - [RetIf](#retif) * - [If](#if) * - [Do](#do) * - [While](#while) @@ -171,35 +198,23 @@

* - [Foreach](#foreach) * - [Switch](#switch) * - [Goto](#goto) - * - [Silent](#silent) * - [Try](#try) * - [Catch](#catch) * - [Throw](#throw) - * - [Call](#call) - * - [Closure](#closure) - * - [New](#new) * - [UseGroup](#usegroup) * - [UseItem](#useitem) * - [Block](#block) * - [Program](#program) * - [Namespace](#namespace) - * - [Sys](#sys) - * - [Echo](#echo) - * - [List](#list) - * - [Print](#print) - * - [Isset](#isset) - * - [Unset](#unset) - * - [Empty](#empty) + * - [PropertyStatement](#propertystatement) + * - [Property](#property) * - [Declaration](#declaration) * - [Class](#class) * - [Interface](#interface) * - [Trait](#trait) - * - [Constant](#constant) - * - [ClassConstant](#classconstant) * - [Function](#function) * - [Method](#method) * - [Parameter](#parameter) - * - [Property](#property) * --- */ @@ -250,7 +265,8 @@

["+", "-", "."], ["*", "/", "%"], ["!"], - ["instanceof"] + ["instanceof"], + ["cast"] // TODO: typecasts // TODO: [ (array) // TODO: clone, new @@ -260,13 +276,59 @@

}); }); +/** + * Change parent node informations after swapping childs + */ +AST.prototype.swapLocations = function(target, first, last, parser) { + if (this.withPositions) { + target.loc.start = first.loc.start; + target.loc.end = last.loc.end; + if (this.withSource) { + target.loc.source = parser.lexer._input.substring( + target.loc.start.offset, + target.loc.end.offset + ); + } + } +}; + +/** + * Includes locations from first & last into the target + */ +AST.prototype.resolveLocations = function(target, first, last, parser) { + if (this.withPositions) { + if (target.loc.start.offset > first.loc.start.offset) { + target.loc.start = first.loc.start; + } + if (target.loc.end.offset < last.loc.end.offset) { + target.loc.end = last.loc.end; + } + if (this.withSource) { + target.loc.source = parser.lexer._input.substring( + target.loc.start.offset, + target.loc.end.offset + ); + } + } +}; + /** * Check and fix precence, by default using right */ -AST.prototype.resolvePrecedence = function(result) { +AST.prototype.resolvePrecedence = function(result, parser) { let buffer, lLevel, rLevel; // handling precendence - if (result.kind === "bin") { + if (result.kind === "call") { + // including what argument into location + this.resolveLocations(result, result.what, result, parser); + } else if ( + result.kind === "propertylookup" || + result.kind === "staticlookup" || + (result.kind === "offsetlookup" && result.offset) + ) { + // including what argument into location + this.resolveLocations(result, result.what, result.offset, parser); + } else if (result.kind === "bin") { if (result.right && !result.right.parenthesizedExpression) { if (result.right.kind === "bin") { lLevel = AST.precedence[result.type]; @@ -276,7 +338,8 @@

// shift precedence buffer = result.right; result.right = result.right.left; - buffer.left = this.resolvePrecedence(result); + this.swapLocations(result, result.left, result.right, parser); + buffer.left = this.resolvePrecedence(result, parser); result = buffer; } } else if (result.right.kind === "retif") { @@ -285,24 +348,51 @@

if (lLevel && rLevel && rLevel <= lLevel) { buffer = result.right; result.right = result.right.test; - buffer.test = this.resolvePrecedence(result); + this.swapLocations(result, result.left, result.right, parser); + buffer.test = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.test, buffer.falseExpr, parser); result = buffer; } } } + } else if ( + result.kind === "cast" && + result.what && + !result.what.parenthesizedExpression + ) { + // https://github.com/glayzzle/php-parser/issues/172 + if (result.what.kind === "bin") { + buffer = result.what; + result.what = result.what.left; + this.swapLocations(result, result, result.what, parser); + buffer.left = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.left, buffer.right, parser); + result = buffer; + } else if (result.what.kind === "retif") { + buffer = result.what; + result.what = result.what.test; + this.swapLocations(result, result, result.what, parser); + buffer.test = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.test, buffer.falseExpr, parser); + result = buffer; + } } else if (result.kind === "unary") { // https://github.com/glayzzle/php-parser/issues/75 if (result.what && !result.what.parenthesizedExpression) { - // unary precedence is allways lower + // unary precedence is always lower if (result.what.kind === "bin") { buffer = result.what; result.what = result.what.left; - buffer.left = this.resolvePrecedence(result); + this.swapLocations(result, result, result.what, parser); + buffer.left = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.left, buffer.right, parser); result = buffer; } else if (result.what.kind === "retif") { buffer = result.what; result.what = result.what.test; - buffer.test = this.resolvePrecedence(result); + this.swapLocations(result, result, result.what, parser); + buffer.test = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.test, buffer.falseExpr, parser); result = buffer; } } @@ -315,7 +405,9 @@

) { buffer = result.falseExpr; result.falseExpr = buffer.test; - buffer.test = this.resolvePrecedence(result); + this.swapLocations(result, result.test, result.falseExpr, parser); + buffer.test = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.test, buffer.falseExpr, parser); result = buffer; } } else if (result.kind === "assign") { @@ -332,9 +424,21 @@

buffer = result.right; result.right = result.right.left; buffer.left = result; + this.swapLocations(buffer, buffer.left, result.right, parser); result = buffer; } } + } else if ( + result.kind === "silent" && + result.expr.right && + !result.expr.parenthesizedExpression + ) { + // overall least precedence + buffer = result.expr; + result.expr = buffer.left; + buffer.left = result; + this.swapLocations(buffer, buffer.left, buffer.right, parser); + result = buffer; } return result; }; @@ -374,7 +478,7 @@

} else { location = new Location(src, null, null); } - // last argument is allways the location + // last argument is always the location args.push(location); } // handle lazy kind definitions @@ -393,8 +497,26 @@

// buffer of trailingComments astNode.trailingComments = result.trailingComments; } - return self.resolvePrecedence(astNode); + if (typeof result.postBuild === "function") { + result.postBuild(astNode); + } + if (parser.debug) { + delete AST.stack[result.stackUid]; + } + return self.resolvePrecedence(astNode, parser); }; + if (parser.debug) { + if (!AST.stack) { + AST.stack = {}; + AST.stackUid = 1; + } + AST.stack[++AST.stackUid] = { + position: start, + stack: new Error().stack.split("\n").slice(3, 5) + }; + result.stackUid = AST.stackUid; + } + /** * Helper to change a node kind * @param {String} newKind @@ -414,6 +536,7 @@

result.trailingComments = docs; } }; + /** * Release a node without using it on the AST */ @@ -430,10 +553,24 @@

parser._docIndex = parser._docs.length - docs.length; } } + if (parser.debug) { + delete AST.stack[result.stackUid]; + } }; return result; }; +AST.prototype.checkNodes = function() { + const errors = []; + for (const k in AST.stack) { + if (AST.stack.hasOwnProperty(k)) { + errors.push(AST.stack[k]); + } + } + AST.stack = {}; + return errors; +}; + // Define all AST nodes [ require("./ast/array"), @@ -448,20 +585,23 @@

require("./ast/catch"), require("./ast/class"), require("./ast/classconstant"), + require("./ast/classreference"), require("./ast/clone"), require("./ast/closure"), require("./ast/comment"), require("./ast/commentblock"), require("./ast/commentline"), require("./ast/constant"), - require("./ast/constref"), + require("./ast/constantstatement"), require("./ast/continue"), require("./ast/declaration"), require("./ast/declare"), + require("./ast/declaredirective"), require("./ast/do"), require("./ast/echo"), require("./ast/empty"), require("./ast/encapsed"), + require("./ast/encapsedpart"), require("./ast/entry"), require("./ast/error"), require("./ast/eval"), @@ -489,32 +629,39 @@

require("./ast/namespace"), require("./ast/new"), require("./ast/node"), + require("./ast/noop"), require("./ast/nowdoc"), require("./ast/number"), require("./ast/offsetlookup"), require("./ast/operation"), require("./ast/parameter"), + require("./ast/parentreference"), require("./ast/post"), require("./ast/pre"), require("./ast/print"), require("./ast/program"), require("./ast/property"), require("./ast/propertylookup"), + require("./ast/propertystatement"), + require("./ast/reference"), require("./ast/retif"), require("./ast/return"), + require("./ast/selfreference"), require("./ast/silent"), require("./ast/statement"), require("./ast/static"), + require("./ast/staticvariable"), require("./ast/staticlookup"), + require("./ast/staticreference"), require("./ast/string"), require("./ast/switch"), - require("./ast/sys"), require("./ast/throw"), require("./ast/trait"), require("./ast/traitalias"), require("./ast/traitprecedence"), require("./ast/traituse"), require("./ast/try"), + require("./ast/typereference"), require("./ast/unary"), require("./ast/unset"), require("./ast/usegroup"), @@ -541,7 +688,7 @@


@@ -562,6 +709,6 @@

}); - + diff --git a/docs/ast_array.js.html b/docs/ast_array.js.html index 3b96db8a0..77bcce525 100644 --- a/docs/ast_array.js.html +++ b/docs/ast_array.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -158,7 +161,7 @@


@@ -179,6 +182,6 @@

}); - + diff --git a/docs/ast_assign.js.html b/docs/ast_assign.js.html index 64ffd6dad..c80e440a0 100644 --- a/docs/ast_assign.js.html +++ b/docs/ast_assign.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,25 +111,25 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "assign"; /** * Assigns a value to the specified target * @constructor Assign - * @extends {Statement} + * @extends {Expression} * @property {Expression} left * @property {Expression} right * @property {String} operator */ -module.exports = Statement.extends(KIND, function Assign( +module.exports = Expression.extends(KIND, function Assign( left, right, operator, docs, location ) { - Statement.apply(this, [KIND, docs, location]); + Expression.apply(this, [KIND, docs, location]); this.operator = operator; this.left = left; this.right = right; @@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_bin.js.html b/docs/ast_bin.js.html index 450a3b5c9..2b77f1327 100644 --- a/docs/ast_bin.js.html +++ b/docs/ast_bin.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -142,7 +145,7 @@


@@ -163,6 +166,6 @@

}); - + diff --git a/docs/ast_block.js.html b/docs/ast_block.js.html index 3069f7ea6..6f6ba46c4 100644 --- a/docs/ast_block.js.html +++ b/docs/ast_block.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -138,7 +141,7 @@


@@ -159,6 +162,6 @@

}); - + diff --git a/docs/ast_boolean.js.html b/docs/ast_boolean.js.html index 6fc1223d8..3decc2773 100644 --- a/docs/ast_boolean.js.html +++ b/docs/ast_boolean.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -136,7 +139,7 @@


@@ -157,6 +160,6 @@

}); - + diff --git a/docs/ast_break.js.html b/docs/ast_break.js.html index 4e8f8f5ac..fde186ed3 100644 --- a/docs/ast_break.js.html +++ b/docs/ast_break.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,17 +111,17 @@

*/ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "break"; /** * A break statement * @constructor Break - * @extends {Node} + * @extends {Statement} * @property {Number|Null} level */ -module.exports = Node.extends(KIND, function Break(level, docs, location) { - Node.apply(this, [KIND, docs, location]); +module.exports = Statement.extends(KIND, function Break(level, docs, location) { + Statement.apply(this, [KIND, docs, location]); this.level = level; }); @@ -133,7 +136,7 @@


@@ -154,6 +157,6 @@

}); - + diff --git a/docs/ast_call.js.html b/docs/ast_call.js.html index 8dbb6195f..5a77c9372 100644 --- a/docs/ast_call.js.html +++ b/docs/ast_call.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,23 +111,23 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "call"; /** * Executes a call statement * @constructor Call - * @extends {Statement} + * @extends {Expression} * @property {Identifier|Variable|??} what * @property {Arguments[]} arguments */ -module.exports = Statement.extends(KIND, function Call( +module.exports = Expression.extends(KIND, function Call( what, args, docs, location ) { - Statement.apply(this, [KIND, docs, location]); + Expression.apply(this, [KIND, docs, location]); this.what = what; this.arguments = args; }); @@ -140,7 +143,7 @@


@@ -161,6 +164,6 @@

}); - + diff --git a/docs/ast_case.js.html b/docs/ast_case.js.html index c17cbb799..5377108c9 100644 --- a/docs/ast_case.js.html +++ b/docs/ast_case.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,18 +111,23 @@

*/ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "case"; /** * A switch case statement * @constructor Case - * @extends {Node} + * @extends {Statement} * @property {Expression|null} test - if null, means that the default case * @property {Block|null} body */ -module.exports = Node.extends(KIND, function Case(test, body, docs, location) { - Node.apply(this, [KIND, docs, location]); +module.exports = Statement.extends(KIND, function Case( + test, + body, + docs, + location +) { + Statement.apply(this, [KIND, docs, location]); this.test = test; this.body = body; }); @@ -135,7 +143,7 @@


@@ -156,6 +164,6 @@

}); - + diff --git a/docs/ast_cast.js.html b/docs/ast_cast.js.html index aaf7c95bb..c43064b48 100644 --- a/docs/ast_cast.js.html +++ b/docs/ast_cast.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_catch.js.html b/docs/ast_catch.js.html index 2da7c8db9..d439aa1e5 100644 --- a/docs/ast_catch.js.html +++ b/docs/ast_catch.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -144,7 +147,7 @@


@@ -165,6 +168,6 @@

}); - + diff --git a/docs/ast_class.js.html b/docs/ast_class.js.html index 028fd113d..559a82081 100644 --- a/docs/ast_class.js.html +++ b/docs/ast_class.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -150,7 +153,7 @@


@@ -171,6 +174,6 @@

}); - + diff --git a/docs/ast_classconstant.js.html b/docs/ast_classconstant.js.html index 32451b83f..93821872a 100644 --- a/docs/ast_classconstant.js.html +++ b/docs/ast_classconstant.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,27 +111,51 @@

*/ "use strict"; -const Constant = require("./constant"); +const ConstantStatement = require("./constantstatement"); const KIND = "classconstant"; +const IS_UNDEFINED = ""; +const IS_PUBLIC = "public"; +const IS_PROTECTED = "protected"; +const IS_PRIVATE = "private"; + /** * Defines a class/interface/trait constant * @constructor ClassConstant - * @extends {Constant} - * @property {boolean} isStatic + * @extends {ConstantStatement} * @property {string} visibility */ -module.exports = Constant.extends(KIND, function ClassConstant( - name, - value, +const ClassConstant = ConstantStatement.extends(KIND, function ClassConstant( + kind, + constants, flags, docs, location ) { - Constant.apply(this, [name, value, docs, location]); - this.kind = KIND; + ConstantStatement.apply(this, [kind || KIND, constants, docs, location]); this.parseFlags(flags); }); + +/** + * Generic flags parser + * @param {Integer[]} flags + * @return {void} + */ +ClassConstant.prototype.parseFlags = function(flags) { + if (flags[0] === -1) { + this.visibility = IS_UNDEFINED; + } else if (flags[0] === null) { + this.visibility = null; + } else if (flags[0] === 0) { + this.visibility = IS_PUBLIC; + } else if (flags[0] === 1) { + this.visibility = IS_PROTECTED; + } else if (flags[0] === 2) { + this.visibility = IS_PRIVATE; + } +}; + +module.exports = ClassConstant; @@ -141,7 +168,7 @@


@@ -162,6 +189,6 @@

}); - + diff --git a/docs/ast_classreference.js.html b/docs/ast_classreference.js.html new file mode 100644 index 000000000..95c44bd7b --- /dev/null +++ b/docs/ast_classreference.js.html @@ -0,0 +1,202 @@ + + + + + + + + + + + ast/classreference.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/classreference.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Reference = require("./reference");
+const KIND = "classreference";
+
+/**
+ * Defines a class reference node
+ * @constructor ClassReference
+ * @extends {Reference}
+ * @property {string} name
+ * @property {string} resolution
+ */
+const ClassReference = Reference.extends(KIND, function ClassReference(
+  name,
+  isRelative,
+  docs,
+  location
+) {
+  Reference.apply(this, [KIND, docs, location]);
+  if (isRelative) {
+    this.resolution = ClassReference.RELATIVE_NAME;
+  } else if (name.length === 1) {
+    this.resolution = ClassReference.UNQUALIFIED_NAME;
+  } else if (!name[0]) {
+    this.resolution = ClassReference.FULL_QUALIFIED_NAME;
+  } else {
+    this.resolution = ClassReference.QUALIFIED_NAME;
+  }
+  this.name = name.join("\\");
+});
+
+/**
+ * This is an identifier without a namespace separator, such as Foo
+ * @constant {String} UNQUALIFIED_NAME
+ */
+ClassReference.UNQUALIFIED_NAME = "uqn";
+/**
+ * This is an identifier with a namespace separator, such as Foo\Bar
+ * @constant {String} QUALIFIED_NAME
+ */
+ClassReference.QUALIFIED_NAME = "qn";
+/**
+ * This is an identifier with a namespace separator that begins with
+ * a namespace separator, such as \Foo\Bar. The namespace \Foo is also
+ * a fully qualified name.
+ * @constant {String} FULL_QUALIFIED_NAME
+ */
+ClassReference.FULL_QUALIFIED_NAME = "fqn";
+/**
+ * This is an identifier starting with namespace, such as namespace\Foo\Bar.
+ * @constant {String} RELATIVE_NAME
+ */
+ClassReference.RELATIVE_NAME = "rn";
+
+module.exports = ClassReference;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_clone.js.html b/docs/ast_clone.js.html index f7e0aabfc..8e11034cf 100644 --- a/docs/ast_clone.js.html +++ b/docs/ast_clone.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,17 +111,17 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "clone"; /** * Defines a clone call * @constructor Clone - * @extends {Statement} + * @extends {Expression} * @property {Expression} what */ -module.exports = Statement.extends(KIND, function Clone(what, docs, location) { - Statement.apply(this, [KIND, docs, location]); +module.exports = Expression.extends(KIND, function Clone(what, docs, location) { + Expression.apply(this, [KIND, docs, location]); this.what = what; }); @@ -133,7 +136,7 @@


@@ -154,6 +157,6 @@

}); - + diff --git a/docs/ast_closure.js.html b/docs/ast_closure.js.html index ac73db549..ecf56ef82 100644 --- a/docs/ast_closure.js.html +++ b/docs/ast_closure.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,13 +111,13 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "closure"; /** * Defines a closure * @constructor Closure - * @extends {Statement} + * @extends {Expression} * @property {Parameter[]} arguments * @property {Variable[]} uses * @property {Identifier} type @@ -123,7 +126,7 @@

* @property {Block|null} body * @property {boolean} isStatic */ -module.exports = Statement.extends(KIND, function Closure( +module.exports = Expression.extends(KIND, function Closure( args, byref, uses, @@ -133,7 +136,7 @@

docs, location ) { - Statement.apply(this, [KIND, docs, location]); + Expression.apply(this, [KIND, docs, location]); this.uses = uses; this.arguments = args; this.byref = byref; @@ -154,7 +157,7 @@


@@ -175,6 +178,6 @@

}); - + diff --git a/docs/ast_comment.js.html b/docs/ast_comment.js.html index 68a83d6e0..6e9846f39 100644 --- a/docs/ast_comment.js.html +++ b/docs/ast_comment.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -137,7 +140,7 @@


@@ -158,6 +161,6 @@

}); - + diff --git a/docs/ast_commentblock.js.html b/docs/ast_commentblock.js.html index 5252a4188..9ba7812e6 100644 --- a/docs/ast_commentblock.js.html +++ b/docs/ast_commentblock.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -135,7 +138,7 @@


@@ -156,6 +159,6 @@

}); - + diff --git a/docs/ast_commentline.js.html b/docs/ast_commentline.js.html index a2404daae..744b84223 100644 --- a/docs/ast_commentline.js.html +++ b/docs/ast_commentline.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -135,7 +138,7 @@


@@ -156,6 +159,6 @@

}); - + diff --git a/docs/ast_constant.js.html b/docs/ast_constant.js.html index 15ea10396..cffcc245b 100644 --- a/docs/ast_constant.js.html +++ b/docs/ast_constant.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,22 +111,24 @@

*/ "use strict"; -const Declaration = require("./declaration"); +const Node = require("./node"); const KIND = "constant"; /** - * Defines a namespace constant + * Defines a constant * @constructor Constant - * @extends {Declaration} - * @property {Node|null} value + * @extends {Node} + * @property {string} name + * @property {Node|string|number|boolean|null} value */ -module.exports = Declaration.extends(KIND, function Constant( +module.exports = Node.extends(KIND, function Constant( name, value, docs, location ) { - Declaration.apply(this, [KIND, name, docs, location]); + Node.apply(this, [KIND, docs, location]); + this.name = name; this.value = value; }); @@ -138,7 +143,7 @@


@@ -159,6 +164,6 @@

}); - + diff --git a/docs/ast_constantstatement.js.html b/docs/ast_constantstatement.js.html new file mode 100644 index 000000000..b4b9efe95 --- /dev/null +++ b/docs/ast_constantstatement.js.html @@ -0,0 +1,167 @@ + + + + + + + + + + + ast/constantstatement.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/constantstatement.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Statement = require("./statement");
+const KIND = "constantstatement";
+
+/**
+ * Declares a constants into the current scope
+ * @constructor ConstantStatement
+ * @extends {Statement}
+ * @property {Constant[]} constants
+ */
+module.exports = Statement.extends(KIND, function ConstantStatement(
+  kind,
+  constants,
+  docs,
+  location
+) {
+  Statement.apply(this, [kind || KIND, docs, location]);
+  this.constants = constants;
+});
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_constref.js.html b/docs/ast_constref.js.html index abe0b7c74..7ee584444 100644 --- a/docs/ast_constref.js.html +++ b/docs/ast_constref.js.html @@ -86,7 +86,7 @@

php-parser

-

Classes

+

Classes

diff --git a/docs/ast_continue.js.html b/docs/ast_continue.js.html index f92d5b1af..0d99bb8c9 100644 --- a/docs/ast_continue.js.html +++ b/docs/ast_continue.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,17 +111,21 @@

*/ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "continue"; /** * A continue statement * @constructor Continue - * @extends {Node} + * @extends {Statement} * @property {Number|Null} level */ -module.exports = Node.extends(KIND, function Continue(level, docs, location) { - Node.apply(this, [KIND, docs, location]); +module.exports = Statement.extends(KIND, function Continue( + level, + docs, + location +) { + Statement.apply(this, [KIND, docs, location]); this.level = level; }); @@ -133,7 +140,7 @@


@@ -154,6 +161,6 @@

}); - + diff --git a/docs/ast_declaration.js.html b/docs/ast_declaration.js.html index aa3f977d0..aa35d6fd2 100644 --- a/docs/ast_declaration.js.html +++ b/docs/ast_declaration.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -120,7 +123,7 @@

* A declaration statement (function, class, interface...) * @constructor Declaration * @extends {Statement} - * @property {string} name + * @property {Identifier|string} name */ const Declaration = Statement.extends(KIND, function Declaration( kind, @@ -169,7 +172,7 @@


@@ -190,6 +193,6 @@

}); - + diff --git a/docs/ast_declare.js.html b/docs/ast_declare.js.html index 2fbc3c448..77ac6681d 100644 --- a/docs/ast_declare.js.html +++ b/docs/ast_declare.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -115,19 +118,19 @@

* The declare construct is used to set execution directives for a block of code * @constructor Declare * @extends {Block} - * @property {Expression[]} what + * @property {Array[]} directives * @property {String} mode * @see http://php.net/manual/en/control-structures.declare.php */ const Declare = Block.extends(KIND, function Declare( - what, + directives, body, mode, docs, location ) { Block.apply(this, [KIND, body, docs, location]); - this.what = what; + this.directives = directives; this.mode = mode; }); @@ -183,7 +186,7 @@


@@ -204,6 +207,6 @@

}); - + diff --git a/docs/ast_declaredirective.js.html b/docs/ast_declaredirective.js.html new file mode 100644 index 000000000..2eb62360b --- /dev/null +++ b/docs/ast_declaredirective.js.html @@ -0,0 +1,169 @@ + + + + + + + + + + + ast/declaredirective.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/declaredirective.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Node = require("./node");
+const KIND = "declaredirective";
+
+/**
+ * Defines a constant
+ * @constructor DeclareDirective
+ * @extends {Node}
+ * @property {Identifier} name
+ * @property {Node|string|number|boolean|null} value
+ */
+module.exports = Node.extends(KIND, function DeclareDirective(
+  key,
+  value,
+  docs,
+  location
+) {
+  Node.apply(this, [KIND, docs, location]);
+  this.key = key;
+  this.value = value;
+});
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_do.js.html b/docs/ast_do.js.html index e3b247922..6c988e76d 100644 --- a/docs/ast_do.js.html +++ b/docs/ast_do.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -140,7 +143,7 @@


@@ -161,6 +164,6 @@

}); - + diff --git a/docs/ast_echo.js.html b/docs/ast_echo.js.html index e8849cfc6..8d1636e4c 100644 --- a/docs/ast_echo.js.html +++ b/docs/ast_echo.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,23 +111,24 @@

*/ "use strict"; -const Sys = require("./sys"); +const Statement = require("./statement"); const KIND = "echo"; /** * Defines system based call * @constructor Echo * @property {boolean} shortForm - * @extends {Sys} + * @extends {Statement} */ -module.exports = Sys.extends(KIND, function Echo( - args, +module.exports = Statement.extends(KIND, function Echo( + expressions, shortForm, docs, location ) { - Sys.apply(this, [KIND, args, docs, location]); + Statement.apply(this, [KIND, docs, location]); this.shortForm = shortForm; + this.expressions = expressions; }); @@ -138,7 +142,7 @@


@@ -159,6 +163,6 @@

}); - + diff --git a/docs/ast_empty.js.html b/docs/ast_empty.js.html index 023c0fd54..902108e8e 100644 --- a/docs/ast_empty.js.html +++ b/docs/ast_empty.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,16 +111,21 @@

*/ "use strict"; -const Sys = require("./sys"); +const Expression = require("./expression"); const KIND = "empty"; /** * Defines an empty check call * @constructor Empty - * @extends {Sys} + * @extends {Expression} */ -module.exports = Sys.extends(KIND, function Empty(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); +module.exports = Expression.extends(KIND, function Empty( + expression, + docs, + location +) { + Expression.apply(this, [KIND, docs, location]); + this.expression = expression; }); @@ -131,7 +139,7 @@


@@ -152,6 +160,6 @@

}); - + diff --git a/docs/ast_encapsed.js.html b/docs/ast_encapsed.js.html index e12295cde..4f42f9f75 100644 --- a/docs/ast_encapsed.js.html +++ b/docs/ast_encapsed.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -185,7 +188,7 @@


@@ -206,6 +209,6 @@

}); - + diff --git a/docs/ast_encapsedpart.js.html b/docs/ast_encapsedpart.js.html new file mode 100644 index 000000000..8cfc3efbf --- /dev/null +++ b/docs/ast_encapsedpart.js.html @@ -0,0 +1,168 @@ + + + + + + + + + + + ast/encapsedpart.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/encapsedpart.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Expression = require("./expression");
+const KIND = "encapsedpart";
+
+/**
+ * Part of `Encapsed` node
+ * @constructor EncapsedPart
+ * @extends {Expression}
+ * @property {Expression} what
+ */
+module.exports = Expression.extends(KIND, function EncapsedPart(
+  expression,
+  curly,
+  docs,
+  location
+) {
+  Expression.apply(this, [KIND, docs, location]);
+  this.expression = expression;
+  this.curly = curly;
+});
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_entry.js.html b/docs/ast_entry.js.html index c5988103a..ba66dc4f5 100644 --- a/docs/ast_entry.js.html +++ b/docs/ast_entry.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,18 +111,23 @@

*/ "use strict"; -const Node = require("./node"); +const Expression = require("./expression"); const KIND = "entry"; /** * An array entry - see [Array](#array) * @constructor Entry - * @extends {Node} + * @extends {Expression} * @property {Node|null} key The entry key/offset * @property {Node} value The entry value */ -module.exports = Node.extends(KIND, function Entry(key, value, docs, location) { - Node.apply(this, [KIND, docs, location]); +module.exports = Expression.extends(KIND, function Entry( + key, + value, + docs, + location +) { + Expression.apply(this, [KIND, docs, location]); this.key = key; this.value = value; }); @@ -135,7 +143,7 @@


@@ -156,6 +164,6 @@

}); - + diff --git a/docs/ast_error.js.html b/docs/ast_error.js.html index 6f409f8d4..354112078 100644 --- a/docs/ast_error.js.html +++ b/docs/ast_error.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -146,7 +149,7 @@


@@ -167,6 +170,6 @@

}); - + diff --git a/docs/ast_eval.js.html b/docs/ast_eval.js.html index 2c7ebfe74..88f63d0e3 100644 --- a/docs/ast_eval.js.html +++ b/docs/ast_eval.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,17 +111,21 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "eval"; /** * Defines an eval statement * @constructor Eval - * @extends {Statement} + * @extends {Expression} * @property {Node} source */ -module.exports = Statement.extends(KIND, function Eval(source, docs, location) { - Statement.apply(this, [KIND, docs, location]); +module.exports = Expression.extends(KIND, function Eval( + source, + docs, + location +) { + Expression.apply(this, [KIND, docs, location]); this.source = source; }); @@ -133,7 +140,7 @@


@@ -154,6 +161,6 @@

}); - + diff --git a/docs/ast_exit.js.html b/docs/ast_exit.js.html index 483604d33..f45ba2560 100644 --- a/docs/ast_exit.js.html +++ b/docs/ast_exit.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,23 +111,23 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "exit"; /** * Defines an exit / die call * @constructor Exit - * @extends {Statement} + * @extends {Expression} * @property {Node|null} status * @property {Boolean} useDie */ -module.exports = Statement.extends(KIND, function Exit( +module.exports = Expression.extends(KIND, function Exit( status, useDie, docs, location ) { - Statement.apply(this, [KIND, docs, location]); + Expression.apply(this, [KIND, docs, location]); this.status = status; this.useDie = useDie; }); @@ -140,7 +143,7 @@


@@ -161,6 +164,6 @@

}); - + diff --git a/docs/ast_expression.js.html b/docs/ast_expression.js.html index 4f294ad62..45429ce13 100644 --- a/docs/ast_expression.js.html +++ b/docs/ast_expression.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -132,7 +135,7 @@


@@ -153,6 +156,6 @@

}); - + diff --git a/docs/ast_expressionstatement.js.html b/docs/ast_expressionstatement.js.html index 6f2bbb278..49780339e 100644 --- a/docs/ast_expressionstatement.js.html +++ b/docs/ast_expressionstatement.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -137,7 +140,7 @@


@@ -158,6 +161,6 @@

}); - + diff --git a/docs/ast_for.js.html b/docs/ast_for.js.html index 03cc6f92e..fb2b02e1b 100644 --- a/docs/ast_for.js.html +++ b/docs/ast_for.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -150,7 +153,7 @@


@@ -171,6 +174,6 @@

}); - + diff --git a/docs/ast_foreach.js.html b/docs/ast_foreach.js.html index 0c808884e..e36b91bdf 100644 --- a/docs/ast_foreach.js.html +++ b/docs/ast_foreach.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -150,7 +153,7 @@


@@ -171,6 +174,6 @@

}); - + diff --git a/docs/ast_function.js.html b/docs/ast_function.js.html index 2fe020444..d9577a9e3 100644 --- a/docs/ast_function.js.html +++ b/docs/ast_function.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -149,7 +152,7 @@


@@ -170,6 +173,6 @@

}); - + diff --git a/docs/ast_global.js.html b/docs/ast_global.js.html index c14075b0a..cae4bd4c6 100644 --- a/docs/ast_global.js.html +++ b/docs/ast_global.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -137,7 +140,7 @@


@@ -158,6 +161,6 @@

}); - + diff --git a/docs/ast_goto.js.html b/docs/ast_goto.js.html index d3e012cf4..e0f37841a 100644 --- a/docs/ast_goto.js.html +++ b/docs/ast_goto.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -134,7 +137,7 @@


@@ -155,6 +158,6 @@

}); - + diff --git a/docs/ast_halt.js.html b/docs/ast_halt.js.html index 989072a5a..3d70c7700 100644 --- a/docs/ast_halt.js.html +++ b/docs/ast_halt.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -134,7 +137,7 @@


@@ -155,6 +158,6 @@

}); - + diff --git a/docs/ast_identifier.js.html b/docs/ast_identifier.js.html index 1a4586d0b..c2e2ea1d0 100644 --- a/docs/ast_identifier.js.html +++ b/docs/ast_identifier.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -116,50 +119,16 @@

* @constructor Identifier * @extends {Node} * @property {string} name - * @property {string} resolution */ const Identifier = Node.extends(KIND, function Identifier( name, - isRelative, docs, location ) { Node.apply(this, [KIND, docs, location]); - if (isRelative) { - this.resolution = Identifier.RELATIVE_NAME; - } else if (name.length === 1) { - this.resolution = Identifier.UNQUALIFIED_NAME; - } else if (name[0] === "") { - this.resolution = Identifier.FULL_QUALIFIED_NAME; - } else { - this.resolution = Identifier.QUALIFIED_NAME; - } - this.name = name.join("\\"); + this.name = name; }); -/** - * This is an identifier without a namespace separator, such as Foo - * @constant {String} UNQUALIFIED_NAME - */ -Identifier.UNQUALIFIED_NAME = "uqn"; -/** - * This is an identifier with a namespace separator, such as Foo\Bar - * @constant {String} QUALIFIED_NAME - */ -Identifier.QUALIFIED_NAME = "qn"; -/** - * This is an identifier with a namespace separator that begins with - * a namespace separator, such as \Foo\Bar. The namespace \Foo is also - * a fully qualified name. - * @constant {String} FULL_QUALIFIED_NAME - */ -Identifier.FULL_QUALIFIED_NAME = "fqn"; -/** - * This is an identifier starting with namespace, such as namespace\Foo\Bar. - * @constant {String} RELATIVE_NAME - */ -Identifier.RELATIVE_NAME = "rn"; - module.exports = Identifier; @@ -173,7 +142,7 @@


@@ -194,6 +163,6 @@

}); - + diff --git a/docs/ast_if.js.html b/docs/ast_if.js.html index 84d7170cc..bd47743e0 100644 --- a/docs/ast_if.js.html +++ b/docs/ast_if.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -146,7 +149,7 @@


@@ -167,6 +170,6 @@

}); - + diff --git a/docs/ast_include.js.html b/docs/ast_include.js.html index d74a7a849..ea6f368ec 100644 --- a/docs/ast_include.js.html +++ b/docs/ast_include.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,25 +111,25 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "include"; /** * Defines system include call * @constructor Include - * @extends {Statement} + * @extends {Expression} * @property {Node} target * @property {boolean} once * @property {boolean} require */ -module.exports = Statement.extends(KIND, function Include( +module.exports = Expression.extends(KIND, function Include( once, require, target, docs, location ) { - Statement.apply(this, [KIND, docs, location]); + Expression.apply(this, [KIND, docs, location]); this.once = once; this.require = require; this.target = target; @@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_inline.js.html b/docs/ast_inline.js.html index 34bc6a12a..7b7d4f82c 100644 --- a/docs/ast_inline.js.html +++ b/docs/ast_inline.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -136,7 +139,7 @@


@@ -157,6 +160,6 @@

}); - + diff --git a/docs/ast_interface.js.html b/docs/ast_interface.js.html index 4d6254d01..204a5b25f 100644 --- a/docs/ast_interface.js.html +++ b/docs/ast_interface.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -141,7 +144,7 @@


@@ -162,6 +165,6 @@

}); - + diff --git a/docs/ast_isset.js.html b/docs/ast_isset.js.html index 2e287653b..da0a66720 100644 --- a/docs/ast_isset.js.html +++ b/docs/ast_isset.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,16 +111,21 @@

*/ "use strict"; -const Sys = require("./sys"); +const Expression = require("./expression"); const KIND = "isset"; /** * Defines an isset call * @constructor Isset - * @extends {Sys} + * @extends {Expression} */ -module.exports = Sys.extends(KIND, function Isset(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); +module.exports = Expression.extends(KIND, function Isset( + variables, + docs, + location +) { + Expression.apply(this, [KIND, docs, location]); + this.variables = variables; }); @@ -131,7 +139,7 @@


@@ -152,6 +160,6 @@

}); - + diff --git a/docs/ast_label.js.html b/docs/ast_label.js.html index fc8667b73..456dc3e36 100644 --- a/docs/ast_label.js.html +++ b/docs/ast_label.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,17 +111,17 @@

*/ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "label"; /** * A label statement (referenced by goto) * @constructor Label - * @extends {Node} + * @extends {Statement} * @property {String} name */ -module.exports = Node.extends(KIND, function Label(name, docs, location) { - Node.apply(this, [KIND, docs, location]); +module.exports = Statement.extends(KIND, function Label(name, docs, location) { + Statement.apply(this, [KIND, docs, location]); this.name = name; }); @@ -133,7 +136,7 @@


@@ -154,6 +157,6 @@

}); - + diff --git a/docs/ast_list.js.html b/docs/ast_list.js.html index 536162040..174dffc66 100644 --- a/docs/ast_list.js.html +++ b/docs/ast_list.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,22 +111,23 @@

*/ "use strict"; -const Sys = require("./sys"); +const Expression = require("./expression"); const KIND = "list"; /** * Defines list assignment * @constructor List - * @extends {Sys} + * @extends {Expression} * @property {boolean} shortForm */ -module.exports = Sys.extends(KIND, function List( +module.exports = Expression.extends(KIND, function List( items, shortForm, docs, location ) { - Sys.apply(this, [KIND, items, docs, location]); + Expression.apply(this, [KIND, docs, location]); + this.items = items; this.shortForm = shortForm; }); @@ -138,7 +142,7 @@


@@ -159,6 +163,6 @@

}); - + diff --git a/docs/ast_literal.js.html b/docs/ast_literal.js.html index 8b100d829..4f1340810 100644 --- a/docs/ast_literal.js.html +++ b/docs/ast_literal.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,7 +111,7 @@

*/ "use strict"; -const Expr = require("./expression"); +const Expression = require("./expression"); const KIND = "literal"; /** @@ -118,14 +121,14 @@

* @property {string} raw * @property {Node|string|number|boolean|null} value */ -module.exports = Expr.extends(KIND, function Literal( +module.exports = Expression.extends(KIND, function Literal( kind, value, raw, docs, location ) { - Expr.apply(this, [kind || KIND, docs, location]); + Expression.apply(this, [kind || KIND, docs, location]); this.value = value; if (raw) { this.raw = raw; @@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_location.js.html b/docs/ast_location.js.html index 9a89ea917..3af06641f 100644 --- a/docs/ast_location.js.html +++ b/docs/ast_location.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -134,7 +137,7 @@


@@ -155,6 +158,6 @@

}); - + diff --git a/docs/ast_lookup.js.html b/docs/ast_lookup.js.html index b03ce67aa..e73ea5bd5 100644 --- a/docs/ast_lookup.js.html +++ b/docs/ast_lookup.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -141,7 +144,7 @@


@@ -162,6 +165,6 @@

}); - + diff --git a/docs/ast_magic.js.html b/docs/ast_magic.js.html index 904cf7b19..eba4cbd51 100644 --- a/docs/ast_magic.js.html +++ b/docs/ast_magic.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -136,7 +139,7 @@


@@ -157,6 +160,6 @@

}); - + diff --git a/docs/ast_method.js.html b/docs/ast_method.js.html index 192a70c31..1cbc59129 100644 --- a/docs/ast_method.js.html +++ b/docs/ast_method.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,20 +111,20 @@

*/ "use strict"; -const fn = require("./function"); +const _Function = require("./function"); const KIND = "method"; /** * Defines a class/interface/trait method * @constructor Method - * @extends {Function} + * @extends {_Function} * @property {boolean} isAbstract * @property {boolean} isFinal * @property {boolean} isStatic * @property {string} visibility */ -module.exports = fn.extends(KIND, function Method() { - fn.apply(this, arguments); +module.exports = _Function.extends(KIND, function Method() { + _Function.apply(this, arguments); this.kind = KIND; }); @@ -136,7 +139,7 @@


@@ -157,6 +160,6 @@

}); - + diff --git a/docs/ast_namespace.js.html b/docs/ast_namespace.js.html index e13b7f28e..3b3d860cf 100644 --- a/docs/ast_namespace.js.html +++ b/docs/ast_namespace.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -141,7 +144,7 @@


@@ -162,6 +165,6 @@

}); - + diff --git a/docs/ast_new.js.html b/docs/ast_new.js.html index b5a67c441..20a1ef74b 100644 --- a/docs/ast_new.js.html +++ b/docs/ast_new.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,23 +111,23 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "new"; /** * Creates a new instance of the specified class * @constructor New - * @extends {Statement} + * @extends {Expression} * @property {Identifier|Variable|Class} what * @property {Arguments[]} arguments */ -module.exports = Statement.extends(KIND, function New( +module.exports = Expression.extends(KIND, function New( what, args, docs, location ) { - Statement.apply(this, [KIND, docs, location]); + Expression.apply(this, [KIND, docs, location]); this.what = what; this.arguments = args; }); @@ -140,7 +143,7 @@


@@ -161,6 +164,6 @@

}); - + diff --git a/docs/ast_node.js.html b/docs/ast_node.js.html index 7ec642b74..a7afa2d30 100644 --- a/docs/ast_node.js.html +++ b/docs/ast_node.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -134,6 +137,38 @@

this.trailingComments = docs; }; +/** + * Destroying an unused node + */ +Node.prototype.destroy = function(node) { + if (!node) { + throw new Error( + "Node already initialized, you must swap with another node" + ); + } + if (this.leadingComments) { + if (node.leadingComments) { + node.leadingComments = Array.concat( + this.leadingComments, + node.leadingComments + ); + } else { + node.leadingComments = this.leadingComments; + } + } + if (this.trailingComments) { + if (node.trailingComments) { + node.trailingComments = Array.concat( + this.trailingComments, + node.trailingComments + ); + } else { + node.trailingComments = this.trailingComments; + } + } + return node; +}; + /** * Includes current token position of the parser * @param {*} parser @@ -182,7 +217,7 @@


@@ -203,6 +238,6 @@

}); - + diff --git a/docs/ast_noop.js.html b/docs/ast_noop.js.html new file mode 100644 index 000000000..e8b23353a --- /dev/null +++ b/docs/ast_noop.js.html @@ -0,0 +1,161 @@ + + + + + + + + + + + ast/noop.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/noop.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Node = require("./node");
+const KIND = "noop";
+
+/**
+ * Ignore this node, it implies a no operation block, for example :
+ * [$foo, $bar, /* here a noop node * /]
+ * @constructor Noop
+ * @extends {Node}
+ */
+module.exports = Node.extends(KIND, function Noop(docs, location) {
+  Node.apply(this, [KIND, docs, location]);
+});
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_nowdoc.js.html b/docs/ast_nowdoc.js.html index dacbd10ac..4642fa08e 100644 --- a/docs/ast_nowdoc.js.html +++ b/docs/ast_nowdoc.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_number.js.html b/docs/ast_number.js.html index c9397121f..df0b1b750 100644 --- a/docs/ast_number.js.html +++ b/docs/ast_number.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -136,7 +139,7 @@


@@ -157,6 +160,6 @@

}); - + diff --git a/docs/ast_offsetlookup.js.html b/docs/ast_offsetlookup.js.html index 1bef015c1..a2c3a55f9 100644 --- a/docs/ast_offsetlookup.js.html +++ b/docs/ast_offsetlookup.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -136,7 +139,7 @@


@@ -157,6 +160,6 @@

}); - + diff --git a/docs/ast_operation.js.html b/docs/ast_operation.js.html index 70a83c8b8..ce31b29e0 100644 --- a/docs/ast_operation.js.html +++ b/docs/ast_operation.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -131,7 +134,7 @@


@@ -152,6 +155,6 @@

}); - + diff --git a/docs/ast_parameter.js.html b/docs/ast_parameter.js.html index 9df1b7136..995be27b3 100644 --- a/docs/ast_parameter.js.html +++ b/docs/ast_parameter.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -150,7 +153,7 @@


@@ -171,6 +174,6 @@

}); - + diff --git a/docs/ast_parentreference.js.html b/docs/ast_parentreference.js.html new file mode 100644 index 000000000..393910870 --- /dev/null +++ b/docs/ast_parentreference.js.html @@ -0,0 +1,166 @@ + + + + + + + + + + + ast/parentreference.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/parentreference.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Reference = require("./reference");
+const KIND = "parentreference";
+
+/**
+ * Defines a class reference node
+ * @constructor ParentReference
+ * @extends {Reference}
+ */
+const ParentReference = Reference.extends(KIND, function ParentReference(
+  raw,
+  docs,
+  location
+) {
+  Reference.apply(this, [KIND, docs, location]);
+  this.raw = raw;
+});
+module.exports = ParentReference;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_position.js.html b/docs/ast_position.js.html index 19652cf0f..6649d4dfc 100644 --- a/docs/ast_position.js.html +++ b/docs/ast_position.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -134,7 +137,7 @@


@@ -155,6 +158,6 @@

}); - + diff --git a/docs/ast_post.js.html b/docs/ast_post.js.html index 1728caa28..6d40b51e4 100644 --- a/docs/ast_post.js.html +++ b/docs/ast_post.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -140,7 +143,7 @@


@@ -161,6 +164,6 @@

}); - + diff --git a/docs/ast_pre.js.html b/docs/ast_pre.js.html index ff09c27e0..f81dbb3da 100644 --- a/docs/ast_pre.js.html +++ b/docs/ast_pre.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -140,7 +143,7 @@


@@ -161,6 +164,6 @@

}); - + diff --git a/docs/ast_print.js.html b/docs/ast_print.js.html index 481d14a74..49991bef6 100644 --- a/docs/ast_print.js.html +++ b/docs/ast_print.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,16 +111,21 @@

*/ "use strict"; -const Sys = require("./sys"); +const Expression = require("./expression"); const KIND = "print"; /** * Outputs * @constructor Print - * @extends {Sys} + * @extends {Expression} */ -module.exports = Sys.extends(KIND, function Print(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); +module.exports = Expression.extends(KIND, function Print( + expression, + docs, + location +) { + Expression.apply(this, [KIND, docs, location]); + this.expression = expression; }); @@ -131,7 +139,7 @@


@@ -152,6 +160,6 @@

}); - + diff --git a/docs/ast_program.js.html b/docs/ast_program.js.html index b8d06d92a..471a95b0e 100644 --- a/docs/ast_program.js.html +++ b/docs/ast_program.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -148,7 +151,7 @@


@@ -169,6 +172,6 @@

}); - + diff --git a/docs/ast_property.js.html b/docs/ast_property.js.html index bd193b6ce..a2a5ed60c 100644 --- a/docs/ast_property.js.html +++ b/docs/ast_property.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,28 +111,25 @@

*/ "use strict"; -const Declaration = require("./declaration"); +const Statement = require("./statement"); const KIND = "property"; /** * Defines a class property * @constructor Property - * @extends {Declaration} - * @property {boolean} isFinal - * @property {boolean} isStatic - * @property {string} visibility + * @extends {Statement} + * @property {string} name * @property {Node|null} value */ -module.exports = Declaration.extends(KIND, function Property( +module.exports = Statement.extends(KIND, function Property( name, value, - flags, docs, location ) { - Declaration.apply(this, [KIND, name, docs, location]); + Statement.apply(this, [KIND, docs, location]); + this.name = name; this.value = value; - this.parseFlags(flags); }); @@ -143,7 +143,7 @@


@@ -164,6 +164,6 @@

}); - + diff --git a/docs/ast_propertylookup.js.html b/docs/ast_propertylookup.js.html index 247aa478b..f58353b38 100644 --- a/docs/ast_propertylookup.js.html +++ b/docs/ast_propertylookup.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -136,7 +139,7 @@


@@ -157,6 +160,6 @@

}); - + diff --git a/docs/ast_propertystatement.js.html b/docs/ast_propertystatement.js.html new file mode 100644 index 000000000..09f814f68 --- /dev/null +++ b/docs/ast_propertystatement.js.html @@ -0,0 +1,197 @@ + + + + + + + + + + + ast/propertystatement.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/propertystatement.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Statement = require("./statement");
+const KIND = "propertystatement";
+
+const IS_UNDEFINED = "";
+const IS_PUBLIC = "public";
+const IS_PROTECTED = "protected";
+const IS_PRIVATE = "private";
+
+/**
+ * Declares a properties into the current scope
+ * @constructor PropertyStatement
+ * @extends {Statement}
+ * @property {Property[]} properties
+ */
+const PropertyStatement = Statement.extends(KIND, function PropertyStatement(
+  kind,
+  properties,
+  flags,
+  docs,
+  location
+) {
+  Statement.apply(this, [KIND, docs, location]);
+  this.properties = properties;
+  this.parseFlags(flags);
+});
+
+/**
+ * Generic flags parser
+ * @param {Integer[]} flags
+ * @return {void}
+ */
+PropertyStatement.prototype.parseFlags = function(flags) {
+  if (flags[0] === -1) {
+    this.visibility = IS_UNDEFINED;
+  } else if (flags[0] === null) {
+    this.visibility = null;
+  } else if (flags[0] === 0) {
+    this.visibility = IS_PUBLIC;
+  } else if (flags[0] === 1) {
+    this.visibility = IS_PROTECTED;
+  } else if (flags[0] === 2) {
+    this.visibility = IS_PRIVATE;
+  }
+
+  this.isStatic = flags[1] === 1;
+};
+
+module.exports = PropertyStatement;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_reference.js.html b/docs/ast_reference.js.html new file mode 100644 index 000000000..927520861 --- /dev/null +++ b/docs/ast_reference.js.html @@ -0,0 +1,162 @@ + + + + + + + + + + + ast/reference.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/reference.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Node = require("./node");
+const KIND = "reference";
+
+/**
+ * Defines a reference node
+ * @constructor Reference
+ * @extends {Node}
+ */
+const Reference = Node.extends(KIND, function Reference(kind, docs, location) {
+  Node.apply(this, [kind || KIND, docs, location]);
+});
+
+module.exports = Reference;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_retif.js.html b/docs/ast_retif.js.html index abfe438b9..410f28b2b 100644 --- a/docs/ast_retif.js.html +++ b/docs/ast_retif.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,25 +111,25 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "retif"; /** * Defines a short if statement that returns a value * @constructor RetIf - * @extends {Statement} + * @extends {Expression} * @property {Expression} test * @property {Expression} trueExpr * @property {Expression} falseExpr */ -module.exports = Statement.extends(KIND, function RetIf( +module.exports = Expression.extends(KIND, function RetIf( test, trueExpr, falseExpr, docs, location ) { - Statement.apply(this, [KIND, docs, location]); + Expression.apply(this, [KIND, docs, location]); this.test = test; this.trueExpr = trueExpr; this.falseExpr = falseExpr; @@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_return.js.html b/docs/ast_return.js.html index c5fba3314..d19859c8d 100644 --- a/docs/ast_return.js.html +++ b/docs/ast_return.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,17 +111,17 @@

*/ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "return"; /** * A continue statement * @constructor Return - * @extends {Node} + * @extends {Statement} * @property {Expression|null} expr */ -module.exports = Node.extends(KIND, function Return(expr, docs, location) { - Node.apply(this, [KIND, docs, location]); +module.exports = Statement.extends(KIND, function Return(expr, docs, location) { + Statement.apply(this, [KIND, docs, location]); this.expr = expr; }); @@ -133,7 +136,7 @@


@@ -154,6 +157,6 @@

}); - + diff --git a/docs/ast_selfreference.js.html b/docs/ast_selfreference.js.html new file mode 100644 index 000000000..5d37a64ae --- /dev/null +++ b/docs/ast_selfreference.js.html @@ -0,0 +1,166 @@ + + + + + + + + + + + ast/selfreference.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/selfreference.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Reference = require("./reference");
+const KIND = "selfreference";
+
+/**
+ * Defines a class reference node
+ * @constructor SelfReference
+ * @extends {Reference}
+ */
+const SelfReference = Reference.extends(KIND, function SelfReference(
+  raw,
+  docs,
+  location
+) {
+  Reference.apply(this, [KIND, docs, location]);
+  this.raw = raw;
+});
+module.exports = SelfReference;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_silent.js.html b/docs/ast_silent.js.html index efd00d7e3..2f59f8bc0 100644 --- a/docs/ast_silent.js.html +++ b/docs/ast_silent.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,17 +111,21 @@

*/ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "silent"; /** * Avoids to show/log warnings & notices from the inner expression * @constructor Silent - * @extends {Statement} + * @extends {Expression} * @property {Expression} expr */ -module.exports = Statement.extends(KIND, function Silent(expr, docs, location) { - Statement.apply(this, [KIND, docs, location]); +module.exports = Expression.extends(KIND, function Silent( + expr, + docs, + location +) { + Expression.apply(this, [KIND, docs, location]); this.expr = expr; }); @@ -133,7 +140,7 @@


@@ -154,6 +161,6 @@

}); - + diff --git a/docs/ast_statement.js.html b/docs/ast_statement.js.html index f4a0b71c3..39eec6e81 100644 --- a/docs/ast_statement.js.html +++ b/docs/ast_statement.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -131,7 +134,7 @@


@@ -152,6 +155,6 @@

}); - + diff --git a/docs/ast_static.js.html b/docs/ast_static.js.html index 1f0039335..6208ef46b 100644 --- a/docs/ast_static.js.html +++ b/docs/ast_static.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -115,15 +118,15 @@

* Declares a static variable into the current scope * @constructor Static * @extends {Statement} - * @property {Variable[]|Assign[]} items + * @property {StaticVariable[]} variables */ module.exports = Statement.extends(KIND, function Static( - items, + variables, docs, location ) { Statement.apply(this, [KIND, docs, location]); - this.items = items; + this.variables = variables; }); @@ -137,7 +140,7 @@


@@ -158,6 +161,6 @@

}); - + diff --git a/docs/ast_staticlookup.js.html b/docs/ast_staticlookup.js.html index c6f515597..fad639213 100644 --- a/docs/ast_staticlookup.js.html +++ b/docs/ast_staticlookup.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -136,7 +139,7 @@


@@ -157,6 +160,6 @@

}); - + diff --git a/docs/ast_staticreference.js.html b/docs/ast_staticreference.js.html new file mode 100644 index 000000000..1649735e6 --- /dev/null +++ b/docs/ast_staticreference.js.html @@ -0,0 +1,166 @@ + + + + + + + + + + + ast/staticreference.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/staticreference.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Reference = require("./reference");
+const KIND = "staticreference";
+
+/**
+ * Defines a class reference node
+ * @constructor StaticReference
+ * @extends {Reference}
+ */
+const StaticReference = Reference.extends(KIND, function StaticReference(
+  raw,
+  docs,
+  location
+) {
+  Reference.apply(this, [KIND, docs, location]);
+  this.raw = raw;
+});
+module.exports = StaticReference;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_staticvariable.js.html b/docs/ast_staticvariable.js.html new file mode 100644 index 000000000..260473866 --- /dev/null +++ b/docs/ast_staticvariable.js.html @@ -0,0 +1,169 @@ + + + + + + + + + + + ast/staticvariable.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/staticvariable.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Node = require("./node");
+const KIND = "staticvariable";
+
+/**
+ * Defines a constant
+ * @constructor StaticVariable
+ * @extends {Node}
+ * @property {Variable} variable
+ * @property {Node|string|number|boolean|null} defaultValue
+ */
+module.exports = Node.extends(KIND, function StaticVariable(
+  variable,
+  defaultValue,
+  docs,
+  location
+) {
+  Node.apply(this, [KIND, docs, location]);
+  this.variable = variable;
+  this.defaultValue = defaultValue;
+});
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_string.js.html b/docs/ast_string.js.html index 76a97189a..dd1460716 100644 --- a/docs/ast_string.js.html +++ b/docs/ast_string.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_switch.js.html b/docs/ast_switch.js.html index f8f950b59..07fb7741f 100644 --- a/docs/ast_switch.js.html +++ b/docs/ast_switch.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_sys.js.html b/docs/ast_sys.js.html index cba616a6b..a1b9cb200 100644 --- a/docs/ast_sys.js.html +++ b/docs/ast_sys.js.html @@ -86,7 +86,7 @@

php-parser

-

Classes

+

Classes

diff --git a/docs/ast_throw.js.html b/docs/ast_throw.js.html index 4087bb5fa..1b3b52ebb 100644 --- a/docs/ast_throw.js.html +++ b/docs/ast_throw.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -133,7 +136,7 @@


@@ -154,6 +157,6 @@

}); - + diff --git a/docs/ast_trait.js.html b/docs/ast_trait.js.html index b7c19f039..c11f9e5cf 100644 --- a/docs/ast_trait.js.html +++ b/docs/ast_trait.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -115,21 +118,15 @@

* A trait definition * @constructor Trait * @extends {Declaration} - * @property {Identifier|null} extends - * @property {Identifier[]} implements * @property {Declaration[]} body */ module.exports = Declaration.extends(KIND, function Trait( name, - ext, - impl, body, docs, location ) { Declaration.apply(this, [KIND, name, docs, location]); - this.extends = ext; - this.implements = impl; this.body = body; }); @@ -144,7 +141,7 @@


@@ -165,6 +162,6 @@

}); - + diff --git a/docs/ast_traitalias.js.html b/docs/ast_traitalias.js.html index c488a9cc4..88b72eba9 100644 --- a/docs/ast_traitalias.js.html +++ b/docs/ast_traitalias.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -121,8 +124,8 @@

* @constructor TraitAlias * @extends {Node} * @property {Identifier|null} trait - * @property {string} method - * @property {string|null} as + * @property {Identifier} method + * @property {Identifier|null} as * @property {string|null} visibility */ module.exports = Node.extends(KIND, function TraitAlias( @@ -160,7 +163,7 @@


@@ -181,6 +184,6 @@

}); - + diff --git a/docs/ast_traitprecedence.js.html b/docs/ast_traitprecedence.js.html index 8f611e9b1..2a58f0ef8 100644 --- a/docs/ast_traitprecedence.js.html +++ b/docs/ast_traitprecedence.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -116,7 +119,7 @@

* @constructor TraitPrecedence * @extends {Node} * @property {Identifier|null} trait - * @property {string} method + * @property {Identifier} method * @property {Identifier[]} instead */ module.exports = Node.extends(KIND, function TraitPrecedence( @@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_traituse.js.html b/docs/ast_traituse.js.html index 53c82fe1a..c54c00c1b 100644 --- a/docs/ast_traituse.js.html +++ b/docs/ast_traituse.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -140,7 +143,7 @@


@@ -161,6 +164,6 @@

}); - + diff --git a/docs/ast_try.js.html b/docs/ast_try.js.html index 40adff590..42537f483 100644 --- a/docs/ast_try.js.html +++ b/docs/ast_try.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -117,7 +120,7 @@

* @extends {Statement} * @property {Block} body * @property {Catch[]} catches - * @property {Block} allways + * @property {Block} always */ module.exports = Statement.extends(KIND, function Try( body, @@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_typereference.js.html b/docs/ast_typereference.js.html new file mode 100644 index 000000000..9dce07b6a --- /dev/null +++ b/docs/ast_typereference.js.html @@ -0,0 +1,182 @@ + + + + + + + + + + + ast/typereference.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ast/typereference.js +

+ + + + + +
+
+
/**
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
+ * @url http://glayzzle.com
+ */
+"use strict";
+
+const Reference = require("./reference");
+const KIND = "typereference";
+
+/**
+ * Defines a class reference node
+ * @constructor TypeReference
+ * @extends {Reference}
+ * @property {string} name
+ */
+const TypeReference = Reference.extends(KIND, function TypeReference(
+  name,
+  raw,
+  docs,
+  location
+) {
+  Reference.apply(this, [KIND, docs, location]);
+  this.name = name;
+  this.raw = raw;
+});
+
+TypeReference.types = [
+  "int",
+  "float",
+  "string",
+  "bool",
+  "object",
+  "array",
+  "callable",
+  "iterable",
+  "void"
+];
+
+module.exports = TypeReference;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/docs/ast_unary.js.html b/docs/ast_unary.js.html index ac79b7358..701419d91 100644 --- a/docs/ast_unary.js.html +++ b/docs/ast_unary.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -140,7 +143,7 @@


@@ -161,6 +164,6 @@

}); - + diff --git a/docs/ast_unset.js.html b/docs/ast_unset.js.html index 6688d73bf..952bfb7a9 100644 --- a/docs/ast_unset.js.html +++ b/docs/ast_unset.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,16 +111,21 @@

*/ "use strict"; -const Sys = require("./sys"); +const Statement = require("./statement"); const KIND = "unset"; /** * Deletes references to a list of variables * @constructor Unset - * @extends {Sys} + * @extends {Statement} */ -module.exports = Sys.extends(KIND, function Unset(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); +module.exports = Statement.extends(KIND, function Unset( + variables, + docs, + location +) { + Statement.apply(this, [KIND, docs, location]); + this.variables = variables; }); @@ -131,7 +139,7 @@


@@ -152,6 +160,6 @@

}); - + diff --git a/docs/ast_usegroup.js.html b/docs/ast_usegroup.js.html index 069765309..3140cf3f9 100644 --- a/docs/ast_usegroup.js.html +++ b/docs/ast_usegroup.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -145,7 +148,7 @@


@@ -166,6 +169,6 @@

}); - + diff --git a/docs/ast_useitem.js.html b/docs/ast_useitem.js.html index 987d57a0a..6db8920ad 100644 --- a/docs/ast_useitem.js.html +++ b/docs/ast_useitem.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -117,7 +120,7 @@

* @extends {Statement} * @property {String} name * @property {String|null} type - Possible value : function, const - * @property {String|null} alias + * @property {Identifier|null} alias * @see {Namespace} * @see http://php.net/manual/en/language.namespaces.importing.php */ @@ -158,7 +161,7 @@


@@ -179,6 +182,6 @@

}); - + diff --git a/docs/ast_variable.js.html b/docs/ast_variable.js.html index aa92315e7..3824b05f5 100644 --- a/docs/ast_variable.js.html +++ b/docs/ast_variable.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,7 +111,7 @@

*/ "use strict"; -const Expr = require("./expression"); +const Expression = require("./expression"); const KIND = "variable"; /** @@ -130,14 +133,14 @@

* @property {boolean} byref Indicate if the variable reference is used, ex `&$foo` * @property {boolean} curly Indicate if the name is defined between curlies, ex `${foo}` */ -module.exports = Expr.extends(KIND, function Variable( +module.exports = Expression.extends(KIND, function Variable( name, byref, curly, docs, location ) { - Expr.apply(this, [KIND, docs, location]); + Expression.apply(this, [KIND, docs, location]); this.name = name; this.byref = byref || false; this.curly = curly || false; @@ -154,7 +157,7 @@


@@ -175,6 +178,6 @@

}); - + diff --git a/docs/ast_variadic.js.html b/docs/ast_variadic.js.html index 85d416ed4..3086bf4c3 100644 --- a/docs/ast_variadic.js.html +++ b/docs/ast_variadic.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -108,7 +111,7 @@

*/ "use strict"; -const Expr = require("./expression"); +const Expression = require("./expression"); const KIND = "variadic"; /** @@ -118,8 +121,12 @@

* @property {Array|Expression} what * @see https://wiki.php.net/rfc/argument_unpacking */ -module.exports = Expr.extends(KIND, function variadic(what, docs, location) { - Expr.apply(this, [KIND, docs, location]); +module.exports = Expression.extends(KIND, function variadic( + what, + docs, + location +) { + Expression.apply(this, [KIND, docs, location]); this.what = what; }); @@ -134,7 +141,7 @@


@@ -155,6 +162,6 @@

}); - + diff --git a/docs/ast_while.js.html b/docs/ast_while.js.html index 3392ff85b..2ebc334c0 100644 --- a/docs/ast_while.js.html +++ b/docs/ast_while.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -143,7 +146,7 @@


@@ -164,6 +167,6 @@

}); - + diff --git a/docs/ast_yield.js.html b/docs/ast_yield.js.html index aeb34d1ad..c8a604ba3 100644 --- a/docs/ast_yield.js.html +++ b/docs/ast_yield.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -141,7 +144,7 @@


@@ -162,6 +165,6 @@

}); - + diff --git a/docs/ast_yieldfrom.js.html b/docs/ast_yieldfrom.js.html index 77fe0b3a0..a37fab448 100644 --- a/docs/ast_yieldfrom.js.html +++ b/docs/ast_yieldfrom.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -138,7 +141,7 @@


@@ -159,6 +162,6 @@

}); - + diff --git a/docs/engine.html b/docs/engine.html index a13a84364..f21572235 100644 --- a/docs/engine.html +++ b/docs/engine.html @@ -1,965 +1,989 @@ - - - - - - - - - engine - Documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - -
- -

- engine -

- - - - -
-
- -

- - engine - -

- - - -
- -
-
- - - - - - - - - - - - -

- new engine(options) -

-
- - - - - -
-

Initialise a new parser instance with the specified options

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - - - Object - - - - - - - -

List of options

- -
- - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
lexer - - - - Lexer - - - - - - - - -
parser - - - - Parser - - - - - - - - -
ast - - - - AST - - - - - - - - -
tokens - - - - Object - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - -
Tutorials:
-
- -
- - - - - -
- - - - - - - - - - - - - -
- - - - - -
Example
- - -
var parser = require('php-parser');
var instance = new parser({
  parser: {
    extractDoc: true,
    suppressErrors: true,
    php7: true
  },
  ast: {
    withPositions: true
  },
  lexer: {
    short_tags: true,
    asp_tags: true
  }
});

var evalAST = instance.parseEval('some php code');
var codeAST = instance.parseCode('<?php some php code', 'foo.php');
var tokens = instance.tokenGetAll('<?php some php code');
- - -
- - - -
- - - - - - - - - - - - - - -

Methods

- - - - - - - - - - - - - -

- parseCode(buffer, filename) → {Program} -

-
- - - - - -
+ + + + + + + + + engine - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ engine +

+ + + + +
+
+ +

+ + engine + +

+ + + +
+ +
+
+ + + + + + + + + + + + +

+ new engine(options) +

+
+ + + + + +
+

Initialise a new parser instance with the specified options

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + Object + + + + + + + +

List of options

+ +
+ + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
lexer + + + + Lexer + + + + + + + + +
parser + + + + Parser + + + + + + + + +
ast + + + + AST + + + + + + + + +
tokens + + + + Object + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + +
Tutorials:
+
+ +
+ + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
var parser = require('php-parser');
+var instance = new parser({
+  parser: {
+    extractDoc: true,
+    suppressErrors: true,
+    php7: true
+  },
+  ast: {
+    withPositions: true
+  },
+  lexer: {
+    short_tags: true,
+    asp_tags: true
+  }
+});
+
+var evalAST = instance.parseEval('some php code');
+var codeAST = instance.parseCode('<?php some php code', 'foo.php');
+var tokens = instance.tokenGetAll('<?php some php code');
+ + +
+ + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ parseCode(buffer, filename) → {Program} +

+
+ + + + + +

Function that parse a php code with open/close tags

Sample code :

-
<?php $x = 1;

Usage :

+
<?php $x = 1;
+
+

Usage :

var parser = require('php-parser');
 var phpParser = new parser({
   // some options
 });
-var ast = phpParser.parseCode('...php code...', 'foo.php');
-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
buffer - - - - String - - - - - - - -

The code to be parsed

- -
filename - - - - String - - - - - - - -

Filename

- -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

- parseEval(buffer) → {Program} -

-
- - - - - -
-

Parse an evaluating mode string (no need to open php tags)

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
buffer - - - - String - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

- tokenGetAll(buffer) → {Array.<String>} -

-
- - - - - -
+var ast = phpParser.parseCode('...php code...', 'foo.php'); + +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buffer + + + + String + + + + + + + +

The code to be parsed

+ +
filename + + + + String + + + + + + + +

Filename

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ parseEval(buffer) → {Program} +

+
+ + + + + +
+

Parse an evaluating mode string (no need to open php tags)

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buffer + + + + String + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ tokenGetAll(buffer) → {Array.<String>} +

+
+ + + + + +

Extract tokens from the specified buffer.

Note that the output tokens are STRICLY similar to PHP function token_get_all

-
-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
buffer - - - - String - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
- - - - - - - - - - - + +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buffer + + + + String + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-Semibold-webfont.eot b/docs/fonts/OpenSans-Semibold-webfont.eot old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-Semibold-webfont.svg b/docs/fonts/OpenSans-Semibold-webfont.svg old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-Semibold-webfont.ttf b/docs/fonts/OpenSans-Semibold-webfont.ttf old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-Semibold-webfont.woff b/docs/fonts/OpenSans-Semibold-webfont.woff old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.eot b/docs/fonts/OpenSans-SemiboldItalic-webfont.eot old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.svg b/docs/fonts/OpenSans-SemiboldItalic-webfont.svg old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf b/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf old mode 100644 new mode 100755 diff --git a/docs/fonts/OpenSans-SemiboldItalic-webfont.woff b/docs/fonts/OpenSans-SemiboldItalic-webfont.woff old mode 100644 new mode 100755 diff --git a/docs/global.html b/docs/global.html index 6271b5501..cb9ad0459 100644 --- a/docs/global.html +++ b/docs/global.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -219,7 +222,7 @@

@@ -286,7 +289,7 @@

@@ -320,7 +323,8 @@

<?php
 declare(ticks=1) {
 // some statements
-}
+} +

@@ -394,7 +398,8 @@

declare(ticks=1); // some statements declare(ticks=2); -// some statements +// some statements +

@@ -465,7 +470,8 @@

<?php
 declare(ticks=1):
 // some statements
-enddeclare;
+enddeclare; +

@@ -569,7 +575,7 @@

@@ -636,7 +642,7 @@

@@ -805,7 +811,8 @@

echo <<<STR Hello $world STR -; +; +

@@ -874,7 +881,8 @@

The node contains a list of constref / variables / expr :

<?php
-echo $foo->bar_$baz;
+echo $foo->bar_$baz; +
@@ -943,7 +951,8 @@

The node is a shell execute string :

<?php
-echo `ls -larth $path`;
+echo `ls -larth $path`; +
@@ -1012,7 +1021,8 @@

The node is a double quote string :

<?php
-echo "hello $world";
+echo "hello $world"; +
@@ -1116,7 +1126,7 @@

@@ -1310,7 +1320,7 @@

Parameters:

@@ -1331,6 +1341,6 @@
Parameters:
}); - + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 7c100288d..03dbbfec1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

php-parser

-

Classes

+ + +

Classes

@@ -102,7 +105,7 @@

Classes

  • Array

      This javascript library parses PHP code and convert it to AST.

      -

      Installation

      This library is distributed with npm :

      -
      npm install php-parser --save

      Usage

      +
      npm install php-parser --save
      +
      +

      Usage

      // initialize the php parser factory class
       var fs = require('fs');
       var path = require('path');
      @@ -146,7 +150,9 @@ 

      Installation

      console.log( 'Eval parse:', eval ); console.log( 'Tokens parse:', tokens ); console.log( 'File parse:', parser.parseCode(phpFile) ); -

      Sample AST output

      + + +

      Sample AST output

      {
         'kind': 'program',
         'children': [
      @@ -161,7 +167,9 @@ 

      Installation

      ] } ] -}
        +} + +
        • Try it online (demo) : http://glayzzle.com/php-parser/
        • Or from AST Explorer : https://astexplorer.net/
        @@ -175,11 +183,9 @@

        API Overview

        You can also pass options that change the behavior of the parser/lexer.

        Documentation

        You can add here your own project by opening an issue request.

        @@ -211,7 +218,7 @@

        License


        @@ -232,6 +239,6 @@

        License

        }); - + \ No newline at end of file diff --git a/docs/index.js.html b/docs/index.js.html index 7e3226a94..0d6439c04 100644 --- a/docs/index.js.html +++ b/docs/index.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -329,7 +332,7 @@


        @@ -350,6 +353,6 @@

        }); - + diff --git a/docs/lexer.html b/docs/lexer.html index 2660d4811..1c522738e 100644 --- a/docs/lexer.html +++ b/docs/lexer.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -954,7 +957,7 @@


        @@ -975,6 +978,6 @@

        }); - + \ No newline at end of file diff --git a/docs/lexer.js.html b/docs/lexer.js.html index d5f815b79..7326cddd2 100644 --- a/docs/lexer.js.html +++ b/docs/lexer.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -574,7 +577,7 @@


        @@ -595,6 +598,6 @@

        }); - + diff --git a/docs/lexer_comments.js.html b/docs/lexer_comments.js.html index 7823b5e49..8981c42c5 100644 --- a/docs/lexer_comments.js.html +++ b/docs/lexer_comments.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -176,7 +179,7 @@


        @@ -197,6 +200,6 @@

        }); - + diff --git a/docs/lexer_strings.js.html b/docs/lexer_strings.js.html index 93c72274c..1460d90ae 100644 --- a/docs/lexer_strings.js.html +++ b/docs/lexer_strings.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -530,7 +533,7 @@


        @@ -551,6 +554,6 @@

        }); - + diff --git a/docs/parser.html b/docs/parser.html index 8e464daff..810d0b376 100644 --- a/docs/parser.html +++ b/docs/parser.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -534,7 +537,7 @@

        @@ -690,7 +693,7 @@

        Parameters:
        @@ -793,7 +796,7 @@

        @@ -884,7 +887,7 @@

        @@ -975,7 +978,7 @@

        @@ -1066,7 +1069,7 @@

        @@ -1157,7 +1160,7 @@

        @@ -1248,7 +1251,7 @@

        @@ -1339,7 +1342,7 @@

        @@ -1430,7 +1433,7 @@

        @@ -1521,7 +1524,7 @@

        @@ -1564,7 +1567,7 @@


        @@ -1585,6 +1588,6 @@

        }); - + \ No newline at end of file diff --git a/docs/parser.js.html b/docs/parser.js.html index 7b4c0ee00..78e798fa6 100644 --- a/docs/parser.js.html +++ b/docs/parser.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -137,6 +140,7 @@

        this.prev = null; this.debug = false; this.php7 = true; + this.php74 = true; this.extractDoc = false; this.extractTokens = false; this.suppressErrors = false; @@ -365,7 +369,11 @@

        } else { this._tokens = null; } + if (!this.php7) { + this.php74 = false; + } this._docIndex = 0; + this._lastNode = null; this.lexer.setInput(code); this.lexer.all_tokens = this.extractTokens; this.lexer.comment_tokens = this.extractDoc; @@ -391,7 +399,27 @@

        this.lexer.yylloc.last_column, this.lexer.offset ]; - return program(childs, this._errors, this._docs, this._tokens); + const result = program(childs, this._errors, this._docs, this._tokens); + if (this.debug) { + const errors = this.ast.checkNodes(); + if (errors.length > 0) { + errors.forEach(function(error) { + if (error.position) { + // eslint-disable-next-line no-console + console.log( + "Node at line " + + error.position.line + + ", column " + + error.position.column + ); + } + // eslint-disable-next-line no-console + console.log(error.stack.join("\n")); + }); + throw new Error("Some nodes are not closed"); + } + } + return result; }; /** @@ -458,7 +486,9 @@

        docs = this._docs.slice(this._docIndex); this._docIndex = this._docs.length; if (this.debug) { + // eslint-disable-next-line no-console console.log(new Error("Append docs on " + name)); + // eslint-disable-next-line no-console console.log(docs); } } @@ -492,12 +522,30 @@

        * NOTE : As the trailingComment Behavior depends on AST, it will be build on * the AST layer - last child node will keep it's trailingComment nodes */ - node.preBuild = function() { - // inject leading comment on current node + node.postBuild = function(self) { if (this._docIndex < this._docs.length) { - node.setTrailingComments(this._docs.slice(this._docIndex)); - this._docIndex = this._docs.length; + if (this._lastNode) { + const offset = this.prev[2]; + let max = this._docIndex; + for (; max < this._docs.length; max++) { + if (this._docs[max].offset > offset) { + break; + } + } + if (max > this._docIndex) { + // inject trailing comment on child node + this._lastNode.setTrailingComments( + this._docs.slice(this._docIndex, max) + ); + this._docIndex = max; + } + } else if (this.token === this.EOF) { + // end of content + self.setTrailingComments(this._docs.slice(this._docIndex)); + this._docIndex = this._docs.length; + } } + this._lastNode = self; }.bind(this); return node; } @@ -709,6 +757,10 @@

        require("./parser/variable.js") ].forEach(function(ext) { for (const k in ext) { + if (parser.prototype.hasOwnProperty(k)) { + // @see https://github.com/glayzzle/php-parser/issues/234 + throw new Error("Function " + k + " is already defined - collision"); + } parser.prototype[k] = ext[k]; } }); @@ -726,7 +778,7 @@


        @@ -747,6 +799,6 @@

        }); - + diff --git a/docs/parser_array.js.html b/docs/parser_array.js.html index 2c9a2b2a2..62e86650a 100644 --- a/docs/parser_array.js.html +++ b/docs/parser_array.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -135,14 +138,6 @@

        if (this.next().token !== expect) { items = this.read_array_pair_list(shortForm); } - // check non empty entries - /*for(let i = 0, size = items.length - 1; i < size; i++) { - if (items[i] === null) { - this.raiseError( - "Cannot use empty array elements in arrays" - ); - } - }*/ this.expect(expect); this.next(); return result(shortForm, items); @@ -179,7 +174,7 @@

        (!shortForm && this.token === ")") || (shortForm && this.token === "]") ) { - return null; + return this.node("noop")(); } if (this.token === "&") { return this.next().read_variable(true, false, true); @@ -192,18 +187,11 @@

        } else { return entry(expr, this.read_expr()); } + } else { + entry.destroy(); } return expr; } - }, - /** - * ```ebnf - * dim_offset ::= expr? - * ``` - */ - read_dim_offset: function() { - if (this.token == "]") return false; - return this.read_expr(); } }; @@ -218,7 +206,7 @@


        @@ -239,6 +227,6 @@

        }); - + diff --git a/docs/parser_class.js.html b/docs/parser_class.js.html index b9fdbcf52..2e0cba3e9 100644 --- a/docs/parser_class.js.html +++ b/docs/parser_class.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -115,16 +118,25 @@

        * class ::= class_scope? T_CLASS T_STRING (T_EXTENDS NAMESPACE_NAME)? (T_IMPLEMENTS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' CLASS_BODY '}' * ``` */ - read_class: function(flag) { + read_class: function() { const result = this.node("class"); - this.expect(this.tok.T_CLASS); + const flag = this.read_class_scope(); + // graceful mode : ignore token & go next + if (this.token !== this.tok.T_CLASS) { + this.error(this.tok.T_CLASS); + this.next(); + return null; + } this.next().expect(this.tok.T_STRING); - const propName = this.text(); + let propName = this.node("identifier"); + const name = this.text(); + this.next(); + propName = propName(name); let propExtends = null; - let propImplements = null; - if (this.next().token == this.tok.T_EXTENDS) { + if (this.token == this.tok.T_EXTENDS) { propExtends = this.next().read_namespace_name(); } + let propImplements = null; if (this.token == this.tok.T_IMPLEMENTS) { propImplements = this.next().read_name_list(); } @@ -171,7 +183,7 @@

        // check T_USE trait if (this.token === this.tok.T_USE) { - result = result.concat(this.next().read_trait_use_statement()); + result = result.concat(this.read_trait_use_statement()); continue; } @@ -226,7 +238,9 @@

        * ``` */ read_variable_list: function(flags) { - return this.read_list( + const result = this.node("propertystatement"); + + const properties = this.read_list( /** * Reads a variable declaration * @@ -237,20 +251,24 @@

        function read_variable_declaration() { const result = this.node("property"); this.expect(this.tok.T_VARIABLE); + let propName = this.node("identifier"); const name = this.text().substring(1); // ignore $ this.next(); + propName = propName(name); if (this.token === ";" || this.token === ",") { - return result(name, null, flags); + return result(propName, null); } else if (this.token === "=") { // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L815 - return result(name, this.next().read_expr(), flags); + return result(propName, this.next().read_expr()); } else { this.expect([",", ";", "="]); - return result(name, null, flags); + return result(propName, null); } }, "," ); + + return result(null, properties, flags); }, /** * Reads constant list @@ -262,7 +280,8 @@

        if (this.expect(this.tok.T_CONST)) { this.next(); } - return this.read_list( + const result = this.node("classconstant"); + const items = this.read_list( /** * Reads a constant declaration * @@ -272,25 +291,29 @@

        * @return {Constant} [:link:](AST.md#constant) */ function read_constant_declaration() { - const result = this.node("classconstant"); - let name = null; + const result = this.node("constant"); + let constName = null; let value = null; if ( this.token === this.tok.T_STRING || (this.php7 && this.is("IDENTIFIER")) ) { - name = this.text(); + constName = this.node("identifier"); + const name = this.text(); this.next(); + constName = constName(name); } else { this.expect("IDENTIFIER"); } if (this.expect("=")) { value = this.next().read_expr(); } - return result(name, value, flags); + return result(constName, value); }, "," ); + + return result(null, items, flags); }, /** * Read member flags @@ -363,23 +386,23 @@

        */ read_interface: function() { const result = this.node("interface"); - let name = null; - let body = null; - let propExtends = null; - if (this.expect(this.tok.T_INTERFACE)) { - this.next(); - } - if (this.expect(this.tok.T_STRING)) { - name = this.text(); + if (this.token !== this.tok.T_INTERFACE) { + this.error(this.tok.T_INTERFACE); this.next(); + return null; } + this.next().expect(this.tok.T_STRING); + let propName = this.node("identifier"); + const name = this.text(); + this.next(); + propName = propName(name); + let propExtends = null; if (this.token === this.tok.T_EXTENDS) { propExtends = this.next().read_name_list(); } - if (this.expect("{")) { - body = this.next().read_interface_body(); - } - return result(name, propExtends, body); + this.expect("{"); + const body = this.next().read_interface_body(); + return result(propName, propExtends, body); }, /** * Reads an interface body @@ -438,26 +461,20 @@

        */ read_trait: function() { const result = this.node("trait"); - let propName = null; - let propExtends = null; - let propImplements = null; - let body = null; - if (this.expect(this.tok.T_TRAIT)) { + // graceful mode : ignore token & go next + if (this.token !== this.tok.T_TRAIT) { + this.error(this.tok.T_TRAIT); this.next(); + return null; } - if (this.expect(this.tok.T_STRING)) { - propName = this.text(); - } - if (this.next().token == this.tok.T_EXTENDS) { - propExtends = this.next().read_namespace_name(); - } - if (this.token == this.tok.T_IMPLEMENTS) { - propImplements = this.next().read_name_list(); - } - if (this.expect("{")) { - body = this.next().read_class_body(); - } - return result(propName, propExtends, propImplements, body); + this.next().expect(this.tok.T_STRING); + let propName = this.node("identifier"); + const name = this.text(); + this.next(); + propName = propName(name); + this.expect("{"); + const body = this.next().read_class_body(); + return result(propName, body); }, /** * reading a use statement @@ -468,6 +485,7 @@

        read_trait_use_statement: function() { // defines use statements const node = this.node("traituse"); + this.expect(this.tok.T_USE) && this.next(); const traits = [this.read_namespace_name()]; let adaptations = null; while (this.token === ",") { @@ -505,8 +523,10 @@

        let method; if (this.is("IDENTIFIER")) { - method = this.text(); + method = this.node("identifier"); + const methodName = this.text(); this.next(); + method = method(methodName); } else { method = this.read_namespace_name(); @@ -517,8 +537,10 @@

        (this.php7 && this.is("IDENTIFIER")) ) { trait = method; - method = this.text(); + method = this.node("identifier"); + const methodName = this.text(); this.next(); + method = method(methodName); } else { this.expect(this.tok.T_STRING); } @@ -548,8 +570,10 @@

        this.token === this.tok.T_STRING || (this.php7 && this.is("IDENTIFIER")) ) { - alias = this.text(); + alias = this.node("identifier"); + const name = this.text(); this.next(); + alias = alias(name); } else if (flags === false) { // no visibility flags and no name => too bad this.expect(this.tok.T_STRING); @@ -575,7 +599,7 @@


        @@ -596,6 +620,6 @@

        }); - + diff --git a/docs/parser_comment.js.html b/docs/parser_comment.js.html index c498baf07..84586d934 100644 --- a/docs/parser_comment.js.html +++ b/docs/parser_comment.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -119,6 +122,7 @@

        null, this ); + const offset = this.lexer.yylloc.first_offset; // handle location on comment const prev = this.prev; this.prev = [ @@ -128,6 +132,7 @@

        ]; this.lex(); result = result(text); + result.offset = offset; this.prev = prev; return result; }, @@ -136,6 +141,7 @@

        */ read_doc_comment: function() { let result = this.ast.prepare("commentblock", null, this); + const offset = this.lexer.yylloc.first_offset; const text = this.text(); const prev = this.prev; this.prev = [ @@ -145,6 +151,7 @@

        ]; this.lex(); result = result(text); + result.offset = offset; this.prev = prev; return result; } @@ -161,7 +168,7 @@


        @@ -182,6 +189,6 @@

        }); - + diff --git a/docs/parser_expr.js.html b/docs/parser_expr.js.html index 5215b248b..fac731b07 100644 --- a/docs/parser_expr.js.html +++ b/docs/parser_expr.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -109,9 +112,11 @@

        "use strict"; module.exports = { - read_expr: function() { + read_expr: function(expr) { const result = this.node(); - const expr = this.read_expr_item(); + if (!expr) { + expr = this.read_expr_item(); + } // binary operations if (this.token === "|") return result("bin", "|", expr, this.next().read_expr()); @@ -166,8 +171,21 @@

        return result("bin", ">=", expr, this.next().read_expr()); if (this.token === this.tok.T_SPACESHIP) return result("bin", "<=>", expr, this.next().read_expr()); - if (this.token === this.tok.T_INSTANCEOF) - return result("bin", "instanceof", expr, this.next().read_expr()); + if (this.token === this.tok.T_INSTANCEOF) { + expr = result( + "bin", + "instanceof", + expr, + this.next().read_class_name_reference() + ); + if ( + this.token !== ";" && + this.token !== this.tok.T_INLINE_HTML && + this.token !== this.EOF + ) { + expr = this.read_expr(expr); + } + } // extra operations : // $username = $_GET['user'] ?? 'nobody'; @@ -209,26 +227,13 @@

        if (this.token === "@") return this.node("silent")(this.next().read_expr()); if (this.token === "+") return this.node("unary")("+", this.next().read_expr()); + if (this.token === "-") + return this.node("unary")("-", this.next().read_expr()); if (this.token === "!") return this.node("unary")("!", this.next().read_expr()); if (this.token === "~") return this.node("unary")("~", this.next().read_expr()); - if (this.token === "-") { - result = this.node(); - this.next(); - if ( - this.token === this.tok.T_LNUMBER || - this.token === this.tok.T_DNUMBER - ) { - // negative number - result = result("number", "-" + this.text(), null); - this.next(); - return result; - } - return result("unary", "-", this.read_expr()); - } - if (this.token === "(") { expr = this.next().read_expr(); expr.parenthesizedExpression = true; @@ -238,7 +243,7 @@

        if (this.token === "`") { // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1048 - return this.next().read_encapsed_string("`"); + return this.read_encapsed_string("`"); } if (this.token === this.tok.T_LIST) { @@ -263,7 +268,7 @@

        // check if contains at least one assignment statement let hasItem = false; for (let i = 0; i < assignList.length; i++) { - if (assignList[i] !== null) { + if (assignList[i] !== null && assignList[i].kind !== "noop") { hasItem = true; break; } @@ -310,29 +315,29 @@

        ); case this.tok.T_NEW: - return this.next().read_new_expr(); + return this.read_new_expr(); case this.tok.T_ISSET: { result = this.node("isset"); if (this.next().expect("(")) { this.next(); } - const args = this.read_list(this.read_expr, ","); + const variables = this.read_list(this.read_expr, ","); if (this.expect(")")) { this.next(); } - return result(args); + return result(variables); } case this.tok.T_EMPTY: { result = this.node("empty"); if (this.next().expect("(")) { this.next(); } - const arg = this.read_expr(); + const expression = this.read_expr(); if (this.expect(")")) { this.next(); } - return result([arg]); + return result(expression); } case this.tok.T_INCLUDE: return this.node("include")(false, false, this.next().read_expr()); @@ -447,8 +452,8 @@

        // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L877 // should accept only a variable const isConst = - expr.kind === "constref" || - (expr.kind === "staticlookup" && expr.offset.kind === "constref"); + expr.kind === "identifier" || + (expr.kind === "staticlookup" && expr.offset.kind === "identifier"); // VARIABLES SPECIFIC OPERATIONS switch (this.token) { @@ -457,7 +462,10 @@

        let right; if (this.next().token == "&") { if (this.next().token === this.tok.T_NEW) { - right = this.next().read_new_expr(); + if (this.php7) { + this.error(); + } + right = this.read_new_expr(); } else { right = this.read_variable(false, false, true); } @@ -533,9 +541,9 @@

        expr = this.read_scalar(); if (expr.kind === "array" && expr.shortForm && this.token === "=") { // list assign - let list = this.node("list")(expr.items, true); + const list = this.node("list")(expr.items, true); if (expr.loc) list.loc = expr.loc; - let right = this.next().read_expr(); + const right = this.next().read_expr(); return result("assign", list, right, "="); } else { // see #189 - swap docs on nodes @@ -559,6 +567,7 @@

        */ read_new_expr: function() { const result = this.node("new"); + this.expect(this.tok.T_NEW) && this.next(); let args = []; if (this.token === this.tok.T_CLASS) { const what = this.node("class"); @@ -584,7 +593,7 @@

        ); } // Already existing class - const name = this.read_class_name_reference(); + const name = this.read_new_class_name(); if (this.token === "(") { args = this.read_function_argument_list(); } @@ -593,16 +602,16 @@

        /** * Reads a class name * ```ebnf - * class_name_reference ::= namespace_name | variable + * read_new_class_name ::= namespace_name | variable * ``` */ - read_class_name_reference: function() { + read_new_class_name: function() { if ( this.token === this.tok.T_NS_SEPARATOR || this.token === this.tok.T_STRING || this.token === this.tok.T_NAMESPACE ) { - let result = this.read_namespace_name(); + let result = this.read_namespace_name(true); if (this.token === this.tok.T_DOUBLE_COLON) { result = this.read_static_getter(result); } @@ -644,7 +653,7 @@


        @@ -665,6 +674,6 @@

        }); - + diff --git a/docs/parser_function.js.html b/docs/parser_function.js.html index 391c1ce1d..6535d873a 100644 --- a/docs/parser_function.js.html +++ b/docs/parser_function.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -183,22 +186,42 @@

        returnType = null, nullable = false; if (type !== 1) { + const nameNode = this.node("identifier"); if (type === 2) { - if ( - this.token === this.tok.T_STRING || - (this.php7 && this.is("IDENTIFIER")) - ) { + if (this.php7) { + if (this.token === this.tok.T_STRING || this.is("IDENTIFIER")) { + name = this.text(); + this.next(); + } else if (!this.php74) { + this.error("IDENTIFIER"); + } + } else if (this.token === this.tok.T_STRING) { name = this.text(); this.next(); } else { this.error("IDENTIFIER"); } } else { - if (this.expect(this.tok.T_STRING)) { - name = this.text(); + if (this.php7) { + if (this.token === this.tok.T_STRING) { + name = this.text(); + this.next(); + } else if (this.php74) { + if (!this.expect("(")) { + this.next(); + } + } else { + this.error(this.tok.T_STRING); + this.next(); + } + } else { + if (this.expect(this.tok.T_STRING)) { + name = this.text(); + } + this.next(); } - this.next(); } + name = nameNode(name); } if (this.expect("(")) this.next(); const params = this.read_parameter_list(); @@ -269,7 +292,7 @@

        */ read_parameter: function() { const node = this.node("parameter"); - let name = null; + let parameterName = null; let value = null; let type = null; let nullable = false; @@ -286,13 +309,15 @@

        const isRef = this.is_reference(); const isVariadic = this.is_variadic(); if (this.expect(this.tok.T_VARIABLE)) { - name = this.text().substring(1); + parameterName = this.node("identifier"); + const name = this.text().substring(1); this.next(); + parameterName = parameterName(name); } if (this.token == "=") { value = this.next().read_expr(); } - return node(name, type, value, isRef, isVariadic, nullable); + return node(parameterName, type, value, isRef, isVariadic, nullable); }, /** * Reads a list of arguments @@ -341,21 +366,33 @@

        * ``` */ read_type: function() { - const result = this.node("identifier"); - switch (this.token) { - case this.tok.T_ARRAY: + const result = this.node(); + if (this.token === this.tok.T_ARRAY || this.token === this.tok.T_CALLABLE) { + const type = this.text(); + this.next(); + return result("typereference", type.toLowerCase(), type); + } else if (this.token === this.tok.T_STRING) { + const type = this.text(); + const backup = [this.token, this.lexer.getState()]; + this.next(); + if ( + this.token !== this.tok.T_NS_SEPARATOR && + this.ast.typereference.types.indexOf(type.toLowerCase()) > -1 + ) { + return result("typereference", type.toLowerCase(), type); + } else { + // rollback a classic namespace + this.lexer.tokens.push(backup); this.next(); - return result(["", "array"], false); - case this.tok.T_NAMESPACE: - case this.tok.T_NS_SEPARATOR: - case this.tok.T_STRING: return this.read_namespace_name(); - case this.tok.T_CALLABLE: - this.next(); - return result(["", "callable"], false); - default: - return null; + } + } else if ( + this.token === this.tok.T_NAMESPACE || + this.token === this.tok.T_NS_SEPARATOR + ) { + return this.read_namespace_name(); } + return null; } }; @@ -370,7 +407,7 @@


        @@ -391,6 +428,6 @@

        }); - + diff --git a/docs/parser_if.js.html b/docs/parser_if.js.html index 6904bdf48..c7cbd03bc 100644 --- a/docs/parser_if.js.html +++ b/docs/parser_if.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -211,7 +214,7 @@


        @@ -232,6 +235,6 @@

        }); - + diff --git a/docs/parser_loops.js.html b/docs/parser_loops.js.html index 63384f09f..e38b8fd6e 100644 --- a/docs/parser_loops.js.html +++ b/docs/parser_loops.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -119,6 +122,7 @@

        */ read_while: function() { const result = this.node("while"); + this.expect(this.tok.T_WHILE) && this.next(); let test = null; let body = null; let shortForm = false; @@ -143,6 +147,7 @@

        */ read_do: function() { const result = this.node("do"); + this.expect(this.tok.T_DO) && this.next(); let test = null; let body = null; body = this.read_statement(); @@ -166,6 +171,7 @@

        */ read_for: function() { const result = this.node("for"); + this.expect(this.tok.T_FOR) && this.next(); let init = []; let test = []; let increment = []; @@ -208,6 +214,7 @@

        */ read_foreach: function() { const result = this.node("foreach"); + this.expect(this.tok.T_FOREACH) && this.next(); let source = null; let key = null; let value = null; @@ -277,7 +284,7 @@


        @@ -298,6 +305,6 @@

        }); - + diff --git a/docs/parser_main.js.html b/docs/parser_main.js.html index e6e3d23f9..f1cd6a2aa 100644 --- a/docs/parser_main.js.html +++ b/docs/parser_main.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -134,7 +137,7 @@


        @@ -155,6 +158,6 @@

        }); - + diff --git a/docs/parser_namespace.js.html b/docs/parser_namespace.js.html index 2216fe26c..0d0c0081a 100644 --- a/docs/parser_namespace.js.html +++ b/docs/parser_namespace.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -143,8 +146,9 @@

        return result(name.name, body, true); } else if (this.token === "(") { // resolve ambuiguity between namespace & function call - name.resolution = this.ast.identifier.RELATIVE_NAME; + name.resolution = this.ast.reference.RELATIVE_NAME; name.name = name.name.substring(1); + result.destroy(); return this.node("call")(name, this.read_function_argument_list()); } else { this.error(["{", ";"]); @@ -162,19 +166,32 @@

        * namespace_name ::= T_NS_SEPARATOR? (T_STRING T_NS_SEPARATOR)* T_STRING * ``` * @see http://php.net/manual/en/language.namespaces.rules.php - * @return {Identifier} + * @return {Reference} */ - read_namespace_name: function() { - const result = this.node("identifier"); + read_namespace_name: function(resolveReference) { + const result = this.node(); let relative = false; if (this.token === this.tok.T_NAMESPACE) { this.next().expect(this.tok.T_NS_SEPARATOR) && this.next(); relative = true; } - return result( - this.read_list(this.tok.T_STRING, this.tok.T_NS_SEPARATOR, true), - relative + const names = this.read_list( + this.tok.T_STRING, + this.tok.T_NS_SEPARATOR, + true ); + if ( + !relative && + names.length === 1 && + (resolveReference || this.token !== "(") + ) { + if (names[0].toLowerCase() === "parent") { + return result("parentreference", names[0]); + } else if (names[0].toLowerCase() === "self") { + return result("selfreference", names[0]); + } + } + return result("classreference", names, relative); }, /** * Reads a use statement @@ -206,6 +223,14 @@

        this.expect(";") && this.next(); return result; }, + /** + * + * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1045 + */ + read_class_name_reference: function() { + // resolved as the same + return this.read_variable(true, false, false); + }, /** * Reads a use declaration * ```ebnf @@ -242,7 +267,10 @@

        ) { break; } - } else if (this.token !== this.tok.T_STRING) { + } else if ( + this.token !== this.tok.T_STRING && + this.token !== this.tok.T_NS_SEPARATOR + ) { break; } result.push(this.read_use_declaration(typed)); @@ -260,8 +288,10 @@

        let result = null; if (this.token === this.tok.T_AS) { if (this.next().expect(this.tok.T_STRING)) { - result = this.text(); + const aliasName = this.node("identifier"); + const name = this.text(); this.next(); + result = aliasName(name); } } return result; @@ -297,7 +327,7 @@


        @@ -318,6 +348,6 @@

        }); - + diff --git a/docs/parser_scalar.js.html b/docs/parser_scalar.js.html index 6cdfac2ab..cea8b5adb 100644 --- a/docs/parser_scalar.js.html +++ b/docs/parser_scalar.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -203,26 +206,24 @@

        start, this.lexer.yylloc.last_offset ); + this.expect(this.tok.T_END_HEREDOC) && this.next(); node = node( value, raw, this.lexer.heredoc_label, raw[3] === '"' || raw[3] === "'" ); - this.expect(this.tok.T_END_HEREDOC) && this.next(); return node; } else { - return this.next().read_encapsed_string(this.tok.T_END_HEREDOC); + return this.read_encapsed_string(this.tok.T_END_HEREDOC); } case '"': - return this.next().read_encapsed_string('"'); + return this.read_encapsed_string('"'); case 'b"': case 'B"': { - this.next(); - this.lexer.yylloc.prev_offset -= 1; - return this.read_encapsed_string('"'); + return this.read_encapsed_string('"', true); } // NUMERIC @@ -281,6 +282,8 @@

        * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1219 */ read_encapsed_string_item: function(isDoubleQuote) { + const encapsedPart = this.node("encapsedpart"); + let curly = false; let result = this.node(), offset, node, @@ -303,19 +306,19 @@

        // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1239 name = null; if (this.next().token === this.tok.T_STRING_VARNAME) { - const varName = this.text(); name = this.node("variable"); + const varName = this.text(); this.next(); // check if lookup an offset // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1243 if (this.token === "[") { - name = name(varName, false); + name = name(varName, false, false); node = this.node("offsetlookup"); offset = this.next().read_expr(); this.expect("]") && this.next(); name = node(name, offset); } else { - name = this.node("constref")(varName); + name = varName; } } else { name = this.read_expr(); @@ -325,11 +328,9 @@

        } else if (this.token === this.tok.T_CURLY_OPEN) { // expression // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1246 + curly = true; result.destroy(); result = this.next().read_variable(false, false, false); - if (result.kind === "variable") { - result.curly = true; - } this.expect("}") && this.next(); } else if (this.token === this.tok.T_VARIABLE) { // plain variable @@ -349,7 +350,7 @@

        if (this.token === this.tok.T_OBJECT_OPERATOR) { node = this.node("propertylookup"); this.next().expect(this.tok.T_STRING); - const what = this.node("constref"); + const what = this.node("identifier"); name = this.text(); this.next(); result = node(result, what(name)); @@ -365,14 +366,15 @@

        result = result("string", false, value, false, value); } - return result; + return encapsedPart(result, curly); }, /** * Reads an encapsed string */ - read_encapsed_string: function(expect) { - const start = this.lexer.yylloc.prev_offset; + read_encapsed_string: function(expect, isBinary = false) { let node = this.node("encapsed"); + this.next(); + const start = this.lexer.yylloc.prev_offset - (isBinary ? 1 : 0); const value = []; let type = null; @@ -423,7 +425,7 @@


        @@ -444,6 +446,6 @@

        }); - + diff --git a/docs/parser_statement.js.html b/docs/parser_statement.js.html index 9942e0af9..1d7254253 100644 --- a/docs/parser_statement.js.html +++ b/docs/parser_statement.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -145,26 +148,21 @@

        return this.read_function(false, false); // optional flags case this.tok.T_ABSTRACT: - case this.tok.T_FINAL: { - const flag = this.read_class_scope(); - if (this.token === this.tok.T_CLASS) { - return this.read_class(flag); - } else { - this.error(this.tok.T_CLASS); - this.next(); - return null; - } - } + case this.tok.T_FINAL: case this.tok.T_CLASS: - return this.read_class([0, 0, 0]); + return this.read_class(); case this.tok.T_INTERFACE: return this.read_interface(); case this.tok.T_TRAIT: return this.read_trait(); case this.tok.T_USE: return this.read_use_statement(); - case this.tok.T_CONST: - return this.next().read_const_list(); + case this.tok.T_CONST: { + const result = this.node("constantstatement"); + const items = this.next().read_const_list(); + this.expectEndOfStatement(); + return result(null, items); + } case this.tok.T_NAMESPACE: return this.read_namespace(); case this.tok.T_HALT_COMPILER: { @@ -206,41 +204,46 @@

        * ``` */ read_const_list: function() { - const result = this.read_list( + return this.read_list( function() { this.expect(this.tok.T_STRING); const result = this.node("constant"); + let constName = this.node("identifier"); const name = this.text(); - if (this.next().expect("=")) { - return result(name, this.next().read_expr()); + this.next(); + constName = constName(name); + if (this.expect("=")) { + return result(constName, this.next().read_expr()); } else { // fallback - return result(name, null); + return result(constName, null); } }, ",", false ); - this.expectEndOfStatement(); - return result; }, /** * Reads a list of constants declaration * ```ebnf - * declare_list ::= T_STRING '=' expr (',' T_STRING '=' expr)* + * declare_list ::= IDENTIFIER '=' expr (',' IDENTIFIER '=' expr)* * ``` - * @retrurn {Object} + * @retrurn {Array} */ read_declare_list: function() { - const result = {}; + const result = []; while (this.token != this.EOF && this.token !== ")") { this.expect(this.tok.T_STRING); - const name = this.text().toLowerCase(); - if (this.next().expect("=")) { - result[name] = this.next().read_expr(); - } else { - result[name] = null; + const directive = this.node("declaredirective"); + let key = this.node("identifier"); + const name = this.text(); + this.next(); + key = key(name); + let value = null; + if (this.expect("=")) { + value = this.next().read_expr(); } + result.push(directive(key, value)); if (this.token !== ",") break; this.next(); } @@ -258,19 +261,9 @@

        return this.read_function(false, false); // optional flags case this.tok.T_ABSTRACT: - case this.tok.T_FINAL: { - const flag = this.read_class_scope(); - if (this.token === this.tok.T_CLASS) { - return this.read_class(flag); - } else { - this.error(this.tok.T_CLASS); - // graceful mode : ignore token & go next - this.next(); - return null; - } - } + case this.tok.T_FINAL: case this.tok.T_CLASS: - return this.read_class([0, 0, 0]); + return this.read_class(); case this.tok.T_INTERFACE: return this.read_interface(); case this.tok.T_TRAIT: @@ -295,7 +288,6 @@

        * Reads statements */ read_statement: function() { - let result, expr, items, current, label; switch (this.token) { case "{": return this.read_code_block(false); @@ -307,16 +299,16 @@

        return this.read_switch(); case this.tok.T_FOR: - return this.next().read_for(); + return this.read_for(); case this.tok.T_FOREACH: - return this.next().read_foreach(); + return this.read_foreach(); case this.tok.T_WHILE: - return this.next().read_while(); + return this.read_while(); case this.tok.T_DO: - return this.next().read_do(); + return this.read_do(); case this.tok.T_COMMENT: return this.read_comment(); @@ -324,19 +316,20 @@

        case this.tok.T_DOC_COMMENT: return this.read_doc_comment(); - case this.tok.T_RETURN: - result = this.node("return"); - expr = null; + case this.tok.T_RETURN: { + const result = this.node("return"); + let expr = null; if (!this.next().is("EOS")) { expr = this.read_expr(); } this.expectEndOfStatement(); return result(expr); + } // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L429 case this.tok.T_BREAK: case this.tok.T_CONTINUE: { - result = this.node( + const result = this.node( this.token === this.tok.T_CONTINUE ? "continue" : "break" ); let level = null; @@ -348,36 +341,38 @@

        return result(level); } - case this.tok.T_GLOBAL: - result = this.node("global"); - items = this.next().read_list(this.read_simple_variable, ","); + case this.tok.T_GLOBAL: { + const result = this.node("global"); + const items = this.next().read_list(this.read_simple_variable, ","); this.expectEndOfStatement(); return result(items); + } - case this.tok.T_STATIC: - current = [this.token, this.lexer.getState()]; - result = this.node("static"); + case this.tok.T_STATIC: { + const current = [this.token, this.lexer.getState()]; + const result = this.node(); if (this.next().token === this.tok.T_DOUBLE_COLON) { // static keyword for a class this.lexer.tokens.push(current); - expr = this.next().read_expr(); - this.expect(";") && this.next(); - return expr; + const expr = this.next().read_expr(); + this.expectEndOfStatement(expr); + return result("expressionstatement", expr); } if (this.token === this.tok.T_FUNCTION) { return this.read_function(true, [0, 1, 0]); } - items = this.read_variable_declarations(); + const items = this.read_variable_declarations(); this.expectEndOfStatement(); - return result(items); + return result("static", items); + } case this.tok.T_ECHO: { - result = this.node("echo"); + const result = this.node("echo"); const text = this.text(); const shortForm = text === "<?=" || text === "<%="; - const args = this.next().read_list(this.read_expr, ","); + const expressions = this.next().read_list(this.read_expr, ","); this.expectEndOfStatement(); - return result(args, shortForm); + return result(expressions, shortForm); } case this.tok.T_INLINE_HTML: { @@ -397,25 +392,26 @@

        prevChar = "\r\n"; } } - result = this.node("inline"); + const result = this.node("inline"); this.next(); return result(value, fixFirstLine ? prevChar + value : value); } - case this.tok.T_UNSET: - result = this.node("unset"); + case this.tok.T_UNSET: { + const result = this.node("unset"); this.next().expect("(") && this.next(); - items = this.read_list(this.read_variable, ","); + const variables = this.read_list(this.read_variable, ","); this.expect(")") && this.next(); this.expect(";") && this.next(); - return result(items); + return result(variables); + } case this.tok.T_DECLARE: { - result = this.node("declare"); + const result = this.node("declare"); const body = []; let mode; this.next().expect("(") && this.next(); - const what = this.read_declare_list(); + const directives = this.read_declare_list(); this.expect(")") && this.next(); if (this.token === ":") { this.next(); @@ -441,53 +437,61 @@

        this.expect(";") && this.next(); mode = this.ast.declare.MODE_NONE; } - return result(what, body, mode); + return result(directives, body, mode); } case this.tok.T_TRY: return this.read_try(); - case this.tok.T_THROW: - result = this.node("throw"); - expr = this.next().read_expr(); + case this.tok.T_THROW: { + const result = this.node("throw"); + const expr = this.next().read_expr(); this.expectEndOfStatement(); return result(expr); + } - case ";": // ignore this (extra ponctuation) + // ignore this (extra ponctuation) + case ";": { this.next(); return null; + } - case this.tok.T_STRING: - current = [this.token, this.lexer.getState()]; - label = this.text(); + case this.tok.T_STRING: { + const result = this.node(); + const current = [this.token, this.lexer.getState()]; + const label = this.text(); // AST : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L457 if (this.next().token === ":") { - result = this.node("label"); this.next(); - return result(label); + return result("label", label); } // default fallback expr / T_STRING '::' (etc...) + result.destroy(); this.lexer.tokens.push(current); - expr = this.next().read_expr(); - this.expectEndOfStatement(); - return expr; + const statement = this.node("expressionstatement"); + const expr = this.next().read_expr(); + this.expectEndOfStatement(expr); + return statement(expr); + } - case this.tok.T_GOTO: - result = this.node("goto"); - label = null; + case this.tok.T_GOTO: { + const result = this.node("goto"); + let label = null; if (this.next().expect(this.tok.T_STRING)) { label = this.text(); this.next().expectEndOfStatement(); } return result(label); + } - default: + default: { // default fallback expr - let statement = this.node("expressionstatement"); - expr = this.read_expr(); + const statement = this.node("expressionstatement"); + const expr = this.read_expr(); this.expectEndOfStatement(expr); return statement(expr); + } } }, /** @@ -517,7 +521,7 @@


        @@ -538,6 +542,6 @@

        }); - + diff --git a/docs/parser_switch.js.html b/docs/parser_switch.js.html index e7de0b1b1..db0a138af 100644 --- a/docs/parser_switch.js.html +++ b/docs/parser_switch.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -118,8 +121,8 @@

        * @see http://php.net/manual/en/control-structures.switch.php */ read_switch: function() { - this.expect(this.tok.T_SWITCH) && this.next(); const result = this.node("switch"); + this.expect(this.tok.T_SWITCH) && this.next(); this.expect("(") && this.next(); const test = this.read_expr(); this.expect(")") && this.next(); @@ -204,7 +207,7 @@


        @@ -225,6 +228,6 @@

        }); - + diff --git a/docs/parser_try.js.html b/docs/parser_try.js.html index e2cdf2bac..0b1dac71f 100644 --- a/docs/parser_try.js.html +++ b/docs/parser_try.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -153,7 +156,7 @@


        @@ -174,6 +177,6 @@

        }); - + diff --git a/docs/parser_utils.js.html b/docs/parser_utils.js.html index e919d5a5a..efead6ba8 100644 --- a/docs/parser_utils.js.html +++ b/docs/parser_utils.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -136,7 +139,9 @@

        const result = []; if (this.token == separator) { - if (preserveFirstSeparator) result.push(null); + if (preserveFirstSeparator) { + result.push(typeof item === "function" ? this.node("noop")() : null); + } this.next(); } @@ -176,7 +181,7 @@

        * ``` * * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L726 - * @return {Identifier[]} + * @return {Reference[]} */ read_name_list: function() { return this.read_list(this.read_namespace_name, ",", false); @@ -192,14 +197,14 @@

        * * Sample code : * ```php - * <?php class foo extends bar, baz { } + * <?php static $a = 'hello', $b = 'world'; * ``` - * @return {Variable[]|Assign[]} Returns an array composed by a list of variables, or + * @return {StaticVariable[]} Returns an array composed by a list of variables, or * assign values */ read_variable_declarations: function() { return this.read_list(function() { - const node = this.node("assign"); + const node = this.node("staticvariable"); let variable = this.node("variable"); // plain variable name if (this.expect(this.tok.T_VARIABLE)) { @@ -229,7 +234,7 @@


        @@ -250,6 +255,6 @@

        }); - + diff --git a/docs/parser_variable.js.html b/docs/parser_variable.js.html index b3c18ab64..5b7efec55 100644 --- a/docs/parser_variable.js.html +++ b/docs/parser_variable.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -146,25 +149,31 @@

        ) { result = this.node(); const name = this.read_namespace_name(); - if (this.token != this.tok.T_DOUBLE_COLON && this.token != "(") { + if ( + this.token != this.tok.T_DOUBLE_COLON && + this.token != "(" && + ["parentreference", "selfreference"].indexOf(name.kind) === -1 + ) { // @see parser.js line 130 : resolves a conflict with scalar const literal = name.name.toLowerCase(); if (literal === "true") { - result = result("boolean", true, name.name); + result = name.destroy(result("boolean", true, name.name)); } else if (literal === "false") { - result = result("boolean", false, name.name); + result = name.destroy(result("boolean", false, name.name)); } else { // @todo null keyword ? - result = result("constref", name); + result = result("identifier", name); } } else { // @fixme possible #193 bug + result.destroy(name); result = name; } } else if (this.token === this.tok.T_STATIC) { - result = this.node("constref"); + result = this.node("staticreference"); + const raw = this.text(); this.next(); - result = result("static"); + result = result(raw); } else { this.expect("VARIABLE"); } @@ -188,14 +197,20 @@

        this.token === this.tok.T_CLASS || (this.php7 && this.is("IDENTIFIER")) ) { - offset = this.node("constref"); + offset = this.node("identifier"); name = this.text(); this.next(); offset = offset(name); + } else if (this.token === "{") { + offset = this.node("literal"); + name = this.next().read_expr(); + this.expect("}") && this.next(); + offset = offset("literal", name, null); + this.expect("("); } else { this.error([this.tok.T_VARIABLE, this.tok.T_STRING]); // graceful mode : set getter as error node and continue - offset = this.node("constref"); + offset = this.node("identifier"); name = this.text(); this.next(); offset = offset(name); @@ -203,13 +218,82 @@

        return result(what, offset); }, - recursive_variable_chain_scan: function( - result, - read_only, - encapsed, - dereferencable - ) { - let name, node, offset; + read_what: function(is_static_lookup = false) { + let what = null; + let name = null; + switch (this.next().token) { + case this.tok.T_STRING: + what = this.node("identifier"); + name = this.text(); + this.next(); + what = what(name); + + if (is_static_lookup && this.token === this.tok.T_OBJECT_OPERATOR) { + this.error(); + } + + if (this.token === this.tok.T_VARIABLE) { + const inner = this.node("variable"); + name = this.text().substring(1); + this.next(); + what = this.node("encapsed")( + [what, inner(name, false, false)], + null, + "offset" + ); + if (what.loc && what.value[0].loc) { + what.loc.start = what.value[0].loc.start; + } + } else if (this.token === "{") { + const expr = this.next().read_expr(); + this.expect("}") && this.next(); + what = this.node("encapsed")([what, expr], null, "offset"); + if (what.loc && what.value[0].loc) { + what.loc.start = what.value[0].loc.start; + } + } + break; + case this.tok.T_VARIABLE: + what = this.node("variable"); + name = this.text().substring(1); + this.next(); + what = what(name, false, false); + break; + case "$": + what = this.node(); + this.next().expect(["$", "{", this.tok.T_VARIABLE]); + if (this.token === "{") { + // $obj->${$varname} + name = this.next().read_expr(); + this.expect("}") && this.next(); + what = what("literal", "literal", name, null); + } else { + // $obj->$$varname + name = this.read_expr(); + what = what("variable", name, false, false); + } + break; + case "{": + what = this.node("literal"); + name = this.next().read_expr(); + this.expect("}") && this.next(); + what = what("literal", name, null); + break; + default: + this.error([this.tok.T_STRING, this.tok.T_VARIABLE, "$", "{"]); + // graceful mode : set what as error mode & continue + what = this.node("identifier"); + name = this.text(); + this.next(); + what = what(name); + break; + } + + return what; + }, + + recursive_variable_chain_scan: function(result, read_only, encapsed) { + let node, offset; recursive_scan_loop: while (this.token != this.EOF) { switch (this.token) { case "(": @@ -243,96 +327,25 @@

        break; case this.tok.T_DOUBLE_COLON: // @see https://github.com/glayzzle/php-parser/issues/107#issuecomment-354104574 - if (result.kind === "staticlookup") { + if ( + result.kind === "staticlookup" && + result.offset.kind === "identifier" + ) { this.error(); } node = this.node("staticlookup"); - if ( - this.next().token === this.tok.T_STRING || - (this.php7 && this.is("IDENTIFIER")) - ) { - offset = this.node("constref"); - name = this.text(); - this.next(); - offset = offset(name); + result = node(result, this.read_what(true)); - if (this.token === this.tok.T_OBJECT_OPERATOR) { - this.error(); - } - } else { - this.error(this.tok.T_STRING); - // fallback on a constref node - offset = this.node("constref")(this.text()); - this.next(); - } - result = node(result, offset); + // fix 185 // static lookup dereferencables are limited to staticlookup over functions - if (dereferencable && this.token !== "(") { + /*if (dereferencable && this.token !== "(") { this.error("("); - } + }*/ break; case this.tok.T_OBJECT_OPERATOR: { node = this.node("propertylookup"); - let what = null; - switch (this.next().token) { - case this.tok.T_STRING: - what = this.node("constref"); - name = this.text(); - this.next(); - what = what(name); - if (this.token === this.tok.T_VARIABLE) { - const inner = this.node("variable"); - name = this.text().substring(1); - this.next(); - what = this.node("encapsed")( - [what, inner(name, false, false)], - null, - "offset" - ); - if (what.loc && what.value[0].loc) { - what.loc.start = what.value[0].loc.start; - } - } else if (this.token === "{") { - const expr = this.next().read_expr(); - this.expect("}") && this.next(); - what = this.node("encapsed")([what, expr], null, "offset"); - if (what.loc && what.value[0].loc) { - what.loc.start = what.value[0].loc.start; - } - } - break; - case this.tok.T_VARIABLE: - what = this.node("variable"); - name = this.text().substring(1); - this.next(); - what = what(name, false, false); - break; - case "$": - this.next().expect(["{", this.tok.T_VARIABLE]); - if (this.token === "{") { - // $obj->${$varname} - what = this.next().read_expr(); - this.expect("}") && this.next(); - } else { - // $obj->$$varname - what = this.read_expr(); - } - break; - case "{": - what = this.next().read_expr(); - this.expect("}") && this.next(); - break; - default: - this.error([this.tok.T_STRING, this.tok.T_VARIABLE]); - // graceful mode : set what as error mode & continue - what = this.node("constref"); - name = this.text(); - this.next(); - what = what(name); - break; - } - result = node(result, what); + result = node(result, this.read_what()); break; } default: @@ -349,7 +362,7 @@

        if (this.token === this.tok.T_STRING) { const text = this.text(); this.next(); - offset = offset("constref", text); + offset = offset("identifier", text); } else if (this.token === this.tok.T_NUM_STRING) { const num = this.text(); this.next(); @@ -364,10 +377,10 @@

        this.tok.T_NUM_STRING, this.tok.T_VARIABLE ]); - // fallback : consider as constref + // fallback : consider as identifier const text = this.text(); this.next(); - offset = offset("constref", text); + offset = offset("identifier", text); } return offset; }, @@ -387,16 +400,8 @@

        let offset; while (this.token != this.EOF) { const node = this.node(); - if (this.token == "[") { - offset = null; - if (encapsed) { - offset = this.next().read_encaps_var_offset(); - } else { - offset = this.next().token === "]" ? null : this.read_dim_offset(); - } - this.expect("]") && this.next(); - result = node("offsetlookup", result, offset); - } else if (this.token == "{" && !encapsed) { + if (this.token == "{" && !encapsed) { + // @fixme check coverage, not sure thats working offset = this.next().read_expr(); this.expect("}") && this.next(); result = node("offsetlookup", result, offset); @@ -434,7 +439,8 @@

        break; } case "$": // $$$var - result = result(this.read_simple_variable(false), byref); + // @fixme check coverage here + result = result(this.read_simple_variable(false), byref, false); break; case this.tok.T_VARIABLE: { // $$var @@ -467,7 +473,7 @@


        @@ -488,6 +494,6 @@

        }); - + diff --git a/docs/styles/collapse.css b/docs/styles/collapse.css new file mode 100644 index 000000000..4dc412147 --- /dev/null +++ b/docs/styles/collapse.css @@ -0,0 +1,27 @@ +@media only screen and (min-width: 681px) { + nav > ul > li:hover .methods, + .active .methods { + display: block; + } + + .methods { + display: none; + } + + nav > ul > li { + padding: 20px 0; + } + + nav > ul > li > a { + padding: 0; + } + + nav > ul > li.active a { + margin-bottom: 10px; + } + + nav > ul > li:hover > a, + nav > ul > li.active > a { + margin-bottom: 15px; + } +} diff --git a/docs/styles/jsdoc-default.css b/docs/styles/jsdoc-default.css index f2bc6a9d7..c873f1914 100644 --- a/docs/styles/jsdoc-default.css +++ b/docs/styles/jsdoc-default.css @@ -359,7 +359,8 @@ nav>ul>li>a { } nav ul ul { - margin-bottom: 10px padding-left: 0; + margin-bottom: 10px; + padding-left: 0; } nav ul ul a { @@ -465,15 +466,10 @@ footer { } .details ul { - margin: 0 -} - -.details ul { - list-style-type: none + list-style-type: none; + margin: 0; } -.details li {} - .details pre.prettyprint { margin: 0 } diff --git a/docs/tokens.js.html b/docs/tokens.js.html index b94e2ec9d..2d69330b2 100644 --- a/docs/tokens.js.html +++ b/docs/tokens.js.html @@ -20,6 +20,7 @@ + @@ -86,7 +87,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -396,7 +399,7 @@


        @@ -417,6 +420,6 @@

        }); - + diff --git a/docs/tutorial-AST_.html b/docs/tutorial-AST_.html index 5416edb8a..c18a13c77 100644 --- a/docs/tutorial-AST_.html +++ b/docs/tutorial-AST_.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

        php-parser

        -

        Classes

        + + +

        Classes

        @@ -113,8 +116,10 @@

        Abstract Syntax Tree

        "children": [ // array of nodes ] - }

        Nodes

        -

        Every node has a common structure enabling you to scan them and act accordingly.

        + } + +

        Nodes

        +

        Every node has a common structure enabling you to scan them and act accordingly.

        NOTE : This structure depends also on what options you enable.

          {
             "kind": "node name",
        @@ -136,11 +141,14 @@ 

        Abstract Syntax Tree

        "leadingComments": [ // array of comments nodes ] - }

        Nodes hierarchy

        + } + +

        Nodes hierarchy

        • Location
        • Position
        • -
        • Node
            +
          • Node +
            • Identifier
            • TraitUse
            • TraitAlias
            • @@ -148,26 +156,30 @@

              Abstract Syntax Tree

            • Entry
            • Case
            • Label
            • -
            • Comment
                +
              • Comment +
              • Error
              • -
              • Expression
                  +
                • Expression +
                  • Array
                  • Variable
                  • Variadic
                  • ConstRef
                  • Yield
                  • YieldFrom
                  • -
                  • Lookup
                      +
                    • Lookup +
                    • -
                    • Operation
                        +
                      • Operation +
                      • -
                      • Literal
                          +
                        • Literal +
                        • -
                        • Statement
                            +
                          • Statement +
                            • Eval
                            • Exit
                            • Halt
                            • @@ -215,12 +229,14 @@

                              Abstract Syntax Tree

                            • New
                            • UseGroup
                            • UseItem
                            • -
                            • Block
                                +
                              • Block +
                              • -
                              • Sys
                                  +
                                • Sys +
                                • -
                                • Declaration
                                    +
                                  • Declaration +
                                    • Class
                                    • Interface
                                    • Trait
                                    • -
                                    • Constant
                                        +
                                      • Constant +
                                      • -
                                      • Function
                                          +
                                        • Function +
                                        • @@ -258,7 +277,7 @@

                                          Abstract Syntax Tree


                                          @@ -279,6 +298,6 @@

                                          Abstract Syntax Tree

                                          }); - + \ No newline at end of file diff --git a/docs/tutorial-Engine_.html b/docs/tutorial-Engine_.html index f66279c2a..f99fb1f8b 100644 --- a/docs/tutorial-Engine_.html +++ b/docs/tutorial-Engine_.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

                                          php-parser

                                          -

                                          Classes

                                          + + +

                                          Classes

                                          @@ -124,7 +127,9 @@

                                          var evalAST = instance.parseEval('some php code'); var codeAST = instance.parseCode('<?php some php code', 'foo.php'); -var tokens = instance.tokenGetAll('<?php some php code');

                                          Type: Engine

                                          +var tokens = instance.tokenGetAll('<?php some php code'); + +

                                          Type: Engine

                                          Parameters

                                          • options Object List of options
                                          • @@ -146,12 +151,16 @@

                                            parseEval

                                            parseCode

                                            Function that parse a php code with open/close tags

                                            Sample code :

                                            -
                                            <?php $x = 1;

                                            Usage :

                                            +
                                            <?php $x = 1;
                                            +
                                            +

                                            Usage :

                                            var parser = require('php-parser');
                                             var phpParser = new parser({
                                               // some options
                                             });
                                            -var ast = phpParser.parseCode('...php code...', 'foo.php');

                                            Parameters

                                            +var ast = phpParser.parseCode('...php code...', 'foo.php'); + +

                                            Parameters

                                            • buffer String The code to be parsed
                                            • filename String Filename
                                            • @@ -182,7 +191,7 @@

                                              getStringBuffer


                                              @@ -203,6 +212,6 @@

                                              getStringBuffer

                                              }); - + \ No newline at end of file diff --git a/docs/tutorial-Options.html b/docs/tutorial-Options.html index b9beeec9f..1c4642b69 100644 --- a/docs/tutorial-Options.html +++ b/docs/tutorial-Options.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

                                              php-parser

                                              -

                                              Classes

                                              + + +

                                              Classes

                                              @@ -125,7 +128,9 @@

                                              Options

                                              asp_tags: false, short_tags: false } -});

                                              Parser

                                              +}); + +

                                              Parser

                                              • debug : enables debug output, useful for handling parsing errors when extending the library.
                                              • locations : attach location nodes to AST - see more details
                                              • @@ -148,7 +153,7 @@

                                                Lexer


                                                @@ -169,6 +174,6 @@

                                                Lexer

                                                }); - + \ No newline at end of file diff --git a/docs/tutorial-Parser_.html b/docs/tutorial-Parser_.html index bd2b30526..c0133e942 100644 --- a/docs/tutorial-Parser_.html +++ b/docs/tutorial-Parser_.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

                                                php-parser

                                                -

                                                Classes

                                                + + +

                                                Classes

                                                @@ -166,10 +169,10 @@

                                                expect

                                                be added to the program error stack and this function will return false.

                                                Parameters

                                                +
                                                  +
                                                • Throws any Error

                                                Returns boolean

                                                text

                                                @@ -190,7 +193,9 @@

                                                ignoreStack

                                                read_array

                                                Parse an array

                                                array ::= T_ARRAY '(' array_pair_list ')' |
                                                -  '[' array_pair_list ']'

                                                read_array_pair_list

                                                + '[' array_pair_list ']' + +

                                                read_array_pair_list

                                                Reads an array entry item

                                                array_pair_list ::= '&' w_variable |
                                                  (
                                                @@ -199,18 +204,32 @@ 

                                                read_array

                                                expr | '&' w_variable ) )? - )

                                                read_dim_offset

                                                -
                                                 dim_offset ::= expr?

                                                read_class

                                                + ) + +

                                                read_dim_offset

                                                +
                                                 dim_offset ::= expr?
                                                +
                                                +

                                                read_class

                                                reading a class

                                                -
                                                class ::= class_scope? T_CLASS T_STRING (T_EXTENDS NAMESPACE_NAME)? (T_IMPLEMENTS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' CLASS_BODY '}'

                                                read_class_scope

                                                +
                                                class ::= class_scope? T_CLASS T_STRING (T_EXTENDS NAMESPACE_NAME)? (T_IMPLEMENTS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' CLASS_BODY '}'
                                                +
                                                +

                                                read_class_scope

                                                Read the class visibility

                                                -
                                                  class_scope ::= (T_FINAL | T_ABSTRACT)?

                                                read_class_body

                                                +
                                                  class_scope ::= (T_FINAL | T_ABSTRACT)?
                                                +
                                                +

                                                read_class_body

                                                Reads a class body

                                                -
                                                  class_body ::= (member_flags? (T_VAR | T_STRING | T_FUNCTION))*

                                                read_variable_list

                                                +
                                                  class_body ::= (member_flags? (T_VAR | T_STRING | T_FUNCTION))*
                                                +
                                                +

                                                read_variable_list

                                                Reads variable list

                                                -
                                                 variable_list ::= (variable_declaration ',')* variable_declaration

                                                read_constant_list

                                                +
                                                 variable_list ::= (variable_declaration ',')* variable_declaration
                                                +
                                                +

                                                read_constant_list

                                                Reads constant list

                                                -
                                                 constant_list ::= T_CONST (constant_declaration ',')* constant_declaration

                                                read_member_flags

                                                +
                                                 constant_list ::= T_CONST (constant_declaration ',')* constant_declaration
                                                +
                                                +

                                                read_member_flags

                                                Read member flags

                                                Returns any array 1st index : 0 => public, 1 => protected, 2 => private @@ -218,105 +237,173 @@

                                                read_array

                                                3rd index : 0 => normal, 1 => abstract member, 2 => final member

                                                read_interface

                                                reading an interface

                                                -
                                                interface ::= T_INTERFACE T_STRING (T_EXTENDS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' INTERFACE_BODY '}'

                                                read_interface_body

                                                +
                                                interface ::= T_INTERFACE T_STRING (T_EXTENDS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' INTERFACE_BODY '}'
                                                +
                                                +

                                                read_interface_body

                                                Reads an interface body

                                                -
                                                  interface_body ::= (member_flags? (T_CONST | T_FUNCTION))*

                                                read_trait

                                                +
                                                  interface_body ::= (member_flags? (T_CONST | T_FUNCTION))*
                                                +
                                                +

                                                read_trait

                                                reading a trait

                                                -
                                                trait ::= T_TRAIT T_STRING (T_EXTENDS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' FUNCTION* '}'

                                                read_trait_use_statement

                                                +
                                                trait ::= T_TRAIT T_STRING (T_EXTENDS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' FUNCTION* '}'
                                                +
                                                +

                                                read_trait_use_statement

                                                reading a use statement

                                                -
                                                trait_use_statement ::= namespace_name (',' namespace_name)* ('{' trait_use_alias '}')?

                                                read_trait_use_alias

                                                +
                                                trait_use_statement ::= namespace_name (',' namespace_name)* ('{' trait_use_alias '}')?
                                                +
                                                +

                                                read_trait_use_alias

                                                Reading trait alias

                                                -
                                                trait_use_alias ::= namespace_name ( T_DOUBLE_COLON T_STRING )? (T_INSTEADOF namespace_name) | (T_AS member_flags? T_STRING)

                                                name list : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L303 -trait adaptation : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L742

                                                +
                                                trait_use_alias ::= namespace_name ( T_DOUBLE_COLON T_STRING )? (T_INSTEADOF namespace_name) | (T_AS member_flags? T_STRING)
                                                +
                                                +

                                                name list : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L303 +trait adaptation : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L742

                                                read_variable_declaration

                                                Reads a variable declaration

                                                -
                                                 variable_declaration ::= T_VARIABLE '=' scalar

                                                read_constant_declaration

                                                +
                                                 variable_declaration ::= T_VARIABLE '=' scalar
                                                +
                                                +

                                                read_constant_declaration

                                                Reads a constant declaration

                                                -
                                                 constant_declaration ::= (T_STRING | IDENTIFIER) '=' expr

                                                Returns Constant :link:

                                                +
                                                 constant_declaration ::= (T_STRING | IDENTIFIER) '=' expr
                                                +
                                                +

                                                Returns Constant :link:

                                                read_comment

                                                Comments with // or # or / _ ... _ /

                                                read_doc_comment

                                                Comments with / *_ ... _ /

                                                read_expr_item

                                                Reads an expression
                                                - expr ::= @todo

                                                read_new_expr

                                                -
                                                   new_expr ::= T_NEW (namespace_name function_argument_list) | (T_CLASS ... class declaration)

                                                https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L850

                                                + expr ::= @todo + +

                                                read_new_expr

                                                +
                                                   new_expr ::= T_NEW (namespace_name function_argument_list) | (T_CLASS ... class declaration)
                                                +
                                                +

                                                https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L850

                                                read_class_name_reference

                                                Reads a class name

                                                -
                                                class_name_reference ::= namespace_name | variable

                                                read_assignment_list

                                                -
                                                  assignment_list ::= assignment_list_element (',' assignment_list_element?)*

                                                read_assignment_list_element

                                                -
                                                 assignment_list_element ::= expr | expr T_DOUBLE_ARROW expr

                                                is_reference

                                                +
                                                class_name_reference ::= namespace_name | variable
                                                +
                                                +

                                                read_assignment_list

                                                +
                                                  assignment_list ::= assignment_list_element (',' assignment_list_element?)*
                                                +
                                                +

                                                read_assignment_list_element

                                                +
                                                 assignment_list_element ::= expr | expr T_DOUBLE_ARROW expr
                                                +
                                                +

                                                is_reference

                                                checks if current token is a reference keyword

                                                is_variadic

                                                checks if current token is a variadic keyword

                                                read_function

                                                reading a function

                                                -
                                                function ::= function_declaration code_block

                                                read_function_declaration

                                                +
                                                function ::= function_declaration code_block
                                                +
                                                +

                                                read_function_declaration

                                                reads a function declaration (without his body)

                                                -
                                                function_declaration ::= T_FUNCTION '&'?  T_STRING '(' parameter_list ')'

                                                read_lexical_var

                                                -
                                                lexical_var ::= '&'? T_VARIABLE

                                                read_parameter_list

                                                +
                                                function_declaration ::= T_FUNCTION '&'?  T_STRING '(' parameter_list ')'
                                                +
                                                +

                                                read_lexical_var

                                                +
                                                lexical_var ::= '&'? T_VARIABLE
                                                +
                                                +

                                                read_parameter_list

                                                reads a list of parameters

                                                -
                                                 parameter_list ::= (parameter ',')* parameter?

                                                read_parameter

                                                -
                                                 parameter ::= type? '&'? T_ELLIPSIS? T_VARIABLE ('=' expr)?

                                                read_function_argument_list

                                                +
                                                 parameter_list ::= (parameter ',')* parameter?
                                                +
                                                +

                                                read_parameter

                                                +
                                                 parameter ::= type? '&'? T_ELLIPSIS? T_VARIABLE ('=' expr)?
                                                +
                                                +

                                                read_function_argument_list

                                                Reads a list of arguments

                                                -
                                                 function_argument_list ::= '(' (argument_list (',' argument_list)*)? ')'

                                                read_argument_list

                                                -
                                                   argument_list ::= T_ELLIPSIS? expr

                                                read_type

                                                +
                                                 function_argument_list ::= '(' (argument_list (',' argument_list)*)? ')'
                                                +
                                                +

                                                read_argument_list

                                                +
                                                   argument_list ::= T_ELLIPSIS? expr
                                                +
                                                +

                                                read_type

                                                read type hinting

                                                -
                                                 type ::= T_ARRAY | T_CALLABLE | namespace_name

                                                read_if

                                                +
                                                 type ::= T_ARRAY | T_CALLABLE | namespace_name
                                                +
                                                +

                                                read_if

                                                Reads an IF statement

                                                -
                                                 if ::= T_IF '(' expr ')' ':' ...

                                                read_if_expr

                                                +
                                                 if ::= T_IF '(' expr ')' ':' ...
                                                +
                                                +

                                                read_if_expr

                                                reads an if expression : '(' expr ')'

                                                read_elseif_short

                                                reads an elseif (expr): statements

                                                read_else_short

                                                read_while

                                                Reads a while statement

                                                -
                                                while ::= T_WHILE (statement | ':' inner_statement_list T_ENDWHILE ';')

                                                Returns While

                                                +
                                                while ::= T_WHILE (statement | ':' inner_statement_list T_ENDWHILE ';')
                                                +
                                                +

                                                Returns While

                                                read_do

                                                Reads a do / while loop

                                                -
                                                do ::= T_DO statement T_WHILE '(' expr ')' ';'

                                                Returns Do

                                                +
                                                do ::= T_DO statement T_WHILE '(' expr ')' ';'
                                                +
                                                +

                                                Returns Do

                                                read_for

                                                Read a for incremental loop

                                                for ::= T_FOR '(' for_exprs ';' for_exprs ';' for_exprs ')' for_statement
                                                 for_statement ::= statement | ':' inner_statement_list T_ENDFOR ';'
                                                -for_exprs ::= expr? (',' expr)*

                                                Returns For

                                                +for_exprs ::= expr? (',' expr)* + +

                                                Returns For

                                                read_foreach

                                                Reads a foreach loop

                                                -
                                                foreach ::= '(' expr T_AS foreach_variable (T_DOUBLE_ARROW foreach_variable)? ')' statement

                                                Returns Foreach

                                                +
                                                foreach ::= '(' expr T_AS foreach_variable (T_DOUBLE_ARROW foreach_variable)? ')' statement
                                                +
                                                +

                                                Returns Foreach

                                                read_foreach_variable

                                                Reads a foreach variable statement

                                                foreach_variable = variable |
                                                  T_LIST '(' assignment_list ')' |
                                                - '[' array_pair_list ']'

                                                Returns Expression

                                                + '[' array_pair_list ']' + +

                                                Returns Expression

                                                read_start

                                                -
                                                start ::= (namespace | top_statement)*

                                                read_namespace

                                                +
                                                start ::= (namespace | top_statement)*
                                                +
                                                +

                                                read_namespace

                                                Reads a namespace declaration block

                                                namespace ::= T_NAMESPACE namespace_name? '{'
                                                    top_statements
                                                 '}'
                                                -| T_NAMESPACE namespace_name ';' top_statements

                                                Returns Namespace

                                                +| T_NAMESPACE namespace_name ';' top_statements + +

                                                Returns Namespace

                                                read_namespace_name

                                                Reads a namespace name

                                                -
                                                 namespace_name ::= T_NS_SEPARATOR? (T_STRING T_NS_SEPARATOR)* T_STRING

                                                Returns Identifier

                                                +
                                                 namespace_name ::= T_NS_SEPARATOR? (T_STRING T_NS_SEPARATOR)* T_STRING
                                                +
                                                +

                                                Returns Identifier

                                                read_use_statement

                                                Reads a use statement

                                                use_statement ::= T_USE
                                                   use_type? use_declarations |
                                                   use_type use_statement '{' use_declarations '}' |
                                                   use_statement '{' use_declarations(=>typed) '}'
                                                -';'

                                                Returns UseGroup

                                                +';' + +

                                                Returns UseGroup

                                                read_use_declaration

                                                Reads a use declaration

                                                -
                                                use_declaration ::= use_type? namespace_name use_alias

                                                Returns UseItem

                                                +
                                                use_declaration ::= use_type? namespace_name use_alias
                                                +
                                                +

                                                Returns UseItem

                                                read_use_declarations

                                                Reads a list of use declarations

                                                -
                                                use_declarations ::= use_declaration (',' use_declaration)*

                                                Returns Array<UseItem>

                                                +
                                                use_declarations ::= use_declaration (',' use_declaration)*
                                                +
                                                +

                                                Returns Array<UseItem>

                                                read_use_alias

                                                Reads a use statement

                                                -
                                                use_alias ::= (T_AS T_STRING)?

                                                Returns (String | null)

                                                +
                                                use_alias ::= (T_AS T_STRING)?
                                                +
                                                +

                                                Returns (String | null)

                                                read_use_type

                                                Reads the namespace type declaration

                                                -
                                                use_type ::= (T_FUNCTION | T_CONST)?

                                                Returns (String | null) Possible values : function, const

                                                +
                                                use_type ::= (T_FUNCTION | T_CONST)?
                                                +
                                                +

                                                Returns (String | null) Possible values : function, const

                                                resolve_special_chars

                                                Unescape special chars

                                                read_scalar

                                                @@ -325,7 +412,9 @@

                                                read_scalar

                                                | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE? T_END_HEREDOC | '"' encaps_list '"' | T_START_HEREDOC encaps_list T_END_HEREDOC - | namespace_name (T_DOUBLE_COLON T_STRING)?

                                                read_dereferencable

                                                + | namespace_name (T_DOUBLE_COLON T_STRING)? + +

                                                read_dereferencable

                                                Handles the dereferencing

                                                read_encapsed_string_item

                                                Reads and extracts an encapsed item

                                                @@ -336,41 +425,65 @@

                                                read_encapsed_string_item

                                                | T_CURLY_OPEN variable '}' | variable | variable '[' expr ']' - | variable T_OBJECT_OPERATOR T_STRING

                                                Returns (String | Variable | Expr | Lookup)

                                                + | variable T_OBJECT_OPERATOR T_STRING + +

                                                Returns (String | Variable | Expr | Lookup)

                                                read_encapsed_string

                                                Reads an encapsed string

                                                get_magic_constant

                                                Constant token

                                                read_top_statements

                                                reading a list of top statements (helper for top_statement*)

                                                -
                                                 top_statements ::= top_statement*

                                                read_top_statement

                                                +
                                                 top_statements ::= top_statement*
                                                +
                                                +

                                                read_top_statement

                                                reading a top statement

                                                 top_statement ::=
                                                       namespace | function | class
                                                       | interface | trait
                                                       | use_statements | const_list
                                                -      | statement

                                                read_inner_statements

                                                + | statement + +

                                                read_inner_statements

                                                reads a list of simple inner statements (helper for inner_statement*)

                                                -
                                                 inner_statements ::= inner_statement*

                                                read_const_list

                                                +
                                                 inner_statements ::= inner_statement*
                                                +
                                                +

                                                read_const_list

                                                Reads a list of constants declaration

                                                -
                                                  const_list ::= T_CONST T_STRING '=' expr (',' T_STRING '=' expr)* ';'

                                                read_declare_list

                                                +
                                                  const_list ::= T_CONST T_STRING '=' expr (',' T_STRING '=' expr)* ';'
                                                +
                                                +

                                                read_declare_list

                                                Reads a list of constants declaration

                                                -
                                                  declare_list ::= T_STRING '=' expr (',' T_STRING '=' expr)*

                                                read_inner_statement

                                                +
                                                  declare_list ::= T_STRING '=' expr (',' T_STRING '=' expr)*
                                                +
                                                +

                                                read_inner_statement

                                                reads a simple inner statement

                                                -
                                                 inner_statement ::= '{' inner_statements '}' | token

                                                read_statement

                                                +
                                                 inner_statement ::= '{' inner_statements '}' | token
                                                +
                                                +

                                                read_statement

                                                Reads statements

                                                read_code_block

                                                -
                                                 code_block ::= '{' (inner_statements | top_statements) '}'

                                                read_switch

                                                +
                                                 code_block ::= '{' (inner_statements | top_statements) '}'
                                                +
                                                +

                                                read_switch

                                                Reads a switch statement

                                                -
                                                 switch ::= T_SWITCH '(' expr ')' switch_case_list

                                                Returns Switch

                                                +
                                                 switch ::= T_SWITCH '(' expr ')' switch_case_list
                                                +
                                                +

                                                Returns Switch

                                                read_switch_case_list

                                                -
                                                 switch_case_list ::= '{' ';'? case_list* '}' | ':' ';'? case_list* T_ENDSWITCH ';'

                                                read_case_list

                                                -
                                                  case_list ::= ((T_CASE expr) | T_DEFAULT) (':' | ';') inner_statement*

                                                read_try

                                                +
                                                 switch_case_list ::= '{' ';'? case_list* '}' | ':' ';'? case_list* T_ENDSWITCH ';'
                                                +
                                                +

                                                read_case_list

                                                +
                                                  case_list ::= ((T_CASE expr) | T_DEFAULT) (':' | ';') inner_statement*
                                                +
                                                +

                                                read_try

                                                 try ::= T_TRY '{' inner_statement* '}'
                                                          (
                                                              T_CATCH '(' namespace_name variable ')' '{'  inner_statement* '}'
                                                          )*
                                                -         (T_FINALLY '{' inner_statement* '}')?

                                                Returns Try

                                                + (T_FINALLY '{' inner_statement* '}')? + +

                                                Returns Try

                                                read_short_form

                                                Reads a short form of tokens

                                                Parameters

                                                @@ -380,34 +493,51 @@

                                                read_short_form

                                                Returns Block

                                                read_list

                                                Helper : reads a list of tokens / sample : T_STRING ',' T_STRING ...

                                                -
                                                list ::= separator? ( item separator )* item

                                                read_name_list

                                                +
                                                list ::= separator? ( item separator )* item
                                                +
                                                +

                                                read_name_list

                                                Reads a list of names separated by a comma

                                                -
                                                name_list ::= namespace (',' namespace)*

                                                Sample code :

                                                -
                                                <?php class foo extends bar, baz { }

                                                Returns Array<Identifier>

                                                +
                                                name_list ::= namespace (',' namespace)*
                                                +
                                                +

                                                Sample code :

                                                +
                                                <?php class foo extends bar, baz { }
                                                +
                                                +

                                                Returns Array<Identifier>

                                                read_variable_declarations

                                                Reads a list of variables declarations

                                                variable_declaration ::= T_VARIABLE ('=' expr)?*
                                                -variable_declarations ::= variable_declaration (',' variable_declaration)*

                                                Sample code :

                                                -
                                                <?php class foo extends bar, baz { }

                                                Returns (Array<Variable> | Array<Assign>) Returns an array composed by a list of variables, or +variable_declarations ::= variable_declaration (',' variable_declaration)* + +

                                                Sample code :

                                                +
                                                <?php class foo extends bar, baz { }
                                                +
                                                +

                                                Returns (Array<Variable> | Array<Assign>) Returns an array composed by a list of variables, or assign values

                                                read_variable

                                                Reads a variable

                                                -
                                                  variable ::= &? ...complex @todo

                                                Some samples of parsed code :

                                                +
                                                  variable ::= &? ...complex @todo
                                                +
                                                +

                                                Some samples of parsed code :

                                                 &$var                      // simple var
                                                  $var                      // simple var
                                                  classname::CONST_NAME     // dynamic class name with const retrieval
                                                  foo()                     // function call
                                                - $var->func()->property    // chained calls

                                                read_encaps_var_offset

                                                -

                                                https://github.com/php/php-src/blob/493524454d66adde84e00d249d607ecd540de99f/Zend/zend_language_parser.y#L1231

                                                + $var->func()->property // chained calls + +

                                                read_encaps_var_offset

                                                +

                                                https://github.com/php/php-src/blob/493524454d66adde84e00d249d607ecd540de99f/Zend/zend_language_parser.y#L1231

                                                read_reference_variable

                                                -
                                                 reference_variable ::=  simple_variable ('[' OFFSET ']')* | '{' EXPR '}'

                                                - $foo[123]; // foo is an array ==> gets its entry - $foo{1}; // foo is a string ==> get the 2nd char offset +

                                                 reference_variable ::=  simple_variable ('[' OFFSET ']')* | '{' EXPR '}'
                                                +
                                                + + $foo[123]; // foo is an array ==> gets its entry + $foo{1}; // foo is a string ==> get the 2nd char offset ${'foo'}[123]; // get the dynamic var $foo $foo[123]{1}; // gets the 2nd char from the 123 array entry -

                                                +

                                                read_simple_variable

                                                -
                                                 simple_variable ::= T_VARIABLE | '$' '{' expr '}' | '$' simple_variable
                                                +
                                                 simple_variable ::= T_VARIABLE | '$' '{' expr '}' | '$' simple_variable
                                                +
                                                @@ -416,7 +546,7 @@

                                                read_simple_variable


                                                @@ -437,6 +567,6 @@

                                                read_simple_variable

                                                }); - + \ No newline at end of file diff --git a/docs/variadic.html b/docs/variadic.html index a52a27635..d9f68a141 100644 --- a/docs/variadic.html +++ b/docs/variadic.html @@ -18,6 +18,7 @@ + @@ -84,7 +85,9 @@

                                                php-parser

                                                -

                                                Classes

                                                + + +

                                                Classes

                                                @@ -312,6 +315,106 @@

                                                Methods

                                                + + + + + + +

                                                + destroy() +

                                                +
                                                + + + + + +
                                                +

                                                Destroying an unused node

                                                +
                                                + + + + + + + + + + +
                                                + + + + + + +
                                                Inherited From:
                                                +
                                                + +
                                                + + + + + + + + + + + + + + + + + + + + + +
                                                Source:
                                                +
                                                + +
                                                + + + + + + + +
                                                + + + + + + + + + + + + + + + + + + + + @@ -435,7 +538,7 @@
                                                Parameters:
                                                @@ -633,7 +736,7 @@
                                                Parameters:

                                                @@ -654,6 +757,6 @@
                                                Parameters:
                                                }); - + \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..898d304ee --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,38 @@ +import js from "@eslint/js"; +import jest from "eslint-plugin-jest"; +import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; +import globals from "globals"; + +export default [ + { + ignores: ["dist", "docs", "example", "tutorials"], + }, + js.configs.recommended, + { + files: ["test/**"], + ...jest.configs["flat/recommended"], + rules: { + ...jest.configs["flat/recommended"].rules, + "no-console": "off", + }, + languageOptions: { + globals: jest.environments.globals.globals, + }, + }, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + sourceType: "commonjs", + }, + + rules: { + "prefer-const": "error", + "no-var": "error", + curly: ["error", "multi-line"], + }, + }, + eslintPluginPrettierRecommended, +]; diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6d72fb1b6..000000000 --- a/index.d.ts +++ /dev/null @@ -1,364 +0,0 @@ -/*! - * Copyright (C) 2017 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ - -declare module "php-parser" { - /** - * Token items - */ - const enum TokenEnum { - T_HALT_COMPILER = 101, - T_USE = 102, - T_ENCAPSED_AND_WHITESPACE = 103, - T_OBJECT_OPERATOR = 104, - T_STRING = 105, - T_DOLLAR_OPEN_CURLY_BRACES = 106, - T_STRING_VARNAME = 107, - T_CURLY_OPEN = 108, - T_NUM_STRING = 109, - T_ISSET = 110, - T_EMPTY = 111, - T_INCLUDE = 112, - T_INCLUDE_ONCE = 113, - T_EVAL = 114, - T_REQUIRE = 115, - T_REQUIRE_ONCE = 116, - T_NAMESPACE = 117, - T_NS_SEPARATOR = 118, - T_AS = 119, - T_IF = 120, - T_ENDIF = 121, - T_WHILE = 122, - T_DO = 123, - T_FOR = 124, - T_SWITCH = 125, - T_BREAK = 126, - T_CONTINUE = 127, - T_RETURN = 128, - T_GLOBAL = 129, - T_STATIC = 130, - T_ECHO = 131, - T_INLINE_HTML = 132, - T_UNSET = 133, - T_FOREACH = 134, - T_DECLARE = 135, - T_TRY = 136, - T_THROW = 137, - T_GOTO = 138, - T_FINALLY = 139, - T_CATCH = 140, - T_ENDDECLARE = 141, - T_LIST = 142, - T_CLONE = 143, - T_PLUS_EQUAL = 144, - T_MINUS_EQUAL = 145, - T_MUL_EQUAL = 146, - T_DIV_EQUAL = 147, - T_CONCAT_EQUAL = 148, - T_MOD_EQUAL = 149, - T_AND_EQUAL = 150, - T_OR_EQUAL = 151, - T_XOR_EQUAL = 152, - T_SL_EQUAL = 153, - T_SR_EQUAL = 154, - T_INC = 155, - T_DEC = 156, - T_BOOLEAN_OR = 157, - T_BOOLEAN_AND = 158, - T_LOGICAL_OR = 159, - T_LOGICAL_AND = 160, - T_LOGICAL_XOR = 161, - T_SL = 162, - T_SR = 163, - T_IS_IDENTICAL = 164, - T_IS_NOT_IDENTICAL = 165, - T_IS_EQUAL = 166, - T_IS_NOT_EQUAL = 167, - T_IS_SMALLER_OR_EQUAL = 168, - T_IS_GREATER_OR_EQUAL = 169, - T_INSTANCEOF = 170, - T_INT_CAST = 171, - T_DOUBLE_CAST = 172, - T_STRING_CAST = 173, - T_ARRAY_CAST = 174, - T_OBJECT_CAST = 175, - T_BOOL_CAST = 176, - T_UNSET_CAST = 177, - T_EXIT = 178, - T_PRINT = 179, - T_YIELD = 180, - T_YIELD_FROM = 181, - T_FUNCTION = 182, - T_DOUBLE_ARROW = 183, - T_DOUBLE_COLON = 184, - T_ARRAY = 185, - T_CALLABLE = 186, - T_CLASS = 187, - T_ABSTRACT = 188, - T_TRAIT = 189, - T_FINAL = 190, - T_EXTENDS = 191, - T_INTERFACE = 192, - T_IMPLEMENTS = 193, - T_VAR = 194, - T_PUBLIC = 195, - T_PROTECTED = 196, - T_PRIVATE = 197, - T_CONST = 198, - T_NEW = 199, - T_INSTEADOF = 200, - T_ELSEIF = 201, - T_ELSE = 202, - T_ENDSWITCH = 203, - T_CASE = 204, - T_DEFAULT = 205, - T_ENDFOR = 206, - T_ENDFOREACH = 207, - T_ENDWHILE = 208, - T_CONSTANT_ENCAPSED_STRING = 209, - T_LNUMBER = 210, - T_DNUMBER = 211, - T_LINE = 212, - T_FILE = 213, - T_DIR = 214, - T_TRAIT_C = 215, - T_METHOD_C = 216, - T_FUNC_C = 217, - T_NS_C = 218, - T_START_HEREDOC = 219, - T_END_HEREDOC = 220, - T_CLASS_C = 221, - T_VARIABLE = 222, - T_OPEN_TAG = 223, - T_OPEN_TAG_WITH_ECHO = 224, - T_CLOSE_TAG = 225, - T_WHITESPACE = 226, - T_COMMENT = 227, - T_DOC_COMMENT = 228, - T_ELLIPSIS = 229, - T_COALESCE = 230, - T_POW = 231, - T_POW_EQUAL = 232, - T_SPACESHIP = 233 - } - - /** - * The tokens dictionnary - */ - interface TokenDefinition { - /** List of token names as texts */ - values: String[], - /** Define tokens */ - names: TokenEnum[] - } - - /** - * The token structure - */ - interface Token extends Array { - // token name - 0: String; - // the token value - 1: TokenEnum; - // the current line - 2: Number - } - - /** - * Each Position object consists of a line number (1-indexed) and a column number (0-indexed): - */ - interface Position { - line: Number; - column: Number; - offset: Number; - } - - /** - * Defines the location of the node (with it's source contents as string) - */ - interface Location { - source: string; - start: Position; - end: Position; - } - - /** - * - */ - interface Node { - kind: String; - loc: Location; - } - - /** - * Error node - */ - interface ParserError extends Node { - message: String; - token: Token; - line: Number; - expected: any; - } - - /** - * A block statement, i.e., a sequence of statements surrounded by braces. - */ - interface Block extends Node { - children: Node[]; - } - - /** - * The main root node - */ - interface Program extends Block { - errors: ParserError[]; - } - - interface Parser { - lexer: Lexer; - ast: AST; - token: TokenEnum; - prev: TokenEnum; - debug: Boolean; - extractDoc: Boolean; - suppressErrors: Boolean; - getTokenName(token:TokenEnum): String; - parse(code: String, filename: String): Program; - raiseError(message: String, msgExpect: String, expect: any, token: TokenEnum): ParserError; - error(expect: String): ParserError; - node(kind:String): Node; - expectEndOfStatement(): Boolean; - showlog(): Parser; - expect(token:TokenEnum): Boolean; - expect(tokens:TokenEnum[]): Boolean; - text(): String; - next(): Parser; - ignoreComments(): Parser; - nextWithComments(): Parser; - is(type: String): Boolean; - // @todo other parsing functions ... - } - - interface KeywordsDictionnary { - [index: string]: TokenEnum - } - - interface yylloc { - first_offset: Number; - first_line: Number; - first_column: Number; - last_line: Number; - last_column: Number; - } - - interface LexerState { - yytext: String; - offset: Number; - yylineno: Number; - yyprevcol: Number; - yylloc: yylloc; - } - - interface Lexer { - debug: Boolean; - all_tokens: Boolean; - comment_tokens: Boolean; - mode_eval: Boolean; - asp_tags: Boolean; - short_tags: Boolean; - keywords: KeywordsDictionnary; - castKeywords: KeywordsDictionnary; - setInput(input:String): Lexer; - input(size:Number): String; - unput(size:Number): Lexer; - tryMatch(match:String): Boolean; - tryMatchCaseless(match:String): Boolean; - ahead(size:Number): String; - consume(size:Number): Lexer; - getState(): LexerState; - setState(state:LexerState): Lexer; - appendToken(value:TokenEnum, ahead:Number): Lexer; - lex(): TokenEnum; - begin(state:String): Lexer; - popState(): String; - next(): TokenEnum; - // @todo other lexer functions ... - } - - - interface AST { - /** - * - */ - withPositions: Boolean; - /** - * Option, if true extracts original source code attached to the node (by default false) - */ - withSource: Boolean; - /** - * Constructor - */ - constructor(withPositions:Boolean, withSource:Boolean): AST; - constructor(withPositions:Boolean): AST; - constructor(): AST; - /** - * Create a position node from specified parser - * including it's lexer current state - */ - position(parser:Parser): Position; - /** - * Prepares an AST node - */ - prepare(kind:String, parser:Parser): Function; - } - - /** - * List of options / extensions - */ - interface Options { - ast?: { - withPositions?: Boolean; - withSource?: Boolean; - }; - lexer?: { - debug?: Boolean; - all_tokens?: Boolean; - comment_tokens?: Boolean; - mode_eval?: Boolean; - asp_tags?: Boolean; - short_tags?: Boolean; - }; - parser?: { - debug?: Boolean; - extractDoc?: Boolean; - suppressErrors?: Boolean; - }; - } - - /** - * Initialise a new parser instance with the specified options - */ - export default class Engine { - // ----- STATIC HELPERS - static create(options?: Options) : Engine; - static parseEval(buffer: String, options: Options) : Program; - static parseEval(buffer: String) : Program; - static parseCode(buffer: String, filename: String, options: Options) : Program; - static parseCode(buffer: String, options: Options) : Program; - static parseCode(buffer: String) : Program; - static tokenGetAll(buffer: String, options: Options) : Token[]; - static tokenGetAll(buffer: String) : Token[]; - // ----- INSTANCE FUNCTIONS - ast: AST; - lexer: Lexer; - parser: Parser; - tokens: TokenDefinition; - constructor(options?: Options); - parseEval(buffer: String) : Program; - parseCode(buffer: String, filename: String) : Program; - parseCode(buffer: String) : Program; - tokenGetAll(buffer: String) : Token[]; - } -} diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000..e8c233467 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,31 @@ +"use strict"; + +const ENABLE_COVERAGE = !!process.env.CI || !!process.env.COVERAGE; + +module.exports = { + collectCoverage: ENABLE_COVERAGE, + coverageDirectory: "coverage/", + coverageThreshold: { + global: { + statements: 96.4, + branches: 90.1, + functions: 99.4, + lines: 96.9, + }, + }, + projects: [ + { + displayName: "test", + testEnvironment: "node", + }, + { + runner: "jest-runner-eslint", + displayName: "lint", + testMatch: ["/**/*.js"], + testPathIgnorePatterns: [ + "/node_modules/", + "/coverage/", + ], + }, + ], +}; diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 441805c07..000000000 --- a/package-lock.json +++ /dev/null @@ -1,9497 +0,0 @@ -{ - "name": "php-parser", - "version": "3.0.0-prerelease.4", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@babel/code-frame": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", - "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", - "dev": true, - "requires": { - "@babel/highlight": "^7.0.0" - } - }, - "@babel/highlight": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", - "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", - "dev": true, - "requires": { - "chalk": "^2.0.0", - "esutils": "^2.0.2", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@webassemblyjs/ast": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.5.13.tgz", - "integrity": "sha512-49nwvW/Hx9i+OYHg+mRhKZfAlqThr11Dqz8TsrvqGKMhdI2ijy3KBJOun2Z4770TPjrIJhR6KxChQIDaz8clDA==", - "dev": true, - "requires": { - "@webassemblyjs/helper-module-context": "1.5.13", - "@webassemblyjs/helper-wasm-bytecode": "1.5.13", - "@webassemblyjs/wast-parser": "1.5.13", - "debug": "^3.1.0", - "mamacro": "^0.0.3" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "@webassemblyjs/floating-point-hex-parser": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.13.tgz", - "integrity": "sha512-vrvvB18Kh4uyghSKb0NTv+2WZx871WL2NzwMj61jcq2bXkyhRC+8Q0oD7JGVf0+5i/fKQYQSBCNMMsDMRVAMqA==", - "dev": true - }, - "@webassemblyjs/helper-api-error": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.5.13.tgz", - "integrity": "sha512-dBh2CWYqjaDlvMmRP/kudxpdh30uXjIbpkLj9HQe+qtYlwvYjPRjdQXrq1cTAAOUSMTtzqbXIxEdEZmyKfcwsg==", - "dev": true - }, - "@webassemblyjs/helper-buffer": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.5.13.tgz", - "integrity": "sha512-v7igWf1mHcpJNbn4m7e77XOAWXCDT76Xe7Is1VQFXc4K5jRcFrl9D0NrqM4XifQ0bXiuTSkTKMYqDxu5MhNljA==", - "dev": true, - "requires": { - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "@webassemblyjs/helper-code-frame": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.13.tgz", - "integrity": "sha512-yN6ScQQDFCiAXnVctdVO/J5NQRbwyTbQzsGzEgXsAnrxhjp0xihh+nNHQTMrq5UhOqTb5LykpJAvEv9AT0jnAQ==", - "dev": true, - "requires": { - "@webassemblyjs/wast-printer": "1.5.13" - } - }, - "@webassemblyjs/helper-fsm": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.13.tgz", - "integrity": "sha512-hSIKzbXjVMRvy3Jzhgu+vDd/aswJ+UMEnLRCkZDdknZO3Z9e6rp1DAs0tdLItjCFqkz9+0BeOPK/mk3eYvVzZg==", - "dev": true - }, - "@webassemblyjs/helper-module-context": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.13.tgz", - "integrity": "sha512-zxJXULGPLB7r+k+wIlvGlXpT4CYppRz8fLUM/xobGHc9Z3T6qlmJD9ySJ2jknuktuuiR9AjnNpKYDECyaiX+QQ==", - "dev": true, - "requires": { - "debug": "^3.1.0", - "mamacro": "^0.0.3" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.13.tgz", - "integrity": "sha512-0n3SoNGLvbJIZPhtMFq0XmmnA/YmQBXaZKQZcW8maGKwLpVcgjNrxpFZHEOLKjXJYVN5Il8vSfG7nRX50Zn+aw==", - "dev": true - }, - "@webassemblyjs/helper-wasm-section": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.13.tgz", - "integrity": "sha512-IJ/goicOZ5TT1axZFSnlAtz4m8KEjYr12BNOANAwGFPKXM4byEDaMNXYowHMG0yKV9a397eU/NlibFaLwr1fbw==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.13", - "@webassemblyjs/helper-buffer": "1.5.13", - "@webassemblyjs/helper-wasm-bytecode": "1.5.13", - "@webassemblyjs/wasm-gen": "1.5.13", - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "@webassemblyjs/ieee754": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.5.13.tgz", - "integrity": "sha512-TseswvXEPpG5TCBKoLx9tT7+/GMACjC1ruo09j46ULRZWYm8XHpDWaosOjTnI7kr4SRJFzA6MWoUkAB+YCGKKg==", - "dev": true, - "requires": { - "ieee754": "^1.1.11" - } - }, - "@webassemblyjs/leb128": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.5.13.tgz", - "integrity": "sha512-0NRMxrL+GG3eISGZBmLBLAVjphbN8Si15s7jzThaw1UE9e5BY1oH49/+MA1xBzxpf1OW5sf9OrPDOclk9wj2yg==", - "dev": true, - "requires": { - "long": "4.0.0" - }, - "dependencies": { - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", - "dev": true - } - } - }, - "@webassemblyjs/utf8": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.5.13.tgz", - "integrity": "sha512-Ve1ilU2N48Ew0lVGB8FqY7V7hXjaC4+PeZM+vDYxEd+R2iQ0q+Wb3Rw8v0Ri0+rxhoz6gVGsnQNb4FjRiEH/Ng==", - "dev": true - }, - "@webassemblyjs/wasm-edit": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.13.tgz", - "integrity": "sha512-X7ZNW4+Hga4f2NmqENnHke2V/mGYK/xnybJSIXImt1ulxbCOEs/A+ZK/Km2jgihjyVxp/0z0hwIcxC6PrkWtgw==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.13", - "@webassemblyjs/helper-buffer": "1.5.13", - "@webassemblyjs/helper-wasm-bytecode": "1.5.13", - "@webassemblyjs/helper-wasm-section": "1.5.13", - "@webassemblyjs/wasm-gen": "1.5.13", - "@webassemblyjs/wasm-opt": "1.5.13", - "@webassemblyjs/wasm-parser": "1.5.13", - "@webassemblyjs/wast-printer": "1.5.13", - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "@webassemblyjs/wasm-gen": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.13.tgz", - "integrity": "sha512-yfv94Se8R73zmr8GAYzezFHc3lDwE/lBXQddSiIZEKZFuqy7yWtm3KMwA1uGbv5G1WphimJxboXHR80IgX1hQA==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.13", - "@webassemblyjs/helper-wasm-bytecode": "1.5.13", - "@webassemblyjs/ieee754": "1.5.13", - "@webassemblyjs/leb128": "1.5.13", - "@webassemblyjs/utf8": "1.5.13" - } - }, - "@webassemblyjs/wasm-opt": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.13.tgz", - "integrity": "sha512-IkXSkgzVhQ0QYAdIayuCWMmXSYx0dHGU8Ah/AxJf1gBvstMWVnzJnBwLsXLyD87VSBIcsqkmZ28dVb0mOC3oBg==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.13", - "@webassemblyjs/helper-buffer": "1.5.13", - "@webassemblyjs/wasm-gen": "1.5.13", - "@webassemblyjs/wasm-parser": "1.5.13", - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "@webassemblyjs/wasm-parser": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.5.13.tgz", - "integrity": "sha512-XnYoIcu2iqq8/LrtmdnN3T+bRjqYFjRHqWbqK3osD/0r/Fcv4d9ecRzjVtC29ENEuNTK4mQ9yyxCBCbK8S/cpg==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.13", - "@webassemblyjs/helper-api-error": "1.5.13", - "@webassemblyjs/helper-wasm-bytecode": "1.5.13", - "@webassemblyjs/ieee754": "1.5.13", - "@webassemblyjs/leb128": "1.5.13", - "@webassemblyjs/utf8": "1.5.13" - } - }, - "@webassemblyjs/wast-parser": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.5.13.tgz", - "integrity": "sha512-Lbz65T0LQ1LgzKiUytl34CwuhMNhaCLgrh0JW4rJBN6INnBB8NMwUfQM+FxTnLY9qJ+lHJL/gCM5xYhB9oWi4A==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.13", - "@webassemblyjs/floating-point-hex-parser": "1.5.13", - "@webassemblyjs/helper-api-error": "1.5.13", - "@webassemblyjs/helper-code-frame": "1.5.13", - "@webassemblyjs/helper-fsm": "1.5.13", - "long": "^3.2.0", - "mamacro": "^0.0.3" - } - }, - "@webassemblyjs/wast-printer": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.5.13.tgz", - "integrity": "sha512-QcwogrdqcBh8Z+eUF8SG+ag5iwQSXxQJELBEHmLkk790wgQgnIMmntT2sMAMw53GiFNckArf5X0bsCA44j3lWQ==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.13", - "@webassemblyjs/wast-parser": "1.5.13", - "long": "^3.2.0" - } - }, - "abab": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz", - "integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==", - "dev": true - }, - "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", - "dev": true - }, - "acorn-dynamic-import": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", - "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", - "dev": true, - "requires": { - "acorn": "^5.0.0" - }, - "dependencies": { - "acorn": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", - "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==", - "dev": true - } - } - }, - "acorn-globals": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.0.tgz", - "integrity": "sha512-hMtHj3s5RnuhvHPowpBYvJVj3rAar82JiDQHvGs1zO0l10ocX/xEdBShNHTJaboucJUsScghp74pH3s7EnHHQw==", - "dev": true, - "requires": { - "acorn": "^6.0.1", - "acorn-walk": "^6.0.1" - }, - "dependencies": { - "acorn": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.2.tgz", - "integrity": "sha512-GXmKIvbrN3TV7aVqAzVFaMW8F8wzVX7voEBRO3bDA64+EX37YSayggRJP5Xig6HYHBkWKpFg9W5gg6orklubhg==", - "dev": true - } - } - }, - "acorn-walk": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.1.0.tgz", - "integrity": "sha512-ugTb7Lq7u4GfWSqqpwE0bGyoBZNMTok/zDBXxfEG0QM50jNlGhIWjRC1pPN7bvV1anhF+bs+/gNcRw+o55Evbg==", - "dev": true - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "dev": true, - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "ajv-keywords": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", - "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", - "dev": true - }, - "ansi-escapes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", - "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", - "dev": true - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } - } - }, - "append-transform": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", - "integrity": "sha1-126/jKlNJ24keja61EpLdKthGZE=", - "dev": true, - "requires": { - "default-require-extensions": "^1.0.0" - } - }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", - "dev": true - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true - }, - "asn1.js": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", - "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "assert": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", - "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", - "dev": true, - "requires": { - "util": "0.10.3" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true - }, - "astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", - "dev": true - }, - "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "dev": true, - "requires": { - "lodash": "^4.17.10" - } - }, - "async-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", - "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", - "dev": true - }, - "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "atob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", - "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", - "dev": true - }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, - "babel-core": { - "version": "6.26.3", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", - "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", - "dev": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-generator": "^6.26.0", - "babel-helpers": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-register": "^6.26.0", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "convert-source-map": "^1.5.1", - "debug": "^2.6.9", - "json5": "^0.5.1", - "lodash": "^4.17.4", - "minimatch": "^3.0.4", - "path-is-absolute": "^1.0.1", - "private": "^0.1.8", - "slash": "^1.0.0", - "source-map": "^0.5.7" - } - }, - "babel-generator": { - "version": "6.26.1", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", - "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", - "dev": true, - "requires": { - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "detect-indent": "^4.0.0", - "jsesc": "^1.3.0", - "lodash": "^4.17.4", - "source-map": "^0.5.7", - "trim-right": "^1.0.1" - }, - "dependencies": { - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", - "dev": true - } - } - }, - "babel-helper-call-delegate": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", - "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", - "dev": true, - "requires": { - "babel-helper-hoist-variables": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helper-define-map": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", - "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", - "dev": true, - "requires": { - "babel-helper-function-name": "^6.24.1", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" - } - }, - "babel-helper-function-name": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", - "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", - "dev": true, - "requires": { - "babel-helper-get-function-arity": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helper-get-function-arity": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", - "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-hoist-variables": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", - "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-optimise-call-expression": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", - "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-helper-regex": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", - "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" - } - }, - "babel-helper-replace-supers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", - "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", - "dev": true, - "requires": { - "babel-helper-optimise-call-expression": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-helpers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", - "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-jest": { - "version": "22.4.4", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-22.4.4.tgz", - "integrity": "sha512-A9NB6/lZhYyypR9ATryOSDcqBaqNdzq4U+CN+/wcMsLcmKkPxQEoTKLajGfd3IkxNyVBT8NewUK2nWyGbSzHEQ==", - "dev": true, - "requires": { - "babel-plugin-istanbul": "^4.1.5", - "babel-preset-jest": "^22.4.4" - } - }, - "babel-loader": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-7.1.5.tgz", - "integrity": "sha512-iCHfbieL5d1LfOQeeVJEUyD9rTwBcP/fcEbRCfempxTDuqrKpu0AZjLAQHEQa3Yqyj9ORKe2iHfoj4rHLf7xpw==", - "dev": true, - "requires": { - "find-cache-dir": "^1.0.0", - "loader-utils": "^1.0.2", - "mkdirp": "^0.5.1" - } - }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-check-es2015-constants": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", - "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-istanbul": { - "version": "4.1.6", - "resolved": "http://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz", - "integrity": "sha512-PWP9FQ1AhZhS01T/4qLSKoHGY/xvkZdVBGlKM/HuxxS3+sC66HhTNR7+MpbO/so/cz/wY94MeSWJuP1hXIPfwQ==", - "dev": true, - "requires": { - "babel-plugin-syntax-object-rest-spread": "^6.13.0", - "find-up": "^2.1.0", - "istanbul-lib-instrument": "^1.10.1", - "test-exclude": "^4.2.1" - } - }, - "babel-plugin-jest-hoist": { - "version": "22.4.4", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.4.4.tgz", - "integrity": "sha512-DUvGfYaAIlkdnygVIEl0O4Av69NtuQWcrjMOv6DODPuhuGLDnbsARz3AwiiI/EkIMMlxQDUcrZ9yoyJvTNjcVQ==", - "dev": true - }, - "babel-plugin-syntax-object-rest-spread": { - "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", - "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", - "dev": true - }, - "babel-plugin-transform-es2015-arrow-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", - "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-block-scoped-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", - "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-block-scoping": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", - "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" - } - }, - "babel-plugin-transform-es2015-classes": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", - "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", - "dev": true, - "requires": { - "babel-helper-define-map": "^6.24.1", - "babel-helper-function-name": "^6.24.1", - "babel-helper-optimise-call-expression": "^6.24.1", - "babel-helper-replace-supers": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-computed-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", - "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-destructuring": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", - "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-duplicate-keys": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", - "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-for-of": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", - "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-function-name": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", - "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", - "dev": true, - "requires": { - "babel-helper-function-name": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-literals": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", - "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-modules-amd": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", - "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", - "dev": true, - "requires": { - "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-modules-commonjs": { - "version": "6.26.2", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz", - "integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==", - "dev": true, - "requires": { - "babel-plugin-transform-strict-mode": "^6.24.1", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-types": "^6.26.0" - } - }, - "babel-plugin-transform-es2015-modules-systemjs": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", - "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", - "dev": true, - "requires": { - "babel-helper-hoist-variables": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-modules-umd": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", - "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", - "dev": true, - "requires": { - "babel-plugin-transform-es2015-modules-amd": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-object-super": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", - "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", - "dev": true, - "requires": { - "babel-helper-replace-supers": "^6.24.1", - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-parameters": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", - "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", - "dev": true, - "requires": { - "babel-helper-call-delegate": "^6.24.1", - "babel-helper-get-function-arity": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1", - "babel-traverse": "^6.24.1", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-shorthand-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", - "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-spread": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", - "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-sticky-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", - "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", - "dev": true, - "requires": { - "babel-helper-regex": "^6.24.1", - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-plugin-transform-es2015-template-literals": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", - "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-typeof-symbol": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", - "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-unicode-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", - "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", - "dev": true, - "requires": { - "babel-helper-regex": "^6.24.1", - "babel-runtime": "^6.22.0", - "regexpu-core": "^2.0.0" - } - }, - "babel-plugin-transform-regenerator": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", - "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", - "dev": true, - "requires": { - "regenerator-transform": "^0.10.0" - } - }, - "babel-plugin-transform-strict-mode": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", - "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-types": "^6.24.1" - } - }, - "babel-preset-es2015": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", - "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", - "dev": true, - "requires": { - "babel-plugin-check-es2015-constants": "^6.22.0", - "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", - "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", - "babel-plugin-transform-es2015-block-scoping": "^6.24.1", - "babel-plugin-transform-es2015-classes": "^6.24.1", - "babel-plugin-transform-es2015-computed-properties": "^6.24.1", - "babel-plugin-transform-es2015-destructuring": "^6.22.0", - "babel-plugin-transform-es2015-duplicate-keys": "^6.24.1", - "babel-plugin-transform-es2015-for-of": "^6.22.0", - "babel-plugin-transform-es2015-function-name": "^6.24.1", - "babel-plugin-transform-es2015-literals": "^6.22.0", - "babel-plugin-transform-es2015-modules-amd": "^6.24.1", - "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", - "babel-plugin-transform-es2015-modules-systemjs": "^6.24.1", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-transform-es2015-object-super": "^6.24.1", - "babel-plugin-transform-es2015-parameters": "^6.24.1", - "babel-plugin-transform-es2015-shorthand-properties": "^6.24.1", - "babel-plugin-transform-es2015-spread": "^6.22.0", - "babel-plugin-transform-es2015-sticky-regex": "^6.24.1", - "babel-plugin-transform-es2015-template-literals": "^6.22.0", - "babel-plugin-transform-es2015-typeof-symbol": "^6.22.0", - "babel-plugin-transform-es2015-unicode-regex": "^6.24.1", - "babel-plugin-transform-regenerator": "^6.24.1" - } - }, - "babel-preset-jest": { - "version": "22.4.4", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-22.4.4.tgz", - "integrity": "sha512-+dxMtOFwnSYWfum0NaEc0O03oSdwBsjx4tMSChRDPGwu/4wSY6Q6ANW3wkjKpJzzguaovRs/DODcT4hbSN8yiA==", - "dev": true, - "requires": { - "babel-plugin-jest-hoist": "^22.4.4", - "babel-plugin-syntax-object-rest-spread": "^6.13.0" - } - }, - "babel-register": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", - "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", - "dev": true, - "requires": { - "babel-core": "^6.26.0", - "babel-runtime": "^6.26.0", - "core-js": "^2.5.0", - "home-or-tmp": "^2.0.0", - "lodash": "^4.17.4", - "mkdirp": "^0.5.1", - "source-map-support": "^0.4.15" - }, - "dependencies": { - "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "dev": true, - "requires": { - "source-map": "^0.5.6" - } - } - } - }, - "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "dev": true, - "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "babel-template": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", - "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "lodash": "^4.17.4" - } - }, - "babel-traverse": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", - "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", - "dev": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - } - }, - "babel-types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", - "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - } - }, - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "base64-js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", - "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "big.js": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", - "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", - "dev": true - }, - "binary-extensions": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", - "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", - "dev": true - }, - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", - "dev": true - }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", - "dev": true, - "requires": { - "hoek": "4.x.x" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "dev": true - }, - "browser-process-hrtime": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", - "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==", - "dev": true - }, - "browser-resolve": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", - "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", - "dev": true, - "requires": { - "resolve": "1.1.7" - } - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dev": true, - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.1.tgz", - "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1" - } - }, - "browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "randombytes": "^2.0.1" - } - }, - "browserify-sign": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", - "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", - "dev": true, - "requires": { - "bn.js": "^4.1.1", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.2", - "elliptic": "^6.0.0", - "inherits": "^2.0.1", - "parse-asn1": "^5.0.0" - } - }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dev": true, - "requires": { - "pako": "~1.0.5" - } - }, - "bser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz", - "integrity": "sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk=", - "dev": true, - "requires": { - "node-int64": "^0.4.0" - } - }, - "buffer-from": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", - "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==", - "dev": true - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", - "dev": true - }, - "cacache": { - "version": "10.0.4", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", - "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", - "dev": true, - "requires": { - "bluebird": "^3.5.1", - "chownr": "^1.0.1", - "glob": "^7.1.2", - "graceful-fs": "^4.1.11", - "lru-cache": "^4.1.1", - "mississippi": "^2.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.2", - "ssri": "^5.2.4", - "unique-filename": "^1.1.0", - "y18n": "^4.0.0" - }, - "dependencies": { - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - } - } - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "callsites": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", - "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", - "dev": true - }, - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - }, - "capture-exit": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-1.2.0.tgz", - "integrity": "sha1-HF/MSJ/QqwDU8ax64QcuMXP7q28=", - "dev": true, - "requires": { - "rsvp": "^3.3.3" - } - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, - "catharsis": { - "version": "0.8.9", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.9.tgz", - "integrity": "sha1-mMyJDKZS3S7w5ws3klMQ/56Q/Is=", - "dev": true, - "requires": { - "underscore-contrib": "~0.3.0" - } - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "chardet": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.5.0.tgz", - "integrity": "sha512-9ZTaoBaePSCFvNlNGrsyI8ZVACP2svUtq0DkM7t4K2ClAa96sqOIRjAzDTc8zXzFt1cZR46rRzLTiHFSJ+Qw0g==", - "dev": true - }, - "chownr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", - "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", - "dev": true - }, - "chrome-trace-event": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.0.tgz", - "integrity": "sha512-xDbVgyfDTT2piup/h8dK/y4QZfJRSa73bw1WZ8b4XM1o7fsFubUVGYcE+1ANtOzJJELGpYoG2961z0Z6OAld9A==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "ci-info": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", - "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", - "dev": true - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", - "dev": true - }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-convert": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", - "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", - "dev": true, - "requires": { - "color-name": "^1.1.1" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", - "dev": true - }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "console-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", - "dev": true, - "requires": { - "date-now": "^0.1.4" - } - }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", - "dev": true - }, - "convert-source-map": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", - "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "copy-concurrently": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", - "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "fs-write-stream-atomic": "^1.0.8", - "iferr": "^0.1.5", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.0" - }, - "dependencies": { - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - } - } - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, - "core-js": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", - "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "coveralls": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.0.tgz", - "integrity": "sha512-ZppXR9y5PraUOrf/DzHJY6gzNUhXYE3b9D43xEXs4QYZ7/Oe0Gy0CS+IPKWFfvQFXB3RG9QduaQUFehzSpGAFw==", - "dev": true, - "requires": { - "js-yaml": "^3.6.1", - "lcov-parse": "^0.0.10", - "log-driver": "^1.2.5", - "minimist": "^1.2.0", - "request": "^2.79.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "create-ecdh": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.1.tgz", - "integrity": "sha512-iZvCCg8XqHQZ1ioNBTzXS/cQSkqkqcPs8xSX4upNB+DAk9Ht3uzQf2J32uAHNCne8LDmKr29AgZrEs4oIrwLuQ==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.0.0" - } - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "dev": true, - "requires": { - "boom": "5.x.x" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", - "dev": true, - "requires": { - "hoek": "4.x.x" - } - } - } - }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dev": true, - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, - "cssom": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", - "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==", - "dev": true - }, - "cssstyle": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.1.1.tgz", - "integrity": "sha512-364AI1l/M5TYcFH83JnOH/pSqgaNnKmYgKrm0didZMGKWjQB60dymwWy1rKUgL3J1ffdq9xVi2yGLHdSjjSNog==", - "dev": true, - "requires": { - "cssom": "0.3.x" - } - }, - "cyclist": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", - "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", - "dev": true - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "data-urls": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.0.1.tgz", - "integrity": "sha512-0HdcMZzK6ubMUnsMmQmG0AcLQPvbvb47R0+7CCZQCYgcd8OUWG91CG7sM6GoXgjz+WLl4ArFzHtBMy/QqSF4eg==", - "dev": true, - "requires": { - "abab": "^2.0.0", - "whatwg-mimetype": "^2.1.0", - "whatwg-url": "^7.0.0" - }, - "dependencies": { - "whatwg-url": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz", - "integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==", - "dev": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - } - } - }, - "date-now": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "default-require-extensions": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz", - "integrity": "sha1-836hXT4T/9m0N9M+GnW1+5eHTLg=", - "dev": true, - "requires": { - "strip-bom": "^2.0.0" - } - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "des.js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", - "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } - }, - "detect-newline": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", - "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", - "dev": true - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, - "domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "dev": true - }, - "domexception": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", - "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", - "dev": true, - "requires": { - "webidl-conversions": "^4.0.2" - } - }, - "duplexify": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.4.tgz", - "integrity": "sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA==", - "dev": true, - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - } - }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "elliptic": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", - "dev": true, - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "emojis-list": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", - "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", - "dev": true - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "enhanced-resolve": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", - "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.4.0", - "tapable": "^1.0.0" - } - }, - "errno": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", - "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", - "dev": true, - "requires": { - "prr": "~1.0.1" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", - "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" - } - }, - "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz", - "integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==", - "dev": true, - "requires": { - "esprima": "^3.1.3", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true - } - } - }, - "eslint-plugin-prettier": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz", - "integrity": "sha512-tGek5clmW5swrAx1mdPYM8oThrBE83ePh7LeseZHBWfHVGrHPhKn7Y5zgRMbU/9D5Td9K4CEmUPjGxA7iw98Og==", - "dev": true, - "requires": { - "fast-diff": "^1.1.1", - "jest-docblock": "^21.0.0" - }, - "dependencies": { - "jest-docblock": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", - "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==", - "dev": true - } - } - }, - "eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", - "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, - "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", - "dev": true - }, - "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", - "dev": true, - "requires": { - "estraverse": "^4.1.0" - } - }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "exec-sh": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.2.tgz", - "integrity": "sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw==", - "dev": true, - "requires": { - "merge": "^1.2.0" - } - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true, - "requires": { - "fill-range": "^2.1.0" - } - }, - "expect": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/expect/-/expect-22.4.3.tgz", - "integrity": "sha512-XcNXEPehqn8b/jm8FYotdX0YrXn36qp4HWlrVT4ktwQas1l1LPxiVWncYnnL2eyMtKAmVIaG0XAp0QlrqJaxaA==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "jest-diff": "^22.4.3", - "jest-get-type": "^22.4.3", - "jest-matcher-utils": "^22.4.3", - "jest-message-util": "^22.4.3", - "jest-regex-util": "^22.4.3" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - } - } - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", - "dev": true - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "external-editor": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.0.tgz", - "integrity": "sha512-mpkfj0FEdxrIhOC04zk85X7StNtr0yXnG7zCb+8ikO8OJi2jsHh5YGoknNTyXgsbHOf1WOOcVU3kPFWT2WgCkQ==", - "dev": true, - "requires": { - "chardet": "^0.5.0", - "iconv-lite": "^0.4.22", - "tmp": "^0.0.33" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - } - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", - "dev": true - }, - "fast-diff": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.1.2.tgz", - "integrity": "sha512-KaJUt+M9t1qaIteSvjc6P3RbMdXsNhK61GRftR6SNxqmhthcd9MGIi4T+o0jD8LUSpSnSKXE20nLtJ3fOHxQig==", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fb-watchman": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", - "integrity": "sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg=", - "dev": true, - "requires": { - "bser": "^2.0.0" - } - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, - "fileset": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", - "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", - "dev": true, - "requires": { - "glob": "^7.0.3", - "minimatch": "^3.0.3" - } - }, - "fill-range": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", - "dev": true, - "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - } - }, - "find-cache-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", - "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^1.0.0", - "pkg-dir": "^2.0.0" - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "flush-write-stream": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", - "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.4" - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" - } - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "from2": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", - "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - } - }, - "fs-write-stream-atomic": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", - "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "iferr": "^0.1.5", - "imurmurhash": "^0.1.4", - "readable-stream": "1 || 2" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", - "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", - "dev": true, - "optional": true, - "requires": { - "nan": "^2.9.2", - "node-pre-gyp": "^0.10.0" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "debug": { - "version": "2.6.9", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - }, - "deep-extend": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.21", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safer-buffer": "^2.1.0" - } - }, - "ignore-walk": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true - }, - "ini": { - "version": "1.3.5", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, - "minipass": { - "version": "2.2.4", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "^5.1.1", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "needle": { - "version": "2.2.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "^2.1.2", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.10.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.0", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.1.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "npm-packlist": { - "version": "1.1.10", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "^0.5.1", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.6.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "glob": "^7.0.5" - } - }, - "safe-buffer": { - "version": "5.1.1", - "bundled": true, - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "bundled": true, - "dev": true, - "optional": true - }, - "semver": { - "version": "5.5.0", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.0.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", - "yallist": "^3.0.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "yallist": { - "version": "3.0.2", - "bundled": true, - "dev": true - } - } - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", - "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true, - "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" - } - }, - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "requires": { - "is-glob": "^2.0.0" - } - }, - "global-modules-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/global-modules-path/-/global-modules-path-2.1.0.tgz", - "integrity": "sha512-3DrmGj2TP+96cABk9TfMp6f3knH/Y46dqvWznTU3Tf6/bDGLDAn15tFluQ7BcloykOcdY16U0WGq0BQblYOxJQ==", - "dev": true - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "growly": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", - "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", - "dev": true - }, - "handlebars": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz", - "integrity": "sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==", - "dev": true, - "requires": { - "async": "^2.5.0", - "optimist": "^0.6.1", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "dev": true, - "requires": { - "ajv": "^5.1.0", - "har-schema": "^2.0.0" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "hash.js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" - } - }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "dev": true, - "requires": { - "boom": "4.x.x", - "cryptiles": "3.x.x", - "hoek": "4.x.x", - "sntp": "2.x.x" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "hoek": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", - "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", - "dev": true - }, - "home-or-tmp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", - "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.1" - } - }, - "hosted-git-info": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", - "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", - "dev": true - }, - "html-encoding-sniffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", - "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", - "dev": true, - "requires": { - "whatwg-encoding": "^1.0.1" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", - "dev": true - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ieee754": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.11.tgz", - "integrity": "sha512-VhDzCKN7K8ufStx/CLj5/PDTMgph+qwN5Pkd5i0sGnVwk56zJ0lkT8Qzi1xqWLS0Wp29DgDtNeS7v8/wMoZeHg==", - "dev": true - }, - "iferr": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", - "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", - "dev": true - }, - "import-local": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-1.0.0.tgz", - "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", - "dev": true, - "requires": { - "pkg-dir": "^2.0.0", - "resolve-cwd": "^2.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "inquirer": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.0.0.tgz", - "integrity": "sha512-tISQWRwtcAgrz+SHPhTH7d3e73k31gsOy6i1csonLc0u1dVK/wYvuOnFeiWqC5OXFIYbmrIFInef31wbT8MEJg==", - "dev": true, - "requires": { - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.0", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.0", - "figures": "^2.0.0", - "lodash": "^4.3.0", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^6.1.0", - "string-width": "^2.1.0", - "strip-ansi": "^4.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "interpret": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", - "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", - "dev": true - }, - "invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "dev": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true - }, - "is-ci": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", - "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", - "dev": true, - "requires": { - "ci-info": "^1.5.0" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true, - "requires": { - "is-primitive": "^2.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-generator-fn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-1.0.0.tgz", - "integrity": "sha1-lp1J4bszKfa7fwkIm+JleLLd1Go=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-odd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-2.0.0.tgz", - "integrity": "sha512-OTiixgpZAT1M4NHgS5IguFp/Vz2VI3U7Goh4/HA1adtwyLtSBrxYlcSYkhpAE07s4fKEcjrFxyvtQBND4vFQyQ==", - "dev": true, - "requires": { - "is-number": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - } - } - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "requires": { - "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, - "requires": { - "has": "^1.0.1" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "dev": true, - "requires": { - "has-symbols": "^1.0.0" - } - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, - "istanbul-lib-coverage": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.1.tgz", - "integrity": "sha512-PzITeunAgyGbtY1ibVIUiV679EFChHjoMNRibEIobvmrCRaIgwLxNucOSimtNWUhEib/oO7QY2imD75JVgCJWQ==", - "dev": true - }, - "istanbul-lib-hook": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.2.2.tgz", - "integrity": "sha512-/Jmq7Y1VeHnZEQ3TL10VHyb564mn6VrQXHchON9Jf/AEcmQ3ZIiyD1BVzNOKTZf/G3gE+kiGK6SmpF9y3qGPLw==", - "dev": true, - "requires": { - "append-transform": "^0.4.0" - } - }, - "istanbul-lib-instrument": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.2.tgz", - "integrity": "sha512-aWHxfxDqvh/ZlxR8BBaEPVSWDPUkGD63VjGQn3jcw8jCp7sHEMKcrj4xfJn/ABzdMEHiQNyvDQhqm5o8+SQg7A==", - "dev": true, - "requires": { - "babel-generator": "^6.18.0", - "babel-template": "^6.16.0", - "babel-traverse": "^6.18.0", - "babel-types": "^6.18.0", - "babylon": "^6.18.0", - "istanbul-lib-coverage": "^1.2.1", - "semver": "^5.3.0" - } - }, - "istanbul-lib-report": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.5.tgz", - "integrity": "sha512-UsYfRMoi6QO/doUshYNqcKJqVmFe9w51GZz8BS3WB0lYxAllQYklka2wP9+dGZeHYaWIdcXUx8JGdbqaoXRXzw==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^1.2.1", - "mkdirp": "^0.5.1", - "path-parse": "^1.0.5", - "supports-color": "^3.1.2" - }, - "dependencies": { - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true, - "requires": { - "has-flag": "^1.0.0" - } - } - } - }, - "istanbul-reports": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.5.1.tgz", - "integrity": "sha512-+cfoZ0UXzWjhAdzosCPP3AN8vvef8XDkWtTfgaN+7L3YTpNYITnCaEkceo5SEYy644VkHka/P1FvkWvrG/rrJw==", - "dev": true, - "requires": { - "handlebars": "^4.0.3" - } - }, - "jest": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest/-/jest-22.4.3.tgz", - "integrity": "sha512-FFCdU/pXOEASfHxFDOWUysI/+FFoqiXJADEIXgDKuZyqSmBD3tZ4BEGH7+M79v7czj7bbkhwtd2LaEDcJiM/GQ==", - "dev": true, - "requires": { - "import-local": "^1.0.0", - "jest-cli": "^22.4.3" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "debug": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", - "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "jest-cli": { - "version": "22.4.4", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-22.4.4.tgz", - "integrity": "sha512-I9dsgkeyjVEEZj9wrGrqlH+8OlNob9Iptyl+6L5+ToOLJmHm4JwOPatin1b2Bzp5R5YRQJ+oiedx7o1H7wJzhA==", - "dev": true, - "requires": { - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "glob": "^7.1.2", - "graceful-fs": "^4.1.11", - "import-local": "^1.0.0", - "is-ci": "^1.0.10", - "istanbul-api": "^1.1.14", - "istanbul-lib-coverage": "^1.1.1", - "istanbul-lib-instrument": "^1.8.0", - "istanbul-lib-source-maps": "^1.2.1", - "jest-changed-files": "^22.2.0", - "jest-config": "^22.4.4", - "jest-environment-jsdom": "^22.4.1", - "jest-get-type": "^22.1.0", - "jest-haste-map": "^22.4.2", - "jest-message-util": "^22.4.0", - "jest-regex-util": "^22.1.0", - "jest-resolve-dependencies": "^22.1.0", - "jest-runner": "^22.4.4", - "jest-runtime": "^22.4.4", - "jest-snapshot": "^22.4.0", - "jest-util": "^22.4.1", - "jest-validate": "^22.4.4", - "jest-worker": "^22.2.2", - "micromatch": "^2.3.11", - "node-notifier": "^5.2.1", - "realpath-native": "^1.0.0", - "rimraf": "^2.5.4", - "slash": "^1.0.0", - "string-length": "^2.0.0", - "strip-ansi": "^4.0.0", - "which": "^1.2.12", - "yargs": "^10.0.3" - }, - "dependencies": { - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", - "dev": true - }, - "is-ci": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", - "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", - "dev": true, - "requires": { - "ci-info": "^1.5.0" - } - }, - "istanbul-api": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.3.7.tgz", - "integrity": "sha512-4/ApBnMVeEPG3EkSzcw25wDe4N66wxwn+KKn6b47vyek8Xb3NBAcg4xfuQbS7BqcZuTX4wxfD5lVagdggR3gyA==", - "dev": true, - "requires": { - "async": "^2.1.4", - "fileset": "^2.0.2", - "istanbul-lib-coverage": "^1.2.1", - "istanbul-lib-hook": "^1.2.2", - "istanbul-lib-instrument": "^1.10.2", - "istanbul-lib-report": "^1.1.5", - "istanbul-lib-source-maps": "^1.2.6", - "istanbul-reports": "^1.5.1", - "js-yaml": "^3.7.0", - "mkdirp": "^0.5.1", - "once": "^1.4.0" - } - }, - "istanbul-lib-coverage": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.1.tgz", - "integrity": "sha512-PzITeunAgyGbtY1ibVIUiV679EFChHjoMNRibEIobvmrCRaIgwLxNucOSimtNWUhEib/oO7QY2imD75JVgCJWQ==", - "dev": true - }, - "istanbul-lib-instrument": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.2.tgz", - "integrity": "sha512-aWHxfxDqvh/ZlxR8BBaEPVSWDPUkGD63VjGQn3jcw8jCp7sHEMKcrj4xfJn/ABzdMEHiQNyvDQhqm5o8+SQg7A==", - "dev": true, - "requires": { - "babel-generator": "^6.18.0", - "babel-template": "^6.16.0", - "babel-traverse": "^6.18.0", - "babel-types": "^6.18.0", - "babylon": "^6.18.0", - "istanbul-lib-coverage": "^1.2.1", - "semver": "^5.3.0" - } - }, - "istanbul-lib-source-maps": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.6.tgz", - "integrity": "sha512-TtbsY5GIHgbMsMiRw35YBHGpZ1DVFEO19vxxeiDMYaeOFOCzfnYVxvl6pOUIZR4dtPhAGpSMup8OyF8ubsaqEg==", - "dev": true, - "requires": { - "debug": "^3.1.0", - "istanbul-lib-coverage": "^1.2.1", - "mkdirp": "^0.5.1", - "rimraf": "^2.6.1", - "source-map": "^0.5.3" - } - }, - "jest-changed-files": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-22.4.3.tgz", - "integrity": "sha512-83Dh0w1aSkUNFhy5d2dvqWxi/y6weDwVVLU6vmK0cV9VpRxPzhTeGimbsbRDSnEoszhF937M4sDLLeS7Cu/Tmw==", - "dev": true, - "requires": { - "throat": "^4.0.0" - } - }, - "jest-config": { - "version": "22.4.4", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-22.4.4.tgz", - "integrity": "sha512-9CKfo1GC4zrXSoMLcNeDvQBfgtqGTB1uP8iDIZ97oB26RCUb886KkKWhVcpyxVDOUxbhN+uzcBCeFe7w+Iem4A==", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "glob": "^7.1.1", - "jest-environment-jsdom": "^22.4.1", - "jest-environment-node": "^22.4.1", - "jest-get-type": "^22.1.0", - "jest-jasmine2": "^22.4.4", - "jest-regex-util": "^22.1.0", - "jest-resolve": "^22.4.2", - "jest-util": "^22.4.1", - "jest-validate": "^22.4.4", - "pretty-format": "^22.4.0" - } - }, - "jest-environment-jsdom": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-22.4.3.tgz", - "integrity": "sha512-FviwfR+VyT3Datf13+ULjIMO5CSeajlayhhYQwpzgunswoaLIPutdbrnfUHEMyJCwvqQFaVtTmn9+Y8WCt6n1w==", - "dev": true, - "requires": { - "jest-mock": "^22.4.3", - "jest-util": "^22.4.3", - "jsdom": "^11.5.1" - } - }, - "jest-get-type": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", - "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", - "dev": true - }, - "jest-haste-map": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-haste-map/-/jest-haste-map-22.4.3.tgz", - "integrity": "sha512-4Q9fjzuPVwnaqGKDpIsCSoTSnG3cteyk2oNVjBX12HHOaF1oxql+uUiqZb5Ndu7g/vTZfdNwwy4WwYogLh29DQ==", - "dev": true, - "requires": { - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.1.11", - "jest-docblock": "^22.4.3", - "jest-serializer": "^22.4.3", - "jest-worker": "^22.4.3", - "micromatch": "^2.3.11", - "sane": "^2.0.0" - } - }, - "jest-message-util": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-22.4.3.tgz", - "integrity": "sha512-iAMeKxhB3Se5xkSjU0NndLLCHtP4n+GtCqV0bISKA5dmOXQfEbdEmYiu2qpnWBDCQdEafNDDU6Q+l6oBMd/+BA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0-beta.35", - "chalk": "^2.0.1", - "micromatch": "^2.3.11", - "slash": "^1.0.0", - "stack-utils": "^1.0.1" - } - }, - "jest-regex-util": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-22.4.3.tgz", - "integrity": "sha512-LFg1gWr3QinIjb8j833bq7jtQopiwdAs67OGfkPrvy7uNUbVMfTXXcOKXJaeY5GgjobELkKvKENqq1xrUectWg==", - "dev": true - }, - "jest-resolve-dependencies": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-22.4.3.tgz", - "integrity": "sha512-06czCMVToSN8F2U4EvgSB1Bv/56gc7MpCftZ9z9fBgUQM7dzHGCMBsyfVA6dZTx8v0FDcnALf7hupeQxaBCvpA==", - "dev": true, - "requires": { - "jest-regex-util": "^22.4.3" - } - }, - "jest-runner": { - "version": "22.4.4", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-22.4.4.tgz", - "integrity": "sha512-5S/OpB51igQW9xnkM5Tgd/7ZjiAuIoiJAVtvVTBcEBiXBIFzWM3BAMPBM19FX68gRV0KWyFuGKj0EY3M3aceeQ==", - "dev": true, - "requires": { - "exit": "^0.1.2", - "jest-config": "^22.4.4", - "jest-docblock": "^22.4.0", - "jest-haste-map": "^22.4.2", - "jest-jasmine2": "^22.4.4", - "jest-leak-detector": "^22.4.0", - "jest-message-util": "^22.4.0", - "jest-runtime": "^22.4.4", - "jest-util": "^22.4.1", - "jest-worker": "^22.2.2", - "throat": "^4.0.0" - } - }, - "jest-runtime": { - "version": "22.4.4", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-22.4.4.tgz", - "integrity": "sha512-WRTj9m///npte1YjuphCYX7GRY/c2YvJImU9t7qOwFcqHr4YMzmX6evP/3Sehz5DKW2Vi8ONYPCFWe36JVXxfw==", - "dev": true, - "requires": { - "babel-core": "^6.0.0", - "babel-jest": "^22.4.4", - "babel-plugin-istanbul": "^4.1.5", - "chalk": "^2.0.1", - "convert-source-map": "^1.4.0", - "exit": "^0.1.2", - "graceful-fs": "^4.1.11", - "jest-config": "^22.4.4", - "jest-haste-map": "^22.4.2", - "jest-regex-util": "^22.1.0", - "jest-resolve": "^22.4.2", - "jest-util": "^22.4.1", - "jest-validate": "^22.4.4", - "json-stable-stringify": "^1.0.1", - "micromatch": "^2.3.11", - "realpath-native": "^1.0.0", - "slash": "^1.0.0", - "strip-bom": "3.0.0", - "write-file-atomic": "^2.1.0", - "yargs": "^10.0.3" - } - }, - "jest-snapshot": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-snapshot/-/jest-snapshot-22.4.3.tgz", - "integrity": "sha512-JXA0gVs5YL0HtLDCGa9YxcmmV2LZbwJ+0MfyXBBc5qpgkEYITQFJP7XNhcHFbUvRiniRpRbGVfJrOoYhhGE0RQ==", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "jest-diff": "^22.4.3", - "jest-matcher-utils": "^22.4.3", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "pretty-format": "^22.4.3" - } - }, - "jest-util": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-22.4.3.tgz", - "integrity": "sha512-rfDfG8wyC5pDPNdcnAlZgwKnzHvZDu8Td2NJI/jAGKEGxJPYiE4F0ss/gSAkG4778Y23Hvbz+0GMrDJTeo7RjQ==", - "dev": true, - "requires": { - "callsites": "^2.0.0", - "chalk": "^2.0.1", - "graceful-fs": "^4.1.11", - "is-ci": "^1.0.10", - "jest-message-util": "^22.4.3", - "mkdirp": "^0.5.1", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "jest-validate": { - "version": "22.4.4", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-22.4.4.tgz", - "integrity": "sha512-dmlf4CIZRGvkaVg3fa0uetepcua44DHtktHm6rcoNVtYlpwe6fEJRkMFsaUVcFHLzbuBJ2cPw9Gl9TKfnzMVwg==", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "jest-config": "^22.4.4", - "jest-get-type": "^22.1.0", - "leven": "^2.1.0", - "pretty-format": "^22.4.0" - } - }, - "jest-worker": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-22.4.3.tgz", - "integrity": "sha512-B1ucW4fI8qVAuZmicFxI1R3kr2fNeYJyvIQ1rKcuLYnenFV5K5aMbxFj6J0i00Ju83S8jP2d7Dz14+AvbIHRYQ==", - "dev": true, - "requires": { - "merge-stream": "^1.0.1" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - } - }, - "node-notifier": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.2.1.tgz", - "integrity": "sha512-MIBs+AAd6dJ2SklbbE8RUDRlIVhU8MaNLh1A9SUZDUHPiZkWLFde6UNwG41yQHZEToHgJMXqyVZ9UcS/ReOVTg==", - "dev": true, - "requires": { - "growly": "^1.3.0", - "semver": "^5.4.1", - "shellwords": "^0.1.1", - "which": "^1.3.0" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "realpath-native": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.0.2.tgz", - "integrity": "sha512-+S3zTvVt9yTntFrBpm7TQmQ3tzpCrnA1a/y+3cUHAc9ZR6aIjG0WNLR+Rj79QpJktY+VeW/TQtFlQ1bzsehI8g==", - "dev": true, - "requires": { - "util.promisify": "^1.0.0" - } - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, - "string-length": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", - "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", - "dev": true, - "requires": { - "astral-regex": "^1.0.0", - "strip-ansi": "^4.0.0" - } - } - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-diff": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-diff/-/jest-diff-22.4.3.tgz", - "integrity": "sha512-/QqGvCDP5oZOF6PebDuLwrB2BMD8ffJv6TAGAdEVuDx1+uEgrHpSFrfrOiMRx2eJ1hgNjlQrOQEHetVwij90KA==", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "diff": "^3.2.0", - "jest-get-type": "^22.4.3", - "pretty-format": "^22.4.3" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-docblock": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-22.4.3.tgz", - "integrity": "sha512-uPKBEAw7YrEMcXueMKZXn/rbMxBiSv48fSqy3uEnmgOlQhSX+lthBqHb1fKWNVmFqAp9E/RsSdBfiV31LbzaOg==", - "dev": true, - "requires": { - "detect-newline": "^2.1.0" - } - }, - "jest-environment-node": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-22.4.3.tgz", - "integrity": "sha512-reZl8XF6t/lMEuPWwo9OLfttyC26A5AMgDyEQ6DBgZuyfyeNUzYT8BFo6uxCCP/Av/b7eb9fTi3sIHFPBzmlRA==", - "dev": true, - "requires": { - "jest-mock": "^22.4.3", - "jest-util": "^22.4.3" - } - }, - "jest-get-type": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", - "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", - "dev": true - }, - "jest-jasmine2": { - "version": "22.4.4", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-22.4.4.tgz", - "integrity": "sha512-nK3vdUl50MuH7vj/8at7EQVjPGWCi3d5+6aCi7Gxy/XMWdOdbH1qtO/LjKbqD8+8dUAEH+BVVh7HkjpCWC1CSw==", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "co": "^4.6.0", - "expect": "^22.4.0", - "graceful-fs": "^4.1.11", - "is-generator-fn": "^1.0.0", - "jest-diff": "^22.4.0", - "jest-matcher-utils": "^22.4.0", - "jest-message-util": "^22.4.0", - "jest-snapshot": "^22.4.0", - "jest-util": "^22.4.1", - "source-map-support": "^0.5.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-leak-detector": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-22.4.3.tgz", - "integrity": "sha512-NZpR/Ls7+ndO57LuXROdgCGz2RmUdC541tTImL9bdUtU3WadgFGm0yV+Ok4Fuia/1rLAn5KaJ+i76L6e3zGJYQ==", - "dev": true, - "requires": { - "pretty-format": "^22.4.3" - } - }, - "jest-matcher-utils": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-22.4.3.tgz", - "integrity": "sha512-lsEHVaTnKzdAPR5t4B6OcxXo9Vy4K+kRRbG5gtddY8lBEC+Mlpvm1CJcsMESRjzUhzkz568exMV1hTB76nAKbA==", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "jest-get-type": "^22.4.3", - "pretty-format": "^22.4.3" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-message-util": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-22.4.3.tgz", - "integrity": "sha512-iAMeKxhB3Se5xkSjU0NndLLCHtP4n+GtCqV0bISKA5dmOXQfEbdEmYiu2qpnWBDCQdEafNDDU6Q+l6oBMd/+BA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0-beta.35", - "chalk": "^2.0.1", - "micromatch": "^2.3.11", - "slash": "^1.0.0", - "stack-utils": "^1.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-mock": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-22.4.3.tgz", - "integrity": "sha512-+4R6mH5M1G4NK16CKg9N1DtCaFmuxhcIqF4lQK/Q1CIotqMs/XBemfpDPeVZBFow6iyUNu6EBT9ugdNOTT5o5Q==", - "dev": true - }, - "jest-regex-util": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-22.4.3.tgz", - "integrity": "sha512-LFg1gWr3QinIjb8j833bq7jtQopiwdAs67OGfkPrvy7uNUbVMfTXXcOKXJaeY5GgjobELkKvKENqq1xrUectWg==", - "dev": true - }, - "jest-resolve": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-resolve/-/jest-resolve-22.4.3.tgz", - "integrity": "sha512-u3BkD/MQBmwrOJDzDIaxpyqTxYH+XqAXzVJP51gt29H8jpj3QgKof5GGO2uPGKGeA1yTMlpbMs1gIQ6U4vcRhw==", - "dev": true, - "requires": { - "browser-resolve": "^1.11.2", - "chalk": "^2.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-serializer": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-22.4.3.tgz", - "integrity": "sha512-uPaUAppx4VUfJ0QDerpNdF43F68eqKWCzzhUlKNDsUPhjOon7ZehR4C809GCqh765FoMRtTVUVnGvIoskkYHiw==", - "dev": true - }, - "jest-snapshot": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-snapshot/-/jest-snapshot-22.4.3.tgz", - "integrity": "sha512-JXA0gVs5YL0HtLDCGa9YxcmmV2LZbwJ+0MfyXBBc5qpgkEYITQFJP7XNhcHFbUvRiniRpRbGVfJrOoYhhGE0RQ==", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "jest-diff": "^22.4.3", - "jest-matcher-utils": "^22.4.3", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "pretty-format": "^22.4.3" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-util": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-22.4.3.tgz", - "integrity": "sha512-rfDfG8wyC5pDPNdcnAlZgwKnzHvZDu8Td2NJI/jAGKEGxJPYiE4F0ss/gSAkG4778Y23Hvbz+0GMrDJTeo7RjQ==", - "dev": true, - "requires": { - "callsites": "^2.0.0", - "chalk": "^2.0.1", - "graceful-fs": "^4.1.11", - "is-ci": "^1.0.10", - "jest-message-util": "^22.4.3", - "mkdirp": "^0.5.1", - "source-map": "^0.6.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "js-yaml": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz", - "integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "js2xmlparser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-3.0.0.tgz", - "integrity": "sha1-P7YOqgicVED5MZ9RdgzNB+JJlzM=", - "dev": true, - "requires": { - "xmlcreate": "^1.0.1" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true - }, - "jsdoc": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.5.tgz", - "integrity": "sha512-6PxB65TAU4WO0Wzyr/4/YhlGovXl0EVYfpKbpSroSj0qBxT4/xod/l40Opkm38dRHRdQgdeY836M0uVnJQG7kg==", - "dev": true, - "requires": { - "babylon": "7.0.0-beta.19", - "bluebird": "~3.5.0", - "catharsis": "~0.8.9", - "escape-string-regexp": "~1.0.5", - "js2xmlparser": "~3.0.0", - "klaw": "~2.0.0", - "marked": "~0.3.6", - "mkdirp": "~0.5.1", - "requizzle": "~0.2.1", - "strip-json-comments": "~2.0.1", - "taffydb": "2.6.2", - "underscore": "~1.8.3" - }, - "dependencies": { - "babylon": { - "version": "7.0.0-beta.19", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.19.tgz", - "integrity": "sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A==", - "dev": true - }, - "klaw": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.0.0.tgz", - "integrity": "sha1-WcEo4Nxc5BAgEVEZTuucv4WGUPY=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, - "taffydb": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", - "dev": true - } - } - }, - "jsdoc-template": { - "version": "github:braintree/jsdoc-template#9ac837f2a774610c3de55431454777ae2419ba11", - "from": "github:braintree/jsdoc-template", - "dev": true - }, - "jsdom": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", - "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", - "dev": true, - "requires": { - "abab": "^2.0.0", - "acorn": "^5.5.3", - "acorn-globals": "^4.1.0", - "array-equal": "^1.0.0", - "cssom": ">= 0.3.2 < 0.4.0", - "cssstyle": "^1.0.0", - "data-urls": "^1.0.0", - "domexception": "^1.0.1", - "escodegen": "^1.9.1", - "html-encoding-sniffer": "^1.0.2", - "left-pad": "^1.3.0", - "nwsapi": "^2.0.7", - "parse5": "4.0.0", - "pn": "^1.1.0", - "request": "^2.87.0", - "request-promise-native": "^1.0.5", - "sax": "^1.2.4", - "symbol-tree": "^3.2.2", - "tough-cookie": "^2.3.4", - "w3c-hr-time": "^1.0.1", - "webidl-conversions": "^4.0.2", - "whatwg-encoding": "^1.0.3", - "whatwg-mimetype": "^2.1.0", - "whatwg-url": "^6.4.1", - "ws": "^5.2.0", - "xml-name-validator": "^3.0.0" - }, - "dependencies": { - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", - "dev": true - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", - "dev": true, - "requires": { - "ajv": "^5.3.0", - "har-schema": "^2.0.0" - } - }, - "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", - "dev": true - }, - "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", - "dev": true, - "requires": { - "mime-db": "~1.36.0" - } - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "dev": true, - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - } - } - } - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", - "dev": true - } - } - }, - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "~0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, - "requires": { - "invert-kv": "^1.0.0" - } - }, - "lcov-parse": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", - "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", - "dev": true - }, - "left-pad": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", - "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==", - "dev": true - }, - "leven": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", - "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", - "dev": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "loader-runner": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.0.tgz", - "integrity": "sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=", - "dev": true - }, - "loader-utils": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", - "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", - "dev": true, - "requires": { - "big.js": "^3.1.3", - "emojis-list": "^2.0.0", - "json5": "^0.5.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } - } - }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, - "lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", - "dev": true - }, - "lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", - "dev": true - }, - "log-driver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", - "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", - "dev": true - }, - "long": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", - "dev": true - }, - "loose-envify": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", - "dev": true, - "requires": { - "js-tokens": "^3.0.0" - } - }, - "lru-cache": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.2.tgz", - "integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", - "dev": true, - "requires": { - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } - } - }, - "makeerror": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", - "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", - "dev": true, - "requires": { - "tmpl": "1.0.x" - } - }, - "mamacro": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", - "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==", - "dev": true - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "marked": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", - "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", - "dev": true - }, - "math-random": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", - "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", - "dev": true - }, - "md5.js": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", - "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "memory-fs": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", - "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", - "dev": true, - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - }, - "merge": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz", - "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=", - "dev": true - }, - "merge-stream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", - "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", - "dev": true, - "requires": { - "readable-stream": "^2.0.1" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - } - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - } - }, - "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", - "dev": true - }, - "mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", - "dev": true, - "requires": { - "mime-db": "~1.33.0" - } - }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mississippi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", - "integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==", - "dev": true, - "requires": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^2.0.1", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - } - }, - "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", - "dev": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "move-concurrently": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", - "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "copy-concurrently": "^1.0.0", - "fs-write-stream-atomic": "^1.0.8", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.3" - }, - "dependencies": { - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, - "nan": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz", - "integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==", - "dev": true, - "optional": true - }, - "nanomatch": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz", - "integrity": "sha512-n8R9bS8yQ6eSXaV6jHUpKzD8gLsin02w1HSFiegwrs9E098Ylhw5jdyKPaYqvHknHaSCKTPp7C8dGCQ0q9koXA==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-odd": "^2.0.0", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "neo-async": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.1.tgz", - "integrity": "sha512-3KL3fvuRkZ7s4IFOMfztb7zJp3QaVWnBeGoJlgB38XnCRPj/0tLzzLG5IB8NYOHbJ8g8UGrgZv44GLDk6CxTxA==", - "dev": true - }, - "nice-try": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.4.tgz", - "integrity": "sha512-2NpiFHqC87y/zFke0fC0spBXL3bBsoh/p5H1EFhshxjCR5+0g2d6BiXbUFz9v1sAcxsk2htp2eQnNIci2dIYcA==", - "dev": true - }, - "node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", - "dev": true - }, - "node-libs-browser": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", - "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", - "dev": true, - "requires": { - "assert": "^1.1.1", - "browserify-zlib": "^0.2.0", - "buffer": "^4.3.0", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.11.0", - "domain-browser": "^1.1.1", - "events": "^1.0.0", - "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "0.0.0", - "process": "^0.11.10", - "punycode": "^1.2.4", - "querystring-es3": "^0.2.0", - "readable-stream": "^2.3.3", - "stream-browserify": "^2.0.1", - "stream-http": "^2.7.2", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", - "tty-browserify": "0.0.0", - "url": "^0.11.0", - "util": "^0.10.3", - "vm-browserify": "0.0.4" - }, - "dependencies": { - "buffer": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", - "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", - "dev": true, - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", - "dev": true - }, - "timers-browserify": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", - "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", - "dev": true, - "requires": { - "setimmediate": "^1.0.4" - } - }, - "tty-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", - "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", - "dev": true - }, - "vm-browserify": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", - "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", - "dev": true, - "requires": { - "indexof": "0.0.1" - } - } - } - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "nwsapi": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.9.tgz", - "integrity": "sha512-nlWFSCTYQcHk/6A9FFnfhKc14c3aFhfdNBXgo8Qgi9QTBu/qg3Ww+Uiz9wMzXd1T8GFxPc2QIHB6Qtf2XFryFQ==", - "dev": true - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "requires": { - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" - } - }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", - "dev": true, - "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "requires": { - "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - } - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" - }, - "dependencies": { - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - } - } - }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "dev": true, - "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz", - "integrity": "sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "pako": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", - "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", - "dev": true - }, - "parallel-transform": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", - "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", - "dev": true, - "requires": { - "cyclist": "~0.2.2", - "inherits": "^2.0.3", - "readable-stream": "^2.1.5" - } - }, - "parse-asn1": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", - "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", - "dev": true, - "requires": { - "asn1.js": "^4.0.0", - "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3" - } - }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true, - "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "parse5": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", - "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", - "dev": true - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, - "path-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", - "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", - "dev": true - }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", - "dev": true - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pbkdf2": { - "version": "3.0.16", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", - "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", - "dev": true, - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "requires": { - "find-up": "^2.1.0" - }, - "dependencies": { - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - } - } - }, - "pn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", - "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", - "dev": true - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "dev": true - }, - "prettier": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.12.1.tgz", - "integrity": "sha1-wa0g6APndJ+vkFpAnSNn4Gu+cyU=", - "dev": true - }, - "pretty-format": { - "version": "22.4.3", - "resolved": "http://registry.npmjs.org/pretty-format/-/pretty-format-22.4.3.tgz", - "integrity": "sha512-S4oT9/sT6MN7/3COoOy+ZJeA92VmOnveLHgrwBE3Z1W5N9S2A1QGNYiE1z75DAENbJrXXUb+OWXhpJcg05QKQQ==", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0", - "ansi-styles": "^3.2.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - } - } - }, - "private": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", - "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", - "dev": true - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, - "promise-inflight": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", - "dev": true - }, - "prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", - "dev": true - }, - "public-encrypt": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", - "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pumpify": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", - "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", - "dev": true, - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - }, - "dependencies": { - "duplexify": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", - "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", - "dev": true, - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - } - } - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", - "dev": true - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "dev": true - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", - "dev": true - }, - "randomatic": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.0.tgz", - "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", - "dev": true, - "requires": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "randombytes": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", - "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - } - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", - "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "minimatch": "^3.0.2", - "readable-stream": "^2.0.2", - "set-immediate-shim": "^1.0.1" - } - }, - "regenerate": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", - "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", - "dev": true - }, - "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", - "dev": true - }, - "regenerator-transform": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", - "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", - "dev": true, - "requires": { - "babel-runtime": "^6.18.0", - "babel-types": "^6.19.0", - "private": "^0.1.6" - } - }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", - "dev": true, - "requires": { - "is-equal-shallow": "^0.1.3" - } - }, - "regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "regexpu-core": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", - "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", - "dev": true, - "requires": { - "regenerate": "^1.2.1", - "regjsgen": "^0.2.0", - "regjsparser": "^0.1.4" - } - }, - "regjsgen": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", - "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", - "dev": true - }, - "regjsparser": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", - "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", - "dev": true, - "requires": { - "jsesc": "~0.5.0" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "repeat-element": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true, - "requires": { - "is-finite": "^1.0.0" - } - }, - "request": { - "version": "2.85.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", - "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", - "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", - "hawk": "~6.0.2", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", - "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "stringstream": "~0.0.5", - "tough-cookie": "~2.3.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" - } - }, - "request-promise-core": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", - "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", - "dev": true, - "requires": { - "lodash": "^4.13.1" - } - }, - "request-promise-native": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", - "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", - "dev": true, - "requires": { - "request-promise-core": "1.1.1", - "stealthy-require": "^1.1.0", - "tough-cookie": ">=2.3.3" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "requizzle": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.1.tgz", - "integrity": "sha1-aUPDUwxNmn5G8c3dUcFY/GcM294=", - "dev": true, - "requires": { - "underscore": "~1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, - "resolve-cwd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", - "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", - "dev": true, - "requires": { - "resolve-from": "^3.0.0" - } - }, - "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", - "dev": true - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "dev": true - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "rsvp": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.6.2.tgz", - "integrity": "sha512-OfWGQTb9vnwRjwtA2QwpG2ICclHC3pgXZO5xt8H2EfgDquO0qVdSb5T88L4qJVAEugbS56pAuV4XZM58UX8ulw==", - "dev": true - }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "^2.1.0" - } - }, - "run-queue": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", - "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", - "dev": true, - "requires": { - "aproba": "^1.1.1" - } - }, - "rxjs": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz", - "integrity": "sha512-OwMxHxmnmHTUpgO+V7dZChf3Tixf4ih95cmXjzzadULziVl/FKhHScGLj4goEw9weePVOH2Q0+GcCBUhKCZc/g==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", - "dev": true, - "requires": { - "ret": "~0.1.10" - } - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "sane": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/sane/-/sane-2.5.2.tgz", - "integrity": "sha1-tNwYYcIbQn6SlQej51HiosuKs/o=", - "dev": true, - "requires": { - "anymatch": "^2.0.0", - "capture-exit": "^1.2.0", - "exec-sh": "^0.2.0", - "fb-watchman": "^2.0.0", - "fsevents": "^1.2.3", - "micromatch": "^3.1.4", - "minimist": "^1.1.1", - "walker": "~1.0.5", - "watch": "~0.18.0" - }, - "dependencies": { - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true - }, - "schema-utils": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", - "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" - }, - "dependencies": { - "ajv": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.2.tgz", - "integrity": "sha512-hOs7GfvI6tUI1LfZddH82ky6mOMyTuY0mk7kE2pWpmhhUSkumzaTO5vbVwij39MdwPQWCV4Zv57Eo06NtL/GVA==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.1" - } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - } - } - }, - "semver": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", - "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", - "dev": true - }, - "serialize-javascript": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz", - "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==", - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "set-immediate-shim": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", - "dev": true - }, - "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - } - }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", - "dev": true - }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shellwords": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", - "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, - "snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", - "dev": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true, - "requires": { - "kind-of": "^3.2.0" - } - }, - "sntp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", - "dev": true, - "requires": { - "hoek": "4.x.x" - } - }, - "source-list-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", - "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", - "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", - "dev": true, - "requires": { - "atob": "^2.0.0", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-support": { - "version": "0.5.9", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz", - "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "spdx-correct": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.1.tgz", - "integrity": "sha512-hxSPZbRZvSDuOvADntOElzJpenIR7wXJkuoUcUtS0erbgt2fgeaoPIYretfKpslMhfFDY4k0MZ2F5CUzhBsSvQ==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", - "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", - "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", - "dev": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "sshpk": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", - "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" - } - }, - "ssri": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", - "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.1" - } - }, - "stack-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.1.tgz", - "integrity": "sha1-1PM6tU6OOHeLDKXP07OvsS22hiA=", - "dev": true - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", - "dev": true - }, - "stream-browserify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", - "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", - "dev": true, - "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" - } - }, - "stream-each": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.2.tgz", - "integrity": "sha512-mc1dbFhGBxvTM3bIWmAAINbqiuAk9TATcfIQC8P+/+HJefgaiTlMn2dHvkX8qlI12KeYKSQ1Ua9RrIqrn1VPoA==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "stream-shift": "^1.0.0" - } - }, - "stream-http": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.1.tgz", - "integrity": "sha512-cQ0jo17BLca2r0GfRdZKYAGLU6JRoIWxqSOakUMuKOT6MOK7AAlE856L33QuDmAy/eeOrhLee3dZKX0Uadu93A==", - "dev": true, - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.3", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" - } - }, - "stream-shift": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", - "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "stringstream": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", - "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, - "symbol-tree": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", - "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=", - "dev": true - }, - "tapable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.0.0.tgz", - "integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==", - "dev": true - }, - "test-exclude": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.2.3.tgz", - "integrity": "sha512-SYbXgY64PT+4GAL2ocI3HwPa4Q4TBKm0cwAVeKOt/Aoc0gSpNRjJX8w0pA1LMKZ3LBmd8pYBqApFNQLII9kavA==", - "dev": true, - "requires": { - "arrify": "^1.0.1", - "micromatch": "^2.3.11", - "object-assign": "^4.1.0", - "read-pkg-up": "^1.0.1", - "require-main-filename": "^1.0.1" - } - }, - "throat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", - "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "dev": true, - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - } - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, - "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", - "dev": true - }, - "to-arraybuffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", - "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", - "dev": true - }, - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", - "dev": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - } - } - }, - "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", - "dev": true, - "requires": { - "punycode": "^1.4.1" - } - }, - "tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", - "dev": true, - "requires": { - "punycode": "^2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - } - } - }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, - "tslib": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", - "dev": true - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, - "uglify-js": { - "version": "3.4.9", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", - "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", - "dev": true, - "optional": true, - "requires": { - "commander": "~2.17.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "commander": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", - "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", - "dev": true, - "optional": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true - } - } - }, - "uglifyjs-webpack-plugin": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.7.tgz", - "integrity": "sha512-1VicfKhCYHLS8m1DCApqBhoulnASsEoJ/BvpUpP4zoNAPpKzdH+ghk0olGJMmwX2/jprK2j3hAHdUbczBSy2FA==", - "dev": true, - "requires": { - "cacache": "^10.0.4", - "find-cache-dir": "^1.0.0", - "schema-utils": "^0.4.5", - "serialize-javascript": "^1.4.0", - "source-map": "^0.6.1", - "uglify-es": "^3.3.4", - "webpack-sources": "^1.1.0", - "worker-farm": "^1.5.2" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "uglify-es": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", - "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", - "dev": true, - "requires": { - "commander": "~2.13.0", - "source-map": "~0.6.1" - } - } - } - }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true - }, - "underscore-contrib": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz", - "integrity": "sha1-ZltmwkeD+PorGMn4y7Dix9SMJsc=", - "dev": true, - "requires": { - "underscore": "1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, - "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } - } - }, - "unique-filename": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.0.tgz", - "integrity": "sha1-0F8v5AMlYIcfMOk8vnNe6iAVFPM=", - "dev": true, - "requires": { - "unique-slug": "^2.0.0" - } - }, - "unique-slug": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.0.tgz", - "integrity": "sha1-22Z258fMBimHj/GWCXx4hVrp9Ks=", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4" - } - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "upath": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", - "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", - "dev": true - }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - } - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", - "dev": true - } - } - }, - "use": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", - "integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==", - "dev": true, - "requires": { - "kind-of": "^6.0.2" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, - "requires": { - "inherits": "2.0.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true - } - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" - } - }, - "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", - "dev": true - }, - "v8-compile-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.0.tgz", - "integrity": "sha512-qNdTUMaCjPs4eEnM3W9H94R3sU70YCuT+/ST7nUf+id1bVOrdjrpUaeZLqPBPRph3hsgn4a4BvwpxhHZx+oSDg==", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "w3c-hr-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", - "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", - "dev": true, - "requires": { - "browser-process-hrtime": "^0.1.2" - } - }, - "walker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", - "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", - "dev": true, - "requires": { - "makeerror": "1.0.x" - } - }, - "watch": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/watch/-/watch-0.18.0.tgz", - "integrity": "sha1-KAlUdsbffJDJYxOJkMClQj60uYY=", - "dev": true, - "requires": { - "exec-sh": "^0.2.0", - "minimist": "^1.2.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "watchpack": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", - "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", - "dev": true, - "requires": { - "chokidar": "^2.0.2", - "graceful-fs": "^4.1.2", - "neo-async": "^2.5.0" - }, - "dependencies": { - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "chokidar": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", - "integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==", - "dev": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.0", - "braces": "^2.3.0", - "fsevents": "^1.2.2", - "glob-parent": "^3.1.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "lodash.debounce": "^4.0.8", - "normalize-path": "^2.1.1", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0", - "upath": "^1.0.5" - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-glob": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", - "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } - } - }, - "webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", - "dev": true - }, - "webpack": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.15.1.tgz", - "integrity": "sha512-UwfFQ2plA5EMhhzwi/hl5xpLk7mNK7p0853Ml04z1Bqw553pY+oS8Xke3funcVy7eG/yMpZPvnlFTUyGKyKoyw==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.13", - "@webassemblyjs/helper-module-context": "1.5.13", - "@webassemblyjs/wasm-edit": "1.5.13", - "@webassemblyjs/wasm-opt": "1.5.13", - "@webassemblyjs/wasm-parser": "1.5.13", - "acorn": "^5.6.2", - "acorn-dynamic-import": "^3.0.0", - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0", - "chrome-trace-event": "^1.0.0", - "enhanced-resolve": "^4.1.0", - "eslint-scope": "^3.7.1", - "json-parse-better-errors": "^1.0.2", - "loader-runner": "^2.3.0", - "loader-utils": "^1.1.0", - "memory-fs": "~0.4.1", - "micromatch": "^3.1.8", - "mkdirp": "~0.5.0", - "neo-async": "^2.5.0", - "node-libs-browser": "^2.0.0", - "schema-utils": "^0.4.4", - "tapable": "^1.0.0", - "uglifyjs-webpack-plugin": "^1.2.4", - "watchpack": "^1.5.0", - "webpack-sources": "^1.0.1" - }, - "dependencies": { - "acorn": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", - "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==", - "dev": true - }, - "ajv": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.2.tgz", - "integrity": "sha512-hOs7GfvI6tUI1LfZddH82ky6mOMyTuY0mk7kE2pWpmhhUSkumzaTO5vbVwij39MdwPQWCV4Zv57Eo06NtL/GVA==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.1" - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } - } - }, - "webpack-cli": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.0.8.tgz", - "integrity": "sha512-KnRLJ0BUaYRqrhAMb9dv3gzdmhmgIMKo0FmdsnmfqbPGtLnnZ6tORZAvmmKfr+A0VgiVpqC60Gv7Ofg0R2CHtQ==", - "dev": true, - "requires": { - "chalk": "^2.4.1", - "cross-spawn": "^6.0.5", - "enhanced-resolve": "^4.0.0", - "global-modules-path": "^2.1.0", - "import-local": "^1.0.0", - "inquirer": "^6.0.0", - "interpret": "^1.1.0", - "loader-utils": "^1.1.0", - "supports-color": "^5.4.0", - "v8-compile-cache": "^2.0.0", - "yargs": "^11.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "dev": true, - "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" - } - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "yargs": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", - "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" - } - }, - "yargs-parser": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", - "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } - } - } - }, - "webpack-sources": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz", - "integrity": "sha512-aqYp18kPphgoO5c/+NaUvEeACtZjMESmDChuD3NBciVpah3XpMEU9VAAtIaB1BsfJWWTSdv8Vv1m3T0aRk2dUw==", - "dev": true, - "requires": { - "source-list-map": "^2.0.0", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "whatwg-encoding": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.4.tgz", - "integrity": "sha512-vM9KWN6MP2mIHZ86ytcyIv7e8Cj3KTfO2nd2c8PFDqcI4bxFmQp83ibq4wadq7rL9l9sZV6o9B0LTt8ygGAAXg==", - "dev": true, - "requires": { - "iconv-lite": "0.4.23" - } - }, - "whatwg-mimetype": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.2.0.tgz", - "integrity": "sha512-5YSO1nMd5D1hY3WzAQV3PzZL83W3YeyR1yW9PcH26Weh1t+Vzh9B6XkDh7aXm83HBZ4nSMvkjvN2H2ySWIvBgw==", - "dev": true - }, - "whatwg-url": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", - "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", - "dev": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - }, - "worker-farm": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz", - "integrity": "sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ==", - "dev": true, - "requires": { - "errno": "~0.1.7" - } - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "write-file-atomic": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - }, - "ws": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", - "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } - }, - "xml-name-validator": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", - "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", - "dev": true - }, - "xmlcreate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-1.0.2.tgz", - "integrity": "sha1-+mv3YqYKQT+z3Y9LA8WyaSONMI8=", - "dev": true - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - }, - "yargs": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", - "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^8.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "yargs-parser": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz", - "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } - } - } -} diff --git a/package.json b/package.json index 467189368..d2ac370e6 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,28 @@ { "name": "php-parser", - "version": "3.0.0-prerelease.5", - "description": "Parse PHP code and returns its AST", + "version": "3.2.3", + "description": "Parse PHP code from JS and returns its AST", "main": "src/index.js", "browser": "dist/php-parser.js", "files": [ "src", - "dist" + "dist", + "types.d.ts", + "LICENSE" ], + "types": "types.d.ts", "scripts": { - "lint": "prettier --write src/*.js src/**/*.js", - "pretest": "npm run lint", + "fix": "eslint . --fix", "test": "jest", - "prebuild": "npm run test", + "prepublishOnly": "yarpm run build", + "prebuild": "yarpm run test", "build": "webpack --config webpack.config.js", - "postbuild": "npm run build-docs", + "-postbuild": "yarpm run build-docs", "build-docs": "jsdoc -c .jsdoc.json", + "build-types": "jsdoc -t node_modules/tsd-jsdoc/dist -r src -d . && prettier -w types.d.ts", "publish-docs": "git subtree push --prefix docs origin gh-pages", - "cover": "jest --coverage --coverageDirectory=coverage/" + "benchmark": "node test/benchmark.js", + "prepare": "husky" }, "repository": { "type": "git", @@ -31,6 +36,7 @@ "php", "php5", "php7", + "php8", "parser", "lexer", "tokenizer", @@ -50,20 +56,32 @@ } ], "license": "BSD-3-Clause", - "jest": { - "testEnvironment": "node", - "testURL": "http://localhost/" - }, "devDependencies": { - "babel-loader": "^7", - "babel-preset-es2015": "^6", - "coveralls": "^3", - "eslint-plugin-prettier": "^2.6.2", - "jest": "^22.4", - "jsdoc": "^3.5.5", - "jsdoc-template": "github:braintree/jsdoc-template", - "prettier": "^1.9", - "webpack": "^4.15.1", - "webpack-cli": "^3.0.8" - } + "@babel/core": "^7.26.0", + "@babel/preset-env": "^7.26.0", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.14.0", + "@types/node": "^22.9.0", + "babel-loader": "^9.2.1", + "benchmark": "^2.1.4", + "coveralls": "^3.0.3", + "eslint": "^9.14.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jest": "^28.9.0", + "eslint-plugin-prettier": "^5.2.1", + "globals": "^15.12.0", + "husky": "^9.1.6", + "jest": "^29.7.0", + "jest-runner-eslint": "^2.2.1", + "jsdoc": "^3.6.11", + "jsdoc-template": "^1.2.0", + "lodash.template": ">=4.5.0", + "prettier": "^3.3.3", + "tsd-jsdoc": "^2.5.0", + "typescript": "^5.6.3", + "webpack": "5.96.0", + "webpack-cli": "^5.1.4", + "yarpm": "^1.2.0" + }, + "dependencies": {} } diff --git a/src/ast.js b/src/ast.js index 7dd51e064..d11b556b5 100644 --- a/src/ast.js +++ b/src/ast.js @@ -14,24 +14,49 @@ const Position = require("./ast/position"); * - [Location](#location) * - [Position](#position) * - [Node](#node) + * - [Noop](#noop) + * - [NullKeyword](#nullkeyword) + * - [StaticVariable](#staticvariable) + * - [EncapsedPart](#encapsedpart) + * - [Constant](#constant) * - [Identifier](#identifier) + * - [Reference](#reference) + * - [TypeReference](#typereference) + * - [ParentReference](#parentreference) + * - [StaticReference](#staticreference) + * - [SelfReference](#selfreference) + * - [Name](#name) * - [TraitUse](#traituse) * - [TraitAlias](#traitalias) * - [TraitPrecedence](#traitprecedence) - * - [Entry](#entry) - * - [Case](#case) - * - [Label](#label) * - [Comment](#comment) * - [CommentLine](#commentline) * - [CommentBlock](#commentblock) * - [Error](#error) * - [Expression](#expression) + * - [Entry](#entry) + * - [ArrowFunc](#arrowfunc) + * - [Closure](#closure) + * - [ByRef](#byref) + * - [Silent](#silent) + * - [RetIf](#retif) + * - [New](#new) + * - [Include](#include) + * - [Call](#call) + * - [Eval](#eval) + * - [Exit](#exit) + * - [Clone](#clone) + * - [Assign](#assign) + * - [AssignRef](#assignref) * - [Array](#array) + * - [List](#list) * - [Variable](#variable) * - [Variadic](#variadic) - * - [ConstRef](#constref) * - [Yield](#yield) * - [YieldFrom](#yieldfrom) + * - [Print](#print) + * - [Isset](#isset) + * - [Empty](#empty) * - [Lookup](#lookup) * - [PropertyLookup](#propertylookup) * - [StaticLookup](#staticlookup) @@ -51,16 +76,19 @@ const Position = require("./ast/position"); * - [Nowdoc](#nowdoc) * - [Encapsed](#encapsed) * - [Statement](#statement) - * - [Eval](#eval) - * - [Exit](#exit) + * - [ConstantStatement](#constantstatement) + * - [ClassConstant](#classconstant) + * - [Return](#return) + * - [Label](#label) + * - [Continue](#continue) + * - [Case](#case) + * - [Break](#break) + * - [Echo](#echo) + * - [Unset](#unset) * - [Halt](#halt) - * - [Clone](#clone) * - [Declare](#declare) * - [Global](#global) * - [Static](#static) - * - [Include](#include) - * - [Assign](#assign) - * - [RetIf](#retif) * - [If](#if) * - [Do](#do) * - [While](#while) @@ -68,65 +96,39 @@ const Position = require("./ast/position"); * - [Foreach](#foreach) * - [Switch](#switch) * - [Goto](#goto) - * - [Silent](#silent) * - [Try](#try) * - [Catch](#catch) * - [Throw](#throw) - * - [Call](#call) - * - [Closure](#closure) - * - [New](#new) * - [UseGroup](#usegroup) * - [UseItem](#useitem) * - [Block](#block) * - [Program](#program) * - [Namespace](#namespace) - * - [Sys](#sys) - * - [Echo](#echo) - * - [List](#list) - * - [Print](#print) - * - [Isset](#isset) - * - [Unset](#unset) - * - [Empty](#empty) + * - [PropertyStatement](#propertystatement) + * - [Property](#property) * - [Declaration](#declaration) * - [Class](#class) * - [Interface](#interface) * - [Trait](#trait) - * - [Constant](#constant) - * - [ClassConstant](#classconstant) * - [Function](#function) * - [Method](#method) * - [Parameter](#parameter) - * - [Property](#property) * --- */ /** * The AST builder class * @constructor AST + * @memberOf module:php-parser * @tutorial AST * @property {Boolean} withPositions - Should locate any node (by default false) * @property {Boolean} withSource - Should extract the node original code (by default false) */ -const AST = function(withPositions, withSource) { +const AST = function (withPositions, withSource) { this.withPositions = withPositions; this.withSource = withSource; }; -/** - * Create a position node from specified parser - * including it's lexer current state - * @param {Parser} - * @return {Position} - * @private - */ -AST.prototype.position = function(parser) { - return new Position( - parser.lexer.yylloc.first_line, - parser.lexer.yylloc.first_column, - parser.lexer.yylloc.first_offset - ); -}; - // operators in ascending order of precedence AST.precedence = {}; [ @@ -147,33 +149,109 @@ AST.precedence = {}; ["+", "-", "."], ["*", "/", "%"], ["!"], - ["instanceof"] - // TODO: typecasts + ["instanceof"], + ["cast", "silent"], + ["**"], // TODO: [ (array) // TODO: clone, new -].forEach(function(list, index) { - list.forEach(function(operator) { +].forEach(function (list, index) { + list.forEach(function (operator) { AST.precedence[operator] = index + 1; }); }); +/** + * @private + * @function AST#isRightAssociative + * @memberOf module:php-parser + * @param operator + * @return {boolean} + */ +AST.prototype.isRightAssociative = function (operator) { + return operator === "**" || operator === "??"; +}; + +/** + * Change parent node informations after swapping childs + * @private + * @function AST#swapLocations + * @memberOf module:php-parser + */ +AST.prototype.swapLocations = function (target, first, last, parser) { + if (this.withPositions) { + target.loc.start = first.loc.start; + target.loc.end = last.loc.end; + if (this.withSource) { + target.loc.source = parser.lexer._input.substring( + target.loc.start.offset, + target.loc.end.offset, + ); + } + } +}; + +/** + * Includes locations from first & last into the target + * @private + * @function AST#resolveLocations + * @memberOf module:php-parser + */ +AST.prototype.resolveLocations = function (target, first, last, parser) { + if (this.withPositions) { + if (target.loc.start.offset > first.loc.start.offset) { + target.loc.start = first.loc.start; + } + /* istanbul ignore next */ + if (target.loc.end.offset < last.loc.end.offset) { + target.loc.end = last.loc.end; + } + if (this.withSource) { + target.loc.source = parser.lexer._input.substring( + target.loc.start.offset, + target.loc.end.offset, + ); + } + } +}; + /** * Check and fix precence, by default using right + * @private + * @function AST#resolvePrecedence + * @memberOf module:php-parser */ -AST.prototype.resolvePrecedence = function(result) { +AST.prototype.resolvePrecedence = function (result, parser) { let buffer, lLevel, rLevel; // handling precendence - if (result.kind === "bin") { + if (result.kind === "call") { + // including what argument into location + this.resolveLocations(result, result.what, result, parser); + } else if ( + result.kind === "propertylookup" || + result.kind === "staticlookup" || + (result.kind === "offsetlookup" && result.offset) + ) { + // including what argument into location + this.resolveLocations(result, result.what, result.offset, parser); + } else if (result.kind === "bin") { if (result.right && !result.right.parenthesizedExpression) { if (result.right.kind === "bin") { lLevel = AST.precedence[result.type]; rLevel = AST.precedence[result.right.type]; - if (lLevel && rLevel && rLevel <= lLevel) { + if ( + lLevel && + rLevel && + rLevel <= lLevel && + (result.type !== result.right.type || + !this.isRightAssociative(result.type)) + ) { // https://github.com/glayzzle/php-parser/issues/79 // shift precedence buffer = result.right; result.right = result.right.left; - buffer.left = this.resolvePrecedence(result); + this.swapLocations(result, result.left, result.right, parser); + buffer.left = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.left, buffer.right, parser); result = buffer; } } else if (result.right.kind === "retif") { @@ -182,24 +260,51 @@ AST.prototype.resolvePrecedence = function(result) { if (lLevel && rLevel && rLevel <= lLevel) { buffer = result.right; result.right = result.right.test; - buffer.test = this.resolvePrecedence(result); + this.swapLocations(result, result.left, result.right, parser); + buffer.test = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.test, buffer.falseExpr, parser); result = buffer; } } } + } else if ( + (result.kind === "silent" || result.kind === "cast") && + result.expr && + !result.expr.parenthesizedExpression + ) { + // https://github.com/glayzzle/php-parser/issues/172 + if (result.expr.kind === "bin") { + buffer = result.expr; + result.expr = result.expr.left; + this.swapLocations(result, result, result.expr, parser); + buffer.left = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.left, buffer.right, parser); + result = buffer; + } else if (result.expr.kind === "retif") { + buffer = result.expr; + result.expr = result.expr.test; + this.swapLocations(result, result, result.expr, parser); + buffer.test = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.test, buffer.falseExpr, parser); + result = buffer; + } } else if (result.kind === "unary") { // https://github.com/glayzzle/php-parser/issues/75 if (result.what && !result.what.parenthesizedExpression) { - // unary precedence is allways lower + // unary precedence is always lower if (result.what.kind === "bin") { buffer = result.what; result.what = result.what.left; - buffer.left = this.resolvePrecedence(result); + this.swapLocations(result, result, result.what, parser); + buffer.left = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.left, buffer.right, parser); result = buffer; } else if (result.what.kind === "retif") { buffer = result.what; result.what = result.what.test; - buffer.test = this.resolvePrecedence(result); + this.swapLocations(result, result, result.what, parser); + buffer.test = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.test, buffer.falseExpr, parser); result = buffer; } } @@ -212,7 +317,9 @@ AST.prototype.resolvePrecedence = function(result) { ) { buffer = result.falseExpr; result.falseExpr = buffer.test; - buffer.test = this.resolvePrecedence(result); + this.swapLocations(result, result.test, result.falseExpr, parser); + buffer.test = this.resolvePrecedence(result, parser); + this.swapLocations(buffer, buffer.test, buffer.falseExpr, parser); result = buffer; } } else if (result.kind === "assign") { @@ -229,49 +336,49 @@ AST.prototype.resolvePrecedence = function(result) { buffer = result.right; result.right = result.right.left; buffer.left = result; + this.swapLocations(buffer, buffer.left, result.right, parser); result = buffer; } } + } else if (result.kind === "expressionstatement") { + this.swapLocations(result, result.expression, result, parser); } return result; }; /** * Prepares an AST node + * @private + * @function AST#prepare + * @memberOf module:php-parser * @param {String|null} kind - Defines the node type - * (if null, the kind must be passed at the function call) + * @param {*} docs - (if null, the kind must be passed at the function call) * @param {Parser} parser - The parser instance (use for extracting locations) * @return {Function} */ -AST.prototype.prepare = function(kind, docs, parser) { +AST.prototype.prepare = function (kind, docs, parser) { let start = null; if (this.withPositions || this.withSource) { - start = this.position(parser); + start = parser.position(); } const self = this; // returns the node - const result = function() { + const result = function () { let location = null; const args = Array.prototype.slice.call(arguments); args.push(docs); - if (typeof result.preBuild === "function") { - result.preBuild(arguments); - } if (self.withPositions || self.withSource) { let src = null; if (self.withSource) { src = parser.lexer._input.substring(start.offset, parser.prev[2]); } - if (self.withPositions) { - location = new Location( - src, - start, - new Position(parser.prev[0], parser.prev[1], parser.prev[2]) - ); - } else { - location = new Location(src, null, null); - } - // last argument is allways the location + // if with source, need location on swapLocations function + location = new Location( + src, + start, + new Position(parser.prev[0], parser.prev[1], parser.prev[2]), + ); + // last argument is always the location args.push(location); } // handle lazy kind definitions @@ -286,24 +393,37 @@ AST.prototype.prepare = function(kind, docs, parser) { const astNode = Object.create(node.prototype); node.apply(astNode, args); result.instance = astNode; + /* istanbul ignore next */ if (result.trailingComments) { // buffer of trailingComments astNode.trailingComments = result.trailingComments; } - return self.resolvePrecedence(astNode); - }; - /** - * Helper to change a node kind - * @param {String} newKind - */ - result.setKind = function(newKind) { - kind = newKind; + if (typeof result.postBuild === "function") { + result.postBuild(astNode); + } + if (parser.debug) { + delete self.stack[result.stackUid]; + } + return self.resolvePrecedence(astNode, parser); }; + if (parser.debug) { + if (!this.stack) { + this.stack = {}; + this.stackUid = 1; + } + this.stack[++this.stackUid] = { + position: start, + stack: new Error().stack.split("\n").slice(3, 5), + }; + result.stackUid = this.stackUid; + } + /** * Sets a list of trailing comments + * @private * @param {*} docs */ - result.setTrailingComments = function(docs) { + result.setTrailingComments = function (docs) { if (result.instance) { // already created result.instance.setTrailingComments(docs); @@ -311,10 +431,13 @@ AST.prototype.prepare = function(kind, docs, parser) { result.trailingComments = docs; } }; + /** * Release a node without using it on the AST + * @private + * @param {*} target */ - result.destroy = function(target) { + result.destroy = function (target) { if (docs) { // release current docs stack if (target) { @@ -327,18 +450,38 @@ AST.prototype.prepare = function(kind, docs, parser) { parser._docIndex = parser._docs.length - docs.length; } } + if (parser.debug) { + delete self.stack[result.stackUid]; + } }; return result; }; +AST.prototype.checkNodes = function () { + const errors = []; + for (const k in this.stack) { + if (Object.prototype.hasOwnProperty.call(this.stack, k)) { + this.stack[k].key = k; + errors.push(this.stack[k]); + } + } + this.stack = {}; + return errors; +}; + // Define all AST nodes [ require("./ast/array"), + require("./ast/arrowfunc"), require("./ast/assign"), + require("./ast/assignref"), + require("./ast/attribute"), + require("./ast/attrgroup"), require("./ast/bin"), require("./ast/block"), require("./ast/boolean"), require("./ast/break"), + require("./ast/byref"), require("./ast/call"), require("./ast/case"), require("./ast/cast"), @@ -351,15 +494,19 @@ AST.prototype.prepare = function(kind, docs, parser) { require("./ast/commentblock"), require("./ast/commentline"), require("./ast/constant"), - require("./ast/constref"), + require("./ast/constantstatement"), require("./ast/continue"), require("./ast/declaration"), require("./ast/declare"), + require("./ast/declaredirective"), require("./ast/do"), require("./ast/echo"), require("./ast/empty"), require("./ast/encapsed"), + require("./ast/encapsedpart"), require("./ast/entry"), + require("./ast/enum"), + require("./ast/enumcase"), require("./ast/error"), require("./ast/eval"), require("./ast/exit"), @@ -376,52 +523,68 @@ AST.prototype.prepare = function(kind, docs, parser) { require("./ast/include"), require("./ast/inline"), require("./ast/interface"), + require("./ast/intersectiontype"), require("./ast/isset"), require("./ast/label"), require("./ast/list"), require("./ast/literal"), require("./ast/lookup"), require("./ast/magic"), + require("./ast/match"), + require("./ast/matcharm"), require("./ast/method"), + require("./ast/name"), require("./ast/namespace"), + require("./ast/namedargument"), require("./ast/new"), require("./ast/node"), + require("./ast/noop"), require("./ast/nowdoc"), + require("./ast/nullkeyword"), + require("./ast/nullsafepropertylookup"), require("./ast/number"), require("./ast/offsetlookup"), require("./ast/operation"), require("./ast/parameter"), + require("./ast/parentreference"), require("./ast/post"), require("./ast/pre"), require("./ast/print"), require("./ast/program"), require("./ast/property"), require("./ast/propertylookup"), + require("./ast/propertystatement"), + require("./ast/reference"), require("./ast/retif"), require("./ast/return"), + require("./ast/selfreference"), require("./ast/silent"), require("./ast/statement"), require("./ast/static"), + require("./ast/staticvariable"), require("./ast/staticlookup"), + require("./ast/staticreference"), require("./ast/string"), require("./ast/switch"), - require("./ast/sys"), require("./ast/throw"), require("./ast/trait"), require("./ast/traitalias"), require("./ast/traitprecedence"), require("./ast/traituse"), require("./ast/try"), + require("./ast/typereference"), require("./ast/unary"), + require("./ast/uniontype"), require("./ast/unset"), require("./ast/usegroup"), require("./ast/useitem"), require("./ast/variable"), require("./ast/variadic"), + require("./ast/variadicplaceholder"), require("./ast/while"), require("./ast/yield"), - require("./ast/yieldfrom") -].forEach(function(ctor) { + require("./ast/yieldfrom"), +].forEach(function (ctor) { AST.prototype[ctor.kind] = ctor; }); diff --git a/src/ast/array.js b/src/ast/array.js index f458d3b73..ce518aa79 100644 --- a/src/ast/array.js +++ b/src/ast/array.js @@ -11,6 +11,7 @@ const KIND = "array"; /** * Defines an array structure * @constructor Array + * @memberOf module:php-parser * @example * // PHP code : * [1, 'foo' => 'bar', 3] @@ -30,16 +31,14 @@ const KIND = "array"; * ] * } * @extends {Expression} - * @property {Entry|Expr|Variable} items List of array items + * @property {Array} items List of array items * @property {boolean} shortForm Indicate if the short array syntax is used, ex `[]` instead `array()` */ -module.exports = Expr.extends(KIND, function Array( - shortForm, - items, - docs, - location -) { - Expr.apply(this, [KIND, docs, location]); - this.items = items; - this.shortForm = shortForm; -}); +module.exports = Expr.extends( + KIND, + function Array(shortForm, items, docs, location) { + Expr.apply(this, [KIND, docs, location]); + this.items = items; + this.shortForm = shortForm; + }, +); diff --git a/src/ast/arrowfunc.js b/src/ast/arrowfunc.js new file mode 100644 index 000000000..695b6ef6a --- /dev/null +++ b/src/ast/arrowfunc.js @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Expression = require("./expression"); +const KIND = "arrowfunc"; + +/** + * Defines an arrow function (it's like a closure) + * @constructor ArrowFunc + * @memberOf module:php-parser + * @extends {Expression} + * @property {Parameter[]} arguments + * @property {Identifier} type + * @property {Expression} body + * @property {boolean} byref + * @property {boolean} nullable + * @property {boolean} isStatic + */ +module.exports = Expression.extends( + KIND, + function Closure( + args, + byref, + body, + type, + nullable, + isStatic, + docs, + location, + ) { + Expression.apply(this, [KIND, docs, location]); + this.arguments = args; + this.byref = byref; + this.body = body; + this.type = type; + this.nullable = nullable; + this.isStatic = isStatic || false; + }, +); diff --git a/src/ast/assign.js b/src/ast/assign.js index 508c3b612..4cf6a6857 100644 --- a/src/ast/assign.js +++ b/src/ast/assign.js @@ -5,26 +5,24 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "assign"; /** * Assigns a value to the specified target * @constructor Assign - * @extends {Statement} + * @memberOf module:php-parser + * @extends {Expression} * @property {Expression} left * @property {Expression} right * @property {String} operator */ -module.exports = Statement.extends(KIND, function Assign( - left, - right, - operator, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.operator = operator; - this.left = left; - this.right = right; -}); +module.exports = Expression.extends( + KIND, + function Assign(left, right, operator, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.left = left; + this.right = right; + this.operator = operator; + }, +); diff --git a/src/ast/assignref.js b/src/ast/assignref.js new file mode 100644 index 000000000..668bd058a --- /dev/null +++ b/src/ast/assignref.js @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Expression = require("./expression"); +const KIND = "assignref"; + +/** + * Assigns a value to the specified target + * @constructor AssignRef + * @memberOf module:php-parser + * @extends {Expression} + * @property {Expression} left + * @property {Expression} right + * @property {String} operator + */ +module.exports = Expression.extends( + KIND, + function AssignRef(left, right, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.left = left; + this.right = right; + }, +); diff --git a/src/ast/attrgroup.js b/src/ast/attrgroup.js new file mode 100644 index 000000000..6ce01f061 --- /dev/null +++ b/src/ast/attrgroup.js @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Node = require("./node"); +const KIND = "attrgroup"; + +/** + * Attribute group + * @memberOf module:php-parser + * @constructor AttrGroup + * @extends {Node} + * @property {Attribute[]} attrs + */ +module.exports = Node.extends(KIND, function AttrGroup(attrs, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.attrs = attrs || []; +}); diff --git a/src/ast/attribute.js b/src/ast/attribute.js new file mode 100644 index 000000000..f617bb6d1 --- /dev/null +++ b/src/ast/attribute.js @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Node = require("./node"); +const KIND = "attribute"; + +/** + * Attribute Value + * @memberOf module:php-parser + * @constructor Attribute + * @extends {Node} + * @property {String} name + * @property {Parameter[]} args + */ +module.exports = Node.extends( + KIND, + function Attribute(name, args, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.name = name; + this.args = args; + }, +); diff --git a/src/ast/bin.js b/src/ast/bin.js index 9c3724ef3..6221f4843 100644 --- a/src/ast/bin.js +++ b/src/ast/bin.js @@ -10,20 +10,18 @@ const KIND = "bin"; /** * Binary operations * @constructor Bin + * @memberOf module:php-parser * @extends {Operation} * @property {String} type * @property {Expression} left * @property {Expression} right */ -module.exports = Operation.extends(KIND, function Bin( - type, - left, - right, - docs, - location -) { - Operation.apply(this, [KIND, docs, location]); - this.type = type; - this.left = left; - this.right = right; -}); +module.exports = Operation.extends( + KIND, + function Bin(type, left, right, docs, location) { + Operation.apply(this, [KIND, docs, location]); + this.type = type; + this.left = left; + this.right = right; + }, +); diff --git a/src/ast/block.js b/src/ast/block.js index 4df2baff6..1a51712f9 100644 --- a/src/ast/block.js +++ b/src/ast/block.js @@ -11,15 +11,14 @@ const KIND = "block"; /** * A block statement, i.e., a sequence of statements surrounded by braces. * @constructor Block + * @memberOf module:php-parser * @extends {Statement} * @property {Node[]} children */ -module.exports = Statement.extends(KIND, function Block( - kind, - children, - docs, - location -) { - Statement.apply(this, [kind || KIND, docs, location]); - this.children = children.filter(Boolean); -}); +module.exports = Statement.extends( + KIND, + function Block(kind, children, docs, location) { + Statement.apply(this, [kind || KIND, docs, location]); + this.children = children.filter(Boolean); + }, +); diff --git a/src/ast/boolean.js b/src/ast/boolean.js index 7fd6e359f..9480d662d 100644 --- a/src/ast/boolean.js +++ b/src/ast/boolean.js @@ -11,13 +11,13 @@ const KIND = "boolean"; /** * Defines a boolean value (true/false) * @constructor Boolean + * @memberOf module:php-parser * @extends {Literal} + * @property {boolean} value */ -module.exports = Literal.extends(KIND, function Boolean( - value, - raw, - docs, - location -) { - Literal.apply(this, [KIND, value, raw, docs, location]); -}); +module.exports = Literal.extends( + KIND, + function Boolean(value, raw, docs, location) { + Literal.apply(this, [KIND, value, raw, docs, location]); + }, +); diff --git a/src/ast/break.js b/src/ast/break.js index 6f02c4c6c..2e98e2515 100644 --- a/src/ast/break.js +++ b/src/ast/break.js @@ -5,16 +5,17 @@ */ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "break"; /** * A break statement * @constructor Break - * @extends {Node} + * @memberOf module:php-parser + * @extends {Statement} * @property {Number|Null} level */ -module.exports = Node.extends(KIND, function Break(level, docs, location) { - Node.apply(this, [KIND, docs, location]); +module.exports = Statement.extends(KIND, function Break(level, docs, location) { + Statement.apply(this, [KIND, docs, location]); this.level = level; }); diff --git a/src/ast/byref.js b/src/ast/byref.js new file mode 100644 index 000000000..89cfb98c2 --- /dev/null +++ b/src/ast/byref.js @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Expression = require("./expression"); +const KIND = "byref"; + +/** + * Passing by Reference - so the function can modify the variable + * @constructor ByRef + * @memberOf module:php-parser + * @extends {Expression} + * @property {ExpressionStatement} what + */ +module.exports = Expression.extends(KIND, function ByRef(what, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.what = what; +}); diff --git a/src/ast/call.js b/src/ast/call.js index 5dfe402a2..51daf3485 100644 --- a/src/ast/call.js +++ b/src/ast/call.js @@ -5,23 +5,22 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "call"; /** * Executes a call statement * @constructor Call - * @extends {Statement} - * @property {Identifier|Variable|??} what - * @property {Arguments[]} arguments + * @memberOf module:php-parser + * @extends {Expression} + * @property {Identifier|Variable} what + * @property {Expression[]} arguments */ -module.exports = Statement.extends(KIND, function Call( - what, - args, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.what = what; - this.arguments = args; -}); +module.exports = Expression.extends( + KIND, + function Call(what, args, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.what = what; + this.arguments = args; + }, +); diff --git a/src/ast/case.js b/src/ast/case.js index a935db0f6..8e25b0537 100644 --- a/src/ast/case.js +++ b/src/ast/case.js @@ -5,18 +5,22 @@ */ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "case"; /** * A switch case statement * @constructor Case - * @extends {Node} + * @memberOf module:php-parser + * @extends {Statement} * @property {Expression|null} test - if null, means that the default case * @property {Block|null} body */ -module.exports = Node.extends(KIND, function Case(test, body, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.test = test; - this.body = body; -}); +module.exports = Statement.extends( + KIND, + function Case(test, body, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.test = test; + this.body = body; + }, +); diff --git a/src/ast/cast.js b/src/ast/cast.js index 9c2ca33c0..8dadffa0a 100644 --- a/src/ast/cast.js +++ b/src/ast/cast.js @@ -11,20 +11,18 @@ const KIND = "cast"; /** * Binary operations * @constructor Cast + * @memberOf module:php-parser * @extends {Operation} * @property {String} type * @property {String} raw - * @property {Expression} what + * @property {Expression} expr */ -module.exports = Operation.extends(KIND, function Cast( - type, - raw, - what, - docs, - location -) { - Operation.apply(this, [KIND, docs, location]); - this.type = type; - this.raw = raw; - this.what = what; -}); +module.exports = Operation.extends( + KIND, + function Cast(type, raw, expr, docs, location) { + Operation.apply(this, [KIND, docs, location]); + this.type = type; + this.raw = raw; + this.expr = expr; + }, +); diff --git a/src/ast/catch.js b/src/ast/catch.js index 7640a84a5..4560ffb97 100644 --- a/src/ast/catch.js +++ b/src/ast/catch.js @@ -11,21 +11,19 @@ const KIND = "catch"; /** * Defines a catch statement * @constructor Catch + * @memberOf module:php-parser * @extends {Statement} - * @property {Identifier[]} what + * @property {Name[]} what * @property {Variable} variable - * @property {Statement} body + * @property {Block} body * @see http://php.net/manual/en/language.exceptions.php */ -module.exports = Statement.extends(KIND, function Catch( - body, - what, - variable, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.body = body; - this.what = what; - this.variable = variable; -}); +module.exports = Statement.extends( + KIND, + function Catch(body, what, variable, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.body = body; + this.what = what; + this.variable = variable; + }, +); diff --git a/src/ast/class.js b/src/ast/class.js index ecc94d9d5..cfa620c2c 100644 --- a/src/ast/class.js +++ b/src/ast/class.js @@ -11,27 +11,26 @@ const KIND = "class"; /** * A class definition * @constructor Class + * @memberOf module:php-parser * @extends {Declaration} * @property {Identifier|null} extends - * @property {Identifier[]} implements + * @property {Identifier[]|null} implements * @property {Declaration[]} body * @property {boolean} isAnonymous * @property {boolean} isAbstract * @property {boolean} isFinal + * @property {boolean} isReadonly + * @property {AttrGroup[]} attrGroups */ -module.exports = Declaration.extends(KIND, function Class( - name, - ext, - impl, - body, - flags, - docs, - location -) { - Declaration.apply(this, [KIND, name, docs, location]); - this.isAnonymous = name ? false : true; - this.extends = ext; - this.implements = impl; - this.body = body; - this.parseFlags(flags); -}); +module.exports = Declaration.extends( + KIND, + function Class(name, ext, impl, body, flags, docs, location) { + Declaration.apply(this, [KIND, name, docs, location]); + this.isAnonymous = name ? false : true; + this.extends = ext; + this.implements = impl; + this.body = body; + this.attrGroups = []; + this.parseFlags(flags); + }, +); diff --git a/src/ast/classconstant.js b/src/ast/classconstant.js index 7e111df27..bea667188 100644 --- a/src/ast/classconstant.js +++ b/src/ast/classconstant.js @@ -5,24 +5,67 @@ */ "use strict"; -const Constant = require("./constant"); +const ConstantStatement = require("./constantstatement"); const KIND = "classconstant"; +const IS_UNDEFINED = ""; +const IS_PUBLIC = "public"; +const IS_PROTECTED = "protected"; +const IS_PRIVATE = "private"; + /** * Defines a class/interface/trait constant * @constructor ClassConstant - * @extends {Constant} - * @property {boolean} isStatic + * @memberOf module:php-parser + * @extends {ConstantStatement} * @property {string} visibility + * @property {boolean} final + * @property {boolean} nullable + * @property {TypeReference|IntersectionType|UnionType|null} type + * @property {AttrGroup[]} attrGroups */ -module.exports = Constant.extends(KIND, function ClassConstant( - name, - value, - flags, - docs, - location -) { - Constant.apply(this, [name, value, docs, location]); - this.kind = KIND; - this.parseFlags(flags); -}); +const ClassConstant = ConstantStatement.extends( + KIND, + function ClassConstant( + kind, + constants, + flags, + nullable, + type, + attrGroups, + docs, + location, + ) { + ConstantStatement.apply(this, [kind || KIND, constants, docs, location]); + this.parseFlags(flags); + this.nullable = nullable; + this.type = type; + this.attrGroups = attrGroups; + }, +); + +/** + * Generic flags parser + * @function + * @name ClassConstant#parseFlags + * @memberOf module:php-parser + * @param {Array} flags + * @return {void} + */ +ClassConstant.prototype.parseFlags = function (flags) { + if (flags[0] === -1) { + this.visibility = IS_UNDEFINED; + } else if (flags[0] === null) { + /* istanbul ignore next */ + this.visibility = null; + } else if (flags[0] === 0) { + this.visibility = IS_PUBLIC; + } else if (flags[0] === 1) { + this.visibility = IS_PROTECTED; + } else if (flags[0] === 2) { + this.visibility = IS_PRIVATE; + } + this.final = flags[2] === 2; +}; + +module.exports = ClassConstant; diff --git a/src/ast/clone.js b/src/ast/clone.js index 184391cc2..54ff3e37b 100644 --- a/src/ast/clone.js +++ b/src/ast/clone.js @@ -5,16 +5,17 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "clone"; /** * Defines a clone call * @constructor Clone - * @extends {Statement} + * @memberOf module:php-parser + * @extends {Expression} * @property {Expression} what */ -module.exports = Statement.extends(KIND, function Clone(what, docs, location) { - Statement.apply(this, [KIND, docs, location]); +module.exports = Expression.extends(KIND, function Clone(what, docs, location) { + Expression.apply(this, [KIND, docs, location]); this.what = what; }); diff --git a/src/ast/closure.js b/src/ast/closure.js index 7fbfbb60a..059f47e12 100644 --- a/src/ast/closure.js +++ b/src/ast/closure.js @@ -5,37 +5,43 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "closure"; /** * Defines a closure * @constructor Closure - * @extends {Statement} + * @memberOf module:php-parser + * @extends {Expression} * @property {Parameter[]} arguments * @property {Variable[]} uses * @property {Identifier} type - * @property {boolean} byref + * @property {Boolean} byref * @property {boolean} nullable * @property {Block|null} body * @property {boolean} isStatic + * @property {AttrGroup[]} attrGroups */ -module.exports = Statement.extends(KIND, function Closure( - args, - byref, - uses, - type, - nullable, - isStatic, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.uses = uses; - this.arguments = args; - this.byref = byref; - this.type = type; - this.nullable = nullable; - this.isStatic = isStatic || false; - this.body = null; -}); +module.exports = Expression.extends( + KIND, + function Closure( + args, + byref, + uses, + type, + nullable, + isStatic, + docs, + location, + ) { + Expression.apply(this, [KIND, docs, location]); + this.uses = uses; + this.arguments = args; + this.byref = byref; + this.type = type; + this.nullable = nullable; + this.isStatic = isStatic || false; + this.body = null; + this.attrGroups = []; + }, +); diff --git a/src/ast/comment.js b/src/ast/comment.js index e725a4d8c..71f99fe0d 100644 --- a/src/ast/comment.js +++ b/src/ast/comment.js @@ -10,15 +10,14 @@ const Node = require("./node"); /** * Abstract documentation node (ComentLine or CommentBlock) * @constructor Comment + * @memberOf module:php-parser * @extends {Node} * @property {String} value */ -module.exports = Node.extends("comment", function Comment( - kind, - value, - docs, - location -) { - Node.apply(this, [kind, docs, location]); - this.value = value; -}); +module.exports = Node.extends( + "comment", + function Comment(kind, value, docs, location) { + Node.apply(this, [kind, docs, location]); + this.value = value; + }, +); diff --git a/src/ast/commentblock.js b/src/ast/commentblock.js index 1f58ecac7..9b94b8326 100644 --- a/src/ast/commentblock.js +++ b/src/ast/commentblock.js @@ -11,12 +11,12 @@ const KIND = "commentblock"; /** * A comment block (multiline) * @constructor CommentBlock + * @memberOf module:php-parser * @extends {Comment} */ -module.exports = Comment.extends(KIND, function CommentBlock( - value, - docs, - location -) { - Comment.apply(this, [KIND, value, docs, location]); -}); +module.exports = Comment.extends( + KIND, + function CommentBlock(value, docs, location) { + Comment.apply(this, [KIND, value, docs, location]); + }, +); diff --git a/src/ast/commentline.js b/src/ast/commentline.js index 65b0357f4..d92d6f2d1 100644 --- a/src/ast/commentline.js +++ b/src/ast/commentline.js @@ -11,12 +11,12 @@ const KIND = "commentline"; /** * A single line comment * @constructor CommentLine + * @memberOf module:php-parser * @extends {Comment} */ -module.exports = Comment.extends(KIND, function CommentLine( - value, - docs, - location -) { - Comment.apply(this, [KIND, value, docs, location]); -}); +module.exports = Comment.extends( + KIND, + function CommentLine(value, docs, location) { + Comment.apply(this, [KIND, value, docs, location]); + }, +); diff --git a/src/ast/constant.js b/src/ast/constant.js index 755e2438d..698a7b14e 100644 --- a/src/ast/constant.js +++ b/src/ast/constant.js @@ -5,21 +5,22 @@ */ "use strict"; -const Declaration = require("./declaration"); +const Node = require("./node"); const KIND = "constant"; /** - * Defines a namespace constant + * Defines a constant * @constructor Constant - * @extends {Declaration} - * @property {Node|null} value + * @memberOf module:php-parser + * @extends {Node} + * @property {string} name + * @property {Node|string|number|boolean|null} value */ -module.exports = Declaration.extends(KIND, function Constant( - name, - value, - docs, - location -) { - Declaration.apply(this, [KIND, name, docs, location]); - this.value = value; -}); +module.exports = Node.extends( + KIND, + function Constant(name, value, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.name = name; + this.value = value; + }, +); diff --git a/src/ast/constantstatement.js b/src/ast/constantstatement.js new file mode 100644 index 000000000..eac6ca245 --- /dev/null +++ b/src/ast/constantstatement.js @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Statement = require("./statement"); +const KIND = "constantstatement"; + +/** + * Declares a constants into the current scope + * @constructor ConstantStatement + * @memberOf module:php-parser + * @extends {Statement} + * @property {Constant[]} constants + */ +module.exports = Statement.extends( + KIND, + function ConstantStatement(kind, constants, docs, location) { + Statement.apply(this, [kind || KIND, docs, location]); + this.constants = constants; + }, +); diff --git a/src/ast/constref.js b/src/ast/constref.js deleted file mode 100644 index 2794c09c6..000000000 --- a/src/ast/constref.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ -"use strict"; - -const Expr = require("./expression"); -const KIND = "constref"; - -/** - * A constant reference - * @constructor ConstRef - * @extends {Expression} - * @property {String|Node} name - */ -module.exports = Expr.extends(KIND, function ConstRef( - identifier, - docs, - location -) { - Expr.apply(this, [KIND, docs, location]); - this.name = identifier; -}); diff --git a/src/ast/continue.js b/src/ast/continue.js index b0e92a209..8344bc1b4 100644 --- a/src/ast/continue.js +++ b/src/ast/continue.js @@ -5,16 +5,20 @@ */ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "continue"; /** * A continue statement * @constructor Continue - * @extends {Node} - * @property {Number|Null} level + * @memberOf module:php-parser + * @extends {Statement} + * @property {number|null} level */ -module.exports = Node.extends(KIND, function Continue(level, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.level = level; -}); +module.exports = Statement.extends( + KIND, + function Continue(level, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.level = level; + }, +); diff --git a/src/ast/declaration.js b/src/ast/declaration.js index 0bff4a9d6..33ffbf5e0 100644 --- a/src/ast/declaration.js +++ b/src/ast/declaration.js @@ -16,31 +16,35 @@ const IS_PRIVATE = "private"; /** * A declaration statement (function, class, interface...) * @constructor Declaration + * @memberOf module:php-parser * @extends {Statement} - * @property {string} name + * @property {Identifier|string} name */ -const Declaration = Statement.extends(KIND, function Declaration( - kind, - name, - docs, - location -) { - Statement.apply(this, [kind || KIND, docs, location]); - this.name = name; -}); +const Declaration = Statement.extends( + KIND, + function Declaration(kind, name, docs, location) { + Statement.apply(this, [kind || KIND, docs, location]); + this.name = name; + }, +); /** * Generic flags parser - * @param {Integer[]} flags + * @function + * @name Declaration#parseFlags + * @memberOf module:php-parser + * @param {Array} flags * @return {void} */ -Declaration.prototype.parseFlags = function(flags) { +Declaration.prototype.parseFlags = function (flags) { this.isAbstract = flags[2] === 1; this.isFinal = flags[2] === 2; + this.isReadonly = flags[3] === 1; if (this.kind !== "class") { if (flags[0] === -1) { this.visibility = IS_UNDEFINED; } else if (flags[0] === null) { + /* istanbul ignore next */ this.visibility = null; } else if (flags[0] === 0) { this.visibility = IS_PUBLIC; diff --git a/src/ast/declare.js b/src/ast/declare.js index 019930b9e..dab989f21 100644 --- a/src/ast/declare.js +++ b/src/ast/declare.js @@ -11,22 +11,20 @@ const KIND = "declare"; /** * The declare construct is used to set execution directives for a block of code * @constructor Declare + * @memberOf module:php-parser * @extends {Block} - * @property {Expression[]} what - * @property {String} mode + * @property {DeclareDirective[]} directives + * @property {string} mode * @see http://php.net/manual/en/control-structures.declare.php */ -const Declare = Block.extends(KIND, function Declare( - what, - body, - mode, - docs, - location -) { - Block.apply(this, [KIND, body, docs, location]); - this.what = what; - this.mode = mode; -}); +const Declare = Block.extends( + KIND, + function Declare(directives, body, mode, docs, location) { + Block.apply(this, [KIND, body, docs, location]); + this.directives = directives; + this.mode = mode; + }, +); /** * The node is declared as a short tag syntax : @@ -36,7 +34,8 @@ const Declare = Block.extends(KIND, function Declare( * // some statements * enddeclare; * ``` - * @constant {String} MODE_SHORT + * @constant {String} Declare#MODE_SHORT + * @memberOf module:php-parser */ Declare.MODE_SHORT = "short"; @@ -48,7 +47,8 @@ Declare.MODE_SHORT = "short"; * // some statements * } * ``` - * @constant {String} MODE_BLOCK + * @constant {String} Declare#MODE_BLOCK + * @memberOf module:php-parser */ Declare.MODE_BLOCK = "block"; @@ -63,7 +63,8 @@ Declare.MODE_BLOCK = "block"; * declare(ticks=2); * // some statements * ``` - * @constant {String} MODE_NONE + * @constant {String} Declare#MODE_NONE + * @memberOf module:php-parser */ Declare.MODE_NONE = "none"; diff --git a/src/ast/declaredirective.js b/src/ast/declaredirective.js new file mode 100644 index 000000000..ed65937d0 --- /dev/null +++ b/src/ast/declaredirective.js @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Node = require("./node"); +const KIND = "declaredirective"; + +/** + * Defines a constant + * @constructor DeclareDirective + * @memberOf module:php-parser + * @extends {Node} + * @property {Identifier} key + * @property {Node|string|number|boolean|null} value + */ +module.exports = Node.extends( + KIND, + function DeclareDirective(key, value, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.key = key; + this.value = value; + }, +); diff --git a/src/ast/do.js b/src/ast/do.js index 80a1cff00..801790893 100644 --- a/src/ast/do.js +++ b/src/ast/do.js @@ -11,17 +11,16 @@ const KIND = "do"; /** * Defines a do/while statement * @constructor Do + * @memberOf module:php-parser * @extends {Statement} * @property {Expression} test - * @property {Statement} body + * @property {Block | null} body */ -module.exports = Statement.extends(KIND, function Do( - test, - body, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.body = body; -}); +module.exports = Statement.extends( + KIND, + function Do(test, body, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.test = test; + this.body = body; + }, +); diff --git a/src/ast/echo.js b/src/ast/echo.js index 281a99e78..5bf5765bb 100644 --- a/src/ast/echo.js +++ b/src/ast/echo.js @@ -5,21 +5,22 @@ */ "use strict"; -const Sys = require("./sys"); +const Statement = require("./statement"); const KIND = "echo"; /** * Defines system based call * @constructor Echo + * @memberOf module:php-parser * @property {boolean} shortForm - * @extends {Sys} + * @property {Expression[]} expressions + * @extends {Statement} */ -module.exports = Sys.extends(KIND, function Echo( - args, - shortForm, - docs, - location -) { - Sys.apply(this, [KIND, args, docs, location]); - this.shortForm = shortForm; -}); +module.exports = Statement.extends( + KIND, + function Echo(expressions, shortForm, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.shortForm = shortForm; + this.expressions = expressions; + }, +); diff --git a/src/ast/empty.js b/src/ast/empty.js index b7ed89f6e..d2c5809b7 100644 --- a/src/ast/empty.js +++ b/src/ast/empty.js @@ -5,14 +5,19 @@ */ "use strict"; -const Sys = require("./sys"); +const Expression = require("./expression"); const KIND = "empty"; /** * Defines an empty check call * @constructor Empty - * @extends {Sys} + * @memberOf module:php-parser + * @extends {Expression} */ -module.exports = Sys.extends(KIND, function Empty(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); -}); +module.exports = Expression.extends( + KIND, + function Empty(expression, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.expression = expression; + }, +); diff --git a/src/ast/encapsed.js b/src/ast/encapsed.js index d78c0afa2..ac34a4365 100644 --- a/src/ast/encapsed.js +++ b/src/ast/encapsed.js @@ -11,20 +11,19 @@ const KIND = "encapsed"; /** * Defines an encapsed string (contains expressions) * @constructor Encapsed + * @memberOf module:php-parser * @extends {Literal} * @property {String} type - Defines the type of encapsed string (shell, heredoc, string) * @property {String|Null} label - The heredoc label, defined only when the type is heredoc + * @property {EncapsedPart[]} value */ -const Encapsed = Literal.extends(KIND, function Encapsed( - value, - raw, - type, - docs, - location -) { - Literal.apply(this, [KIND, value, raw, docs, location]); - this.type = type; -}); +const Encapsed = Literal.extends( + KIND, + function Encapsed(value, raw, type, docs, location) { + Literal.apply(this, [KIND, value, raw, docs, location]); + this.type = type; + }, +); /** * The node is a double quote string : @@ -32,7 +31,8 @@ const Encapsed = Literal.extends(KIND, function Encapsed( * bar_$baz; * ``` - * @constant {String} TYPE_OFFSET - `offset` + * @constant {String} Encapsed#TYPE_OFFSET - `offset` + * @memberOf module:php-parser */ Encapsed.TYPE_OFFSET = "offset"; diff --git a/src/ast/encapsedpart.js b/src/ast/encapsedpart.js new file mode 100644 index 000000000..cb5d836b1 --- /dev/null +++ b/src/ast/encapsedpart.js @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Expression = require("./expression"); +const KIND = "encapsedpart"; + +/** + * Part of `Encapsed` node + * @constructor EncapsedPart + * @memberOf module:php-parser + * @extends {Expression} + * @property {Expression} expression + * @property {String} syntax + * @property {Boolean} curly + */ +module.exports = Expression.extends( + KIND, + function EncapsedPart(expression, syntax, curly, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.expression = expression; + this.syntax = syntax; + this.curly = curly; + }, +); diff --git a/src/ast/entry.js b/src/ast/entry.js index 51fb6a588..4300e2366 100644 --- a/src/ast/entry.js +++ b/src/ast/entry.js @@ -5,18 +5,26 @@ */ "use strict"; -const Node = require("./node"); +const Expression = require("./expression"); const KIND = "entry"; /** * An array entry - see [Array](#array) + * @memberOf module:php-parser * @constructor Entry - * @extends {Node} + * @extends {Expression} * @property {Node|null} key The entry key/offset * @property {Node} value The entry value + * @property {Boolean} byRef By reference + * @property {Boolean} unpack Argument unpacking */ -module.exports = Node.extends(KIND, function Entry(key, value, docs, location) { - Node.apply(this, [KIND, docs, location]); - this.key = key; - this.value = value; -}); +module.exports = Expression.extends( + KIND, + function Entry(key, value, byRef, unpack, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.key = key; + this.value = value; + this.byRef = byRef; + this.unpack = unpack; + }, +); diff --git a/src/ast/enum.js b/src/ast/enum.js new file mode 100644 index 000000000..eee63b58d --- /dev/null +++ b/src/ast/enum.js @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Declaration = require("./declaration"); +const KIND = "enum"; + +/** + * A enum definition + * @constructor Enum + * @memberOf module:php-parser + * @extends {Declaration} + * @property {Identifier|null} valueType + * @property {Identifier[]} implements + * @property {Declaration[]} body + * @property {AttrGroup[]} attrGroups + */ +module.exports = Declaration.extends( + KIND, + function Enum(name, valueType, impl, body, docs, location) { + Declaration.apply(this, [KIND, name, docs, location]); + this.valueType = valueType; + this.implements = impl; + this.body = body; + this.attrGroups = []; + }, +); diff --git a/src/ast/enumcase.js b/src/ast/enumcase.js new file mode 100644 index 000000000..a182d25a7 --- /dev/null +++ b/src/ast/enumcase.js @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Node = require("./node"); +const KIND = "enumcase"; + +/** + * Declares a cases into the current scope + * @constructor EnumCase + * @memberOf module:php-parser + * @extends {Node} + * @property {string} name + * @property {string|number|null} value + */ +module.exports = Node.extends( + KIND, + function EnumCase(name, value, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.name = name; + this.value = value; + }, +); diff --git a/src/ast/error.js b/src/ast/error.js index a8f6b7e52..a715469c4 100644 --- a/src/ast/error.js +++ b/src/ast/error.js @@ -11,23 +11,20 @@ const KIND = "error"; /** * Defines an error node (used only on silentMode) * @constructor Error + * @memberOf module:php-parser * @extends {Node} * @property {string} message * @property {number} line * @property {number|string} token * @property {string|array} expected */ -module.exports = Node.extends(KIND, function Error( - message, - token, - line, - expected, - docs, - location -) { - Node.apply(this, [KIND, docs, location]); - this.message = message; - this.token = token; - this.line = line; - this.expected = expected; -}); +module.exports = Node.extends( + KIND, + function Error(message, token, line, expected, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.message = message; + this.token = token; + this.line = line; + this.expected = expected; + }, +); diff --git a/src/ast/eval.js b/src/ast/eval.js index 1f2b98ea4..950414823 100644 --- a/src/ast/eval.js +++ b/src/ast/eval.js @@ -5,16 +5,20 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "eval"; /** * Defines an eval statement * @constructor Eval - * @extends {Statement} + * @memberOf module:php-parser + * @extends {Expression} * @property {Node} source */ -module.exports = Statement.extends(KIND, function Eval(source, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.source = source; -}); +module.exports = Expression.extends( + KIND, + function Eval(source, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.source = source; + }, +); diff --git a/src/ast/exit.js b/src/ast/exit.js index e6e089546..3d895dd6e 100644 --- a/src/ast/exit.js +++ b/src/ast/exit.js @@ -5,23 +5,22 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "exit"; /** * Defines an exit / die call * @constructor Exit - * @extends {Statement} - * @property {Node|null} status - * @property {Boolean} useDie + * @memberOf module:php-parser + * @extends {Expression} + * @property {Node|null} expression + * @property {boolean} useDie */ -module.exports = Statement.extends(KIND, function Exit( - status, - useDie, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.status = status; - this.useDie = useDie; -}); +module.exports = Expression.extends( + KIND, + function Exit(expression, useDie, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.expression = expression; + this.useDie = useDie; + }, +); diff --git a/src/ast/expression.js b/src/ast/expression.js index 3b4d39d8e..c64f16a6c 100644 --- a/src/ast/expression.js +++ b/src/ast/expression.js @@ -12,6 +12,7 @@ const KIND = "expression"; * Any expression node. Since the left-hand side of an assignment may * be any expression in general, an expression can also be a pattern. * @constructor Expression + * @memberOf module:php-parser * @extends {Node} */ module.exports = Node.extends(KIND, function Expression(kind, docs, location) { diff --git a/src/ast/expressionstatement.js b/src/ast/expressionstatement.js index f8d2fca40..77f40d51c 100644 --- a/src/ast/expressionstatement.js +++ b/src/ast/expressionstatement.js @@ -11,14 +11,14 @@ const KIND = "expressionstatement"; /** * Defines an expression based statement * @constructor ExpressionStatement + * @memberOf module:php-parser * @extends {Statement} * @property {Expression} expression */ -module.exports = Statement.extends(KIND, function ExpressionStatement( - expr, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.expression = expr; -}); +module.exports = Statement.extends( + KIND, + function ExpressionStatement(expr, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.expression = expr; + }, +); diff --git a/src/ast/for.js b/src/ast/for.js index 773743b86..37ad87004 100644 --- a/src/ast/for.js +++ b/src/ast/for.js @@ -11,27 +11,23 @@ const KIND = "for"; /** * Defines a for iterator * @constructor For + * @memberOf module:php-parser * @extends {Statement} * @property {Expression[]} init * @property {Expression[]} test * @property {Expression[]} increment - * @property {Statement} body + * @property {Block | null} body * @property {boolean} shortForm * @see http://php.net/manual/en/control-structures.for.php */ -module.exports = Statement.extends(KIND, function For( - init, - test, - increment, - body, - shortForm, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.init = init; - this.test = test; - this.increment = increment; - this.shortForm = shortForm; - this.body = body; -}); +module.exports = Statement.extends( + KIND, + function For(init, test, increment, body, shortForm, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.init = init; + this.test = test; + this.increment = increment; + this.shortForm = shortForm; + this.body = body; + }, +); diff --git a/src/ast/foreach.js b/src/ast/foreach.js index e2143fb4c..dbb70e0e5 100644 --- a/src/ast/foreach.js +++ b/src/ast/foreach.js @@ -11,27 +11,23 @@ const KIND = "foreach"; /** * Defines a foreach iterator * @constructor Foreach + * @memberOf module:php-parser * @extends {Statement} * @property {Expression} source * @property {Expression|null} key * @property {Expression} value - * @property {Statement} body + * @property {Block | null} body * @property {boolean} shortForm * @see http://php.net/manual/en/control-structures.foreach.php */ -module.exports = Statement.extends(KIND, function Foreach( - source, - key, - value, - body, - shortForm, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.source = source; - this.key = key; - this.value = value; - this.shortForm = shortForm; - this.body = body; -}); +module.exports = Statement.extends( + KIND, + function Foreach(source, key, value, body, shortForm, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.source = source; + this.key = key; + this.value = value; + this.shortForm = shortForm; + this.body = body; + }, +); diff --git a/src/ast/function.js b/src/ast/function.js index abbbdd4e9..796903ab1 100644 --- a/src/ast/function.js +++ b/src/ast/function.js @@ -11,26 +11,24 @@ const KIND = "function"; /** * Defines a classic function * @constructor Function + * @memberOf module:php-parser * @extends {Declaration} * @property {Parameter[]} arguments * @property {Identifier} type * @property {boolean} byref * @property {boolean} nullable * @property {Block|null} body + * @property {AttrGroup[]} attrGroups */ -module.exports = Declaration.extends(KIND, function _Function( - name, - args, - byref, - type, - nullable, - docs, - location -) { - Declaration.apply(this, [KIND, name, docs, location]); - this.arguments = args; - this.byref = byref; - this.type = type; - this.nullable = nullable; - this.body = null; -}); +module.exports = Declaration.extends( + KIND, + function _Function(name, args, byref, type, nullable, docs, location) { + Declaration.apply(this, [KIND, name, docs, location]); + this.arguments = args; + this.byref = byref; + this.type = type; + this.nullable = nullable; + this.body = null; + this.attrGroups = []; + }, +); diff --git a/src/ast/global.js b/src/ast/global.js index f9cc9c064..ba9692f53 100644 --- a/src/ast/global.js +++ b/src/ast/global.js @@ -11,14 +11,14 @@ const KIND = "global"; /** * Imports a variable from the global scope * @constructor Global + * @memberOf module:php-parser * @extends {Statement} * @property {Variable[]} items */ -module.exports = Statement.extends(KIND, function Global( - items, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.items = items; -}); +module.exports = Statement.extends( + KIND, + function Global(items, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.items = items; + }, +); diff --git a/src/ast/goto.js b/src/ast/goto.js index e80f70174..4e00653eb 100644 --- a/src/ast/goto.js +++ b/src/ast/goto.js @@ -11,8 +11,9 @@ const KIND = "goto"; /** * Defines goto statement * @constructor Goto + * @memberOf module:php-parser * @extends {Statement} - * @property {String} label + * @property {string} label * @see {Label} */ module.exports = Statement.extends(KIND, function Goto(label, docs, location) { diff --git a/src/ast/halt.js b/src/ast/halt.js index eaa0dd2a9..acad687dc 100644 --- a/src/ast/halt.js +++ b/src/ast/halt.js @@ -11,6 +11,7 @@ const KIND = "halt"; /** * Halts the compiler execution * @constructor Halt + * @memberOf module:php-parser * @extends {Statement} * @property {String} after - String after the halt statement * @see http://php.net/manual/en/function.halt-compiler.php diff --git a/src/ast/identifier.js b/src/ast/identifier.js index d416d88c5..557c8f557 100644 --- a/src/ast/identifier.js +++ b/src/ast/identifier.js @@ -11,50 +11,16 @@ const KIND = "identifier"; /** * Defines an identifier node * @constructor Identifier + * @memberOf module:php-parser * @extends {Node} * @property {string} name - * @property {string} resolution */ -const Identifier = Node.extends(KIND, function Identifier( - name, - isRelative, - docs, - location -) { - Node.apply(this, [KIND, docs, location]); - if (isRelative) { - this.resolution = Identifier.RELATIVE_NAME; - } else if (name.length === 1) { - this.resolution = Identifier.UNQUALIFIED_NAME; - } else if (name[0] === "") { - this.resolution = Identifier.FULL_QUALIFIED_NAME; - } else { - this.resolution = Identifier.QUALIFIED_NAME; - } - this.name = name.join("\\"); -}); - -/** - * This is an identifier without a namespace separator, such as Foo - * @constant {String} UNQUALIFIED_NAME - */ -Identifier.UNQUALIFIED_NAME = "uqn"; -/** - * This is an identifier with a namespace separator, such as Foo\Bar - * @constant {String} QUALIFIED_NAME - */ -Identifier.QUALIFIED_NAME = "qn"; -/** - * This is an identifier with a namespace separator that begins with - * a namespace separator, such as \Foo\Bar. The namespace \Foo is also - * a fully qualified name. - * @constant {String} FULL_QUALIFIED_NAME - */ -Identifier.FULL_QUALIFIED_NAME = "fqn"; -/** - * This is an identifier starting with namespace, such as namespace\Foo\Bar. - * @constant {String} RELATIVE_NAME - */ -Identifier.RELATIVE_NAME = "rn"; +const Identifier = Node.extends( + KIND, + function Identifier(name, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.name = name; + }, +); module.exports = Identifier; diff --git a/src/ast/if.js b/src/ast/if.js index 780e41554..c04b61246 100644 --- a/src/ast/if.js +++ b/src/ast/if.js @@ -11,23 +11,20 @@ const KIND = "if"; /** * Defines a if statement * @constructor If + * @memberOf module:php-parser * @extends {Statement} * @property {Expression} test * @property {Block} body * @property {Block|If|null} alternate * @property {boolean} shortForm */ -module.exports = Statement.extends(KIND, function If( - test, - body, - alternate, - shortForm, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.body = body; - this.alternate = alternate; - this.shortForm = shortForm; -}); +module.exports = Statement.extends( + KIND, + function If(test, body, alternate, shortForm, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.test = test; + this.body = body; + this.alternate = alternate; + this.shortForm = shortForm; + }, +); diff --git a/src/ast/include.js b/src/ast/include.js index 16601117f..a6312cda1 100644 --- a/src/ast/include.js +++ b/src/ast/include.js @@ -5,26 +5,24 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "include"; /** * Defines system include call * @constructor Include - * @extends {Statement} + * @memberOf module:php-parser + * @extends {Expression} * @property {Node} target * @property {boolean} once * @property {boolean} require */ -module.exports = Statement.extends(KIND, function Include( - once, - require, - target, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.once = once; - this.require = require; - this.target = target; -}); +module.exports = Expression.extends( + KIND, + function Include(once, require, target, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.once = once; + this.require = require; + this.target = target; + }, +); diff --git a/src/ast/inline.js b/src/ast/inline.js index 2aa857520..822ab0698 100644 --- a/src/ast/inline.js +++ b/src/ast/inline.js @@ -11,13 +11,13 @@ const KIND = "inline"; /** * Defines inline html output (treated as echo output) * @constructor Inline + * @memberOf module:php-parser * @extends {Literal} + * @property {string} value */ -module.exports = Literal.extends(KIND, function Inline( - value, - raw, - docs, - location -) { - Literal.apply(this, [KIND, value, raw, docs, location]); -}); +module.exports = Literal.extends( + KIND, + function Inline(value, raw, docs, location) { + Literal.apply(this, [KIND, value, raw, docs, location]); + }, +); diff --git a/src/ast/interface.js b/src/ast/interface.js index b86eddea7..fcdd3f833 100644 --- a/src/ast/interface.js +++ b/src/ast/interface.js @@ -11,18 +11,18 @@ const KIND = "interface"; /** * An interface definition * @constructor Interface + * @memberOf module:php-parser * @extends {Declaration} * @property {Identifier[]} extends * @property {Declaration[]} body + * @property {AttrGroup[]} attrGroups */ -module.exports = Declaration.extends(KIND, function Interface( - name, - ext, - body, - docs, - location -) { - Declaration.apply(this, [KIND, name, docs, location]); - this.extends = ext; - this.body = body; -}); +module.exports = Declaration.extends( + KIND, + function Interface(name, ext, body, attrGroups, docs, location) { + Declaration.apply(this, [KIND, name, docs, location]); + this.extends = ext; + this.body = body; + this.attrGroups = attrGroups; + }, +); diff --git a/src/ast/intersectiontype.js b/src/ast/intersectiontype.js new file mode 100644 index 000000000..0a316d950 --- /dev/null +++ b/src/ast/intersectiontype.js @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Declaration = require("./declaration"); +const KIND = "intersectiontype"; + +/** + * A union of types + * @memberOf module:php-parser + * @constructor IntersectionType + * @extends {Declaration} + * @property {TypeReference[]} types + */ +module.exports = Declaration.extends( + KIND, + function IntersectionType(types, docs, location) { + Declaration.apply(this, [KIND, null, docs, location]); + this.types = types; + }, +); diff --git a/src/ast/isset.js b/src/ast/isset.js index 3e9cf8e39..9ea1e2a5d 100644 --- a/src/ast/isset.js +++ b/src/ast/isset.js @@ -5,14 +5,19 @@ */ "use strict"; -const Sys = require("./sys"); +const Expression = require("./expression"); const KIND = "isset"; /** * Defines an isset call * @constructor Isset - * @extends {Sys} + * @memberOf module:php-parser + * @extends {Expression} */ -module.exports = Sys.extends(KIND, function Isset(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); -}); +module.exports = Expression.extends( + KIND, + function Isset(variables, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.variables = variables; + }, +); diff --git a/src/ast/label.js b/src/ast/label.js index 3c9ca0bbc..c1e630413 100644 --- a/src/ast/label.js +++ b/src/ast/label.js @@ -5,16 +5,17 @@ */ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "label"; /** * A label statement (referenced by goto) * @constructor Label - * @extends {Node} + * @memberOf module:php-parser + * @extends {Statement} * @property {String} name */ -module.exports = Node.extends(KIND, function Label(name, docs, location) { - Node.apply(this, [KIND, docs, location]); +module.exports = Statement.extends(KIND, function Label(name, docs, location) { + Statement.apply(this, [KIND, docs, location]); this.name = name; }); diff --git a/src/ast/list.js b/src/ast/list.js index d59cc8df9..efe7ef5c4 100644 --- a/src/ast/list.js +++ b/src/ast/list.js @@ -5,21 +5,22 @@ */ "use strict"; -const Sys = require("./sys"); +const Expression = require("./expression"); const KIND = "list"; /** * Defines list assignment * @constructor List - * @extends {Sys} + * @memberOf module:php-parser + * @extends {Expression} * @property {boolean} shortForm + * @property {Entry[]} items */ -module.exports = Sys.extends(KIND, function List( - items, - shortForm, - docs, - location -) { - Sys.apply(this, [KIND, items, docs, location]); - this.shortForm = shortForm; -}); +module.exports = Expression.extends( + KIND, + function List(items, shortForm, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.items = items; + this.shortForm = shortForm; + }, +); diff --git a/src/ast/literal.js b/src/ast/literal.js index 3491245c0..fcb849e06 100644 --- a/src/ast/literal.js +++ b/src/ast/literal.js @@ -5,26 +5,24 @@ */ "use strict"; -const Expr = require("./expression"); +const Expression = require("./expression"); const KIND = "literal"; /** * Defines an array structure * @constructor Literal + * @memberOf module:php-parser * @extends {Expression} * @property {string} raw - * @property {Node|string|number|boolean|null} value + * @property {EncapsedPart[]|Node|string|number|boolean|null} value */ -module.exports = Expr.extends(KIND, function Literal( - kind, - value, - raw, - docs, - location -) { - Expr.apply(this, [kind || KIND, docs, location]); - this.value = value; - if (raw) { - this.raw = raw; - } -}); +module.exports = Expression.extends( + KIND, + function Literal(kind, value, raw, docs, location) { + Expression.apply(this, [kind || KIND, docs, location]); + this.value = value; + if (raw) { + this.raw = raw; + } + }, +); diff --git a/src/ast/location.js b/src/ast/location.js index a0f5f46de..65a975e89 100644 --- a/src/ast/location.js +++ b/src/ast/location.js @@ -8,11 +8,12 @@ /** * Defines the location of the node (with it's source contents as string) * @constructor Location - * @property {String|null} source + * @memberOf module:php-parser + * @property {string|null} source * @property {Position} start * @property {Position} end */ -const Location = function(source, start, end) { +const Location = function (source, start, end) { this.source = source; this.start = start; this.end = end; diff --git a/src/ast/lookup.js b/src/ast/lookup.js index d91e036b6..e0bf88a59 100644 --- a/src/ast/lookup.js +++ b/src/ast/lookup.js @@ -11,18 +11,16 @@ const KIND = "lookup"; /** * Lookup on an offset in the specified object * @constructor Lookup + * @memberOf module:php-parser * @extends {Expression} * @property {Expression} what * @property {Expression} offset */ -module.exports = Expr.extends(KIND, function Lookup( - kind, - what, - offset, - docs, - location -) { - Expr.apply(this, [kind || KIND, docs, location]); - this.what = what; - this.offset = offset; -}); +module.exports = Expr.extends( + KIND, + function Lookup(kind, what, offset, docs, location) { + Expr.apply(this, [kind || KIND, docs, location]); + this.what = what; + this.offset = offset; + }, +); diff --git a/src/ast/magic.js b/src/ast/magic.js index 74259e942..2ff5511cd 100644 --- a/src/ast/magic.js +++ b/src/ast/magic.js @@ -11,13 +11,12 @@ const KIND = "magic"; /** * Defines magic constant * @constructor Magic + * @memberOf module:php-parser * @extends {Literal} */ -module.exports = Literal.extends(KIND, function Magic( - value, - raw, - docs, - location -) { - Literal.apply(this, [KIND, value, raw, docs, location]); -}); +module.exports = Literal.extends( + KIND, + function Magic(value, raw, docs, location) { + Literal.apply(this, [KIND, value, raw, docs, location]); + }, +); diff --git a/src/ast/match.js b/src/ast/match.js new file mode 100644 index 000000000..ab76fe85a --- /dev/null +++ b/src/ast/match.js @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Expression = require("./expression"); +const KIND = "match"; + +/** + * Defines a match expression + * @memberOf module:php-parser + * @constructor Match + * @extends {Expression} + * @property {Expression} cond Condition expression to match against + * @property {MatchArm[]} arms Arms for comparison + */ +module.exports = Expression.extends( + KIND, + function Match(cond, arms, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.cond = cond; + this.arms = arms; + }, +); diff --git a/src/ast/matcharm.js b/src/ast/matcharm.js new file mode 100644 index 000000000..b8aea6a2d --- /dev/null +++ b/src/ast/matcharm.js @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Expression = require("./expression"); +const KIND = "matcharm"; + +/** + * An array entry - see [Array](#array) + * @memberOf module:php-parser + * @constructor MatchArm + * @extends {Expression} + * @property {Expression[]|null} conds The match condition expression list - null indicates default arm + * @property {Expression} body The return value expression + */ +module.exports = Expression.extends( + KIND, + function MatchArm(conds, body, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.conds = conds; + this.body = body; + }, +); diff --git a/src/ast/method.js b/src/ast/method.js index edf34ae0b..727db188a 100644 --- a/src/ast/method.js +++ b/src/ast/method.js @@ -5,19 +5,20 @@ */ "use strict"; -const fn = require("./function"); +const Function_ = require("./function"); const KIND = "method"; /** * Defines a class/interface/trait method * @constructor Method + * @memberOf module:php-parser * @extends {Function} * @property {boolean} isAbstract * @property {boolean} isFinal * @property {boolean} isStatic * @property {string} visibility */ -module.exports = fn.extends(KIND, function Method() { - fn.apply(this, arguments); +module.exports = Function_.extends(KIND, function Method() { + Function_.apply(this, arguments); this.kind = KIND; }); diff --git a/src/ast/name.js b/src/ast/name.js new file mode 100644 index 000000000..ae7ffcb21 --- /dev/null +++ b/src/ast/name.js @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Reference = require("./reference"); +const KIND = "name"; + +/** + * Defines a class reference node + * @constructor Name + * @memberOf module:php-parser + * @extends {Reference} + * @property {string} name + * @property {string} resolution + */ +const Name = Reference.extends( + KIND, + function Name(name, resolution, docs, location) { + Reference.apply(this, [KIND, docs, location]); + this.name = name.replace(/\\$/, ""); + this.resolution = resolution; + }, +); + +/** + * This is an identifier without a namespace separator, such as Foo + * @constant {String} Name#UNQUALIFIED_NAME + * @memberOf module:php-parser + */ +Name.UNQUALIFIED_NAME = "uqn"; +/** + * This is an identifier with a namespace separator, such as Foo\Bar + * @constant {String} Name#QUALIFIED_NAME + * @memberOf module:php-parser + */ +Name.QUALIFIED_NAME = "qn"; +/** + * This is an identifier with a namespace separator that begins with + * a namespace separator, such as \Foo\Bar. The namespace \Foo is also + * a fully qualified name. + * @constant {String} Name#FULL_QUALIFIED_NAME + * @memberOf module:php-parser + */ +Name.FULL_QUALIFIED_NAME = "fqn"; +/** + * This is an identifier starting with namespace, such as namespace\Foo\Bar. + * @constant {String} Name#RELATIVE_NAME + * @memberOf module:php-parser + */ +Name.RELATIVE_NAME = "rn"; + +module.exports = Name; diff --git a/src/ast/namedargument.js b/src/ast/namedargument.js new file mode 100644 index 000000000..63e35b2d0 --- /dev/null +++ b/src/ast/namedargument.js @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Expression = require("./expression"); +const KIND = "namedargument"; + +/** + * Named arguments. + * @memberOf module:php-parser + * @constructor namedargument + * @extends {Expression} + * @property {String} name + * @property {Expression} value + * @see https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments + */ +module.exports = Expression.extends( + KIND, + function namedargument(name, value, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.name = name; + this.value = value; + }, +); diff --git a/src/ast/namespace.js b/src/ast/namespace.js index ea9f52e58..60b72086c 100644 --- a/src/ast/namespace.js +++ b/src/ast/namespace.js @@ -11,18 +11,16 @@ const KIND = "namespace"; /** * The main program node * @constructor Namespace + * @memberOf module:php-parser * @extends {Block} - * @property {String} name - * @property {Boolean} withBrackets + * @property {string} name + * @property {boolean} withBrackets */ -module.exports = Block.extends(KIND, function Namespace( - name, - children, - withBrackets, - docs, - location -) { - Block.apply(this, [KIND, children, docs, location]); - this.name = name; - this.withBrackets = withBrackets || false; -}); +module.exports = Block.extends( + KIND, + function Namespace(name, children, withBrackets, docs, location) { + Block.apply(this, [KIND, children, docs, location]); + this.name = name; + this.withBrackets = withBrackets || false; + }, +); diff --git a/src/ast/new.js b/src/ast/new.js index 85b34fa0b..554a21aa3 100644 --- a/src/ast/new.js +++ b/src/ast/new.js @@ -5,23 +5,22 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "new"; /** * Creates a new instance of the specified class * @constructor New - * @extends {Statement} + * @memberOf module:php-parser + * @extends {Expression} * @property {Identifier|Variable|Class} what - * @property {Arguments[]} arguments + * @property {Variable[]} arguments */ -module.exports = Statement.extends(KIND, function New( - what, - args, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.what = what; - this.arguments = args; -}); +module.exports = Expression.extends( + KIND, + function New(what, args, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.what = what; + this.arguments = args; + }, +); diff --git a/src/ast/node.js b/src/ast/node.js index 0ce59f51f..111ae757d 100644 --- a/src/ast/node.js +++ b/src/ast/node.js @@ -8,10 +8,11 @@ /** * A generic AST node * @constructor Node + * @memberOf module:php-parser * @property {Location|null} loc - * @property {Comment[]} leadingComments - * @property {Comment[]?} trailingComments - * @property {String} kind + * @property {CommentBlock[]|Comment[]|null} leadingComments + * @property {CommentBlock[]|Comment[]|null} trailingComments + * @property {string} kind */ const Node = function Node(kind, docs, location) { this.kind = kind; @@ -25,17 +26,56 @@ const Node = function Node(kind, docs, location) { /** * Attach comments to current node + * @function Node#setTrailingComments + * @memberOf module:php-parser * @param {*} docs */ -Node.prototype.setTrailingComments = function(docs) { +Node.prototype.setTrailingComments = function (docs) { this.trailingComments = docs; }; +/** + * Destroying an unused node + * @function Node#destroy + * @memberOf module:php-parser + */ +Node.prototype.destroy = function (node) { + if (!node) { + /* istanbul ignore next */ + throw new Error( + "Node already initialized, you must swap with another node", + ); + } + if (this.leadingComments) { + if (node.leadingComments) { + node.leadingComments = Array.concat( + this.leadingComments, + node.leadingComments, + ); + } else { + node.leadingComments = this.leadingComments; + } + } + if (this.trailingComments) { + if (node.trailingComments) { + node.trailingComments = Array.concat( + this.trailingComments, + node.trailingComments, + ); + } else { + node.trailingComments = this.trailingComments; + } + } + return node; +}; + /** * Includes current token position of the parser + * @function Node#includeToken + * @memberOf module:php-parser * @param {*} parser */ -Node.prototype.includeToken = function(parser) { +Node.prototype.includeToken = function (parser) { if (this.loc) { if (this.loc.end) { this.loc.end.line = parser.lexer.yylloc.last_line; @@ -45,7 +85,7 @@ Node.prototype.includeToken = function(parser) { if (parser.ast.withSource) { this.loc.source = parser.lexer._input.substring( this.loc.start.offset, - parser.lexer.offset + parser.lexer.offset, ); } } @@ -54,11 +94,13 @@ Node.prototype.includeToken = function(parser) { /** * Helper for extending the Node class - * @param {String} type + * @function Node.extends + * @memberOf module:php-parser + * @param {string} type * @param {Function} constructor * @return {Function} */ -Node.extends = function(type, constructor) { +Node.extends = function (type, constructor) { constructor.prototype = Object.create(this.prototype); constructor.extends = this.extends; constructor.prototype.constructor = constructor; diff --git a/src/ast/noop.js b/src/ast/noop.js new file mode 100644 index 000000000..f9d9e1ef0 --- /dev/null +++ b/src/ast/noop.js @@ -0,0 +1,20 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Node = require("./node"); +const KIND = "noop"; + +/** + * Ignore this node, it implies a no operation block, for example : + * [$foo, $bar, /* here a noop node * /] + * @constructor Noop + * @memberOf module:php-parser + * @extends {Node} + */ +module.exports = Node.extends(KIND, function Noop(docs, location) { + Node.apply(this, [KIND, docs, location]); +}); diff --git a/src/ast/nowdoc.js b/src/ast/nowdoc.js index 7dbb4b9cf..726a3f954 100644 --- a/src/ast/nowdoc.js +++ b/src/ast/nowdoc.js @@ -11,20 +11,16 @@ const KIND = "nowdoc"; /** * Defines a nowdoc string * @constructor NowDoc + * @memberOf module:php-parser * @extends {Literal} - * @property {String} label - * @property {String} raw - * @property {Boolean} quote + * @property {string} label + * @property {string} raw + * @property {string} value */ -module.exports = Literal.extends(KIND, function Nowdoc( - value, - raw, - label, - quote, - docs, - location -) { - Literal.apply(this, [KIND, value, raw, docs, location]); - this.label = label; - this.quote = quote; -}); +module.exports = Literal.extends( + KIND, + function Nowdoc(value, raw, label, docs, location) { + Literal.apply(this, [KIND, value, raw, docs, location]); + this.label = label; + }, +); diff --git a/src/ast/nullkeyword.js b/src/ast/nullkeyword.js new file mode 100644 index 000000000..cc6bf5f4d --- /dev/null +++ b/src/ast/nullkeyword.js @@ -0,0 +1,20 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Node = require("./node"); +const KIND = "nullkeyword"; + +/** + * Represents the null keyword + * @constructor NullKeyword + * @memberOf module:php-parser + * @extends {Node} + */ +module.exports = Node.extends(KIND, function NullKeyword(raw, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.raw = raw; +}); diff --git a/src/ast/nullsafepropertylookup.js b/src/ast/nullsafepropertylookup.js new file mode 100644 index 000000000..16003ec51 --- /dev/null +++ b/src/ast/nullsafepropertylookup.js @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Lookup = require("./lookup"); +const KIND = "nullsafepropertylookup"; + +/** + * Lookup to an object property + * @memberOf module:php-parser + * @constructor NullSafePropertyLookup + * @extends {Lookup} + */ +module.exports = Lookup.extends( + KIND, + function NullSafePropertyLookup(what, offset, docs, location) { + Lookup.apply(this, [KIND, what, offset, docs, location]); + }, +); diff --git a/src/ast/number.js b/src/ast/number.js index ffd18211d..0c1f9d4ee 100644 --- a/src/ast/number.js +++ b/src/ast/number.js @@ -11,13 +11,13 @@ const KIND = "number"; /** * Defines a numeric value * @constructor Number + * @memberOf module:php-parser * @extends {Literal} + * @property {number} value */ -module.exports = Literal.extends(KIND, function Number( - value, - raw, - docs, - location -) { - Literal.apply(this, [KIND, value, raw, docs, location]); -}); +module.exports = Literal.extends( + KIND, + function Number(value, raw, docs, location) { + Literal.apply(this, [KIND, value, raw, docs, location]); + }, +); diff --git a/src/ast/offsetlookup.js b/src/ast/offsetlookup.js index 6a842e066..a9318855c 100644 --- a/src/ast/offsetlookup.js +++ b/src/ast/offsetlookup.js @@ -11,13 +11,12 @@ const KIND = "offsetlookup"; /** * Lookup on an offset in an array * @constructor OffsetLookup + * @memberOf module:php-parser * @extends {Lookup} */ -module.exports = Lookup.extends(KIND, function OffsetLookup( - what, - offset, - docs, - location -) { - Lookup.apply(this, [KIND, what, offset, docs, location]); -}); +module.exports = Lookup.extends( + KIND, + function OffsetLookup(what, offset, docs, location) { + Lookup.apply(this, [KIND, what, offset, docs, location]); + }, +); diff --git a/src/ast/operation.js b/src/ast/operation.js index 852fbd848..6e3eda9ea 100644 --- a/src/ast/operation.js +++ b/src/ast/operation.js @@ -11,6 +11,7 @@ const KIND = "operation"; /** * Defines binary operations * @constructor Operation + * @memberOf module:php-parser * @extends {Expression} */ module.exports = Expr.extends(KIND, function Operation(kind, docs, location) { diff --git a/src/ast/parameter.js b/src/ast/parameter.js index 6a1fe9270..7e417d528 100644 --- a/src/ast/parameter.js +++ b/src/ast/parameter.js @@ -8,30 +8,54 @@ const Declaration = require("./declaration"); const KIND = "parameter"; +/** + * @memberOf module:php-parser + * @typedef {1} MODIFIER_PUBLIC + **/ +/** + * @memberOf module:php-parser + * @typedef {2} MODIFIER_PROTECTED + **/ +/** + * @memberOf module:php-parser + * @typedef {4} MODIFIER_PRIVATE + **/ /** * Defines a function parameter * @constructor Parameter + * @memberOf module:php-parser * @extends {Declaration} * @property {Identifier|null} type * @property {Node|null} value * @property {boolean} byref * @property {boolean} variadic + * @property {boolean} readonly * @property {boolean} nullable + * @property {AttrGroup[]} attrGroups + * @property {MODIFIER_PUBLIC|MODIFIER_PROTECTED|MODIFIER_PRIVATE} flags */ -module.exports = Declaration.extends(KIND, function Parameter( - name, - type, - value, - isRef, - isVariadic, - nullable, - docs, - location -) { - Declaration.apply(this, [KIND, name, docs, location]); - this.value = value; - this.type = type; - this.byref = isRef; - this.variadic = isVariadic; - this.nullable = nullable; -}); +module.exports = Declaration.extends( + KIND, + function Parameter( + name, + type, + value, + isRef, + isVariadic, + readonly, + nullable, + flags, + docs, + location, + ) { + Declaration.apply(this, [KIND, name, docs, location]); + this.value = value; + this.type = type; + this.byref = isRef; + this.variadic = isVariadic; + this.readonly = readonly; + this.nullable = nullable; + this.flags = flags || 0; + this.attrGroups = []; + }, +); diff --git a/src/ast/parentreference.js b/src/ast/parentreference.js new file mode 100644 index 000000000..0ba489aa0 --- /dev/null +++ b/src/ast/parentreference.js @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Reference = require("./reference"); +const KIND = "parentreference"; + +/** + * Defines a class reference node + * @constructor ParentReference + * @memberOf module:php-parser + * @extends {Reference} + */ +const ParentReference = Reference.extends( + KIND, + function ParentReference(raw, docs, location) { + Reference.apply(this, [KIND, docs, location]); + this.raw = raw; + }, +); +module.exports = ParentReference; diff --git a/src/ast/position.js b/src/ast/position.js index bb08cd811..6e4f123c4 100644 --- a/src/ast/position.js +++ b/src/ast/position.js @@ -8,11 +8,12 @@ /** * Each Position object consists of a line number (1-indexed) and a column number (0-indexed): * @constructor Position - * @property {Number} line - * @property {Number} column - * @property {Number} offset + * @memberOf module:php-parser + * @property {number} line + * @property {number} column + * @property {number} offset */ -const Position = function(line, column, offset) { +const Position = function (line, column, offset) { this.line = line; this.column = column; this.offset = offset; diff --git a/src/ast/post.js b/src/ast/post.js index 70aa72f3b..56b48b937 100644 --- a/src/ast/post.js +++ b/src/ast/post.js @@ -11,17 +11,16 @@ const KIND = "post"; /** * Defines a post operation `$i++` or `$i--` * @constructor Post + * @memberOf module:php-parser * @extends {Operation} * @property {String} type * @property {Variable} what */ -module.exports = Operation.extends(KIND, function Post( - type, - what, - docs, - location -) { - Operation.apply(this, [KIND, docs, location]); - this.type = type; - this.what = what; -}); +module.exports = Operation.extends( + KIND, + function Post(type, what, docs, location) { + Operation.apply(this, [KIND, docs, location]); + this.type = type; + this.what = what; + }, +); diff --git a/src/ast/pre.js b/src/ast/pre.js index 7ef0efe5f..58b84a710 100644 --- a/src/ast/pre.js +++ b/src/ast/pre.js @@ -11,17 +11,16 @@ const KIND = "pre"; /** * Defines a pre operation `++$i` or `--$i` * @constructor Pre + * @memberOf module:php-parser * @extends {Operation} * @property {String} type * @property {Variable} what */ -module.exports = Operation.extends(KIND, function Pre( - type, - what, - docs, - location -) { - Operation.apply(this, [KIND, docs, location]); - this.type = type; - this.what = what; -}); +module.exports = Operation.extends( + KIND, + function Pre(type, what, docs, location) { + Operation.apply(this, [KIND, docs, location]); + this.type = type; + this.what = what; + }, +); diff --git a/src/ast/print.js b/src/ast/print.js index 7836ffeea..3455263c9 100644 --- a/src/ast/print.js +++ b/src/ast/print.js @@ -5,14 +5,19 @@ */ "use strict"; -const Sys = require("./sys"); +const Expression = require("./expression"); const KIND = "print"; /** * Outputs * @constructor Print - * @extends {Sys} + * @memberOf module:php-parser + * @extends {Expression} */ -module.exports = Sys.extends(KIND, function Print(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); -}); +module.exports = Expression.extends( + KIND, + function Print(expression, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.expression = expression; + }, +); diff --git a/src/ast/program.js b/src/ast/program.js index 3d921a162..5ea3d764f 100644 --- a/src/ast/program.js +++ b/src/ast/program.js @@ -11,25 +11,22 @@ const KIND = "program"; /** * The main program node * @constructor Program + * @memberOf module:php-parser * @extends {Block} * @property {Error[]} errors - * @property {Doc[]?} comments - * @property {String[]?} tokens + * @property {Comment[]|null} comments + * @property {String[]|null} tokens */ -module.exports = Block.extends(KIND, function Program( - children, - errors, - comments, - tokens, - docs, - location -) { - Block.apply(this, [KIND, children, docs, location]); - this.errors = errors; - if (comments) { - this.comments = comments; - } - if (tokens) { - this.tokens = tokens; - } -}); +module.exports = Block.extends( + KIND, + function Program(children, errors, comments, tokens, docs, location) { + Block.apply(this, [KIND, children, docs, location]); + this.errors = errors; + if (comments) { + this.comments = comments; + } + if (tokens) { + this.tokens = tokens; + } + }, +); diff --git a/src/ast/property.js b/src/ast/property.js index c22d7b493..ad01986ce 100644 --- a/src/ast/property.js +++ b/src/ast/property.js @@ -5,26 +5,39 @@ */ "use strict"; -const Declaration = require("./declaration"); +const Statement = require("./statement"); const KIND = "property"; /** * Defines a class property * @constructor Property - * @extends {Declaration} - * @property {boolean} isFinal - * @property {boolean} isStatic - * @property {string} visibility + * @memberOf module:php-parser + * @extends {Statement} + * @property {string} name * @property {Node|null} value + * @property {boolean} readonly + * @property {boolean} nullable + * @property {Identifier|Array|null} type + * @property {AttrGroup[]} attrGroups */ -module.exports = Declaration.extends(KIND, function Property( - name, - value, - flags, - docs, - location -) { - Declaration.apply(this, [KIND, name, docs, location]); - this.value = value; - this.parseFlags(flags); -}); +module.exports = Statement.extends( + KIND, + function Property( + name, + value, + readonly, + nullable, + type, + attrGroups, + docs, + location, + ) { + Statement.apply(this, [KIND, docs, location]); + this.name = name; + this.value = value; + this.readonly = readonly; + this.nullable = nullable; + this.type = type; + this.attrGroups = attrGroups; + }, +); diff --git a/src/ast/propertylookup.js b/src/ast/propertylookup.js index 21a966dec..ef2b14a80 100644 --- a/src/ast/propertylookup.js +++ b/src/ast/propertylookup.js @@ -10,14 +10,13 @@ const KIND = "propertylookup"; /** * Lookup to an object property + * @memberOf module:php-parser * @constructor PropertyLookup * @extends {Lookup} */ -module.exports = Lookup.extends(KIND, function PropertyLookup( - what, - offset, - docs, - location -) { - Lookup.apply(this, [KIND, what, offset, docs, location]); -}); +module.exports = Lookup.extends( + KIND, + function PropertyLookup(what, offset, docs, location) { + Lookup.apply(this, [KIND, what, offset, docs, location]); + }, +); diff --git a/src/ast/propertystatement.js b/src/ast/propertystatement.js new file mode 100644 index 000000000..271c8e6a8 --- /dev/null +++ b/src/ast/propertystatement.js @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Statement = require("./statement"); +const KIND = "propertystatement"; + +const IS_UNDEFINED = ""; +const IS_PUBLIC = "public"; +const IS_PROTECTED = "protected"; +const IS_PRIVATE = "private"; + +/** + * Declares a properties into the current scope + * @constructor PropertyStatement + * @memberOf module:php-parser + * @extends {Statement} + * @property {Property[]} properties + * @property {string|null} visibility + * @property {boolean} isStatic + */ +const PropertyStatement = Statement.extends( + KIND, + function PropertyStatement(kind, properties, flags, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.properties = properties; + this.parseFlags(flags); + }, +); + +/** + * Generic flags parser + * @function PropertyStatement#parseFlags + * @memberOf module:php-parser + * @param {Array} flags + * @return {void} + */ +PropertyStatement.prototype.parseFlags = function (flags) { + if (flags[0] === -1) { + this.visibility = IS_UNDEFINED; + } else if (flags[0] === null) { + this.visibility = null; + } else if (flags[0] === 0) { + this.visibility = IS_PUBLIC; + } else if (flags[0] === 1) { + this.visibility = IS_PROTECTED; + } else if (flags[0] === 2) { + this.visibility = IS_PRIVATE; + } + + this.isStatic = flags[1] === 1; +}; + +module.exports = PropertyStatement; diff --git a/src/ast/reference.js b/src/ast/reference.js new file mode 100644 index 000000000..e000937ad --- /dev/null +++ b/src/ast/reference.js @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Node = require("./node"); +const KIND = "reference"; + +/** + * Defines a reference node + * @constructor Reference + * @memberOf module:php-parser + * @extends {Node} + */ +const Reference = Node.extends(KIND, function Reference(kind, docs, location) { + Node.apply(this, [kind || KIND, docs, location]); +}); + +module.exports = Reference; diff --git a/src/ast/retif.js b/src/ast/retif.js index 751d8b936..70a044f60 100644 --- a/src/ast/retif.js +++ b/src/ast/retif.js @@ -5,26 +5,24 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "retif"; /** * Defines a short if statement that returns a value * @constructor RetIf - * @extends {Statement} + * @memberOf module:php-parser + * @extends {Expression} * @property {Expression} test * @property {Expression} trueExpr * @property {Expression} falseExpr */ -module.exports = Statement.extends(KIND, function RetIf( - test, - trueExpr, - falseExpr, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.trueExpr = trueExpr; - this.falseExpr = falseExpr; -}); +module.exports = Expression.extends( + KIND, + function RetIf(test, trueExpr, falseExpr, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.test = test; + this.trueExpr = trueExpr; + this.falseExpr = falseExpr; + }, +); diff --git a/src/ast/return.js b/src/ast/return.js index cdf2ac348..c7c049baa 100644 --- a/src/ast/return.js +++ b/src/ast/return.js @@ -5,16 +5,17 @@ */ "use strict"; -const Node = require("./node"); +const Statement = require("./statement"); const KIND = "return"; /** * A continue statement * @constructor Return - * @extends {Node} + * @memberOf module:php-parser + * @extends {Statement} * @property {Expression|null} expr */ -module.exports = Node.extends(KIND, function Return(expr, docs, location) { - Node.apply(this, [KIND, docs, location]); +module.exports = Statement.extends(KIND, function Return(expr, docs, location) { + Statement.apply(this, [KIND, docs, location]); this.expr = expr; }); diff --git a/src/ast/selfreference.js b/src/ast/selfreference.js new file mode 100644 index 000000000..0259e9752 --- /dev/null +++ b/src/ast/selfreference.js @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Reference = require("./reference"); +const KIND = "selfreference"; + +/** + * Defines a class reference node + * @constructor SelfReference + * @memberOf module:php-parser + * @extends {Reference} + */ +const SelfReference = Reference.extends( + KIND, + function SelfReference(raw, docs, location) { + Reference.apply(this, [KIND, docs, location]); + this.raw = raw; + }, +); +module.exports = SelfReference; diff --git a/src/ast/silent.js b/src/ast/silent.js index bba7b8e81..8bf60defc 100644 --- a/src/ast/silent.js +++ b/src/ast/silent.js @@ -5,16 +5,20 @@ */ "use strict"; -const Statement = require("./statement"); +const Expression = require("./expression"); const KIND = "silent"; /** * Avoids to show/log warnings & notices from the inner expression * @constructor Silent - * @extends {Statement} + * @memberOf module:php-parser + * @extends {Expression} * @property {Expression} expr */ -module.exports = Statement.extends(KIND, function Silent(expr, docs, location) { - Statement.apply(this, [KIND, docs, location]); - this.expr = expr; -}); +module.exports = Expression.extends( + KIND, + function Silent(expr, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.expr = expr; + }, +); diff --git a/src/ast/statement.js b/src/ast/statement.js index c4c578fc7..6f25bd8ee 100644 --- a/src/ast/statement.js +++ b/src/ast/statement.js @@ -11,6 +11,7 @@ const KIND = "statement"; /** * Any statement. * @constructor Statement + * @memberOf module:php-parser * @extends {Node} */ module.exports = Node.extends(KIND, function Statement(kind, docs, location) { diff --git a/src/ast/static.js b/src/ast/static.js index fe6557ab1..33f00145a 100644 --- a/src/ast/static.js +++ b/src/ast/static.js @@ -11,14 +11,14 @@ const KIND = "static"; /** * Declares a static variable into the current scope * @constructor Static + * @memberOf module:php-parser * @extends {Statement} - * @property {Variable[]|Assign[]} items + * @property {StaticVariable[]} variables */ -module.exports = Statement.extends(KIND, function Static( - items, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.items = items; -}); +module.exports = Statement.extends( + KIND, + function Static(variables, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.variables = variables; + }, +); diff --git a/src/ast/staticlookup.js b/src/ast/staticlookup.js index cf9407d9f..5bbd2d594 100644 --- a/src/ast/staticlookup.js +++ b/src/ast/staticlookup.js @@ -11,13 +11,12 @@ const KIND = "staticlookup"; /** * Lookup to a static property * @constructor StaticLookup + * @memberOf module:php-parser * @extends {Lookup} */ -module.exports = Lookup.extends(KIND, function StaticLookup( - what, - offset, - docs, - location -) { - Lookup.apply(this, [KIND, what, offset, docs, location]); -}); +module.exports = Lookup.extends( + KIND, + function StaticLookup(what, offset, docs, location) { + Lookup.apply(this, [KIND, what, offset, docs, location]); + }, +); diff --git a/src/ast/staticreference.js b/src/ast/staticreference.js new file mode 100644 index 000000000..c3b0755f2 --- /dev/null +++ b/src/ast/staticreference.js @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Reference = require("./reference"); +const KIND = "staticreference"; + +/** + * Defines a class reference node + * @constructor StaticReference + * @memberOf module:php-parser + * @extends {Reference} + */ +const StaticReference = Reference.extends( + KIND, + function StaticReference(raw, docs, location) { + Reference.apply(this, [KIND, docs, location]); + this.raw = raw; + }, +); +module.exports = StaticReference; diff --git a/src/ast/staticvariable.js b/src/ast/staticvariable.js new file mode 100644 index 000000000..2388c4f24 --- /dev/null +++ b/src/ast/staticvariable.js @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Node = require("./node"); +const KIND = "staticvariable"; + +/** + * Defines a constant + * @constructor StaticVariable + * @memberOf module:php-parser + * @extends {Node} + * @property {Variable} variable + * @property {Node|string|number|boolean|null} defaultValue + */ +module.exports = Node.extends( + KIND, + function StaticVariable(variable, defaultValue, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.variable = variable; + this.defaultValue = defaultValue; + }, +); diff --git a/src/ast/string.js b/src/ast/string.js index dc739041a..c2c7423a1 100644 --- a/src/ast/string.js +++ b/src/ast/string.js @@ -9,22 +9,20 @@ const Literal = require("./literal"); const KIND = "string"; /** - * Defines a string (simple ou double quoted) - chars are already escaped + * Defines a string (simple or double quoted) - chars are already escaped * @constructor String + * @memberOf module:php-parser * @extends {Literal} * @property {boolean} unicode * @property {boolean} isDoubleQuote * @see {Encapsed} + * @property {string} value */ -module.exports = Literal.extends(KIND, function String( - isDoubleQuote, - value, - unicode, - raw, - docs, - location -) { - Literal.apply(this, [KIND, value, raw, docs, location]); - this.unicode = unicode; - this.isDoubleQuote = isDoubleQuote; -}); +module.exports = Literal.extends( + KIND, + function String(isDoubleQuote, value, unicode, raw, docs, location) { + Literal.apply(this, [KIND, value, raw, docs, location]); + this.unicode = unicode; + this.isDoubleQuote = isDoubleQuote; + }, +); diff --git a/src/ast/switch.js b/src/ast/switch.js index dc39a5376..6f48d2142 100644 --- a/src/ast/switch.js +++ b/src/ast/switch.js @@ -11,20 +11,18 @@ const KIND = "switch"; /** * Defines a switch statement * @constructor Switch + * @memberOf module:php-parser * @extends {Statement} * @property {Expression} test * @property {Block} body * @property {boolean} shortForm */ -module.exports = Statement.extends(KIND, function Switch( - test, - body, - shortForm, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.body = body; - this.shortForm = shortForm; -}); +module.exports = Statement.extends( + KIND, + function Switch(test, body, shortForm, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.test = test; + this.body = body; + this.shortForm = shortForm; + }, +); diff --git a/src/ast/sys.js b/src/ast/sys.js deleted file mode 100644 index 0044e1dc5..000000000 --- a/src/ast/sys.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (C) 2018 Glayzzle (BSD3 License) - * @authors https://github.com/glayzzle/php-parser/graphs/contributors - * @url http://glayzzle.com - */ -"use strict"; - -const Statement = require("./statement"); -const KIND = "sys"; - -/** - * Defines system based call - * @constructor Sys - * @extends {Statement} - * @property {Node[]} arguments - */ -module.exports = Statement.extends(KIND, function Sys( - kind, - args, - docs, - location -) { - Statement.apply(this, [kind || KIND, docs, location]); - this.arguments = args; -}); diff --git a/src/ast/throw.js b/src/ast/throw.js index cb617df0d..36c51f88e 100644 --- a/src/ast/throw.js +++ b/src/ast/throw.js @@ -11,6 +11,7 @@ const KIND = "throw"; /** * Defines a throw statement * @constructor Throw + * @memberOf module:php-parser * @extends {Statement} * @property {Expression} what */ diff --git a/src/ast/trait.js b/src/ast/trait.js index 900c3c4df..62151e911 100644 --- a/src/ast/trait.js +++ b/src/ast/trait.js @@ -11,21 +11,14 @@ const KIND = "trait"; /** * A trait definition * @constructor Trait + * @memberOf module:php-parser * @extends {Declaration} - * @property {Identifier|null} extends - * @property {Identifier[]} implements * @property {Declaration[]} body */ -module.exports = Declaration.extends(KIND, function Trait( - name, - ext, - impl, - body, - docs, - location -) { - Declaration.apply(this, [KIND, name, docs, location]); - this.extends = ext; - this.implements = impl; - this.body = body; -}); +module.exports = Declaration.extends( + KIND, + function Trait(name, body, docs, location) { + Declaration.apply(this, [KIND, name, docs, location]); + this.body = body; + }, +); diff --git a/src/ast/traitalias.js b/src/ast/traitalias.js index 416614b3e..d6a9ecdf0 100644 --- a/src/ast/traitalias.js +++ b/src/ast/traitalias.js @@ -16,32 +16,29 @@ const IS_PRIVATE = "private"; /** * Defines a trait alias * @constructor TraitAlias + * @memberOf module:php-parser * @extends {Node} * @property {Identifier|null} trait - * @property {string} method - * @property {string|null} as + * @property {Identifier} method + * @property {Identifier|null} as * @property {string|null} visibility */ -module.exports = Node.extends(KIND, function TraitAlias( - trait, - method, - as, - flags, - docs, - location -) { - Node.apply(this, [KIND, docs, location]); - this.trait = trait; - this.method = method; - this.as = as; - this.visibility = IS_UNDEFINED; - if (flags) { - if (flags[0] === 0) { - this.visibility = IS_PUBLIC; - } else if (flags[0] === 1) { - this.visibility = IS_PROTECTED; - } else if (flags[0] === 2) { - this.visibility = IS_PRIVATE; +module.exports = Node.extends( + KIND, + function TraitAlias(trait, method, as, flags, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.trait = trait; + this.method = method; + this.as = as; + this.visibility = IS_UNDEFINED; + if (flags) { + if (flags[0] === 0) { + this.visibility = IS_PUBLIC; + } else if (flags[0] === 1) { + this.visibility = IS_PROTECTED; + } else if (flags[0] === 2) { + this.visibility = IS_PRIVATE; + } } - } -}); + }, +); diff --git a/src/ast/traitprecedence.js b/src/ast/traitprecedence.js index 08c1ae6e6..99ad43940 100644 --- a/src/ast/traitprecedence.js +++ b/src/ast/traitprecedence.js @@ -11,20 +11,18 @@ const KIND = "traitprecedence"; /** * Defines a trait alias * @constructor TraitPrecedence + * @memberOf module:php-parser * @extends {Node} * @property {Identifier|null} trait - * @property {string} method + * @property {Identifier} method * @property {Identifier[]} instead */ -module.exports = Node.extends(KIND, function TraitPrecedence( - trait, - method, - instead, - docs, - location -) { - Node.apply(this, [KIND, docs, location]); - this.trait = trait; - this.method = method; - this.instead = instead; -}); +module.exports = Node.extends( + KIND, + function TraitPrecedence(trait, method, instead, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.trait = trait; + this.method = method; + this.instead = instead; + }, +); diff --git a/src/ast/traituse.js b/src/ast/traituse.js index 14fe02978..fc163dc57 100644 --- a/src/ast/traituse.js +++ b/src/ast/traituse.js @@ -11,17 +11,16 @@ const KIND = "traituse"; /** * Defines a trait usage * @constructor TraitUse + * @memberOf module:php-parser * @extends {Node} * @property {Identifier[]} traits * @property {Node[]|null} adaptations */ -module.exports = Node.extends(KIND, function TraitUse( - traits, - adaptations, - docs, - location -) { - Node.apply(this, [KIND, docs, location]); - this.traits = traits; - this.adaptations = adaptations; -}); +module.exports = Node.extends( + KIND, + function TraitUse(traits, adaptations, docs, location) { + Node.apply(this, [KIND, docs, location]); + this.traits = traits; + this.adaptations = adaptations; + }, +); diff --git a/src/ast/try.js b/src/ast/try.js index c3de1f311..9a97f0728 100644 --- a/src/ast/try.js +++ b/src/ast/try.js @@ -11,20 +11,18 @@ const KIND = "try"; /** * Defines a try statement * @constructor Try + * @memberOf module:php-parser * @extends {Statement} * @property {Block} body * @property {Catch[]} catches - * @property {Block} allways + * @property {Block} always */ -module.exports = Statement.extends(KIND, function Try( - body, - catches, - always, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.body = body; - this.catches = catches; - this.always = always; -}); +module.exports = Statement.extends( + KIND, + function Try(body, catches, always, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.body = body; + this.catches = catches; + this.always = always; + }, +); diff --git a/src/ast/typereference.js b/src/ast/typereference.js new file mode 100644 index 000000000..944f74665 --- /dev/null +++ b/src/ast/typereference.js @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Reference = require("./reference"); +const KIND = "typereference"; + +/** + * Defines a class reference node + * @constructor TypeReference + * @memberOf module:php-parser + * @extends {Reference} + * @property {string} name + */ +const TypeReference = Reference.extends( + KIND, + function TypeReference(name, raw, docs, location) { + Reference.apply(this, [KIND, docs, location]); + this.name = name; + this.raw = raw; + }, +); + +TypeReference.types = [ + "int", + "float", + "string", + "bool", + "object", + "array", + "callable", + "iterable", + "void", + "static", +]; + +module.exports = TypeReference; diff --git a/src/ast/unary.js b/src/ast/unary.js index cfcbd2aee..7d086c0a0 100644 --- a/src/ast/unary.js +++ b/src/ast/unary.js @@ -11,17 +11,16 @@ const KIND = "unary"; /** * Unary operations * @constructor Unary + * @memberOf module:php-parser * @extends {Operation} - * @property {String} type + * @property {string} type * @property {Expression} what */ -module.exports = Operation.extends(KIND, function Unary( - type, - what, - docs, - location -) { - Operation.apply(this, [KIND, docs, location]); - this.type = type; - this.what = what; -}); +module.exports = Operation.extends( + KIND, + function Unary(type, what, docs, location) { + Operation.apply(this, [KIND, docs, location]); + this.type = type; + this.what = what; + }, +); diff --git a/src/ast/uniontype.js b/src/ast/uniontype.js new file mode 100644 index 000000000..e4d2bc318 --- /dev/null +++ b/src/ast/uniontype.js @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Declaration = require("./declaration"); +const KIND = "uniontype"; + +/** + * A union of types + * @memberOf module:php-parser + * @constructor UnionType + * @extends {Declaration} + * @property {TypeReference[]} types + */ +module.exports = Declaration.extends( + KIND, + function UnionType(types, docs, location) { + Declaration.apply(this, [KIND, null, docs, location]); + this.types = types; + }, +); diff --git a/src/ast/unset.js b/src/ast/unset.js index 497094733..36f110cc8 100644 --- a/src/ast/unset.js +++ b/src/ast/unset.js @@ -5,14 +5,19 @@ */ "use strict"; -const Sys = require("./sys"); +const Statement = require("./statement"); const KIND = "unset"; /** * Deletes references to a list of variables * @constructor Unset - * @extends {Sys} + * @memberOf module:php-parser + * @extends {Statement} */ -module.exports = Sys.extends(KIND, function Unset(args, docs, location) { - Sys.apply(this, [KIND, args, docs, location]); -}); +module.exports = Statement.extends( + KIND, + function Unset(variables, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.variables = variables; + }, +); diff --git a/src/ast/usegroup.js b/src/ast/usegroup.js index 0eeafd3d9..d00cfd74e 100644 --- a/src/ast/usegroup.js +++ b/src/ast/usegroup.js @@ -11,22 +11,20 @@ const KIND = "usegroup"; /** * Defines a use statement (with a list of use items) * @constructor UseGroup + * @memberOf module:php-parser * @extends {Statement} - * @property {String|null} name - * @property {String|null} type - Possible value : function, const + * @property {string|null} name + * @property {string|null} type - Possible value : function, const * @property {UseItem[]} item * @see {Namespace} * @see http://php.net/manual/en/language.namespaces.importing.php */ -module.exports = Statement.extends(KIND, function UseGroup( - name, - type, - items, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.name = name; - this.type = type; - this.items = items; -}); +module.exports = Statement.extends( + KIND, + function UseGroup(name, type, items, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.name = name; + this.type = type; + this.items = items; + }, +); diff --git a/src/ast/useitem.js b/src/ast/useitem.js index bbff339c8..17af88c4f 100644 --- a/src/ast/useitem.js +++ b/src/ast/useitem.js @@ -11,34 +11,34 @@ const KIND = "useitem"; /** * Defines a use statement (from namespace) * @constructor UseItem + * @memberOf module:php-parser * @extends {Statement} - * @property {String} name - * @property {String|null} type - Possible value : function, const - * @property {String|null} alias + * @property {string} name + * @property {string|null} type - Possible value : function, const + * @property {Identifier|null} alias * @see {Namespace} * @see http://php.net/manual/en/language.namespaces.importing.php */ -const UseItem = Statement.extends(KIND, function UseItem( - name, - alias, - type, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.name = name; - this.alias = alias; - this.type = type; -}); +const UseItem = Statement.extends( + KIND, + function UseItem(name, alias, type, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.name = name; + this.alias = alias; + this.type = type; + }, +); /** * Importing a constant - * @constant {String} TYPE_CONST + * @constant {string} UseItem#TYPE_CONST + * @memberOf module:php-parser */ UseItem.TYPE_CONST = "const"; /** * Importing a function - * @constant {String} TYPE_FUNC + * @constant {string} UseItem#TYPE_FUNC + * @memberOf module:php-parser */ UseItem.TYPE_FUNCTION = "function"; diff --git a/src/ast/variable.js b/src/ast/variable.js index 9a5c5097a..cd6609036 100644 --- a/src/ast/variable.js +++ b/src/ast/variable.js @@ -5,37 +5,32 @@ */ "use strict"; -const Expr = require("./expression"); +const Expression = require("./expression"); const KIND = "variable"; /** * Any expression node. Since the left-hand side of an assignment may * be any expression in general, an expression can also be a pattern. * @constructor Variable + * @memberOf module:php-parser * @extends {Expression} * @example * // PHP code : - * &$foo + * $foo * // AST output * { * "kind": "variable", * "name": "foo", - * "byref": true, * "curly": false * } - * @property {String|Node} name The variable name (can be a complex expression when the name is resolved dynamically) - * @property {boolean} byref Indicate if the variable reference is used, ex `&$foo` + * @property {string|Node} name The variable name (can be a complex expression when the name is resolved dynamically) * @property {boolean} curly Indicate if the name is defined between curlies, ex `${foo}` */ -module.exports = Expr.extends(KIND, function Variable( - name, - byref, - curly, - docs, - location -) { - Expr.apply(this, [KIND, docs, location]); - this.name = name; - this.byref = byref || false; - this.curly = curly || false; -}); +module.exports = Expression.extends( + KIND, + function Variable(name, curly, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.name = name; + this.curly = curly || false; + }, +); diff --git a/src/ast/variadic.js b/src/ast/variadic.js index f5f7231e6..c9783ae3f 100644 --- a/src/ast/variadic.js +++ b/src/ast/variadic.js @@ -5,17 +5,21 @@ */ "use strict"; -const Expr = require("./expression"); +const Expression = require("./expression"); const KIND = "variadic"; /** * Introduce a list of items into the arguments of the call - * @constructor variadic + * @constructor Variadic + * @memberOf module:php-parser * @extends {Expression} * @property {Array|Expression} what * @see https://wiki.php.net/rfc/argument_unpacking */ -module.exports = Expr.extends(KIND, function variadic(what, docs, location) { - Expr.apply(this, [KIND, docs, location]); - this.what = what; -}); +module.exports = Expression.extends( + KIND, + function variadic(what, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.what = what; + }, +); diff --git a/src/ast/variadicplaceholder.js b/src/ast/variadicplaceholder.js new file mode 100644 index 000000000..4e1fe657d --- /dev/null +++ b/src/ast/variadicplaceholder.js @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +const Node = require("./node"); +const KIND = "variadicplaceholder"; + +/** + * Defines a variadic placeholder (the ellipsis in PHP 8.1+'s first-class callable syntax) + * @constructor VariadicPlaceholder + * @memberOf module:php-parser + * @extends {Node} + * @see {Namespace} + * @see http://php.net/manual/en/language.namespaces.importing.php + */ +module.exports = Node.extends( + KIND, + function VariadicPlaceholder(docs, location) { + Node.apply(this, [KIND, docs, location]); + }, +); diff --git a/src/ast/while.js b/src/ast/while.js index 5887ec950..d92972717 100644 --- a/src/ast/while.js +++ b/src/ast/while.js @@ -11,20 +11,18 @@ const KIND = "while"; /** * Defines a while statement * @constructor While + * @memberOf module:php-parser * @extends {Statement} * @property {Expression} test - * @property {Statement} body + * @property {Block | null} body * @property {boolean} shortForm */ -module.exports = Statement.extends(KIND, function While( - test, - body, - shortForm, - docs, - location -) { - Statement.apply(this, [KIND, docs, location]); - this.test = test; - this.body = body; - this.shortForm = shortForm; -}); +module.exports = Statement.extends( + KIND, + function While(test, body, shortForm, docs, location) { + Statement.apply(this, [KIND, docs, location]); + this.test = test; + this.body = body; + this.shortForm = shortForm; + }, +); diff --git a/src/ast/yield.js b/src/ast/yield.js index 5214d0a6f..4cd92e54c 100644 --- a/src/ast/yield.js +++ b/src/ast/yield.js @@ -11,18 +11,17 @@ const KIND = "yield"; /** * Defines a yield generator statement * @constructor Yield + * @memberOf module:php-parser * @extends {Expression} - * @property {Expression|Null} value - * @property {Expression|Null} key + * @property {Expression|null} value + * @property {Expression|null} key * @see http://php.net/manual/en/language.generators.syntax.php */ -module.exports = Expression.extends(KIND, function Yield( - value, - key, - docs, - location -) { - Expression.apply(this, [KIND, docs, location]); - this.value = value; - this.key = key; -}); +module.exports = Expression.extends( + KIND, + function Yield(value, key, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.value = value; + this.key = key; + }, +); diff --git a/src/ast/yieldfrom.js b/src/ast/yieldfrom.js index b7dd53cc0..11cf8df97 100644 --- a/src/ast/yieldfrom.js +++ b/src/ast/yieldfrom.js @@ -11,15 +11,15 @@ const KIND = "yieldfrom"; /** * Defines a yield from generator statement * @constructor YieldFrom + * @memberOf module:php-parser * @extends {Expression} * @property {Expression} value * @see http://php.net/manual/en/language.generators.syntax.php */ -module.exports = Expression.extends(KIND, function YieldFrom( - value, - docs, - location -) { - Expression.apply(this, [KIND, docs, location]); - this.value = value; -}); +module.exports = Expression.extends( + KIND, + function YieldFrom(value, docs, location) { + Expression.apply(this, [KIND, docs, location]); + this.value = value; + }, +); diff --git a/src/index.js b/src/index.js index 31b26e55f..8e9b734d2 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ -/*! - * Copyright (C) 2018 Glayzzle (BSD3 License) +/** + * Copyright (C) 2020 Glayzzle (BSD3 License) * @authors https://github.com/glayzzle/php-parser/graphs/contributors * @url http://glayzzle.com */ @@ -38,6 +38,7 @@ function combine(src, to) { * Initialise a new parser instance with the specified options * * @class + * @memberOf module:php-parser * @tutorial Engine * @example * var parser = require('php-parser'); @@ -45,7 +46,7 @@ function combine(src, to) { * parser: { * extractDoc: true, * suppressErrors: true, - * php7: true + * version: 704 // or '7.4' * }, * ast: { * withPositions: true @@ -66,7 +67,7 @@ function combine(src, to) { * @property {AST} ast * @property {Object} tokens */ -const engine = function(options) { +const Engine = function (options) { if (typeof this === "function") { return new this(options); } @@ -76,23 +77,42 @@ const engine = function(options) { this.parser = new parser(this.lexer, this.ast); if (options && typeof options === "object") { // disable php7 from lexer if already disabled from parser - if (options.parser && options.parser.php7 === false) { + if (options.parser) { if (!options.lexer) { options.lexer = {}; } - options.lexer.php7 = false; + if (options.parser.version) { + if (typeof options.parser.version === "string") { + let version = options.parser.version.split("."); + version = parseInt(version[0]) * 100 + parseInt(version[1]); + if (isNaN(version)) { + throw new Error("Bad version number : " + options.parser.version); + } else { + options.parser.version = version; + } + } else if (typeof options.parser.version !== "number") { + throw new Error("Expecting a number for version"); + } + if (options.parser.version < 500 || options.parser.version > 900) { + throw new Error("Can only handle versions between 5.x to 8.x"); + } + } } combine(options, this); + + // same version flags based on parser options + this.lexer.version = this.parser.version; } }; /** * Check if the inpyt is a buffer or a string + * @private * @param {Buffer|String} buffer Input value that can be either a buffer or a string * @return {String} Returns the string from input */ -const getStringBuffer = function(buffer) { - return Buffer.isBuffer(buffer) ? buffer.toString() : buffer; +const getStringBuffer = function (buffer) { + return typeof buffer.write === "function" ? buffer.toString() : buffer; }; /** @@ -101,16 +121,16 @@ const getStringBuffer = function(buffer) { * @return {Engine} * @private */ -engine.create = function(options) { - return new engine(options); +Engine.create = function (options) { + return new Engine(options); }; /** * Evaluate the buffer * @private */ -engine.parseEval = function(buffer, options) { - const self = new engine(options); +Engine.parseEval = function (buffer, options) { + const self = new Engine(options); return self.parseEval(buffer); }; @@ -119,7 +139,7 @@ engine.parseEval = function(buffer, options) { * @param {String} buffer * @return {Program} */ -engine.prototype.parseEval = function(buffer) { +Engine.prototype.parseEval = function (buffer) { this.lexer.mode_eval = true; this.lexer.all_tokens = false; buffer = getStringBuffer(buffer); @@ -130,13 +150,13 @@ engine.prototype.parseEval = function(buffer) { * Static function that parse a php code with open/close tags * @private */ -engine.parseCode = function(buffer, filename, options) { +Engine.parseCode = function (buffer, filename, options) { if (typeof filename === "object" && !options) { // retro-compatibility options = filename; filename = "unknown"; } - const self = new engine(options); + const self = new Engine(options); return self.parseCode(buffer, filename); }; @@ -160,7 +180,7 @@ engine.parseCode = function(buffer, filename, options) { * @param {String} filename - Filename * @return {Program} */ -engine.prototype.parseCode = function(buffer, filename) { +Engine.prototype.parseCode = function (buffer, filename) { this.lexer.mode_eval = false; this.lexer.all_tokens = false; buffer = getStringBuffer(buffer); @@ -171,18 +191,18 @@ engine.prototype.parseCode = function(buffer, filename) { * Split the buffer into tokens * @private */ -engine.tokenGetAll = function(buffer, options) { - const self = new engine(options); +Engine.tokenGetAll = function (buffer, options) { + const self = new Engine(options); return self.tokenGetAll(buffer); }; /** * Extract tokens from the specified buffer. * > Note that the output tokens are *STRICLY* similar to PHP function `token_get_all` - * @param {String} buffer - * @return {String[]} - Each item can be a string or an array with following informations [token_name, text, line_number] + * @param {string} buffer + * @return {Array} - Each item can be a string or an array with following informations [token_name, text, line_number] */ -engine.prototype.tokenGetAll = function(buffer) { +Engine.prototype.tokenGetAll = function (buffer) { this.lexer.mode_eval = false; this.lexer.all_tokens = true; buffer = getStringBuffer(buffer); @@ -193,7 +213,7 @@ engine.prototype.tokenGetAll = function(buffer) { const result = []; while (token != EOF) { let entry = this.lexer.yytext; - if (names.hasOwnProperty(token)) { + if (Object.prototype.hasOwnProperty.call(names, token)) { entry = [names[token], entry, this.lexer.yylloc.first_line]; } result.push(entry); @@ -202,8 +222,10 @@ engine.prototype.tokenGetAll = function(buffer) { return result; }; +/** @module php-parser */ + // exports the function -module.exports = engine; +module.exports = Engine; // makes libraries public module.exports.tokens = tokens; @@ -211,6 +233,7 @@ module.exports.lexer = lexer; module.exports.AST = AST; module.exports.parser = parser; module.exports.combine = combine; +module.exports.Engine = Engine; // allow the default export in index.d.ts -module.exports.default = engine; +module.exports.default = Engine; diff --git a/src/lexer.js b/src/lexer.js index 0254082d9..c1cee6b35 100644 --- a/src/lexer.js +++ b/src/lexer.js @@ -9,17 +9,18 @@ * This is the php lexer. It will tokenize the string for helping the * parser to build the AST from its grammar. * - * @class - * @property {Integer} EOF - * @property {Boolean} all_tokens defines if all tokens must be retrieved (used by token_get_all only) - * @property {Boolean} comment_tokens extracts comments tokens - * @property {Boolean} mode_eval enables the evald mode (ignore opening tags) - * @property {Boolean} asp_tags disables by default asp tags mode - * @property {Boolean} short_tags enables by default short tags mode - * @property {Object} keywords List of php keyword - * @property {Object} castKeywords List of php keywords for type casting + * @constructor Lexer + * @memberOf module:php-parser + * @property {number} EOF + * @property {boolean} all_tokens defines if all tokens must be retrieved (used by token_get_all only) + * @property {boolean} comment_tokens extracts comments tokens + * @property {boolean} mode_eval enables the evald mode (ignore opening tags) + * @property {boolean} asp_tags disables by default asp tags mode + * @property {boolean} short_tags enables by default short tags mode + * @property {object} keywords List of php keyword + * @property {object} castKeywords List of php keywords for type casting */ -const lexer = function(engine) { +const Lexer = function (engine) { this.engine = engine; this.tok = this.engine.tokens.names; this.EOF = 1; @@ -28,8 +29,8 @@ const lexer = function(engine) { this.comment_tokens = false; this.mode_eval = false; this.asp_tags = false; - this.short_tags = true; - this.php7 = true; + this.short_tags = false; + this.version = 803; this.yyprevcol = 0; this.keywords = { __class__: this.tok.T_CLASS_C, @@ -76,6 +77,7 @@ const lexer = function(engine) { class: this.tok.T_CLASS, interface: this.tok.T_INTERFACE, trait: this.tok.T_TRAIT, + enum: this.tok.T_ENUM, extends: this.tok.T_EXTENDS, implements: this.tok.T_IMPLEMENTS, new: this.tok.T_NEW, @@ -105,7 +107,9 @@ const lexer = function(engine) { callable: this.tok.T_CALLABLE, or: this.tok.T_LOGICAL_OR, and: this.tok.T_LOGICAL_AND, - xor: this.tok.T_LOGICAL_XOR + xor: this.tok.T_LOGICAL_XOR, + match: this.tok.T_MATCH, + readonly: this.tok.T_READ_ONLY, }; this.castKeywords = { int: this.tok.T_INT_CAST, @@ -119,14 +123,16 @@ const lexer = function(engine) { object: this.tok.T_OBJECT_CAST, bool: this.tok.T_BOOL_CAST, boolean: this.tok.T_BOOL_CAST, - unset: this.tok.T_UNSET_CAST + unset: this.tok.T_UNSET_CAST, }; }; /** * Initialize the lexer with the specified input + * @function Lexer#setInput + * @memberOf module:php-parser */ -lexer.prototype.setInput = function(input) { +Lexer.prototype.setInput = function (input) { this._input = input; this.size = input.length; this.yylineno = 1; @@ -141,9 +147,14 @@ lexer.prototype.setInput = function(input) { prev_line: 1, prev_column: 0, last_line: 1, - last_column: 0 + last_column: 0, }; this.tokens = []; + if (this.version > 703) { + this.keywords.fn = this.tok.T_FN; + } else { + delete this.keywords.fn; + } this.done = this.offset >= this.size; if (!this.all_tokens && this.mode_eval) { this.conditionStack = ["INITIAL"]; @@ -152,13 +163,36 @@ lexer.prototype.setInput = function(input) { this.conditionStack = []; this.begin("INITIAL"); } + // https://github.com/php/php-src/blob/999e32b65a8a4bb59e27e538fa68ffae4b99d863/Zend/zend_language_scanner.h#L59 + // Used for heredoc and nowdoc + this.heredoc_label = { + label: "", + length: 0, + indentation: 0, + indentation_uses_spaces: false, + finished: false, + /* + * this used for parser to detemine the if current node segment is first encaps node. + * if ture, the indentation will remove from the begining. and if false, the prev node + * might be a variable '}' ,and the leading spaces should not be removed util meet the + * first \n + */ + first_encaps_node: false, + // for backward compatible + /* istanbul ignore next */ + toString: function () { + this.label; + }, + }; return this; }; /** * consumes and returns one char from the input + * @function Lexer#input + * @memberOf module:php-parser */ -lexer.prototype.input = function() { +Lexer.prototype.input = function () { const ch = this._input[this.offset]; if (!ch) return ""; this.yytext += ch; @@ -179,8 +213,10 @@ lexer.prototype.input = function() { /** * revert eating specified size + * @function Lexer#unput + * @memberOf module:php-parser */ -lexer.prototype.unput = function(size) { +Lexer.prototype.unput = function (size) { if (size === 1) { // 1 char unput (most cases) this.offset--; @@ -243,18 +279,36 @@ lexer.prototype.unput = function(size) { return this; }; -// check if the text matches -lexer.prototype.tryMatch = function(text) { +/** + * check if the text matches + * @function Lexer#tryMatch + * @memberOf module:php-parser + * @param {string} text + * @returns {boolean} + */ +Lexer.prototype.tryMatch = function (text) { return text === this.ahead(text.length); }; -// check if the text matches -lexer.prototype.tryMatchCaseless = function(text) { +/** + * check if the text matches + * @function Lexer#tryMatchCaseless + * @memberOf module:php-parser + * @param {string} text + * @returns {boolean} + */ +Lexer.prototype.tryMatchCaseless = function (text) { return text === this.ahead(text.length).toLowerCase(); }; -// look ahead -lexer.prototype.ahead = function(size) { +/** + * look ahead + * @function Lexer#ahead + * @memberOf module:php-parser + * @param {number} size + * @returns {string} + */ +Lexer.prototype.ahead = function (size) { let text = this._input.substring(this.offset, this.offset + size); if ( text[text.length - 1] === "\r" && @@ -265,8 +319,14 @@ lexer.prototype.ahead = function(size) { return text; }; -// consume the specified size -lexer.prototype.consume = function(size) { +/** + * consume the specified size + * @function Lexer#consume + * @memberOf module:php-parser + * @param {number} size + * @returns {Lexer} + */ +Lexer.prototype.consume = function (size) { for (let i = 0; i < size; i++) { const ch = this._input[this.offset]; if (!ch) break; @@ -290,8 +350,10 @@ lexer.prototype.consume = function(size) { /** * Gets the current state + * @function Lexer#getState + * @memberOf module:php-parser */ -lexer.prototype.getState = function() { +Lexer.prototype.getState = function () { return { yytext: this.yytext, offset: this.offset, @@ -302,31 +364,49 @@ lexer.prototype.getState = function() { first_line: this.yylloc.first_line, first_column: this.yylloc.first_column, last_line: this.yylloc.last_line, - last_column: this.yylloc.last_column - } + last_column: this.yylloc.last_column, + }, + heredoc_label: this.heredoc_label, }; }; /** * Sets the current lexer state + * @function Lexer#setState + * @memberOf module:php-parser */ -lexer.prototype.setState = function(state) { +Lexer.prototype.setState = function (state) { this.yytext = state.yytext; this.offset = state.offset; this.yylineno = state.yylineno; this.yyprevcol = state.yyprevcol; this.yylloc = state.yylloc; + if (state.heredoc_label) { + this.heredoc_label = state.heredoc_label; + } return this; }; -// prepend next token -lexer.prototype.appendToken = function(value, ahead) { +/** + * prepend next token + * @function Lexer#appendToken + * @memberOf module:php-parser + * @param {*} value + * @param {*} ahead + * @returns {Lexer} + */ +Lexer.prototype.appendToken = function (value, ahead) { this.tokens.push([value, ahead]); return this; }; -// return next match that has a token -lexer.prototype.lex = function() { +/** + * return next match that has a token + * @function Lexer#lex + * @memberOf module:php-parser + * @returns {number|string} + */ +Lexer.prototype.lex = function () { this.yylloc.prev_offset = this.offset; this.yylloc.prev_line = this.yylloc.last_line; this.yylloc.prev_column = this.yylloc.last_column; @@ -362,31 +442,49 @@ lexer.prototype.lex = function() { return token; }; -// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) -lexer.prototype.begin = function(condition) { +/** + * activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + * @function Lexer#begin + * @memberOf module:php-parser + * @param {*} condition + * @returns {Lexer} + */ +Lexer.prototype.begin = function (condition) { this.conditionStack.push(condition); this.curCondition = condition; this.stateCb = this["match" + condition]; + /* istanbul ignore next */ if (typeof this.stateCb !== "function") { throw new Error('Undefined condition state "' + condition + '"'); } return this; }; -// pop the previously active lexer condition state off the condition stack -lexer.prototype.popState = function() { +/** + * pop the previously active lexer condition state off the condition stack + * @function Lexer#popState + * @memberOf module:php-parser + * @returns {string|*} + */ +Lexer.prototype.popState = function () { const n = this.conditionStack.length - 1; const condition = n > 0 ? this.conditionStack.pop() : this.conditionStack[0]; this.curCondition = this.conditionStack[this.conditionStack.length - 1]; this.stateCb = this["match" + this.curCondition]; + /* istanbul ignore next */ if (typeof this.stateCb !== "function") { throw new Error('Undefined condition state "' + this.curCondition + '"'); } return condition; }; -// return next match in input -lexer.prototype.next = function() { +/** + * return next match in input + * @function Lexer#next + * @memberOf module:php-parser + * @returns {number|*} + */ +Lexer.prototype.next = function () { let token; if (!this._input) { this.done = true; @@ -415,6 +513,7 @@ lexer.prototype.next = function() { if (this.offset >= this.size && this.tokens.length === 0) { this.done = true; } + /* istanbul ignore next */ if (this.debug) { let tName = token; if (typeof tName === "number") { @@ -434,7 +533,7 @@ lexer.prototype.next = function() { this.yylloc.last_column + '\t"' + this.yytext + - '"' + '"', ); // eslint-disable-next-line no-console console.error(e.stack); @@ -444,6 +543,7 @@ lexer.prototype.next = function() { // extends the lexer with states [ + require("./lexer/attribute.js"), require("./lexer/comments.js"), require("./lexer/initial.js"), require("./lexer/numbers.js"), @@ -451,11 +551,11 @@ lexer.prototype.next = function() { require("./lexer/scripting.js"), require("./lexer/strings.js"), require("./lexer/tokens.js"), - require("./lexer/utils.js") -].forEach(function(ext) { + require("./lexer/utils.js"), +].forEach(function (ext) { for (const k in ext) { - lexer.prototype[k] = ext[k]; + Lexer.prototype[k] = ext[k]; } }); -module.exports = lexer; +module.exports = Lexer; diff --git a/src/lexer/attribute.js b/src/lexer/attribute.js new file mode 100644 index 000000000..b3421baea --- /dev/null +++ b/src/lexer/attribute.js @@ -0,0 +1,85 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +module.exports = { + attributeIndex: 0, + attributeListDepth: {}, + matchST_ATTRIBUTE: function () { + let ch = this.input(); + if (this.is_WHITESPACE()) { + do { + ch = this.input(); + } while (this.is_WHITESPACE()); + this.unput(1); + return null; + } + switch (ch) { + case "]": + if (this.attributeListDepth[this.attributeIndex] === 0) { + delete this.attributeListDepth[this.attributeIndex]; + this.attributeIndex--; + this.popState(); + } else { + /* istanbul ignore next */ + this.attributeListDepth[this.attributeIndex]--; + } + return "]"; + case "(": + case ")": + case ":": + case "=": + case "|": + case "&": + case "^": + case "-": + case "+": + case "*": + case "%": + case "~": + case "<": + case ">": + case "!": + case ".": + return this.consume_TOKEN(); + case "[": + this.attributeListDepth[this.attributeIndex]++; + return "["; + case ",": + return ","; + case '"': + return this.ST_DOUBLE_QUOTES(); + case "'": + return this.T_CONSTANT_ENCAPSED_STRING(); + case "/": + if (this._input[this.offset] === "/") { + return this.T_COMMENT(); + } else if (this._input[this.offset] === "*") { + this.input(); + return this.T_DOC_COMMENT(); + } else { + return this.consume_TOKEN(); + } + } + if (this.is_LABEL_START() || ch === "\\") { + while (this.offset < this.size) { + const ch = this.input(); + if (!(this.is_LABEL() || ch === "\\")) { + if (ch) this.unput(1); + break; + } + } + return this.T_STRING(); + } else if (this.is_NUM()) { + return this.consume_NUM(); + } + + /* istanbul ignore next */ + throw new Error( + `Bad terminal sequence "${ch}" at line ${this.yylineno} (offset ${this.offset})`, + ); + }, +}; diff --git a/src/lexer/comments.js b/src/lexer/comments.js index d38240562..43501d701 100644 --- a/src/lexer/comments.js +++ b/src/lexer/comments.js @@ -6,10 +6,10 @@ "use strict"; module.exports = { - /** + /* * Reads a single line comment */ - T_COMMENT: function() { + T_COMMENT: function () { while (this.offset < this.size) { const ch = this.input(); if (ch === "\n" || ch === "\r") { @@ -32,10 +32,10 @@ module.exports = { } return this.tok.T_COMMENT; }, - /** + /* * Behaviour : https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1927 */ - T_DOC_COMMENT: function() { + T_DOC_COMMENT: function () { let ch = this.input(); let token = this.tok.T_COMMENT; if (ch === "*") { @@ -59,5 +59,5 @@ module.exports = { } } return token; - } + }, }; diff --git a/src/lexer/initial.js b/src/lexer/initial.js index 03bb9d7d7..1524b8048 100644 --- a/src/lexer/initial.js +++ b/src/lexer/initial.js @@ -6,7 +6,7 @@ "use strict"; module.exports = { - nextINITIAL: function() { + nextINITIAL: function () { if ( this.conditionStack.length > 1 && this.conditionStack[this.conditionStack.length - 1] === "INITIAL" @@ -18,7 +18,7 @@ module.exports = { } return this; }, - matchINITIAL: function() { + matchINITIAL: function () { while (this.offset < this.size) { let ch = this.input(); if (ch == "<") { @@ -32,16 +32,12 @@ module.exports = { } else if (this.tryMatchCaseless("?php")) { ch = this._input[this.offset + 4]; if (ch === " " || ch === "\t" || ch === "\n" || ch === "\r") { - this.unput(1) - .appendToken(this.tok.T_OPEN_TAG, 6) - .nextINITIAL(); + this.unput(1).appendToken(this.tok.T_OPEN_TAG, 6).nextINITIAL(); break; } } if (this.short_tags) { - this.unput(1) - .appendToken(this.tok.T_OPEN_TAG, 2) - .nextINITIAL(); + this.unput(1).appendToken(this.tok.T_OPEN_TAG, 2).nextINITIAL(); break; } } else if (this.asp_tags && ch == "%") { @@ -53,9 +49,7 @@ module.exports = { break; } else { this.aspTagMode = true; - this.unput(1) - .appendToken(this.tok.T_OPEN_TAG, 2) - .nextINITIAL(); + this.unput(1).appendToken(this.tok.T_OPEN_TAG, 2).nextINITIAL(); break; } } @@ -66,5 +60,5 @@ module.exports = { } else { return false; } - } + }, }; diff --git a/src/lexer/numbers.js b/src/lexer/numbers.js index e2b2a02a2..0d6239461 100644 --- a/src/lexer/numbers.js +++ b/src/lexer/numbers.js @@ -14,60 +14,100 @@ if (process.arch == "x64") { } module.exports = { - consume_NUM: function() { + consume_NUM: function () { let ch = this.yytext[0]; - let hasPoint = this.yytext[0] === "."; + let hasPoint = ch === "."; if (ch === "0") { ch = this.input(); // check if hexa if (ch === "x" || ch === "X") { ch = this.input(); - if (this.is_HEX()) { + if (ch !== "_" && this.is_HEX()) { return this.consume_HNUM(); } else { this.unput(ch ? 2 : 1); } + // check binary notation } else if (ch === "b" || ch === "B") { ch = this.input(); - if (ch === "0" || ch === "1") { + if ((ch !== "_" && ch === "0") || ch === "1") { return this.consume_BNUM(); } else { this.unput(ch ? 2 : 1); } + } else if (ch === "o" || ch === "O") { + ch = this.input(); + if (ch !== "_" && this.is_OCTAL()) { + return this.consume_ONUM(); + } else { + this.unput(ch ? 2 : 1); + } } else if (!this.is_NUM()) { if (ch) this.unput(1); } } while (this.offset < this.size) { + const prev = ch; ch = this.input(); - if (!this.is_NUM()) { - if (ch === "." && !hasPoint) { - hasPoint = true; - } else if (ch === "e" || ch === "E") { - ch = this.input(); - if (ch === "+" || ch === "-") { - ch = this.input(); - if (this.is_NUM()) { - this.consume_LNUM(); - return this.tok.T_DNUMBER; - } else { - this.unput(ch ? 3 : 2); - break; - } - } else if (this.is_NUM()) { - this.consume_LNUM(); - return this.tok.T_DNUMBER; - } else { - this.unput(ch ? 2 : 1); - break; - } - } else { - if (ch) this.unput(1); + + if (ch === "_") { + if (prev === "_") { + // restriction : next to underscore / 1__1; + this.unput(2); // keep 1 + break; + } + if (prev === ".") { + // next to decimal point "1._0" + this.unput(1); // keep 1. break; } + if (prev === "e" || prev === "E") { + // next to e "1e_10" + this.unput(2); // keep 1 + break; + } + } else if (ch === ".") { + if (hasPoint) { + // no multiple points "1.0.5" + this.unput(1); // keep 1.0 + break; + } + if (prev === "_") { + // next to decimal point "1_.0" + this.unput(2); // keep 1 + break; + } + hasPoint = true; + continue; + } else if (ch === "e" || ch === "E") { + if (prev === "_") { + // next to e "1_e10" + this.unput(1); + break; + } + let undo = 2; + ch = this.input(); + if (ch === "+" || ch === "-") { + // 1e-5 + undo = 3; + ch = this.input(); + } + if (this.is_NUM_START()) { + this.consume_LNUM(); + return this.tok.T_DNUMBER; + } + this.unput(ch ? undo : undo - 1); // keep only 1 + break; + } + + if (!this.is_NUM()) { + // example : 10.0a + if (ch) this.unput(1); // keep 10.0 + break; } } + if (hasPoint) { return this.tok.T_DNUMBER; } else if (this.yytext.length < MAX_LENGTH_OF_LONG - 1) { @@ -84,7 +124,7 @@ module.exports = { } }, // read hexa - consume_HNUM: function() { + consume_HNUM: function () { while (this.offset < this.size) { const ch = this.input(); if (!this.is_HEX()) { @@ -95,7 +135,7 @@ module.exports = { return this.tok.T_LNUMBER; }, // read a generic number - consume_LNUM: function() { + consume_LNUM: function () { while (this.offset < this.size) { const ch = this.input(); if (!this.is_NUM()) { @@ -106,15 +146,26 @@ module.exports = { return this.tok.T_LNUMBER; }, // read binary - consume_BNUM: function() { + consume_BNUM: function () { let ch; while (this.offset < this.size) { ch = this.input(); - if (ch !== "0" && ch !== "1") { + if (ch !== "0" && ch !== "1" && ch !== "_") { if (ch) this.unput(1); break; } } return this.tok.T_LNUMBER; - } + }, + // read an octal number + consume_ONUM: function () { + while (this.offset < this.size) { + const ch = this.input(); + if (!this.is_OCTAL()) { + if (ch) this.unput(1); + break; + } + } + return this.tok.T_LNUMBER; + }, }; diff --git a/src/lexer/property.js b/src/lexer/property.js index 6d6d5b1b2..8d2c00259 100644 --- a/src/lexer/property.js +++ b/src/lexer/property.js @@ -6,7 +6,7 @@ "use strict"; module.exports = { - matchST_LOOKING_FOR_PROPERTY: function() { + matchST_LOOKING_FOR_PROPERTY: function () { let ch = this.input(); if (ch === "-") { ch = this.input(); @@ -28,7 +28,7 @@ module.exports = { if (ch) this.unput(1); return false; }, - matchST_LOOKING_FOR_VARNAME: function() { + matchST_LOOKING_FOR_VARNAME: function () { let ch = this.input(); // SHIFT STATE @@ -52,9 +52,9 @@ module.exports = { // stops looking for a varname and starts the scripting mode return false; }, - matchST_VAR_OFFSET: function() { + matchST_VAR_OFFSET: function () { const ch = this.input(); - if (this.is_NUM()) { + if (this.is_NUM_START()) { this.consume_NUM(); return this.tok.T_NUM_STRING; } else if (ch === "]") { @@ -66,6 +66,7 @@ module.exports = { this.consume_LABEL(); return this.tok.T_VARIABLE; } else { + /* istanbul ignore next */ throw new Error("Unexpected terminal"); } } else if (this.is_LABEL_START()) { @@ -88,7 +89,8 @@ module.exports = { ) { return ch; } else { + /* istanbul ignore next */ throw new Error("Unexpected terminal"); } - } + }, }; diff --git a/src/lexer/scripting.js b/src/lexer/scripting.js index a577290b3..0a6a1a1a3 100644 --- a/src/lexer/scripting.js +++ b/src/lexer/scripting.js @@ -6,7 +6,7 @@ "use strict"; module.exports = { - matchST_IN_SCRIPTING: function() { + matchST_IN_SCRIPTING: function () { let ch = this.input(); switch (ch) { case " ": @@ -16,6 +16,12 @@ module.exports = { case "\r\n": return this.T_WHITESPACE(); case "#": + if (this.version >= 800 && this._input[this.offset] === "[") { + this.input(); + this.attributeListDepth[++this.attributeIndex] = 0; + this.begin("ST_ATTRIBUTE"); + return this.tok.T_ATTRIBUTE; + } return this.T_COMMENT(); case "/": if (this._input[this.offset] === "/") { @@ -69,13 +75,13 @@ module.exports = { default: if (ch === ".") { ch = this.input(); - if (this.is_NUM()) { + if (this.is_NUM_START()) { return this.consume_NUM(); } else { if (ch) this.unput(1); } } - if (this.is_NUM()) { + if (this.is_NUM_START()) { return this.consume_NUM(); } else if (this.is_LABEL_START()) { return this.consume_LABEL().T_STRING(); @@ -90,11 +96,11 @@ module.exports = { this.yylineno + " (offset " + this.offset + - ")" + ")", ); }, - T_WHITESPACE: function() { + T_WHITESPACE: function () { while (this.offset < this.size) { const ch = this.input(); if (ch === " " || ch === "\t" || ch === "\n" || ch === "\r") { @@ -104,5 +110,5 @@ module.exports = { break; } return this.tok.T_WHITESPACE; - } + }, }; diff --git a/src/lexer/strings.js b/src/lexer/strings.js index d2d0100bd..689213e5f 100644 --- a/src/lexer/strings.js +++ b/src/lexer/strings.js @@ -5,8 +5,21 @@ */ "use strict"; +const newline = ["\n", "\r"]; +const valid_after_heredoc = ["\n", "\r", ";"]; +const valid_after_heredoc_73 = valid_after_heredoc.concat([ + "\t", + " ", + ",", + "]", + ")", + "/", + "=", + "!", +]); + module.exports = { - T_CONSTANT_ENCAPSED_STRING: function() { + T_CONSTANT_ENCAPSED_STRING: function () { let ch; while (this.offset < this.size) { ch = this.input(); @@ -19,7 +32,7 @@ module.exports = { return this.tok.T_CONSTANT_ENCAPSED_STRING; }, // check if matching a HEREDOC state - is_HEREDOC: function() { + is_HEREDOC: function () { const revert = this.offset; if ( this._input[this.offset - 1] === "<" && @@ -60,12 +73,11 @@ module.exports = { // required ending quote if (tChar) this.offset++; // require newline - if ( - this._input[this.offset - 1] === "\r" || - this._input[this.offset - 1] === "\n" - ) { + if (newline.includes(this._input[this.offset - 1])) { // go go go - this.heredoc_label = yylabel; + this.heredoc_label.label = yylabel; + this.heredoc_label.length = yylabel.length; + this.heredoc_label.finished = false; yyoffset = this.offset - revert; this.offset = revert; this.consume(yyoffset); @@ -74,6 +86,8 @@ module.exports = { } else { this.begin("ST_HEREDOC"); } + // prematch to get the indentation information from end of doc + this.prematch_ENDOFDOC(); return this.tok.T_START_HEREDOC; } } @@ -82,7 +96,7 @@ module.exports = { this.offset = revert; return false; }, - ST_DOUBLE_QUOTES: function() { + ST_DOUBLE_QUOTES: function () { let ch; while (this.offset < this.size) { ch = this.input(); @@ -116,7 +130,7 @@ module.exports = { if (this.yytext.length > 2) { this.appendToken( this.tok.T_ENCAPSED_AND_WHITESPACE, - this.yytext.length - prefix + this.yytext.length - prefix, ); } this.unput(this.yytext.length - prefix); @@ -126,36 +140,128 @@ module.exports = { }, // check if its a DOC end sequence - isDOC_MATCH: function() { + isDOC_MATCH: function (offset, consumeLeadingSpaces) { // @fixme : check if out of text limits + + // consumeLeadingSpaces is false happen DOC prematch END HEREDOC stage. + + // Ensure current state is really after a new line break, not after a such as ${variables} + const prev_ch = this._input[offset - 2]; + if (!newline.includes(prev_ch)) { + return false; + } + + // skip leading spaces or tabs + let indentation_uses_spaces = false; + let indentation_uses_tabs = false; + // reset heredoc_label structure + let indentation = 0; + let leading_ch = this._input[offset - 1]; + + if (this.version >= 703) { + while (leading_ch === "\t" || leading_ch === " ") { + if (leading_ch === " ") { + indentation_uses_spaces = true; + } else if (leading_ch === "\t") { + indentation_uses_tabs = true; + } + + leading_ch = this._input[offset + indentation]; + indentation++; + } + + // Move offset to skip leading whitespace + offset = offset + indentation; + + // return out if there was only whitespace on this line + if (newline.includes(this._input[offset - 1])) { + return false; + } + } + if ( this._input.substring( - this.offset - 1, - this.offset - 1 + this.heredoc_label.length - ) === this.heredoc_label + offset - 1, + offset - 1 + this.heredoc_label.length, + ) === this.heredoc_label.label ) { - const ch = this._input[this.offset - 1 + this.heredoc_label.length]; - if (ch === "\n" || ch === "\r" || ch === ";") { + const ch = this._input[offset - 1 + this.heredoc_label.length]; + if ( + (this.version >= 703 + ? valid_after_heredoc_73 + : valid_after_heredoc + ).includes(ch) + ) { + if (consumeLeadingSpaces) { + this.consume(indentation); + // https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes + if (indentation_uses_spaces && indentation_uses_tabs) { + throw new Error( + "Parse error: mixing spaces and tabs in ending marker at line " + + this.yylineno + + " (offset " + + this.offset + + ")", + ); + } + } else { + // Called in prematch_ENDOFDOC + this.heredoc_label.indentation = indentation; + this.heredoc_label.indentation_uses_spaces = indentation_uses_spaces; + this.heredoc_label.first_encaps_node = true; + } return true; } } + return false; }, - matchST_NOWDOC: function() { - /** edge case : empty now doc **/ - if (this.isDOC_MATCH()) { + /* + * Prematch the end of HEREDOC/NOWDOC end tag to preset the + * context of this.heredoc_label + */ + prematch_ENDOFDOC: function () { + // reset heredoc + this.heredoc_label.indentation_uses_spaces = false; + this.heredoc_label.indentation = 0; + this.heredoc_label.first_encaps_node = true; + let offset = this.offset + 1; + + while (offset < this._input.length) { + // if match heredoc_label structrue will be set + if (this.isDOC_MATCH(offset, false)) { + return; + } + + if (!newline.includes(this._input[offset - 1])) { + // skip one line + while ( + !newline.includes(this._input[offset++]) && + offset < this._input.length + ) { + // skip + } + } + + offset++; + } + }, + + matchST_NOWDOC: function () { + // edge case : empty now doc + if (this.isDOC_MATCH(this.offset, true)) { // @fixme : never reached (may be caused by quotes) this.consume(this.heredoc_label.length); this.popState(); return this.tok.T_END_HEREDOC; } - /** SCANNING CONTENTS **/ + // SCANNING CONTENTS let ch = this._input[this.offset - 1]; while (this.offset < this.size) { - if (ch === "\n" || ch === "\r") { + if (newline.includes(ch)) { ch = this.input(); - if (this.isDOC_MATCH()) { + if (this.isDOC_MATCH(this.offset, true)) { this.unput(1).popState(); this.appendToken(this.tok.T_END_HEREDOC, this.heredoc_label.length); return this.tok.T_ENCAPSED_AND_WHITESPACE; @@ -168,26 +274,26 @@ module.exports = { return this.tok.T_ENCAPSED_AND_WHITESPACE; }, - matchST_HEREDOC: function() { - /** edge case : empty here doc **/ + matchST_HEREDOC: function () { + // edge case : empty here doc let ch = this.input(); - if (this.isDOC_MATCH()) { + if (this.isDOC_MATCH(this.offset, true)) { this.consume(this.heredoc_label.length - 1); this.popState(); return this.tok.T_END_HEREDOC; } - /** SCANNING CONTENTS **/ + // SCANNING CONTENTS while (this.offset < this.size) { if (ch === "\\") { ch = this.input(); // ignore next - if (ch !== "\n" && ch !== "\r") { + if (!newline.includes(ch)) { ch = this.input(); } } - if (ch === "\n" || ch === "\r") { + if (newline.includes(ch)) { ch = this.input(); - if (this.isDOC_MATCH()) { + if (this.isDOC_MATCH(this.offset, true)) { this.unput(1).popState(); this.appendToken(this.tok.T_END_HEREDOC, this.heredoc_label.length); return this.tok.T_ENCAPSED_AND_WHITESPACE; @@ -240,7 +346,7 @@ module.exports = { return this.tok.T_ENCAPSED_AND_WHITESPACE; }, - consume_VARIABLE: function() { + consume_VARIABLE: function () { this.consume_LABEL(); const ch = this.input(); if (ch == "[") { @@ -264,7 +370,7 @@ module.exports = { return this.tok.T_VARIABLE; }, // HANDLES BACKQUOTES - matchST_BACKQUOTE: function() { + matchST_BACKQUOTE: function () { let ch = this.input(); if (ch === "$") { ch = this.input(); @@ -339,7 +445,7 @@ module.exports = { return this.tok.T_ENCAPSED_AND_WHITESPACE; }, - matchST_DOUBLE_QUOTES: function() { + matchST_DOUBLE_QUOTES: function () { let ch = this.input(); if (ch === "$") { ch = this.input(); @@ -413,5 +519,5 @@ module.exports = { ch = this.input(); } return this.tok.T_ENCAPSED_AND_WHITESPACE; - } + }, }; diff --git a/src/lexer/tokens.js b/src/lexer/tokens.js index fbec8db37..217524ca8 100644 --- a/src/lexer/tokens.js +++ b/src/lexer/tokens.js @@ -6,12 +6,12 @@ "use strict"; module.exports = { - T_STRING: function() { + T_STRING: function () { const token = this.yytext.toLowerCase(); let id = this.keywords[token]; if (typeof id !== "number") { if (token === "yield") { - if (this.php7 && this.tryMatch(" from")) { + if (this.version >= 700 && this.tryMatch(" from")) { this.consume(5); id = this.tok.T_YIELD_FROM; } else { @@ -20,7 +20,7 @@ module.exports = { } else { id = this.tok.T_STRING; if (token === "b" || token === "B") { - const ch = this.input(1); + const ch = this.input(); if (ch === '"') { return this.ST_DOUBLE_QUOTES(); } else if (ch === "'") { @@ -31,10 +31,59 @@ module.exports = { } } } + + // https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1546 + if (id === this.tok.T_ENUM) { + if (this.version < 801) { + return this.tok.T_STRING; + } + const initial = this.offset; + let ch = this.input(); + while (ch == " ") { + ch = this.input(); + } + let isEnum = false; + if (this.is_LABEL_START()) { + while (this.is_LABEL()) { + ch += this.input(); + } + const label = ch.slice(0, -1).toLowerCase(); + isEnum = label !== "extends" && label !== "implements"; + } + + this.unput(this.offset - initial); + return isEnum ? this.tok.T_ENUM : this.tok.T_STRING; + } + + if (this.offset < this.size && id !== this.tok.T_YIELD_FROM) { + // If immediately followed by a backslash, this is a T_NAME_RELATIVE or T_NAME_QUALIFIED. + let ch = this.input(); + if (ch === "\\") { + id = + token === "namespace" + ? this.tok.T_NAME_RELATIVE + : this.tok.T_NAME_QUALIFIED; + do { + if (this._input[this.offset] === "{") { + // e.g. when using group use statements, the last '\\' is followed by a '{' + this.input(); + break; + } + + this.consume_LABEL(); + ch = this.input(); + } while (ch === "\\"); + } + + if (ch) { + this.unput(1); + } + } + return id; }, // reads a custom token - consume_TOKEN: function() { + consume_TOKEN: function () { const ch = this._input[this.offset - 1]; const fn = this.tokenTerminals[ch]; if (fn) { @@ -45,7 +94,7 @@ module.exports = { }, // list of special char tokens tokenTerminals: { - $: function() { + $: function () { this.offset++; if (this.is_LABEL_START()) { this.offset--; @@ -56,7 +105,7 @@ module.exports = { return "$"; } }, - "-": function() { + "-": function () { const nchar = this._input[this.offset]; if (nchar === ">") { this.begin("ST_LOOKING_FOR_PROPERTY").input(); @@ -70,17 +119,39 @@ module.exports = { } return "-"; }, - "\\": function() { + "\\": function () { + if (this.offset < this.size) { + this.input(); + if (this.is_LABEL_START()) { + let ch; + do { + if (this._input[this.offset] === "{") { + // e.g. when using group use statements, the last '\\' is followed by a '{' + this.input(); + break; + } + + this.consume_LABEL(); + ch = this.input(); + } while (ch === "\\"); + + this.unput(1); + + return this.tok.T_NAME_FULLY_QUALIFIED; + } else { + this.unput(1); + } + } return this.tok.T_NS_SEPARATOR; }, - "/": function() { + "/": function () { if (this._input[this.offset] === "=") { this.input(); return this.tok.T_DIV_EQUAL; } return "/"; }, - ":": function() { + ":": function () { if (this._input[this.offset] === ":") { this.input(); return this.tok.T_DOUBLE_COLON; @@ -88,7 +159,7 @@ module.exports = { return ":"; } }, - "(": function() { + "(": function () { const initial = this.offset; this.input(); if (this.is_TABSPACE()) { @@ -113,7 +184,7 @@ module.exports = { this.unput(this.offset - initial); return "("; }, - "=": function() { + "=": function () { const nchar = this._input[this.offset]; if (nchar === ">") { this.input(); @@ -129,7 +200,7 @@ module.exports = { } return "="; }, - "+": function() { + "+": function () { const nchar = this._input[this.offset]; if (nchar === "+") { this.input(); @@ -140,7 +211,7 @@ module.exports = { } return "+"; }, - "!": function() { + "!": function () { if (this._input[this.offset] === "=") { if (this._input[this.offset + 1] === "=") { this.consume(2); @@ -152,14 +223,28 @@ module.exports = { } return "!"; }, - "?": function() { - if (this.php7 && this._input[this.offset] === "?") { - this.input(); - return this.tok.T_COALESCE; + "?": function () { + if (this.version >= 700 && this._input[this.offset] === "?") { + if (this.version >= 704 && this._input[this.offset + 1] === "=") { + this.consume(2); + return this.tok.T_COALESCE_EQUAL; + } else { + this.input(); + return this.tok.T_COALESCE; + } + } + if ( + this.version >= 800 && + this._input[this.offset] === "-" && + this._input[this.offset + 1] === ">" + ) { + this.consume(1); + this.begin("ST_LOOKING_FOR_PROPERTY").input(); + return this.tok.T_NULLSAFE_OBJECT_OPERATOR; } return "?"; }, - "<": function() { + "<": function () { let nchar = this._input[this.offset]; if (nchar === "<") { nchar = this._input[this.offset + 1]; @@ -175,7 +260,7 @@ module.exports = { return this.tok.T_SL; } else if (nchar === "=") { this.input(); - if (this.php7 && this._input[this.offset] === ">") { + if (this.version >= 700 && this._input[this.offset] === ">") { this.input(); return this.tok.T_SPACESHIP; } else { @@ -187,7 +272,7 @@ module.exports = { } return "<"; }, - ">": function() { + ">": function () { let nchar = this._input[this.offset]; if (nchar === "=") { this.input(); @@ -204,7 +289,7 @@ module.exports = { } return ">"; }, - "*": function() { + "*": function () { const nchar = this._input[this.offset]; if (nchar === "=") { this.input(); @@ -220,7 +305,7 @@ module.exports = { } return "*"; }, - ".": function() { + ".": function () { const nchar = this._input[this.offset]; if (nchar === "=") { this.input(); @@ -231,14 +316,14 @@ module.exports = { } return "."; }, - "%": function() { + "%": function () { if (this._input[this.offset] === "=") { this.input(); return this.tok.T_MOD_EQUAL; } return "%"; }, - "&": function() { + "&": function () { const nchar = this._input[this.offset]; if (nchar === "=") { this.input(); @@ -249,7 +334,7 @@ module.exports = { } return "&"; }, - "|": function() { + "|": function () { const nchar = this._input[this.offset]; if (nchar === "=") { this.input(); @@ -260,12 +345,12 @@ module.exports = { } return "|"; }, - "^": function() { + "^": function () { if (this._input[this.offset] === "=") { this.input(); return this.tok.T_XOR_EQUAL; } return "^"; - } - } + }, + }, }; diff --git a/src/lexer/utils.js b/src/lexer/utils.js index 190d0f626..8a2733037 100644 --- a/src/lexer/utils.js +++ b/src/lexer/utils.js @@ -9,13 +9,19 @@ const tokens = ";:,.\\[]()|^&+-/*=%!~$<>?@"; module.exports = { // check if the char can be a numeric - is_NUM: function() { + is_NUM: function () { + const ch = this._input.charCodeAt(this.offset - 1); + return (ch > 47 && ch < 58) || ch === 95; + }, + + // check if the char can be a numeric + is_NUM_START: function () { const ch = this._input.charCodeAt(this.offset - 1); return ch > 47 && ch < 58; }, // check if current char can be a label - is_LABEL: function() { + is_LABEL: function () { const ch = this._input.charCodeAt(this.offset - 1); return ( (ch > 96 && ch < 123) || @@ -27,15 +33,22 @@ module.exports = { }, // check if current char can be a label - is_LABEL_START: function() { + is_LABEL_START: function () { const ch = this._input.charCodeAt(this.offset - 1); - return ( - (ch > 96 && ch < 123) || (ch > 64 && ch < 91) || ch === 95 || ch > 126 - ); + // A - Z + if (ch > 64 && ch < 91) return true; + // a - z + if (ch > 96 && ch < 123) return true; + // _ (95) + if (ch === 95) return true; + // utf8 / extended + if (ch > 126) return true; + // else + return false; }, // reads each char of the label - consume_LABEL: function() { + consume_LABEL: function () { while (this.offset < this.size) { const ch = this.input(); if (!this.is_LABEL()) { @@ -47,22 +60,22 @@ module.exports = { }, // check if current char is a token char - is_TOKEN: function() { + is_TOKEN: function () { const ch = this._input[this.offset - 1]; return tokens.indexOf(ch) !== -1; }, // check if current char is a whitespace - is_WHITESPACE: function() { + is_WHITESPACE: function () { const ch = this._input[this.offset - 1]; return ch === " " || ch === "\t" || ch === "\n" || ch === "\r"; }, // check if current char is a whitespace (without newlines) - is_TABSPACE: function() { + is_TABSPACE: function () { const ch = this._input[this.offset - 1]; return ch === " " || ch === "\t"; }, // consume all whitespaces (excluding newlines) - consume_TABSPACE: function() { + consume_TABSPACE: function () { while (this.offset < this.size) { const ch = this.input(); if (!this.is_TABSPACE()) { @@ -73,10 +86,27 @@ module.exports = { return this; }, // check if current char can be a hexadecimal number - is_HEX: function() { + is_HEX: function () { const ch = this._input.charCodeAt(this.offset - 1); - return ( - (ch > 47 && ch < 58) || (ch > 64 && ch < 71) || (ch > 96 && ch < 103) - ); - } + // 0 - 9 + if (ch > 47 && ch < 58) return true; + // A - F + if (ch > 64 && ch < 71) return true; + // a - f + if (ch > 96 && ch < 103) return true; + // _ (code 95) + if (ch === 95) return true; + // else + return false; + }, + // check if current char can be an octal number + is_OCTAL: function () { + const ch = this._input.charCodeAt(this.offset - 1); + // 0 - 7 + if (ch > 47 && ch < 56) return true; + // _ (code 95) + if (ch === 95) return true; + // else + return false; + }, }; diff --git a/src/parser.js b/src/parser.js index e3fe00d5c..5e5ef1fa5 100644 --- a/src/parser.js +++ b/src/parser.js @@ -5,6 +5,8 @@ */ "use strict"; +const Position = require("./ast/position"); + /** * @private */ @@ -15,17 +17,18 @@ function isNumber(n) { /** * The PHP Parser class that build the AST tree from the lexer * - * @class + * @constructor Parser + * @memberOf module:php-parser * @tutorial Parser * @property {Lexer} lexer - current lexer instance * @property {AST} ast - the AST factory instance - * @property {Integer|String} token - current token - * @property {Boolean} extractDoc - should extract documentation as AST node - * @property {Boolean} extractTokens - should extract each token - * @property {Boolean} suppressErrors - should ignore parsing errors and continue - * @property {Boolean} debug - should output debug informations + * @property {number|string} token - current token + * @property {boolean} extractDoc - should extract documentation as AST node + * @property {boolean} extractTokens - should extract each token + * @property {boolean} suppressErrors - should ignore parsing errors and continue + * @property {boolean} debug - should output debug informations */ -const parser = function(lexer, ast) { +const Parser = function (lexer, ast) { this.lexer = lexer; this.ast = ast; this.tok = lexer.tok; @@ -33,14 +36,15 @@ const parser = function(lexer, ast) { this.token = null; this.prev = null; this.debug = false; - this.php7 = true; + this.version = 803; this.extractDoc = false; this.extractTokens = false; this.suppressErrors = false; - const mapIt = function(item) { + const mapIt = function (item) { return [item, null]; }; this.entries = { + // reserved_non_modifiers IDENTIFIER: new Map( [ this.tok.T_ABSTRACT, @@ -69,15 +73,17 @@ const parser = function(lexer, ast) { this.tok.T_ENDIF, this.tok.T_ENDSWITCH, this.tok.T_ENDWHILE, + this.tok.T_ENUM, this.tok.T_EVAL, this.tok.T_EXIT, this.tok.T_EXTENDS, this.tok.T_FILE, this.tok.T_FINAL, this.tok.T_FINALLY, - this.tok.T_FUNC_C, + this.tok.T_FN, this.tok.T_FOR, this.tok.T_FOREACH, + this.tok.T_FUNC_C, this.tok.T_FUNCTION, this.tok.T_GLOBAL, this.tok.T_GOTO, @@ -94,6 +100,7 @@ const parser = function(lexer, ast) { this.tok.T_LOGICAL_AND, this.tok.T_LOGICAL_OR, this.tok.T_LOGICAL_XOR, + this.tok.T_MATCH, this.tok.T_METHOD_C, this.tok.T_NAMESPACE, this.tok.T_NEW, @@ -102,6 +109,7 @@ const parser = function(lexer, ast) { this.tok.T_PRIVATE, this.tok.T_PROTECTED, this.tok.T_PUBLIC, + this.tok.T_READ_ONLY, this.tok.T_REQUIRE, this.tok.T_REQUIRE_ONCE, this.tok.T_RETURN, @@ -114,19 +122,21 @@ const parser = function(lexer, ast) { this.tok.T_USE, this.tok.T_VAR, this.tok.T_WHILE, - this.tok.T_YIELD - ].map(mapIt) + this.tok.T_YIELD, + ].map(mapIt), ), VARIABLE: new Map( [ this.tok.T_VARIABLE, "$", "&", - this.tok.T_NS_SEPARATOR, this.tok.T_STRING, + this.tok.T_NAME_RELATIVE, + this.tok.T_NAME_QUALIFIED, + this.tok.T_NAME_FULLY_QUALIFIED, this.tok.T_NAMESPACE, - this.tok.T_STATIC - ].map(mapIt) + this.tok.T_STATIC, + ].map(mapIt), ), SCALAR: new Map( [ @@ -148,8 +158,8 @@ const parser = function(lexer, ast) { 'b"', 'B"', "-", - this.tok.T_NS_SEPARATOR - ].map(mapIt) + this.tok.T_NS_SEPARATOR, + ].map(mapIt), ), T_MAGIC_CONST: new Map( [ @@ -160,8 +170,8 @@ const parser = function(lexer, ast) { this.tok.T_LINE, this.tok.T_FILE, this.tok.T_DIR, - this.tok.T_NS_C - ].map(mapIt) + this.tok.T_NS_C, + ].map(mapIt), ), T_MEMBER_FLAGS: new Map( [ @@ -170,8 +180,8 @@ const parser = function(lexer, ast) { this.tok.T_PROTECTED, this.tok.T_STATIC, this.tok.T_ABSTRACT, - this.tok.T_FINAL - ].map(mapIt) + this.tok.T_FINAL, + ].map(mapIt), ), EOS: new Map([";", this.EOF, this.tok.T_INLINE_HTML].map(mapIt)), EXPR: new Map( @@ -190,6 +200,7 @@ const parser = function(lexer, ast) { this.tok.T_NEW, this.tok.T_ISSET, this.tok.T_EMPTY, + this.tok.T_MATCH, this.tok.T_INCLUDE, this.tok.T_INCLUDE_ONCE, this.tok.T_REQUIRE, @@ -207,11 +218,15 @@ const parser = function(lexer, ast) { this.tok.T_YIELD, this.tok.T_STATIC, this.tok.T_FUNCTION, + this.tok.T_FN, // using VARIABLES : this.tok.T_VARIABLE, "$", this.tok.T_NS_SEPARATOR, this.tok.T_STRING, + this.tok.T_NAME_RELATIVE, + this.tok.T_NAME_QUALIFIED, + this.tok.T_NAME_FULLY_QUALIFIED, // using SCALAR : this.tok.T_STRING, // @see variable.js line 45 > conflict with variable = shift/reduce :) this.tok.T_CONSTANT_ENCAPSED_STRING, @@ -227,16 +242,23 @@ const parser = function(lexer, ast) { this.tok.T_LINE, this.tok.T_FILE, this.tok.T_DIR, - this.tok.T_NS_C - ].map(mapIt) - ) + this.tok.T_NS_C, + '"', + 'b"', + 'B"', + "-", + this.tok.T_NS_SEPARATOR, + ].map(mapIt), + ), }; }; /** * helper : gets a token name + * @function Parser#getTokenName + * @memberOf module:php-parser */ -parser.prototype.getTokenName = function(token) { +Parser.prototype.getTokenName = function (token) { if (!isNumber(token)) { return "'" + token + "'"; } else { @@ -247,8 +269,10 @@ parser.prototype.getTokenName = function(token) { /** * main entry point : converts a source code to AST + * @function Parser#parse + * @memberOf module:php-parser */ -parser.prototype.parse = function(code, filename) { +Parser.prototype.parse = function (code, filename) { this._errors = []; this.filename = filename || "eval"; this.currentNamespace = [""]; @@ -263,6 +287,7 @@ parser.prototype.parse = function(code, filename) { this._tokens = null; } this._docIndex = 0; + this._lastNode = null; this.lexer.setInput(code); this.lexer.all_tokens = this.extractTokens; this.lexer.comment_tokens = this.extractDoc; @@ -270,37 +295,61 @@ parser.prototype.parse = function(code, filename) { this.innerList = false; this.innerListForm = false; const program = this.node("program"); - let childs = []; + const childs = []; this.next(); while (this.token != this.EOF) { - const node = this.read_start(); - if (node !== null && node !== undefined) { - if (Array.isArray(node)) { - childs = childs.concat(node); - } else { - childs.push(node); - } - } + childs.push(this.read_start()); + } + // append last comment + if ( + childs.length === 0 && + this.extractDoc && + this._docs.length > this._docIndex + ) { + childs.push(this.node("noop")()); } // #176 : register latest position this.prev = [ this.lexer.yylloc.last_line, this.lexer.yylloc.last_column, - this.lexer.offset + this.lexer.offset, ]; - return program(childs, this._errors, this._docs, this._tokens); + const result = program(childs, this._errors, this._docs, this._tokens); + if (this.debug) { + const errors = this.ast.checkNodes(); + /* istanbul ignore next */ + if (errors.length > 0) { + errors.forEach(function (error) { + if (error.position) { + // eslint-disable-next-line no-console + console.log( + "Node at line " + + error.position.line + + ", column " + + error.position.column, + ); + } + // eslint-disable-next-line no-console + console.log(error.stack.join("\n")); + }); + throw new Error("Some nodes are not closed"); + } + } + return result; }; /** * Raise an error + * @function Parser#raiseError + * @memberOf module:php-parser */ -parser.prototype.raiseError = function(message, msgExpect, expect, token) { +Parser.prototype.raiseError = function (message, msgExpect, expect, token) { message += " on line " + this.lexer.yylloc.first_line; if (!this.suppressErrors) { const err = new SyntaxError( message, this.filename, - this.lexer.yylloc.first_line + this.lexer.yylloc.first_line, ); err.lineNumber = this.lexer.yylloc.first_line; err.fileName = this.filename; @@ -312,7 +361,7 @@ parser.prototype.raiseError = function(message, msgExpect, expect, token) { message, token, this.lexer.yylloc.first_line, - expect + expect, ); this._errors.push(node); return node; @@ -320,8 +369,10 @@ parser.prototype.raiseError = function(message, msgExpect, expect, token) { /** * handling errors + * @function Parser#error + * @memberOf module:php-parser */ -parser.prototype.error = function(expect) { +Parser.prototype.error = function (expect) { let msg = "Parse Error : syntax error"; let token = this.getTokenName(this.token); let msgExpect = ""; @@ -329,6 +380,7 @@ parser.prototype.error = function(expect) { if (this.token !== this.EOF) { if (isNumber(this.token)) { let symbol = this.text(); + /* istanbul ignore next */ if (symbol.length > 10) { symbol = symbol.substring(0, 7) + "..."; } @@ -345,22 +397,42 @@ parser.prototype.error = function(expect) { return this.raiseError(msg, msgExpect, expect, token); }; +/** + * Create a position node from the lexers position + * + * @function Parser#position + * @memberOf module:php-parser + * @return {Position} + */ +Parser.prototype.position = function () { + return new Position( + this.lexer.yylloc.first_line, + this.lexer.yylloc.first_column, + this.lexer.yylloc.first_offset, + ); +}; + /** * Creates a new AST node + * @function Parser#node + * @memberOf module:php-parser */ -parser.prototype.node = function(name) { +Parser.prototype.node = function (name) { if (this.extractDoc) { let docs = null; if (this._docIndex < this._docs.length) { docs = this._docs.slice(this._docIndex); this._docIndex = this._docs.length; + /* istanbul ignore next */ if (this.debug) { + // eslint-disable-next-line no-console console.log(new Error("Append docs on " + name)); + // eslint-disable-next-line no-console console.log(docs); } } const node = this.ast.prepare(name, docs, this); - /** + /* * TOKENS : * node1 commentA token commmentB node2 commentC token commentD node3 commentE token * @@ -389,12 +461,30 @@ parser.prototype.node = function(name) { * NOTE : As the trailingComment Behavior depends on AST, it will be build on * the AST layer - last child node will keep it's trailingComment nodes */ - node.preBuild = function() { - // inject leading comment on current node + node.postBuild = function (self) { if (this._docIndex < this._docs.length) { - node.setTrailingComments(this._docs.slice(this._docIndex)); - this._docIndex = this._docs.length; + if (this._lastNode) { + const offset = this.prev[2]; + let max = this._docIndex; + for (; max < this._docs.length; max++) { + if (this._docs[max].offset > offset) { + break; + } + } + if (max > this._docIndex) { + // inject trailing comment on child node + this._lastNode.setTrailingComments( + this._docs.slice(this._docIndex, max), + ); + this._docIndex = max; + } + } else if (this.token === this.EOF) { + // end of content + self.setTrailingComments(this._docs.slice(this._docIndex)); + this._docIndex = this._docs.length; + } } + this._lastNode = self; }.bind(this); return node; } @@ -403,9 +493,11 @@ parser.prototype.node = function(name) { /** * expects an end of statement or end of file + * @function Parser#expectEndOfStatement + * @memberOf module:php-parser * @return {boolean} */ -parser.prototype.expectEndOfStatement = function(node) { +Parser.prototype.expectEndOfStatement = function (node) { if (this.token === ";") { // include only real ';' statements // https://github.com/glayzzle/php-parser/issues/164 @@ -420,20 +512,27 @@ parser.prototype.expectEndOfStatement = function(node) { return true; }; -/** outputs some debug information on current token **/ const ignoreStack = ["parser.next", "parser.node", "parser.showlog"]; -parser.prototype.showlog = function() { +/** + * outputs some debug information on current token + * @private + * @function Parser#showlog + * @memberOf module:php-parser + */ +Parser.prototype.showlog = function () { const stack = new Error().stack.split("\n"); let line; for (let offset = 2; offset < stack.length; offset++) { line = stack[offset].trim(); let found = false; for (let i = 0; i < ignoreStack.length; i++) { + /* istanbul ignore next */ if (line.substring(3, 3 + ignoreStack[i].length) === ignoreStack[i]) { found = true; break; } } + /* istanbul ignore next */ if (!found) { break; } @@ -448,7 +547,7 @@ parser.prototype.showlog = function() { this.lexer.yytext + "<" + " @-->" + - line + line, ); return this; }; @@ -462,11 +561,13 @@ parser.prototype.showlog = function() { * If the suppressError mode is activated, then the error will * be added to the program error stack and this function will return `false`. * + * @function Parser#expect + * @memberOf module:php-parser * @param {String|Number} token * @return {boolean} * @throws Error */ -parser.prototype.expect = function(token) { +Parser.prototype.expect = function (token) { if (Array.isArray(token)) { if (token.indexOf(this.token) === -1) { this.error(token); @@ -481,14 +582,20 @@ parser.prototype.expect = function(token) { /** * Returns the current token contents + * @function Parser#text + * @memberOf module:php-parser * @return {String} */ -parser.prototype.text = function() { +Parser.prototype.text = function () { return this.lexer.yytext; }; -/** consume the next token **/ -parser.prototype.next = function() { +/** + * consume the next token + * @function Parser#next + * @memberOf module:php-parser + */ +Parser.prototype.next = function () { // prepare the back command if (this.token !== ";" || this.lexer.yytext === ";") { // ignore '?>' from automated resolution @@ -496,7 +603,7 @@ parser.prototype.next = function() { this.prev = [ this.lexer.yylloc.last_line, this.lexer.yylloc.last_column, - this.lexer.offset + this.lexer.offset, ]; } @@ -526,24 +633,44 @@ parser.prototype.next = function() { return this; }; +/** + * Peek at the next token. + * @function Parser#peek + * @memberOf module:php-parser + * @returns {string|number} Next Token + */ +Parser.prototype.peek = function () { + const lexerState = this.lexer.getState(); + const nextToken = this.lexer.lex(); + this.lexer.setState(lexerState); + return nextToken; +}; + /** * Eating a token + * @function Parser#lex + * @memberOf module:php-parser */ -parser.prototype.lex = function() { +Parser.prototype.lex = function () { // append on token stack if (this.extractTokens) { do { // the token - this.token = this.lexer.lex() || this.EOF; + this.token = this.lexer.lex() || /* istanbul ignore next */ this.EOF; if (this.token === this.EOF) return this; let entry = this.lexer.yytext; - if (this.lexer.engine.tokens.values.hasOwnProperty(this.token)) { + if ( + Object.prototype.hasOwnProperty.call( + this.lexer.engine.tokens.values, + this.token, + ) + ) { entry = [ this.lexer.engine.tokens.values[this.token], entry, this.lexer.yylloc.first_line, this.lexer.yylloc.first_offset, - this.lexer.offset + this.lexer.offset, ]; } else { entry = [ @@ -551,7 +678,7 @@ parser.prototype.lex = function() { entry, this.lexer.yylloc.first_line, this.lexer.yylloc.first_offset, - this.lexer.offset + this.lexer.offset, ]; } this._tokens.push(entry); @@ -572,15 +699,17 @@ parser.prototype.lex = function() { this.token === this.tok.T_OPEN_TAG ); } else { - this.token = this.lexer.lex() || this.EOF; + this.token = this.lexer.lex() || /* istanbul ignore next */ this.EOF; } return this; }; /** * Check if token is of specified type + * @function Parser#is + * @memberOf module:php-parser */ -parser.prototype.is = function(type) { +Parser.prototype.is = function (type) { if (Array.isArray(type)) { return type.indexOf(this.token) !== -1; } @@ -593,6 +722,7 @@ parser.prototype.is = function(type) { require("./parser/class.js"), require("./parser/comment.js"), require("./parser/expr.js"), + require("./parser/enum.js"), require("./parser/function.js"), require("./parser/if.js"), require("./parser/loops.js"), @@ -603,11 +733,16 @@ parser.prototype.is = function(type) { require("./parser/switch.js"), require("./parser/try.js"), require("./parser/utils.js"), - require("./parser/variable.js") -].forEach(function(ext) { + require("./parser/variable.js"), +].forEach(function (ext) { for (const k in ext) { - parser.prototype[k] = ext[k]; + /* istanbul ignore next */ + if (Object.prototype.hasOwnProperty.call(Parser.prototype, k)) { + // @see https://github.com/glayzzle/php-parser/issues/234 + throw new Error("Function " + k + " is already defined - collision"); + } + Parser.prototype[k] = ext[k]; } }); -module.exports = parser; +module.exports = Parser; diff --git a/src/parser/array.js b/src/parser/array.js index 0f8008f64..0d354b209 100644 --- a/src/parser/array.js +++ b/src/parser/array.js @@ -5,21 +5,18 @@ */ "use strict"; -const ArrayExpr = "array"; -const ArrayEntry = "entry"; - module.exports = { - /** + /* * Parse an array * ```ebnf * array ::= T_ARRAY '(' array_pair_list ')' | * '[' array_pair_list ']' * ``` */ - read_array: function() { + read_array: function () { let expect = null; let shortForm = false; - const result = this.node(ArrayExpr); + const result = this.node("array"); if (this.token === this.tok.T_ARRAY) { this.next().expect("("); @@ -32,35 +29,27 @@ module.exports = { if (this.next().token !== expect) { items = this.read_array_pair_list(shortForm); } - // check non empty entries - /*for(let i = 0, size = items.length - 1; i < size; i++) { - if (items[i] === null) { - this.raiseError( - "Cannot use empty array elements in arrays" - ); - } - }*/ this.expect(expect); this.next(); return result(shortForm, items); }, - /** + /* * Reads an array of items * ```ebnf * array_pair_list ::= array_pair (',' array_pair?)* * ``` */ - read_array_pair_list: function(shortForm) { + read_array_pair_list: function (shortForm) { const self = this; return this.read_list( - function() { + function () { return self.read_array_pair(shortForm); }, ",", - true + true, ); }, - /** + /* * Reads an entry * array_pair: * expr T_DOUBLE_ARROW expr @@ -70,36 +59,55 @@ module.exports = { * | expr T_DOUBLE_ARROW T_LIST '(' array_pair_list ')' * | T_LIST '(' array_pair_list ')' */ - read_array_pair: function(shortForm) { + read_array_pair: function (shortForm) { if ( - this.token === "," || (!shortForm && this.token === ")") || (shortForm && this.token === "]") ) { - return null; + return; + } + + if (this.token === ",") { + return this.node("noop")(); } + + const entry = this.node("entry"); + + let key = null; + let value = null; + let byRef = false; + let unpack = false; + if (this.token === "&") { - return this.next().read_variable(true, false, true); + this.next(); + byRef = true; + value = this.read_variable(true, false); + } else if (this.token === this.tok.T_ELLIPSIS && this.version >= 704) { + this.next(); + if (this.token === "&") { + this.error(); + } + unpack = true; + value = this.read_expr(); } else { - const entry = this.node(ArrayEntry); const expr = this.read_expr(); + if (this.token === this.tok.T_DOUBLE_ARROW) { - if (this.next().token === "&") { - return entry(expr, this.next().read_variable(true, false, true)); + this.next(); + key = expr; + + if (this.token === "&") { + this.next(); + byRef = true; + value = this.read_variable(true, false); } else { - return entry(expr, this.read_expr()); + value = this.read_expr(); } + } else { + value = expr; } - return expr; } + + return entry(key, value, byRef, unpack); }, - /** - * ```ebnf - * dim_offset ::= expr? - * ``` - */ - read_dim_offset: function() { - if (this.token == "]") return false; - return this.read_expr(); - } }; diff --git a/src/parser/class.js b/src/parser/class.js index ae5366508..cbc2c370f 100644 --- a/src/parser/class.js +++ b/src/parser/class.js @@ -6,55 +6,76 @@ "use strict"; module.exports = { - /** + /* * reading a class * ```ebnf * class ::= class_scope? T_CLASS T_STRING (T_EXTENDS NAMESPACE_NAME)? (T_IMPLEMENTS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' CLASS_BODY '}' * ``` */ - read_class: function(flag) { + read_class_declaration_statement: function (attrs) { const result = this.node("class"); - this.expect(this.tok.T_CLASS); - this.next().expect(this.tok.T_STRING); - const propName = this.text(); - let propExtends = null; - let propImplements = null; - if (this.next().token == this.tok.T_EXTENDS) { - propExtends = this.next().read_namespace_name(); - } - if (this.token == this.tok.T_IMPLEMENTS) { - propImplements = this.next().read_name_list(); + const flag = this.read_class_modifiers(); + // graceful mode : ignore token & go next + if (this.token !== this.tok.T_CLASS) { + this.error(this.tok.T_CLASS); + this.next(); + return null; } + this.next().expect(this.tok.T_STRING); + let propName = this.node("identifier"); + const name = this.text(); + this.next(); + propName = propName(name); + const propExtends = this.read_extends_from(); + const propImplements = this.read_implements_list(); this.expect("{"); - const body = this.next().read_class_body(); - return result(propName, propExtends, propImplements, body, flag); + const body = this.next().read_class_body(true, false); + const node = result(propName, propExtends, propImplements, body, flag); + if (attrs) node.attrGroups = attrs; + return node; }, - /** - * Read the class visibility - * ```ebnf - * class_scope ::= (T_FINAL | T_ABSTRACT)? - * ``` - */ - read_class_scope: function() { - const result = this.token; - if (result == this.tok.T_FINAL) { + + read_class_modifiers: function () { + const modifier = this.read_class_modifier({ + readonly: 0, + final_or_abstract: 0, + }); + return [0, 0, modifier.final_or_abstract, modifier.readonly]; + }, + + read_class_modifier: function (memo) { + if (this.token === this.tok.T_READ_ONLY) { + this.next(); + memo.readonly = 1; + memo = this.read_class_modifier(memo); + } else if ( + memo.final_or_abstract === 0 && + this.token === this.tok.T_ABSTRACT + ) { this.next(); - return [0, 0, 2]; - } else if (result == this.tok.T_ABSTRACT) { + memo.final_or_abstract = 1; + memo = this.read_class_modifier(memo); + } else if ( + memo.final_or_abstract === 0 && + this.token === this.tok.T_FINAL + ) { this.next(); - return [0, 0, 1]; + memo.final_or_abstract = 2; + memo = this.read_class_modifier(memo); } - return [0, 0, 0]; + + return memo; }, - /** + + /* * Reads a class body * ```ebnf * class_body ::= (member_flags? (T_VAR | T_STRING | T_FUNCTION))* * ``` */ - read_class_body: function() { + read_class_body: function (allow_variables, allow_enum_cases) { let result = []; - + let attrs = []; while (this.token !== this.EOF && this.token !== "}") { if (this.token === this.tok.T_COMMENT) { result.push(this.read_comment()); @@ -68,16 +89,32 @@ module.exports = { // check T_USE trait if (this.token === this.tok.T_USE) { - result = result.concat(this.next().read_trait_use_statement()); + result = result.concat(this.read_trait_use_statement()); continue; } + // check enum cases + if (allow_enum_cases && this.token === this.tok.T_CASE) { + const enumcase = this.read_enum_case(); + if (this.expect(";")) { + this.next(); + } + result = result.concat(enumcase); + continue; + } + + if (this.token === this.tok.T_ATTRIBUTE) { + attrs = this.read_attr_list(); + } + + const locStart = this.position(); + // read member flags const flags = this.read_member_flags(false); // check constant if (this.token === this.tok.T_CONST) { - const constants = this.read_constant_list(flags); + const constants = this.read_constant_list(flags, attrs); if (this.expect(";")) { this.next(); } @@ -86,27 +123,45 @@ module.exports = { } // jump over T_VAR then land on T_VARIABLE - if (this.token === this.tok.T_VAR) { + if (allow_variables && this.token === this.tok.T_VAR) { this.next().expect(this.tok.T_VARIABLE); flags[0] = null; // public (as null) flags[1] = 0; // non static var } - if (this.token === this.tok.T_VARIABLE) { + if (this.token === this.tok.T_FUNCTION) { + // reads a function + result.push(this.read_function(false, flags, attrs, locStart)); + attrs = []; + } else if ( + allow_variables && + (this.token === this.tok.T_VARIABLE || + (this.version >= 801 && this.token === this.tok.T_READ_ONLY) || + // support https://wiki.php.net/rfc/typed_properties_v2 + (this.version >= 704 && + (this.token === "?" || + this.token === this.tok.T_ARRAY || + this.token === this.tok.T_CALLABLE || + this.token === this.tok.T_NAMESPACE || + this.token === this.tok.T_NAME_FULLY_QUALIFIED || + this.token === this.tok.T_NAME_QUALIFIED || + this.token === this.tok.T_NAME_RELATIVE || + this.token === this.tok.T_NS_SEPARATOR || + this.token === this.tok.T_STRING))) + ) { // reads a variable - const variables = this.read_variable_list(flags); + const variables = this.read_variable_list(flags, attrs); + attrs = []; this.expect(";"); this.next(); result = result.concat(variables); - } else if (this.token === this.tok.T_FUNCTION) { - // reads a function - result.push(this.read_function(false, flags)); } else { // raise an error this.error([ this.tok.T_CONST, - this.tok.T_VARIABLE, - this.tok.T_FUNCTION + ...(allow_variables ? [this.tok.T_VARIABLE] : []), + ...(allow_enum_cases ? [this.tok.T_CASE] : []), + this.tok.T_FUNCTION, ]); // ignore token this.next(); @@ -116,15 +171,17 @@ module.exports = { this.next(); return result; }, - /** + /* * Reads variable list * ```ebnf * variable_list ::= (variable_declaration ',')* variable_declaration * ``` */ - read_variable_list: function(flags) { - return this.read_list( - /** + read_variable_list: function (flags, attrs) { + const result = this.node("propertystatement"); + + const properties = this.read_list( + /* * Reads a variable declaration * * ```ebnf @@ -133,34 +190,49 @@ module.exports = { */ function read_variable_declaration() { const result = this.node("property"); + let readonly = false; + if (this.token === this.tok.T_READ_ONLY) { + readonly = true; + this.next(); + } + const [nullable, type] = this.read_optional_type(); this.expect(this.tok.T_VARIABLE); + let propName = this.node("identifier"); const name = this.text().substring(1); // ignore $ this.next(); - if (this.token === ";" || this.token === ",") { - return result(name, null, flags); - } else if (this.token === "=") { + propName = propName(name); + + let value = null; + + this.expect([",", ";", "="]); + if (this.token === "=") { // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L815 - return result(name, this.next().read_expr(), flags); - } else { - this.expect([",", ";", "="]); - return result(name, null, flags); + value = this.next().read_expr(); } + return result(propName, value, readonly, nullable, type, attrs || []); }, - "," + ",", ); + + return result(null, properties, flags); }, - /** + /* * Reads constant list * ```ebnf - * constant_list ::= T_CONST (constant_declaration ',')* constant_declaration + * constant_list ::= T_CONST [type] (constant_declaration ',')* constant_declaration * ``` */ - read_constant_list: function(flags) { + read_constant_list: function (flags, attrs) { if (this.expect(this.tok.T_CONST)) { this.next(); } - return this.read_list( - /** + + const [nullable, type] = + this.version >= 803 ? this.read_optional_type() : [false, null]; + + const result = this.node("classconstant"); + const items = this.read_list( + /* * Reads a constant declaration * * ```ebnf @@ -169,34 +241,38 @@ module.exports = { * @return {Constant} [:link:](AST.md#constant) */ function read_constant_declaration() { - const result = this.node("classconstant"); - let name = null; + const result = this.node("constant"); + let constName = null; let value = null; if ( this.token === this.tok.T_STRING || - (this.php7 && this.is("IDENTIFIER")) + (this.version >= 700 && this.is("IDENTIFIER")) ) { - name = this.text(); + constName = this.node("identifier"); + const name = this.text(); this.next(); + constName = constName(name); } else { this.expect("IDENTIFIER"); } if (this.expect("=")) { value = this.next().read_expr(); } - return result(name, value, flags); + return result(constName, value); }, - "," + ",", ); + + return result(null, items, flags, nullable, type, attrs || []); }, - /** + /* * Read member flags * @return array * 1st index : 0 => public, 1 => protected, 2 => private * 2nd index : 0 => instance member, 1 => static member * 3rd index : 0 => normal, 1 => abstract member, 2 => final member */ - read_member_flags: function(asInterface) { + read_member_flags: function (asInterface) { const result = [-1, -1, -1]; if (this.is("T_MEMBER_FLAGS")) { let idx = 0, @@ -229,11 +305,11 @@ module.exports = { break; } if (asInterface) { - if (idx == 0 && val == 2) { + if (idx === 0 && val === 2) { // an interface can't be private this.expect([this.tok.T_PUBLIC, this.tok.T_PROTECTED]); val = -1; - } else if (idx == 2 && val == 1) { + } else if (idx === 2 && val === 1) { // an interface cant be abstract this.error(); val = -1; @@ -248,44 +324,100 @@ module.exports = { } while (this.next().is("T_MEMBER_FLAGS")); } - if (result[1] == -1) result[1] = 0; - if (result[2] == -1) result[2] = 0; + if (result[1] === -1) result[1] = 0; + if (result[2] === -1) result[2] = 0; return result; }, - /** + + /* + * optional_type: + * /- empty -/ { $$ = NULL; } + * | type_expr { $$ = $1; } + * ; + * + * type_expr: + * type { $$ = $1; } + * | '?' type { $$ = $2; $$->attr |= ZEND_TYPE_NULLABLE; } + * | union_type { $$ = $1; } + * ; + * + * type: + * T_ARRAY { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); } + * | T_CALLABLE { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); } + * | name { $$ = $1; } + * ; + * + * union_type: + * type '|' type { $$ = zend_ast_create_list(2, ZEND_AST_TYPE_UNION, $1, $3); } + * | union_type '|' type { $$ = zend_ast_list_add($1, $3); } + * ; + */ + read_optional_type: function () { + const nullable = this.token === "?"; + if (nullable) { + this.next(); + } + + if (this.peek() === "=") { + return [false, null]; + } + + let type = this.read_types(); + if (nullable && !type) { + this.raiseError( + "Expecting a type definition combined with nullable operator", + ); + } + if (!nullable && !type) { + return [false, null]; + } + if (this.token === "|") { + type = [type]; + do { + this.next(); + const variant = this.read_type(); + if (!variant) { + this.raiseError("Expecting a type definition"); + break; + } + type.push(variant); + } while (this.token === "|"); + } + return [nullable, type]; + }, + + /* * reading an interface * ```ebnf * interface ::= T_INTERFACE T_STRING (T_EXTENDS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' INTERFACE_BODY '}' * ``` */ - read_interface: function() { + read_interface_declaration_statement: function (attrs) { const result = this.node("interface"); - let name = null; - let body = null; - let propExtends = null; - if (this.expect(this.tok.T_INTERFACE)) { + if (this.token !== this.tok.T_INTERFACE) { + this.error(this.tok.T_INTERFACE); this.next(); + return null; } - if (this.expect(this.tok.T_STRING)) { - name = this.text(); - this.next(); - } - if (this.token === this.tok.T_EXTENDS) { - propExtends = this.next().read_name_list(); - } - if (this.expect("{")) { - body = this.next().read_interface_body(); - } - return result(name, propExtends, body); + this.next().expect(this.tok.T_STRING); + let propName = this.node("identifier"); + const name = this.text(); + this.next(); + propName = propName(name); + const propExtends = this.read_interface_extends_list(); + this.expect("{"); + const body = this.next().read_interface_body(); + return result(propName, propExtends, body, attrs || []); }, - /** + /* * Reads an interface body * ```ebnf * interface_body ::= (member_flags? (T_CONST | T_FUNCTION))* * ``` */ - read_interface_body: function() { - let result = []; + read_interface_body: function () { + let result = [], + attrs = []; while (this.token !== this.EOF && this.token !== "}") { if (this.token === this.tok.T_COMMENT) { @@ -298,24 +430,34 @@ module.exports = { continue; } + const locStart = this.position(); + + attrs = this.read_attr_list(); // read member flags const flags = this.read_member_flags(true); // check constant - if (this.token == this.tok.T_CONST) { - const constants = this.read_constant_list(flags); + if (this.token === this.tok.T_CONST) { + const constants = this.read_constant_list(flags, attrs); if (this.expect(";")) { this.next(); } result = result.concat(constants); + attrs = []; } else if (this.token === this.tok.T_FUNCTION) { // reads a function - const method = this.read_function_declaration(2, flags); + const method = this.read_function_declaration( + 2, + flags, + attrs, + locStart, + ); method.parseFlags(flags); result.push(method); if (this.expect(";")) { this.next(); } + attrs = []; } else { // raise an error this.error([this.tok.T_CONST, this.tok.T_FUNCTION]); @@ -327,44 +469,39 @@ module.exports = { } return result; }, - /** + /* * reading a trait * ```ebnf * trait ::= T_TRAIT T_STRING (T_EXTENDS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' FUNCTION* '}' * ``` */ - read_trait: function() { + read_trait_declaration_statement: function () { const result = this.node("trait"); - let propName = null; - let propExtends = null; - let propImplements = null; - let body = null; - if (this.expect(this.tok.T_TRAIT)) { + // graceful mode : ignore token & go next + if (this.token !== this.tok.T_TRAIT) { + this.error(this.tok.T_TRAIT); this.next(); + return null; } - if (this.expect(this.tok.T_STRING)) { - propName = this.text(); - } - if (this.next().token == this.tok.T_EXTENDS) { - propExtends = this.next().read_namespace_name(); - } - if (this.token == this.tok.T_IMPLEMENTS) { - propImplements = this.next().read_name_list(); - } - if (this.expect("{")) { - body = this.next().read_class_body(); - } - return result(propName, propExtends, propImplements, body); + this.next().expect(this.tok.T_STRING); + let propName = this.node("identifier"); + const name = this.text(); + this.next(); + propName = propName(name); + this.expect("{"); + const body = this.next().read_class_body(true, false); + return result(propName, body); }, - /** + /* * reading a use statement * ```ebnf * trait_use_statement ::= namespace_name (',' namespace_name)* ('{' trait_use_alias '}')? * ``` */ - read_trait_use_statement: function() { + read_trait_use_statement: function () { // defines use statements const node = this.node("traituse"); + this.expect(this.tok.T_USE) && this.next(); const traits = [this.read_namespace_name()]; let adaptations = null; while (this.token === ",") { @@ -388,7 +525,7 @@ module.exports = { } return node(traits, adaptations); }, - /** + /* * Reading trait alias * ```ebnf * trait_use_alias ::= namespace_name ( T_DOUBLE_COLON T_STRING )? (T_INSTEADOF namespace_name) | (T_AS member_flags? T_STRING) @@ -396,14 +533,16 @@ module.exports = { * name list : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L303 * trait adaptation : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L742 */ - read_trait_use_alias: function() { + read_trait_use_alias: function () { const node = this.node(); let trait = null; let method; if (this.is("IDENTIFIER")) { - method = this.text(); + method = this.node("identifier"); + const methodName = this.text(); this.next(); + method = method(methodName); } else { method = this.read_namespace_name(); @@ -411,11 +550,13 @@ module.exports = { this.next(); if ( this.token === this.tok.T_STRING || - (this.php7 && this.is("IDENTIFIER")) + (this.version >= 700 && this.is("IDENTIFIER")) ) { trait = method; - method = this.text(); + method = this.node("identifier"); + const methodName = this.text(); this.next(); + method = method(methodName); } else { this.expect(this.tok.T_STRING); } @@ -431,7 +572,7 @@ module.exports = { "traitprecedence", trait, method, - this.next().read_name_list() + this.next().read_name_list(), ); } else if (this.token === this.tok.T_AS) { // handle trait alias @@ -443,10 +584,12 @@ module.exports = { if ( this.token === this.tok.T_STRING || - (this.php7 && this.is("IDENTIFIER")) + (this.version >= 700 && this.is("IDENTIFIER")) ) { - alias = this.text(); + alias = this.node("identifier"); + const name = this.text(); this.next(); + alias = alias(name); } else if (flags === false) { // no visibility flags and no name => too bad this.expect(this.tok.T_STRING); @@ -458,5 +601,5 @@ module.exports = { // handle errors this.expect([this.tok.T_AS, this.tok.T_INSTEADOF]); return node("traitalias", trait, method, null, null); - } + }, }; diff --git a/src/parser/comment.js b/src/parser/comment.js index 1be7a1594..fdddb2529 100644 --- a/src/parser/comment.js +++ b/src/parser/comment.js @@ -6,43 +6,47 @@ "use strict"; module.exports = { - /** + /* * Comments with // or # or / * ... * / */ - read_comment: function() { + read_comment: function () { const text = this.text(); let result = this.ast.prepare( text.substring(0, 2) === "/*" ? "commentblock" : "commentline", null, - this + this, ); + const offset = this.lexer.yylloc.first_offset; // handle location on comment const prev = this.prev; this.prev = [ this.lexer.yylloc.last_line, this.lexer.yylloc.last_column, - this.lexer.offset + this.lexer.offset, ]; this.lex(); result = result(text); + result.offset = offset; this.prev = prev; return result; }, - /** + /* * Comments with / ** ... * / */ - read_doc_comment: function() { + read_doc_comment: function () { let result = this.ast.prepare("commentblock", null, this); + const offset = this.lexer.yylloc.first_offset; const text = this.text(); const prev = this.prev; this.prev = [ this.lexer.yylloc.last_line, this.lexer.yylloc.last_column, - this.lexer.offset + this.lexer.offset, ]; this.lex(); result = result(text); + result.offset = offset; this.prev = prev; return result; - } + }, }; diff --git a/src/parser/enum.js b/src/parser/enum.js new file mode 100644 index 000000000..f380fe390 --- /dev/null +++ b/src/parser/enum.js @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2018 Glayzzle (BSD3 License) + * @authors https://github.com/glayzzle/php-parser/graphs/contributors + * @url http://glayzzle.com + */ +"use strict"; + +module.exports = { + /* + * reading an enum + * ```ebnf + * enum ::= enum_scope? T_ENUM T_STRING (':' NAMESPACE_NAME)? (T_IMPLEMENTS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' ENUM_BODY '}' + * ``` + */ + read_enum_declaration_statement: function (attrs) { + const result = this.node("enum"); + // graceful mode : ignore token & go next + if (!this.expect(this.tok.T_ENUM)) { + return null; + } + this.next().expect(this.tok.T_STRING); + let propName = this.node("identifier"); + const name = this.text(); + this.next(); + propName = propName(name); + const valueType = this.read_enum_value_type(); + const propImplements = this.read_implements_list(); + this.expect("{"); + const body = this.next().read_class_body(false, true); + const node = result(propName, valueType, propImplements, body); + if (attrs) node.attrGroups = attrs; + return node; + }, + + read_enum_value_type: function () { + if (this.token === ":") { + return this.next().read_namespace_name(); + } + + return null; + }, + + read_enum_case: function () { + this.expect(this.tok.T_CASE); + const result = this.node("enumcase"); + let caseName = this.node("identifier"); + const name = this.next().text(); + this.next(); + caseName = caseName(name); + + const value = this.token === "=" ? this.next().read_expr() : null; + this.expect(";"); + + return result(caseName, value); + }, +}; diff --git a/src/parser/expr.js b/src/parser/expr.js index d133c90c7..538fffdbd 100644 --- a/src/parser/expr.js +++ b/src/parser/expr.js @@ -6,70 +6,127 @@ "use strict"; module.exports = { - read_expr: function() { + read_expr: function (expr) { const result = this.node(); - const expr = this.read_expr_item(); + if (this.token === "@") { + if (!expr) { + expr = this.next().read_expr(); + } + return result("silent", expr); + } + if (!expr) { + expr = this.read_expr_item(); + } // binary operations - if (this.token === "|") + if (this.token === "|") { return result("bin", "|", expr, this.next().read_expr()); - if (this.token === "&") + } + if (this.token === "&") { return result("bin", "&", expr, this.next().read_expr()); - if (this.token === "^") + } + if (this.token === "^") { return result("bin", "^", expr, this.next().read_expr()); - if (this.token === ".") + } + if (this.token === ".") { return result("bin", ".", expr, this.next().read_expr()); - if (this.token === "+") + } + if (this.token === "+") { return result("bin", "+", expr, this.next().read_expr()); - if (this.token === "-") + } + if (this.token === "-") { return result("bin", "-", expr, this.next().read_expr()); - if (this.token === "*") + } + if (this.token === "*") { return result("bin", "*", expr, this.next().read_expr()); - if (this.token === "/") + } + if (this.token === "/") { return result("bin", "/", expr, this.next().read_expr()); - if (this.token === "%") + } + if (this.token === "%") { return result("bin", "%", expr, this.next().read_expr()); - if (this.token === this.tok.T_POW) + } + if (this.token === this.tok.T_POW) { return result("bin", "**", expr, this.next().read_expr()); - if (this.token === this.tok.T_SL) + } + if (this.token === this.tok.T_SL) { return result("bin", "<<", expr, this.next().read_expr()); - if (this.token === this.tok.T_SR) + } + if (this.token === this.tok.T_SR) { return result("bin", ">>", expr, this.next().read_expr()); + } // more binary operations (formerly bool) - if (this.token === this.tok.T_BOOLEAN_OR) + if (this.token === this.tok.T_BOOLEAN_OR) { return result("bin", "||", expr, this.next().read_expr()); - if (this.token === this.tok.T_LOGICAL_OR) + } + if (this.token === this.tok.T_LOGICAL_OR) { return result("bin", "or", expr, this.next().read_expr()); - if (this.token === this.tok.T_BOOLEAN_AND) + } + if (this.token === this.tok.T_BOOLEAN_AND) { return result("bin", "&&", expr, this.next().read_expr()); - if (this.token === this.tok.T_LOGICAL_AND) + } + if (this.token === this.tok.T_LOGICAL_AND) { return result("bin", "and", expr, this.next().read_expr()); - if (this.token === this.tok.T_LOGICAL_XOR) + } + if (this.token === this.tok.T_LOGICAL_XOR) { return result("bin", "xor", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_IDENTICAL) + } + if (this.token === this.tok.T_IS_IDENTICAL) { return result("bin", "===", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_NOT_IDENTICAL) + } + if (this.token === this.tok.T_IS_NOT_IDENTICAL) { return result("bin", "!==", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_EQUAL) + } + if (this.token === this.tok.T_IS_EQUAL) { return result("bin", "==", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_NOT_EQUAL) + } + if (this.token === this.tok.T_IS_NOT_EQUAL) { return result("bin", "!=", expr, this.next().read_expr()); - if (this.token === "<") + } + if (this.token === "<") { return result("bin", "<", expr, this.next().read_expr()); - if (this.token === ">") + } + if (this.token === ">") { return result("bin", ">", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_SMALLER_OR_EQUAL) + } + if (this.token === this.tok.T_IS_SMALLER_OR_EQUAL) { return result("bin", "<=", expr, this.next().read_expr()); - if (this.token === this.tok.T_IS_GREATER_OR_EQUAL) + } + if (this.token === this.tok.T_IS_GREATER_OR_EQUAL) { return result("bin", ">=", expr, this.next().read_expr()); - if (this.token === this.tok.T_SPACESHIP) + } + if (this.token === this.tok.T_SPACESHIP) { return result("bin", "<=>", expr, this.next().read_expr()); - if (this.token === this.tok.T_INSTANCEOF) - return result("bin", "instanceof", expr, this.next().read_expr()); + } + if (this.token === this.tok.T_OBJECT_OPERATOR) { + if (this.version < 804) { + this.raiseError( + "New without parenthesis is not allowed before PHP 8.4", + ); + } + return result("bin", "->", expr, this.next().read_expr()); + } + + if (this.token === this.tok.T_INSTANCEOF) { + expr = result( + "bin", + "instanceof", + expr, + this.next().read_class_name_reference(), + ); + if ( + this.token !== ";" && + this.token !== this.tok.T_INLINE_HTML && + this.token !== this.EOF + ) { + expr = this.read_expr(expr); + } + } // extra operations : // $username = $_GET['user'] ?? 'nobody'; - if (this.token === this.tok.T_COALESCE) + if (this.token === this.tok.T_COALESCE) { return result("bin", "??", expr, this.next().read_expr()); + } // extra operations : // $username = $_GET['user'] ? true : false; @@ -88,42 +145,136 @@ module.exports = { return expr; }, - /** + /* * Reads a cast expression */ - read_expr_cast: function(type) { + read_expr_cast: function (type) { return this.node("cast")(type, this.text(), this.next().read_expr()); }, - /** + /* + * Read a isset variable + */ + read_isset_variable: function () { + return this.read_expr(); + }, + + /* + * Reads isset variables + */ + read_isset_variables: function () { + return this.read_function_list(this.read_isset_variable, ","); + }, + + /* + * Reads internal PHP functions + */ + read_internal_functions_in_yacc: function () { + let result = null; + switch (this.token) { + case this.tok.T_ISSET: + { + result = this.node("isset"); + if (this.next().expect("(")) { + this.next(); + } + const variables = this.read_isset_variables(); + if (this.expect(")")) { + this.next(); + } + result = result(variables); + } + break; + case this.tok.T_EMPTY: + { + result = this.node("empty"); + if (this.next().expect("(")) { + this.next(); + } + const expression = this.read_expr(); + if (this.expect(")")) { + this.next(); + } + result = result(expression); + } + break; + case this.tok.T_INCLUDE: + result = this.node("include")(false, false, this.next().read_expr()); + break; + case this.tok.T_INCLUDE_ONCE: + result = this.node("include")(true, false, this.next().read_expr()); + break; + case this.tok.T_EVAL: + { + result = this.node("eval"); + if (this.next().expect("(")) { + this.next(); + } + const expr = this.read_expr(); + if (this.expect(")")) { + this.next(); + } + result = result(expr); + } + break; + case this.tok.T_REQUIRE: + result = this.node("include")(false, true, this.next().read_expr()); + break; + case this.tok.T_REQUIRE_ONCE: + result = this.node("include")(true, true, this.next().read_expr()); + break; + } + + return result; + }, + + /* + * Reads optional expression + */ + read_optional_expr: function (stopToken) { + if (this.token !== stopToken) { + return this.read_expr(); + } + + return null; + }, + + /* + * Reads exit expression + */ + read_exit_expr: function () { + let expression = null; + + if (this.token === "(") { + this.next(); + expression = this.read_optional_expr(")"); + this.expect(")") && this.next(); + } + + return expression; + }, + + /* * ```ebnf * Reads an expression * expr ::= @todo * ``` */ - read_expr_item: function() { - let result, expr; - if (this.token === "@") return this.node("silent")(this.next().read_expr()); - if (this.token === "+") + read_expr_item: function () { + let result, + expr, + attrs = []; + if (this.token === "+") { return this.node("unary")("+", this.next().read_expr()); - if (this.token === "!") + } + if (this.token === "-") { + return this.node("unary")("-", this.next().read_expr()); + } + if (this.token === "!") { return this.node("unary")("!", this.next().read_expr()); - if (this.token === "~") + } + if (this.token === "~") { return this.node("unary")("~", this.next().read_expr()); - - if (this.token === "-") { - result = this.node(); - this.next(); - if ( - this.token === this.tok.T_LNUMBER || - this.token === this.tok.T_DNUMBER - ) { - // negative number - result = result("number", "-" + this.text(), null); - this.next(); - return result; - } - return result("unary", "-", this.read_expr()); } if (this.token === "(") { @@ -135,7 +286,7 @@ module.exports = { if (this.token === "`") { // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1048 - return this.next().read_encapsed_string("`"); + return this.read_encapsed_string("`"); } if (this.token === this.tok.T_LIST) { @@ -160,15 +311,16 @@ module.exports = { // check if contains at least one assignment statement let hasItem = false; for (let i = 0; i < assignList.length; i++) { - if (assignList[i] !== null) { + if (assignList[i] !== null && assignList[i].kind !== "noop") { hasItem = true; break; } } if (!hasItem) { + /* istanbul ignore next */ this.raiseError( "Fatal Error : Cannot use empty list on line " + - this.lexer.yylloc.first_line + this.lexer.yylloc.first_line, ); } @@ -179,10 +331,11 @@ module.exports = { return assign( result(assignList, false), this.next().read_expr(), - "=" + "=", ); } else { // error fallback : list($a, $b); + /* istanbul ignore next */ return result(assignList, false); } } else { @@ -190,70 +343,35 @@ module.exports = { } } - if (this.token === this.tok.T_CLONE) + if (this.token === this.tok.T_ATTRIBUTE) { + attrs = this.read_attr_list(); + } + + if (this.token === this.tok.T_CLONE) { return this.node("clone")(this.next().read_expr()); + } switch (this.token) { case this.tok.T_INC: - return this.node("pre")( - "+", - this.next().read_variable(false, false, false) - ); + return this.node("pre")("+", this.next().read_variable(false, false)); case this.tok.T_DEC: - return this.node("pre")( - "-", - this.next().read_variable(false, false, false) - ); + return this.node("pre")("-", this.next().read_variable(false, false)); case this.tok.T_NEW: - return this.next().read_new_expr(); + return this.read_new_expr(); - case this.tok.T_ISSET: { - result = this.node("isset"); - if (this.next().expect("(")) { - this.next(); - } - const args = this.read_list(this.read_expr, ","); - if (this.expect(")")) { - this.next(); - } - return result(args); - } - case this.tok.T_EMPTY: { - result = this.node("empty"); - if (this.next().expect("(")) { - this.next(); - } - const arg = this.read_expr(); - if (this.expect(")")) { - this.next(); - } - return result([arg]); - } + case this.tok.T_ISSET: + case this.tok.T_EMPTY: case this.tok.T_INCLUDE: - return this.node("include")(false, false, this.next().read_expr()); - case this.tok.T_INCLUDE_ONCE: - return this.node("include")(true, false, this.next().read_expr()); - + case this.tok.T_EVAL: case this.tok.T_REQUIRE: - return this.node("include")(false, true, this.next().read_expr()); - case this.tok.T_REQUIRE_ONCE: - return this.node("include")(true, true, this.next().read_expr()); - - case this.tok.T_EVAL: - result = this.node("eval"); - if (this.next().expect("(")) { - this.next(); - } - expr = this.read_expr(); - if (this.expect(")")) { - this.next(); - } - return result(expr); + return this.read_internal_functions_in_yacc(); + case this.tok.T_MATCH: + return this.read_match_expression(); case this.tok.T_INT_CAST: return this.read_expr_cast("int"); @@ -262,7 +380,7 @@ module.exports = { case this.tok.T_STRING_CAST: return this.read_expr_cast( - this.text().indexOf("binary") !== -1 ? "binary" : "string" + this.text().indexOf("binary") !== -1 ? "binary" : "string", ); case this.tok.T_ARRAY_CAST: @@ -277,21 +395,20 @@ module.exports = { case this.tok.T_UNSET_CAST: return this.read_expr_cast("unset"); + case this.tok.T_THROW: { + if (this.version < 800) { + this.raiseError("PHP 8+ is required to use throw as an expression"); + } + const result = this.node("throw"); + const expr = this.next().read_expr(); + return result(expr); + } case this.tok.T_EXIT: { const useDie = this.lexer.yytext.toLowerCase() === "die"; result = this.node("exit"); - let status = null; - if (this.next().token === "(") { - if (this.next().token !== ")") { - status = this.read_expr(); - if (this.expect(")")) { - this.next(); - } - } else { - this.next(); - } - } - return result(status, useDie); + this.next(); + const expression = this.read_exit_expr(); + return result(expression, useDie); } case this.tok.T_PRINT: @@ -320,14 +437,19 @@ module.exports = { expr = this.next().read_expr(); return result(expr); + case this.tok.T_FN: case this.tok.T_FUNCTION: - return this.read_function(true); + return this.read_inline_function(undefined, attrs); case this.tok.T_STATIC: { const backup = [this.token, this.lexer.getState()]; - if (this.next().token === this.tok.T_FUNCTION) { + this.next(); + if ( + this.token === this.tok.T_FUNCTION || + (this.version >= 704 && this.token === this.tok.T_FN) + ) { // handles static function - return this.read_function(true, [0, 1, 0]); + return this.read_inline_function([0, 1, 0], attrs); } else { // rollback this.lexer.tokens.push(backup); @@ -339,29 +461,22 @@ module.exports = { // SCALAR | VARIABLE if (this.is("VARIABLE")) { result = this.node(); - expr = this.read_variable(false, false, false); + expr = this.read_variable(false, false); // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L877 // should accept only a variable const isConst = - expr.kind === "constref" || - (expr.kind === "staticlookup" && expr.offset.kind === "constref"); + expr.kind === "identifier" || + (expr.kind === "staticlookup" && expr.offset.kind === "identifier"); // VARIABLES SPECIFIC OPERATIONS switch (this.token) { case "=": { if (isConst) this.error("VARIABLE"); - let right; if (this.next().token == "&") { - if (this.next().token === this.tok.T_NEW) { - right = this.next().read_new_expr(); - } else { - right = this.read_variable(false, false, true); - } - } else { - right = this.read_expr(); + return this.read_assignref(result, expr); } - return result("assign", expr, right, "="); + return result("assign", expr, this.read_expr(), "="); } // operations : @@ -413,6 +528,10 @@ module.exports = { if (isConst) this.error("VARIABLE"); return result("assign", expr, this.next().read_expr(), ">>="); + case this.tok.T_COALESCE_EQUAL: + if (isConst) this.error("VARIABLE"); + return result("assign", expr, this.next().read_expr(), "??="); + case this.tok.T_INC: if (isConst) this.error("VARIABLE"); this.next(); @@ -430,9 +549,9 @@ module.exports = { expr = this.read_scalar(); if (expr.kind === "array" && expr.shortForm && this.token === "=") { // list assign - let list = this.node("list")(expr.items, true); + const list = this.convertToList(expr); if (expr.loc) list.loc = expr.loc; - let right = this.next().read_expr(); + const right = this.next().read_expr(); return result("assign", list, right, "="); } else { // see #189 - swap docs on nodes @@ -448,69 +567,260 @@ module.exports = { // returns variable | scalar return expr; }, - /** + + /* + * Recursively convert nested array to nested list. + */ + convertToList: function (array) { + const convertedItems = array.items.map((entry) => { + if ( + entry.value && + entry.value.kind === "array" && + entry.value.shortForm + ) { + entry.value = this.convertToList(entry.value); + } + return entry; + }); + const node = this.node("list")(convertedItems, true); + if (array.loc) node.loc = array.loc; + if (array.leadingComments) node.leadingComments = array.leadingComments; + if (array.trailingComments) node.trailingComments = array.trailingComments; + return node; + }, + + /* + * Reads assignment + * @param {*} left + */ + read_assignref: function (result, left) { + this.next(); + let right; + if (this.token === this.tok.T_NEW) { + if (this.version >= 700) { + this.error(); + } + right = this.read_new_expr(); + } else { + right = this.read_variable(false, false); + } + + return result("assignref", left, right); + }, + + /* + * + * inline_function: + * function returns_ref backup_doc_comment '(' parameter_list ')' lexical_vars return_type + * backup_fn_flags '{' inner_statement_list '}' backup_fn_flags + * { $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $2 | $13, $1, $3, + * zend_string_init("{closure}", sizeof("{closure}") - 1, 0), + * $5, $7, $11, $8); CG(extra_fn_flags) = $9; } + * | fn returns_ref '(' parameter_list ')' return_type backup_doc_comment T_DOUBLE_ARROW backup_fn_flags backup_lex_pos expr backup_fn_flags + * { $$ = zend_ast_create_decl(ZEND_AST_ARROW_FUNC, $2 | $12, $1, $7, + * zend_string_init("{closure}", sizeof("{closure}") - 1, 0), $4, NULL, + * zend_ast_create(ZEND_AST_RETURN, $11), $6); + * ((zend_ast_decl *) $$)->lex_pos = $10; + * CG(extra_fn_flags) = $9; } * + */ + read_inline_function: function (flags, attrs) { + if (this.token === this.tok.T_FUNCTION) { + const result = this.read_function(true, flags, attrs); + result.attrGroups = attrs; + return result; + } + // introduced in PHP 7.4 + if (!this.version >= 704) { + this.raiseError("Arrow Functions are not allowed"); + } + // as an arrowfunc + const node = this.node("arrowfunc"); + // eat T_FN + if (this.expect(this.tok.T_FN)) this.next(); + // check the & + const isRef = this.is_reference(); + // ... + if (this.expect("(")) this.next(); + const params = this.read_parameter_list(); + if (this.expect(")")) this.next(); + let nullable = false; + let returnType = null; + if (this.token === ":") { + if (this.next().token === "?") { + nullable = true; + this.next(); + } + returnType = this.read_types(); + } + if (this.expect(this.tok.T_DOUBLE_ARROW)) this.next(); + const body = this.read_expr(); + const result = node( + params, + isRef, + body, + returnType, + nullable, + flags ? true : false, + ); + result.attrGroups = attrs; + return result; + }, + + read_match_expression: function () { + const node = this.node("match"); + this.expect(this.tok.T_MATCH) && this.next(); + if (this.version < 800) { + this.raiseError("Match statements are not allowed before PHP 8"); + } + let cond = null; + let arms = []; + if (this.expect("(")) this.next(); + cond = this.read_expr(); + if (this.expect(")")) this.next(); + if (this.expect("{")) this.next(); + arms = this.read_match_arms(); + if (this.expect("}")) this.next(); + return node(cond, arms); + }, + + read_match_arms: function () { + return this.read_list(() => this.read_match_arm(), ",", true); + }, + + read_match_arm: function () { + if (this.token === "}") { + return; + } + return this.node("matcharm")(this.read_match_arm_conds(), this.read_expr()); + }, + + read_match_arm_conds: function () { + let conds = []; + if (this.token === this.tok.T_DEFAULT) { + conds = null; + this.next(); + } else { + conds.push(this.read_expr()); + while (this.token === ",") { + this.next(); + if (this.token === this.tok.T_DOUBLE_ARROW) { + this.next(); + return conds; + } + conds.push(this.read_expr()); + } + } + if (this.expect(this.tok.T_DOUBLE_ARROW)) { + this.next(); + } + return conds; + }, + + read_attribute() { + const name = this.text(); + let args = []; + this.next(); + if (this.token === "(") { + args = this.read_argument_list(); + } + return this.node("attribute")(name, args); + }, + read_attr_list() { + const list = []; + if (this.token === this.tok.T_ATTRIBUTE) { + do { + const attrGr = this.node("attrgroup")([]); + this.next(); + attrGr.attrs.push(this.read_attribute()); + while (this.token === ",") { + this.next(); + if (this.token !== "]") attrGr.attrs.push(this.read_attribute()); + } + list.push(attrGr); + this.expect("]"); + this.next(); + } while (this.token === this.tok.T_ATTRIBUTE); + } + return list; + }, + + /* * ```ebnf * new_expr ::= T_NEW (namespace_name function_argument_list) | (T_CLASS ... class declaration) * ``` * https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L850 */ - read_new_expr: function() { + read_new_expr: function () { const result = this.node("new"); + this.expect(this.tok.T_NEW) && this.next(); let args = []; + if (this.token === "(") { + this.next(); + const newExp = this.read_expr(); + this.expect(")"); + this.next(); + if (this.token === "(") { + args = this.read_argument_list(); + } + return result(newExp, args); + } + const attrs = this.read_attr_list(); if (this.token === this.tok.T_CLASS) { const what = this.node("class"); // Annonymous class declaration - let propExtends = null, - propImplements = null, - body = null; if (this.next().token === "(") { - args = this.read_function_argument_list(); - } - if (this.token == this.tok.T_EXTENDS) { - propExtends = this.next().read_namespace_name(); - } - if (this.token == this.tok.T_IMPLEMENTS) { - propImplements = this.next().read_name_list(); + args = this.read_argument_list(); } + const propExtends = this.read_extends_from(); + const propImplements = this.read_implements_list(); + let body = null; if (this.expect("{")) { - body = this.next().read_class_body(); + body = this.next().read_class_body(true, false); } - return result( - what(null, propExtends, propImplements, body, [0, 0, 0]), - args - ); + const whatNode = what(null, propExtends, propImplements, body, [0, 0, 0]); + whatNode.attrGroups = attrs; + return result(whatNode, args); } // Already existing class - const name = this.read_class_name_reference(); + let name = this.read_new_class_name(); + while (this.token === "[") { + const offsetNode = this.node("offsetlookup"); + const offset = this.next().read_encaps_var_offset(); + this.expect("]") && this.next(); + name = offsetNode(name, offset); + } if (this.token === "(") { - args = this.read_function_argument_list(); + args = this.read_argument_list(); } return result(name, args); }, - /** + /* * Reads a class name * ```ebnf - * class_name_reference ::= namespace_name | variable + * read_new_class_name ::= namespace_name | variable * ``` */ - read_class_name_reference: function() { + read_new_class_name: function () { if ( this.token === this.tok.T_NS_SEPARATOR || + this.token === this.tok.T_NAME_RELATIVE || + this.token === this.tok.T_NAME_QUALIFIED || + this.token === this.tok.T_NAME_FULLY_QUALIFIED || this.token === this.tok.T_STRING || this.token === this.tok.T_NAMESPACE ) { - let result = this.read_namespace_name(); + let result = this.read_namespace_name(true); if (this.token === this.tok.T_DOUBLE_COLON) { result = this.read_static_getter(result); } return result; } else if (this.is("VARIABLE")) { - return this.read_variable(true, false, false); + return this.read_variable(true, false); } else { this.expect([this.tok.T_STRING, "VARIABLE"]); } }, - handleDereferencable: function(expr) { + handleDereferencable: function (expr) { while (this.token !== this.EOF) { if ( this.token === this.tok.T_OBJECT_OPERATOR || @@ -521,11 +831,11 @@ module.exports = { expr = this.read_dereferencable(expr); } else if (this.token === "(") { // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1118 - expr = this.node("call")(expr, this.read_function_argument_list()); + expr = this.node("call")(expr, this.read_argument_list()); } else { return expr; } } return expr; - } + }, }; diff --git a/src/parser/function.js b/src/parser/function.js index c16de7727..314eca2d4 100644 --- a/src/parser/function.js +++ b/src/parser/function.js @@ -6,36 +6,38 @@ "use strict"; module.exports = { - /** + /* * checks if current token is a reference keyword */ - is_reference: function() { - if (this.token == "&") { + is_reference: function () { + if (this.token === "&") { this.next(); return true; } return false; }, - /** + /* * checks if current token is a variadic keyword */ - is_variadic: function() { + is_variadic: function () { if (this.token === this.tok.T_ELLIPSIS) { this.next(); return true; } return false; }, - /** + /* * reading a function * ```ebnf * function ::= function_declaration code_block * ``` */ - read_function: function(closure, flag) { + read_function: function (closure, flag, attrs, locStart) { const result = this.read_function_declaration( closure ? 1 : flag ? 2 : 0, - flag && flag[1] === 1 + flag && flag[1] === 1, + attrs || [], + locStart, ); if (flag && flag[2] == 1) { // abstract function : @@ -56,13 +58,13 @@ module.exports = { } return result; }, - /** + /* * reads a function declaration (without his body) * ```ebnf * function_declaration ::= T_FUNCTION '&'? T_STRING '(' parameter_list ')' * ``` */ - read_function_declaration: function(type, isStatic) { + read_function_declaration: function (type, isStatic, attrs, locStart) { let nodeName = "function"; if (type === 1) { nodeName = "closure"; @@ -80,180 +82,426 @@ module.exports = { returnType = null, nullable = false; if (type !== 1) { - let nameNode = this.node("identifier"); + const nameNode = this.node("identifier"); if (type === 2) { - if ( - this.token === this.tok.T_STRING || - (this.php7 && this.is("IDENTIFIER")) - ) { + if (this.version >= 700) { + if (this.token === this.tok.T_STRING || this.is("IDENTIFIER")) { + name = this.text(); + this.next(); + } else if (this.version < 704) { + this.error("IDENTIFIER"); + } + } else if (this.token === this.tok.T_STRING) { name = this.text(); this.next(); } else { this.error("IDENTIFIER"); } } else { - if (this.expect(this.tok.T_STRING)) { - name = this.text(); + if (this.version >= 700) { + if (this.token === this.tok.T_STRING) { + name = this.text(); + this.next(); + } else if (this.version >= 704) { + if (!this.expect("(")) { + this.next(); + } + } else { + this.error(this.tok.T_STRING); + this.next(); + } + } else { + if (this.expect(this.tok.T_STRING)) { + name = this.text(); + } + this.next(); } - this.next(); } - name = nameNode([name], true); + name = nameNode(name); } if (this.expect("(")) this.next(); - const params = this.read_parameter_list(); + const params = this.read_parameter_list(name.name === "__construct"); if (this.expect(")")) this.next(); - if (type === 1 && this.token === this.tok.T_USE) { - if (this.next().expect("(")) this.next(); - use = this.read_list(this.read_lexical_var, ","); - if (this.expect(")")) this.next(); + if (type === 1) { + use = this.read_lexical_vars(); } if (this.token === ":") { if (this.next().token === "?") { nullable = true; this.next(); } - returnType = this.read_type(); + returnType = this.read_types(); } + const apply_attrgroup_location = (node) => { + node.attrGroups = attrs || []; + + if (locStart && node.loc) { + node.loc.start = locStart; + if (node.loc.source) { + node.loc.source = this.lexer._input.substr( + node.loc.start.offset, + node.loc.end.offset - node.loc.start.offset, + ); + } + } + return node; + }; + if (type === 1) { // closure - return result(params, isRef, use, returnType, nullable, isStatic); + return apply_attrgroup_location( + result(params, isRef, use, returnType, nullable, isStatic), + ); + } + return apply_attrgroup_location( + result(name, params, isRef, returnType, nullable), + ); + }, + + read_lexical_vars: function () { + let result = []; + + if (this.token === this.tok.T_USE) { + this.next(); + this.expect("(") && this.next(); + result = this.read_lexical_var_list(); + this.expect(")") && this.next(); } - return result(name, params, isRef, returnType, nullable); + + return result; }, - /** + + read_list_with_dangling_comma: function (item) { + const result = []; + + while (this.token != this.EOF) { + result.push(item()); + if (this.token == ",") { + this.next(); + if (this.version >= 800 && this.token === ")") { + return result; + } + } else if (this.token == ")") { + break; + } else { + this.error([",", ")"]); + break; + } + } + return result; + }, + + read_lexical_var_list: function () { + return this.read_list_with_dangling_comma(this.read_lexical_var.bind(this)); + }, + + /* * ```ebnf * lexical_var ::= '&'? T_VARIABLE * ``` */ - read_lexical_var: function() { - const result = this.node("variable"); - let isRef = false; + read_lexical_var: function () { if (this.token === "&") { - isRef = true; - this.next(); + return this.read_byref(this.read_lexical_var.bind(this)); } + const result = this.node("variable"); this.expect(this.tok.T_VARIABLE); const name = this.text().substring(1); this.next(); - return result(name, isRef, false); + return result(name, false); }, - /** + /* * reads a list of parameters * ```ebnf * parameter_list ::= (parameter ',')* parameter? * ``` */ - read_parameter_list: function() { - const result = []; - if (this.token != ")") { - while (this.token != this.EOF) { - result.push(this.read_parameter()); - if (this.token == ",") { - this.next(); - } else if (this.token == ")") { - break; - } else { - this.error([",", ")"]); - break; - } - } + read_parameter_list: function (is_class_constructor) { + if (this.token !== ")") { + let wasVariadic = false; + + return this.read_list_with_dangling_comma( + function () { + const parameter = this.read_parameter(is_class_constructor); + if (parameter) { + // variadic parameters can only be defined at the end of the parameter list + if (wasVariadic) { + this.raiseError( + "Unexpected parameter after a variadic parameter", + ); + } + if (parameter.variadic) { + wasVariadic = true; + } + } + return parameter; + }.bind(this), + ",", + ); } - return result; + + return []; }, - /** + /* * ```ebnf * parameter ::= type? '&'? T_ELLIPSIS? T_VARIABLE ('=' expr)? * ``` * @see https://github.com/php/php-src/blob/493524454d66adde84e00d249d607ecd540de99f/Zend/zend_language_parser.y#L640 */ - read_parameter: function() { + read_parameter: function (is_class_constructor) { const node = this.node("parameter"); - let name = null; + let parameterName = null; let value = null; - let type = null; + let types = null; let nullable = false; + let readonly = false; + let attrs = []; + if (this.token === this.tok.T_ATTRIBUTE) attrs = this.read_attr_list(); + + if (this.version >= 801 && this.token === this.tok.T_READ_ONLY) { + if (is_class_constructor) { + this.next(); + readonly = true; + } else { + this.raiseError( + "readonly properties can be used only on class constructor", + ); + } + } + + const flags = this.read_promoted(); + + if ( + !readonly && + this.version >= 801 && + this.token === this.tok.T_READ_ONLY + ) { + if (is_class_constructor) { + this.next(); + readonly = true; + } else { + this.raiseError( + "readonly properties can be used only on class constructor", + ); + } + } + if (this.token === "?") { this.next(); nullable = true; } - type = this.read_type(); - if (nullable && !type) { + types = this.read_types(); + if (nullable && !types) { this.raiseError( - "Expecting a type definition combined with nullable operator" + "Expecting a type definition combined with nullable operator", ); } const isRef = this.is_reference(); const isVariadic = this.is_variadic(); if (this.expect(this.tok.T_VARIABLE)) { - name = this.text().substring(1); + parameterName = this.node("identifier"); + const name = this.text().substring(1); this.next(); + parameterName = parameterName(name); } if (this.token == "=") { value = this.next().read_expr(); } - return node(name, type, value, isRef, isVariadic, nullable); + const result = node( + parameterName, + types, + value, + isRef, + isVariadic, + readonly, + nullable, + flags, + ); + if (attrs) result.attrGroups = attrs; + return result; }, - /** + read_types: function () { + const MODE_UNSET = "unset"; + const MODE_UNION = "union"; + const MODE_INTERSECTION = "intersection"; + + const types = []; + let mode = MODE_UNSET; + const type = this.read_type(); + if (!type) return null; + + // we have matched a single type + types.push(type); + + // is the current token a: + // - | for union type + // - & for intersection type (> php 8.1) + while (this.token === "|" || (this.version >= 801 && this.token === "&")) { + const nextToken = this.peek(); + + if ( + nextToken === this.tok.T_ELLIPSIS || + nextToken === this.tok.T_VARIABLE + ) { + // the next token is part of the variable (or the variable itself), + // we're not gonna match anymore types + break; + } + + if (mode === MODE_UNSET) { + // are we in union or intersection "mode" + mode = this.token === "|" ? MODE_UNION : MODE_INTERSECTION; + } else { + // it is not possible to mix "modes" + if ( + (mode === MODE_UNION && this.token !== "|") || + (mode === MODE_INTERSECTION && this.token !== "&") + ) { + this.raiseError( + 'Unexpect token "' + this.token + '", "|" and "&" can not be mixed', + ); + } + } + + this.next(); + types.push(this.read_type()); + } + if (types.length === 1) { + return types[0]; + } else { + return mode === MODE_INTERSECTION + ? this.node("intersectiontype")(types) + : this.node("uniontype")(types); + } + }, + read_promoted: function () { + const MODIFIER_PUBLIC = 1; + const MODIFIER_PROTECTED = 2; + const MODIFIER_PRIVATE = 4; + if (this.token === this.tok.T_PUBLIC) { + this.next(); + return MODIFIER_PUBLIC; + } else if (this.token === this.tok.T_PROTECTED) { + this.next(); + return MODIFIER_PROTECTED; + } else if (this.token === this.tok.T_PRIVATE) { + this.next(); + return MODIFIER_PRIVATE; + } + return 0; + }, + /* * Reads a list of arguments * ```ebnf * function_argument_list ::= '(' (argument_list (',' argument_list)*)? ')' * ``` */ - read_function_argument_list: function() { - const result = []; - let wasVariadic = false; + read_argument_list: function () { + let result = []; this.expect("(") && this.next(); - if (this.token !== ")") { - while (this.token != this.EOF) { - const argument = this.read_argument_list(); + if ( + this.version >= 801 && + this.token === this.tok.T_ELLIPSIS && + this.peek() === ")" + ) { + result.push(this.node("variadicplaceholder")()); + this.next(); + } else if (this.token !== ")") { + result = this.read_non_empty_argument_list(); + } + this.expect(")") && this.next(); + return result; + }, + /* + * Reads non empty argument list + */ + read_non_empty_argument_list: function () { + let wasVariadic = false; + + return this.read_function_list( + function () { + const argument = this.read_argument(); if (argument) { - result.push(argument); - if (argument.kind === "variadic") { + const isVariadic = argument.kind === "variadic"; + // variadic arguments can only be followed by other variadic arguments + if (wasVariadic && !isVariadic) { + this.raiseError( + "Unexpected non-variadic argument after a variadic argument", + ); + } + if (isVariadic) { wasVariadic = true; - } else if (wasVariadic) { - this.raiseError("Unexpected argument after a variadic argument"); } } - if (this.token === ",") { - this.next(); - } else break; - } - } - this.expect(")") && this.next(); - return result; + return argument; + }.bind(this), + ",", + ); }, - /** + /* * ```ebnf - * argument_list ::= T_ELLIPSIS? expr + * argument_list ::= T_STRING ':' expr | T_ELLIPSIS? expr * ``` */ - read_argument_list: function() { + read_argument: function () { if (this.token === this.tok.T_ELLIPSIS) { return this.node("variadic")(this.next().read_expr()); } + if ( + this.token === this.tok.T_STRING || + Object.values(this.lexer.keywords).includes(this.token) + ) { + const nextToken = this.peek(); + if (nextToken === ":") { + if (this.version < 800) { + this.raiseError("PHP 8+ is required to use named arguments"); + } + return this.node("namedargument")( + this.text(), + this.next().next().read_expr(), + ); + } + } return this.read_expr(); }, - /** + /* * read type hinting * ```ebnf * type ::= T_ARRAY | T_CALLABLE | namespace_name * ``` */ - read_type: function() { - const result = this.node("identifier"); - switch (this.token) { - case this.tok.T_ARRAY: + read_type: function () { + const result = this.node(); + if (this.token === this.tok.T_ARRAY || this.token === this.tok.T_CALLABLE) { + const type = this.text(); + this.next(); + return result("typereference", type.toLowerCase(), type); + } else if ( + this.token === this.tok.T_NAME_RELATIVE || + this.token === this.tok.T_NAME_QUALIFIED || + this.token === this.tok.T_NAME_FULLY_QUALIFIED || + this.token === this.tok.T_STRING || + this.token === this.tok.T_STATIC + ) { + const type = this.text(); + const backup = [this.token, this.lexer.getState()]; + this.next(); + if ( + this.token !== this.tok.T_NS_SEPARATOR && + this.ast.typereference.types.indexOf(type.toLowerCase()) > -1 + ) { + return result("typereference", type.toLowerCase(), type); + } else { + // rollback a classic namespace + this.lexer.tokens.push(backup); this.next(); - return result(["", "array"], false); - case this.tok.T_NAMESPACE: - case this.tok.T_NS_SEPARATOR: - case this.tok.T_STRING: + // fix : destroy not consumed node (release comments) + result.destroy(); return this.read_namespace_name(); - case this.tok.T_CALLABLE: - this.next(); - return result(["", "callable"], false); - default: - return null; + } } - } + // fix : destroy not consumed node (release comments) + result.destroy(); + return null; + }, }; diff --git a/src/parser/if.js b/src/parser/if.js index eff2a9e1c..fda94ee19 100644 --- a/src/parser/if.js +++ b/src/parser/if.js @@ -6,20 +6,19 @@ "use strict"; module.exports = { - /** + /* * Reads an IF statement * * ```ebnf * if ::= T_IF '(' expr ')' ':' ... * ``` */ - read_if: function() { + read_if: function () { const result = this.node("if"); + const test = this.next().read_if_expr(); let body = null; let alternate = null; let shortForm = false; - let test = null; - test = this.next().read_if_expr(); if (this.token === ":") { shortForm = true; @@ -49,27 +48,25 @@ module.exports = { } return result(test, body, alternate, shortForm); }, - /** + /* * reads an if expression : '(' expr ')' */ - read_if_expr: function() { + read_if_expr: function () { this.expect("(") && this.next(); const result = this.read_expr(); this.expect(")") && this.next(); return result; }, - /** + /* * reads an elseif (expr): statements */ - read_elseif_short: function() { - const result = this.node("if"); + read_elseif_short: function () { let alternate = null; - let test = null; - let body = null; - const items = []; - test = this.next().read_if_expr(); + const result = this.node("if"); + const test = this.next().read_if_expr(); if (this.expect(":")) this.next(); - body = this.node("block"); + const body = this.node("block"); + const items = []; while (this.token != this.EOF && this.token !== this.tok.T_ENDIF) { if (this.token === this.tok.T_ELSEIF) { alternate = this.read_elseif_short(); @@ -80,19 +77,18 @@ module.exports = { } items.push(this.read_inner_statement()); } - body = body(null, items); - return result(test, body, alternate, true); + return result(test, body(null, items), alternate, true); }, - /** + /* * */ - read_else_short: function() { - const body = this.node("block"); + read_else_short: function () { if (this.next().expect(":")) this.next(); + const body = this.node("block"); const items = []; while (this.token != this.EOF && this.token !== this.tok.T_ENDIF) { items.push(this.read_inner_statement()); } return body(null, items); - } + }, }; diff --git a/src/parser/loops.js b/src/parser/loops.js index f61b1a349..62847a6b8 100644 --- a/src/parser/loops.js +++ b/src/parser/loops.js @@ -6,7 +6,7 @@ "use strict"; module.exports = { - /** + /* * Reads a while statement * ```ebnf * while ::= T_WHILE (statement | ':' inner_statement_list T_ENDWHILE ';') @@ -14,8 +14,9 @@ module.exports = { * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L587 * @return {While} */ - read_while: function() { + read_while: function () { const result = this.node("while"); + this.expect(this.tok.T_WHILE) && this.next(); let test = null; let body = null; let shortForm = false; @@ -30,7 +31,7 @@ module.exports = { } return result(test, body, shortForm); }, - /** + /* * Reads a do / while loop * ```ebnf * do ::= T_DO statement T_WHILE '(' expr ')' ';' @@ -38,8 +39,9 @@ module.exports = { * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L423 * @return {Do} */ - read_do: function() { + read_do: function () { const result = this.node("do"); + this.expect(this.tok.T_DO) && this.next(); let test = null; let body = null; body = this.read_statement(); @@ -51,7 +53,7 @@ module.exports = { } return result(test, body); }, - /** + /* * Read a for incremental loop * ```ebnf * for ::= T_FOR '(' for_exprs ';' for_exprs ';' for_exprs ')' for_statement @@ -61,8 +63,9 @@ module.exports = { * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L425 * @return {For} */ - read_for: function() { + read_for: function () { const result = this.node("for"); + this.expect(this.tok.T_FOR) && this.next(); let init = []; let test = []; let increment = []; @@ -95,7 +98,7 @@ module.exports = { } return result(init, test, increment, body, shortForm); }, - /** + /* * Reads a foreach loop * ```ebnf * foreach ::= '(' expr T_AS foreach_variable (T_DOUBLE_ARROW foreach_variable)? ')' statement @@ -103,8 +106,9 @@ module.exports = { * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L438 * @return {Foreach} */ - read_foreach: function() { + read_foreach: function () { const result = this.node("foreach"); + this.expect(this.tok.T_FOREACH) && this.next(); let source = null; let key = null; let value = null; @@ -136,7 +140,7 @@ module.exports = { } return result(source, key, value, body, shortForm); }, - /** + /* * Reads a foreach variable statement * ```ebnf * foreach_variable = @@ -148,7 +152,7 @@ module.exports = { * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L544 * @return {Expression} */ - read_foreach_variable: function() { + read_foreach_variable: function () { if (this.token === this.tok.T_LIST || this.token === "[") { const isShort = this.token === "["; const result = this.node("list"); @@ -158,7 +162,7 @@ module.exports = { if (this.expect(isShort ? "]" : ")")) this.next(); return result(assignList, isShort); } else { - return this.read_variable(false, false, false); + return this.read_variable(false, false); } - } + }, }; diff --git a/src/parser/main.js b/src/parser/main.js index 33e54ce10..8b18dfff8 100644 --- a/src/parser/main.js +++ b/src/parser/main.js @@ -6,16 +6,16 @@ "use strict"; module.exports = { - /** + /* * ```ebnf * start ::= (namespace | top_statement)* * ``` */ - read_start: function() { + read_start: function () { if (this.token == this.tok.T_NAMESPACE) { return this.read_namespace(); } else { return this.read_top_statement(); } - } + }, }; diff --git a/src/parser/namespace.js b/src/parser/namespace.js index d4ad5e813..5f1e30431 100644 --- a/src/parser/namespace.js +++ b/src/parser/namespace.js @@ -6,7 +6,7 @@ "use strict"; module.exports = { - /** + /* * Reads a namespace declaration block * ```ebnf * namespace ::= T_NAMESPACE namespace_name? '{' @@ -17,63 +17,91 @@ module.exports = { * @see http://php.net/manual/en/language.namespaces.php * @return {Namespace} */ - read_namespace: function() { + read_namespace: function () { const result = this.node("namespace"); let body; this.expect(this.tok.T_NAMESPACE) && this.next(); - if (this.token == "{") { - this.currentNamespace = [""]; + let name; + + if (this.token === "{") { + name = { + name: [""], + }; + } else { + name = this.read_namespace_name(); + } + this.currentNamespace = name; + + if (this.token === ";") { + this.currentNamespace = name; + body = this.next().read_top_statements(); + this.expect(this.EOF); + return result(name.name, body, false); + } else if (this.token === "{") { + this.currentNamespace = name; body = this.next().read_top_statements(); this.expect("}") && this.next(); - return result([""], body, true); - } else { - const name = this.read_namespace_name(); - if (this.token == ";") { - this.currentNamespace = name; - body = this.next().read_top_statements(); - this.expect(this.EOF); - return result(name.name, body, false); - } else if (this.token == "{") { - this.currentNamespace = name; - body = this.next().read_top_statements(); - this.expect("}") && this.next(); - return result(name.name, body, true); - } else if (this.token === "(") { - // resolve ambuiguity between namespace & function call - name.resolution = this.ast.identifier.RELATIVE_NAME; - name.name = name.name.substring(1); - return this.node("call")(name, this.read_function_argument_list()); - } else { - this.error(["{", ";"]); - // graceful mode : - this.currentNamespace = name; - body = this.read_top_statements(); - this.expect(this.EOF); - return result(name, body, false); + if ( + body.length === 0 && + this.extractDoc && + this._docs.length > this._docIndex + ) { + body.push(this.node("noop")()); } + return result(name.name, body, true); + } else { + this.error(["{", ";"]); + // graceful mode : + this.currentNamespace = name; + body = this.read_top_statements(); + this.expect(this.EOF); + return result(name, body, false); } }, - /** + /* * Reads a namespace name * ```ebnf * namespace_name ::= T_NS_SEPARATOR? (T_STRING T_NS_SEPARATOR)* T_STRING * ``` * @see http://php.net/manual/en/language.namespaces.rules.php - * @return {Identifier} + * @return {Reference} */ - read_namespace_name: function() { - const result = this.node("identifier"); - let relative = false; - if (this.token === this.tok.T_NAMESPACE) { - this.next().expect(this.tok.T_NS_SEPARATOR) && this.next(); - relative = true; + read_namespace_name: function (resolveReference) { + const result = this.node(); + let resolution; + let name = this.text(); + switch (this.token) { + case this.tok.T_NAME_RELATIVE: + resolution = this.ast.name.RELATIVE_NAME; + name = name.replace(/^namespace\\/, ""); + break; + case this.tok.T_NAME_QUALIFIED: + resolution = this.ast.name.QUALIFIED_NAME; + break; + case this.tok.T_NAME_FULLY_QUALIFIED: + resolution = this.ast.name.FULL_QUALIFIED_NAME; + break; + default: + resolution = this.ast.name.UNQUALIFIED_NAME; + if (!this.expect(this.tok.T_STRING)) { + // graceful mode + return result("name", "", this.ast.name.FULL_QUALIFIED_NAME); + } + } + + this.next(); + + if (resolveReference || this.token !== "(") { + if (name.toLowerCase() === "parent") { + return result("parentreference", name); + } else if (name.toLowerCase() === "self") { + return result("selfreference", name); + } } - return result( - this.read_list(this.tok.T_STRING, this.tok.T_NS_SEPARATOR, true), - relative - ); + + return result("name", name, resolution); }, - /** + /* * Reads a use statement * ```ebnf * use_statement ::= T_USE @@ -85,7 +113,7 @@ module.exports = { * @see http://php.net/manual/en/language.namespaces.importing.php * @return {UseGroup} */ - read_use_statement: function() { + read_use_statement: function () { let result = this.node("usegroup"); let items = []; let name = null; @@ -103,7 +131,15 @@ module.exports = { this.expect(";") && this.next(); return result; }, - /** + /* + * + * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1045 + */ + read_class_name_reference: function () { + // resolved as the same + return this.read_variable(true, false); + }, + /* * Reads a use declaration * ```ebnf * use_declaration ::= use_type? namespace_name use_alias @@ -111,7 +147,7 @@ module.exports = { * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L380 * @return {UseItem} */ - read_use_declaration: function(typed) { + read_use_declaration: function (typed) { const result = this.node("useitem"); let type = null; if (typed) type = this.read_use_type(); @@ -119,7 +155,7 @@ module.exports = { const alias = this.read_use_alias(); return result(name.name, alias, type); }, - /** + /* * Reads a list of use declarations * ```ebnf * use_declarations ::= use_declaration (',' use_declaration)* @@ -127,43 +163,54 @@ module.exports = { * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L380 * @return {UseItem[]} */ - read_use_declarations: function(typed) { + read_use_declarations: function (typed) { const result = [this.read_use_declaration(typed)]; while (this.token === ",") { this.next(); if (typed) { if ( + this.token !== this.tok.T_NAME_RELATIVE && + this.token !== this.tok.T_NAME_QUALIFIED && + this.token !== this.tok.T_NAME_FULLY_QUALIFIED && this.token !== this.tok.T_FUNCTION && this.token !== this.tok.T_CONST && this.token !== this.tok.T_STRING ) { break; } - } else if (this.token !== this.tok.T_STRING) { + } else if ( + this.token !== this.tok.T_NAME_RELATIVE && + this.token !== this.tok.T_NAME_QUALIFIED && + this.token !== this.tok.T_NAME_FULLY_QUALIFIED && + this.token !== this.tok.T_STRING && + this.token !== this.tok.T_NS_SEPARATOR + ) { break; } result.push(this.read_use_declaration(typed)); } return result; }, - /** + /* * Reads a use statement * ```ebnf * use_alias ::= (T_AS T_STRING)? * ``` * @return {String|null} */ - read_use_alias: function() { + read_use_alias: function () { let result = null; if (this.token === this.tok.T_AS) { if (this.next().expect(this.tok.T_STRING)) { - result = this.text(); + const aliasName = this.node("identifier"); + const name = this.text(); this.next(); + result = aliasName(name); } } return result; }, - /** + /* * Reads the namespace type declaration * ```ebnf * use_type ::= (T_FUNCTION | T_CONST)? @@ -171,7 +218,7 @@ module.exports = { * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L335 * @return {String|null} Possible values : function, const */ - read_use_type: function() { + read_use_type: function () { if (this.token === this.tok.T_FUNCTION) { this.next(); return this.ast.useitem.TYPE_FUNCTION; @@ -180,5 +227,5 @@ module.exports = { return this.ast.useitem.TYPE_CONST; } return null; - } + }, }; diff --git a/src/parser/scalar.js b/src/parser/scalar.js index 6426649ea..f8ccea1f6 100644 --- a/src/parser/scalar.js +++ b/src/parser/scalar.js @@ -6,52 +6,160 @@ "use strict"; const specialChar = { - "\\r": "\r", - "\\n": "\n", - "\\t": "\t", - "\\v": String.fromCharCode(11), - "\\e": String.fromCharCode(27), - "\\f": String.fromCharCode(12), - "\\\\": "\\", - "\\$": "$", - '\\"': '"', - "\\'": "'" + "\\": "\\", + $: "$", + n: "\n", + r: "\r", + t: "\t", + f: String.fromCharCode(12), + v: String.fromCharCode(11), + e: String.fromCharCode(27), }; module.exports = { - /** + /* * Unescape special chars */ - resolve_special_chars: function(text, doubleQuote) { + resolve_special_chars: function (text, doubleQuote) { if (!doubleQuote) { // single quote fix - return text.replace(/\\['\\]/g, function(seq) { - return specialChar[seq]; - }); + return text.replace(/\\\\/g, "\\").replace(/\\'/g, "'"); } - return text.replace(/\\[rntvef"'\\$]/g, function(seq) { - return specialChar[seq]; - }); + return text + .replace(/\\"/, '"') + .replace( + /\\([\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}|u{([0-9a-fA-F]+)})/g, + ($match, p1, p2) => { + if (specialChar[p1]) { + return specialChar[p1]; + } else if ("x" === p1[0] || "X" === p1[0]) { + return String.fromCodePoint(parseInt(p1.substr(1), 16)); + } else if ("u" === p1[0]) { + return String.fromCodePoint(parseInt(p2, 16)); + } else { + return String.fromCodePoint(parseInt(p1, 8)); + } + }, + ); }, - /** - * ```ebnf - * scalar ::= T_MAGIC_CONST - * | T_LNUMBER | T_DNUMBER - * | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE? T_END_HEREDOC - * | '"' encaps_list '"' - * | T_START_HEREDOC encaps_list T_END_HEREDOC - * | namespace_name (T_DOUBLE_COLON T_STRING)? - * ``` + + /* + * Remove all leading spaces each line for heredoc text if there is a indentation + * @param {string} text + * @param {number} indentation + * @param {boolean} indentation_uses_spaces + * @param {boolean} first_encaps_node if it is behind a variable, the first N spaces should not be removed */ - read_scalar: function() { - if (this.is("T_MAGIC_CONST")) { - return this.get_magic_constant(); - } else { - let value, node; - switch (this.token) { - // TEXTS - case this.tok.T_CONSTANT_ENCAPSED_STRING: { - value = this.node("string"); + remove_heredoc_leading_whitespace_chars: function ( + text, + indentation, + indentation_uses_spaces, + first_encaps_node, + ) { + if (indentation === 0) { + return text; + } + + this.check_heredoc_indentation_level( + text, + indentation, + indentation_uses_spaces, + first_encaps_node, + ); + + const matchedChar = indentation_uses_spaces ? " " : "\t"; + const removementRegExp = new RegExp( + `\\n${matchedChar}{${indentation}}`, + "g", + ); + const removementFirstEncapsNodeRegExp = new RegExp( + `^${matchedChar}{${indentation}}`, + ); + + // Rough replace, need more check + if (first_encaps_node) { + // Remove text leading whitespace + text = text.replace(removementFirstEncapsNodeRegExp, ""); + } + + // Remove leading whitespace after \n + return text.replace(removementRegExp, "\n"); + }, + + /* + * Check indentation level of heredoc in text, if mismatch, raiseError + * @param {string} text + * @param {number} indentation + * @param {boolean} indentation_uses_spaces + * @param {boolean} first_encaps_node if it is behind a variable, the first N spaces should not be removed + */ + check_heredoc_indentation_level: function ( + text, + indentation, + indentation_uses_spaces, + first_encaps_node, + ) { + const textSize = text.length; + let offset = 0; + let leadingWhitespaceCharCount = 0; + /* + * @var inCoutingState {boolean} reset to true after a new line + * @private + */ + let inCoutingState = true; + const chToCheck = indentation_uses_spaces ? " " : "\t"; + let inCheckState = false; + if (!first_encaps_node) { + // start from first \n + offset = text.indexOf("\n"); + // if no \n, just return + if (offset === -1) { + return; + } + offset++; + } + while (offset < textSize) { + if (inCoutingState) { + if (text[offset] === chToCheck) { + leadingWhitespaceCharCount++; + } else { + inCheckState = true; + } + } else { + inCoutingState = false; + } + + if ( + text[offset] !== "\n" && + inCheckState && + leadingWhitespaceCharCount < indentation + ) { + this.raiseError( + `Invalid body indentation level (expecting an indentation at least ${indentation})`, + ); + } else { + inCheckState = false; + } + + if (text[offset] === "\n") { + // Reset counting state + inCoutingState = true; + leadingWhitespaceCharCount = 0; + } + offset++; + } + }, + + /* + * Reads dereferencable scalar + */ + read_dereferencable_scalar: function () { + let result = null; + + switch (this.token) { + case this.tok.T_CONSTANT_ENCAPSED_STRING: + { + let value = this.node("string"); const text = this.text(); let offset = 0; if (text[0] === "b" || text[0] === "B") { @@ -59,29 +167,73 @@ module.exports = { } const isDoubleQuote = text[offset] === '"'; this.next(); + const textValue = this.resolve_special_chars( + text.substring(offset + 1, text.length - 1), + isDoubleQuote, + ); value = value( isDoubleQuote, - this.resolve_special_chars( - text.substring(offset + 1, text.length - 1), - isDoubleQuote - ), + textValue, offset === 1, // unicode flag - text + text, ); if (this.token === this.tok.T_DOUBLE_COLON) { // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1151 - return this.read_static_getter(value); + result = this.read_static_getter(value); } else { // dirrect string - return value; + result = value; } } + break; + case this.tok.T_ARRAY: // array parser + result = this.read_array(); + break; + case "[": // short array format + result = this.read_array(); + break; + } + + return result; + }, + + /* + * ```ebnf + * scalar ::= T_MAGIC_CONST + * | T_LNUMBER | T_DNUMBER + * | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE? T_END_HEREDOC + * | '"' encaps_list '"' + * | T_START_HEREDOC encaps_list T_END_HEREDOC + * | namespace_name (T_DOUBLE_COLON T_STRING)? + * ``` + */ + read_scalar: function () { + if (this.is("T_MAGIC_CONST")) { + return this.get_magic_constant(); + } else { + let value, node; + switch (this.token) { + // NUMERIC + case this.tok.T_LNUMBER: // long + case this.tok.T_DNUMBER: { + // double + const result = this.node("number"); + value = this.text(); + this.next(); + return result(value, null); + } case this.tok.T_START_HEREDOC: if (this.lexer.curCondition === "ST_NOWDOC") { const start = this.lexer.yylloc.first_offset; node = this.node("nowdoc"); value = this.next().text(); // strip the last line return char + if (this.lexer.heredoc_label.indentation > 0) { + value = value.substring( + 0, + value.length - this.lexer.heredoc_label.indentation, + ); + } const lastCh = value[value.length - 1]; if (lastCh === "\n") { if (value[value.length - 2] === "\r") { @@ -96,47 +248,40 @@ module.exports = { value = value.substring(0, value.length - 1); } this.expect(this.tok.T_ENCAPSED_AND_WHITESPACE) && this.next(); + this.expect(this.tok.T_END_HEREDOC) && this.next(); const raw = this.lexer._input.substring( start, - this.lexer.yylloc.last_offset + this.lexer.yylloc.first_offset, ); node = node( - value, + this.remove_heredoc_leading_whitespace_chars( + value, + this.lexer.heredoc_label.indentation, + this.lexer.heredoc_label.indentation_uses_spaces, + this.lexer.heredoc_label.first_encaps_node, + ), raw, - this.lexer.heredoc_label, - raw[3] === '"' || raw[3] === "'" + this.lexer.heredoc_label.label, ); - this.expect(this.tok.T_END_HEREDOC) && this.next(); + this.lexer.heredoc_label.finished = true; return node; } else { - return this.next().read_encapsed_string(this.tok.T_END_HEREDOC); + return this.read_encapsed_string(this.tok.T_END_HEREDOC); } case '"': - return this.next().read_encapsed_string('"'); + return this.read_encapsed_string('"'); case 'b"': case 'B"': { - this.next(); - this.lexer.yylloc.prev_offset -= 1; - return this.read_encapsed_string('"'); - } - - // NUMERIC - case this.tok.T_LNUMBER: // long - case this.tok.T_DNUMBER: { - // double - const result = this.node("number"); - value = this.text(); - this.next(); - return result(value, null); + return this.read_encapsed_string('"', true); } - // ARRAYS + // TEXTS + case this.tok.T_CONSTANT_ENCAPSED_STRING: case this.tok.T_ARRAY: // array parser - return this.read_array(); case "[": // short array format - return this.read_array(); + return this.read_dereferencable_scalar(); default: { const err = this.error("SCALAR"); // graceful mode : ignore token & return error node @@ -146,10 +291,10 @@ module.exports = { } } }, - /** + /* * Handles the dereferencing */ - read_dereferencable: function(expr) { + read_dereferencable: function (expr) { let result, offset; const node = this.node("offsetlookup"); if (this.token === "[") { @@ -162,7 +307,7 @@ module.exports = { } return result; }, - /** + /* * Reads and extracts an encapsed item * ```ebnf * encapsed_string_item ::= T_ENCAPSED_AND_WHITESPACE @@ -177,7 +322,10 @@ module.exports = { * @return {String|Variable|Expr|Lookup} * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1219 */ - read_encapsed_string_item: function(isDoubleQuote) { + read_encapsed_string_item: function (isDoubleQuote) { + const encapsedPart = this.node("encapsedpart"); + let syntax = null; + let curly = false; let result = this.node(), offset, node, @@ -188,51 +336,61 @@ module.exports = { if (this.token === this.tok.T_ENCAPSED_AND_WHITESPACE) { const text = this.text(); this.next(); + + // if this.lexer.heredoc_label.first_encaps_node -> remove first indents result = result( "string", false, - this.resolve_special_chars(text, isDoubleQuote), + this.version >= 703 && !this.lexer.heredoc_label.finished + ? this.remove_heredoc_leading_whitespace_chars( + this.resolve_special_chars(text, isDoubleQuote), + this.lexer.heredoc_label.indentation, + this.lexer.heredoc_label.indentation_uses_spaces, + this.lexer.heredoc_label.first_encaps_node, + ) + : text, false, - text + text, ); } else if (this.token === this.tok.T_DOLLAR_OPEN_CURLY_BRACES) { + syntax = "simple"; + curly = true; // dynamic variable name // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1239 name = null; if (this.next().token === this.tok.T_STRING_VARNAME) { - const varName = this.text(); name = this.node("variable"); + const varName = this.text(); this.next(); // check if lookup an offset // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1243 + result.destroy(); if (this.token === "[") { name = name(varName, false); node = this.node("offsetlookup"); offset = this.next().read_expr(); this.expect("]") && this.next(); - name = node(name, offset); + result = node(name, offset); } else { - name = this.node("constref")(varName); + result = name(varName, false); } } else { - name = this.read_expr(); + result = result("variable", this.read_expr(), false); } this.expect("}") && this.next(); - result = result("variable", name, false, true); } else if (this.token === this.tok.T_CURLY_OPEN) { // expression // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1246 + syntax = "complex"; result.destroy(); - result = this.next().read_variable(false, false, false); - if (result.kind === "variable") { - result.curly = true; - } + result = this.next().read_variable(false, false); this.expect("}") && this.next(); } else if (this.token === this.tok.T_VARIABLE) { + syntax = "simple"; // plain variable // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1231 result.destroy(); - result = this.read_simple_variable(false); + result = this.read_simple_variable(); // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L1233 if (this.token === "[") { @@ -246,7 +404,7 @@ module.exports = { if (this.token === this.tok.T_OBJECT_OPERATOR) { node = this.node("propertylookup"); this.next().expect(this.tok.T_STRING); - const what = this.node("constref"); + const what = this.node("identifier"); name = this.text(); this.next(); result = node(result, what(name)); @@ -262,14 +420,18 @@ module.exports = { result = result("string", false, value, false, value); } - return result; + // reset first_encaps_node to false after access any node + this.lexer.heredoc_label.first_encaps_node = false; + return encapsedPart(result, syntax, curly); }, - /** + /* * Reads an encapsed string */ - read_encapsed_string: function(expect) { - const start = this.lexer.yylloc.prev_offset; + read_encapsed_string: function (expect, isBinary = false) { + const labelStart = this.lexer.yylloc.first_offset; let node = this.node("encapsed"); + this.next(); + const start = this.lexer.yylloc.prev_offset - (isBinary ? 1 : 0); const value = []; let type = null; @@ -285,26 +447,46 @@ module.exports = { while (this.token !== expect && this.token !== this.EOF) { value.push(this.read_encapsed_string_item(true)); } - + if ( + value.length > 0 && + value[value.length - 1].kind === "encapsedpart" && + value[value.length - 1].expression.kind === "string" + ) { + const node = value[value.length - 1].expression; + const lastCh = node.value[node.value.length - 1]; + if (lastCh === "\n") { + if (node.value[node.value.length - 2] === "\r") { + // windows style + node.value = node.value.substring(0, node.value.length - 2); + } else { + // linux style + node.value = node.value.substring(0, node.value.length - 1); + } + } else if (lastCh === "\r") { + // mac style + node.value = node.value.substring(0, node.value.length - 1); + } + } this.expect(expect) && this.next(); - node = node( - value, - this.lexer._input.substring(start - 1, this.lexer.yylloc.first_offset), - type + const raw = this.lexer._input.substring( + type === "heredoc" ? labelStart : start - 1, + this.lexer.yylloc.first_offset, ); + node = node(value, raw, type); if (expect === this.tok.T_END_HEREDOC) { - node.label = this.lexer.heredoc_label; + node.label = this.lexer.heredoc_label.label; + this.lexer.heredoc_label.finished = true; } return node; }, - /** + /* * Constant token */ - get_magic_constant: function() { + get_magic_constant: function () { const result = this.node("magic"); const name = this.text(); this.next(); return result(name.toUpperCase(), name); - } + }, }; diff --git a/src/parser/statement.js b/src/parser/statement.js index bf2611c2c..09b8f7ddf 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -6,13 +6,13 @@ "use strict"; module.exports = { - /** + /* * reading a list of top statements (helper for top_statement*) * ```ebnf * top_statements ::= top_statement* * ``` */ - read_top_statements: function() { + read_top_statements: function () { let result = []; while (this.token !== this.EOF && this.token !== "}") { const statement = this.read_top_statement(); @@ -26,7 +26,7 @@ module.exports = { } return result; }, - /** + /* * reading a top statement * ```ebnf * top_statement ::= @@ -36,32 +36,34 @@ module.exports = { * | statement * ``` */ - read_top_statement: function() { + read_top_statement: function () { + let attrs = []; + if (this.token === this.tok.T_ATTRIBUTE) { + attrs = this.read_attr_list(); + } switch (this.token) { case this.tok.T_FUNCTION: - return this.read_function(false, false); + return this.read_function(false, false, attrs); // optional flags case this.tok.T_ABSTRACT: - case this.tok.T_FINAL: { - const flag = this.read_class_scope(); - if (this.token === this.tok.T_CLASS) { - return this.read_class(flag); - } else { - this.error(this.tok.T_CLASS); - this.next(); - return null; - } - } + case this.tok.T_FINAL: + case this.tok.T_READ_ONLY: case this.tok.T_CLASS: - return this.read_class([0, 0, 0]); + return this.read_class_declaration_statement(attrs); case this.tok.T_INTERFACE: - return this.read_interface(); + return this.read_interface_declaration_statement(attrs); case this.tok.T_TRAIT: - return this.read_trait(); + return this.read_trait_declaration_statement(); + case this.tok.T_ENUM: + return this.read_enum_declaration_statement(attrs); case this.tok.T_USE: return this.read_use_statement(); - case this.tok.T_CONST: - return this.next().read_const_list(); + case this.tok.T_CONST: { + const result = this.node("constantstatement"); + const items = this.next().read_const_list(); + this.expectEndOfStatement(); + return result(null, items); + } case this.tok.T_NAMESPACE: return this.read_namespace(); case this.tok.T_HALT_COMPILER: { @@ -76,13 +78,13 @@ module.exports = { return this.read_statement(); } }, - /** + /* * reads a list of simple inner statements (helper for inner_statement*) * ```ebnf * inner_statements ::= inner_statement* * ``` */ - read_inner_statements: function() { + read_inner_statements: function () { let result = []; while (this.token != this.EOF && this.token !== "}") { const statement = this.read_inner_statement(); @@ -96,85 +98,89 @@ module.exports = { } return result; }, - /** + /* * Reads a list of constants declaration * ```ebnf * const_list ::= T_CONST T_STRING '=' expr (',' T_STRING '=' expr)* ';' * ``` */ - read_const_list: function() { - const result = this.read_list( - function() { + read_const_list: function () { + return this.read_list( + function () { this.expect(this.tok.T_STRING); const result = this.node("constant"); + let constName = this.node("identifier"); const name = this.text(); - if (this.next().expect("=")) { - return result(name, this.next().read_expr()); + this.next(); + constName = constName(name); + if (this.expect("=")) { + return result(constName, this.next().read_expr()); } else { // fallback - return result(name, null); + return result(constName, null); } }, ",", - false + false, ); - this.expectEndOfStatement(); - return result; }, - /** + /* * Reads a list of constants declaration * ```ebnf - * declare_list ::= T_STRING '=' expr (',' T_STRING '=' expr)* + * declare_list ::= IDENTIFIER '=' expr (',' IDENTIFIER '=' expr)* * ``` - * @retrurn {Object} + * @retrurn {Array} */ - read_declare_list: function() { - const result = {}; + read_declare_list: function () { + const result = []; while (this.token != this.EOF && this.token !== ")") { this.expect(this.tok.T_STRING); - const name = this.text().toLowerCase(); - if (this.next().expect("=")) { - result[name] = this.next().read_expr(); - } else { - result[name] = null; + const directive = this.node("declaredirective"); + let key = this.node("identifier"); + const name = this.text(); + this.next(); + key = key(name); + let value = null; + if (this.expect("=")) { + value = this.next().read_expr(); } + result.push(directive(key, value)); if (this.token !== ",") break; this.next(); } return result; }, - /** + /* * reads a simple inner statement * ```ebnf * inner_statement ::= '{' inner_statements '}' | token * ``` */ - read_inner_statement: function() { + read_inner_statement: function () { + let attrs = []; + if (this.token === this.tok.T_ATTRIBUTE) { + attrs = this.read_attr_list(); + } switch (this.token) { - case this.tok.T_FUNCTION: - return this.read_function(false, false); + case this.tok.T_FUNCTION: { + const result = this.read_function(false, false); + result.attrGroups = attrs; + return result; + } // optional flags case this.tok.T_ABSTRACT: - case this.tok.T_FINAL: { - const flag = this.read_class_scope(); - if (this.token === this.tok.T_CLASS) { - return this.read_class(flag); - } else { - this.error(this.tok.T_CLASS); - // graceful mode : ignore token & go next - this.next(); - return null; - } - } + case this.tok.T_FINAL: case this.tok.T_CLASS: - return this.read_class([0, 0, 0]); + return this.read_class_declaration_statement(); case this.tok.T_INTERFACE: - return this.read_interface(); + return this.read_interface_declaration_statement(); case this.tok.T_TRAIT: - return this.read_trait(); + return this.read_trait_declaration_statement(); + case this.tok.T_ENUM: + return this.read_enum_declaration_statement(); case this.tok.T_HALT_COMPILER: { this.raiseError( - "__HALT_COMPILER() can only be used from the outermost scope" + "__HALT_COMPILER() can only be used from the outermost scope", ); // fallback : returns a node but does not stop the parsing let node = this.node("halt"); @@ -188,11 +194,10 @@ module.exports = { return this.read_statement(); } }, - /** + /* * Reads statements */ - read_statement: function() { - let result, expr, items, current, label; + read_statement: function () { switch (this.token) { case "{": return this.read_code_block(false); @@ -204,16 +209,16 @@ module.exports = { return this.read_switch(); case this.tok.T_FOR: - return this.next().read_for(); + return this.read_for(); case this.tok.T_FOREACH: - return this.next().read_foreach(); + return this.read_foreach(); case this.tok.T_WHILE: - return this.next().read_while(); + return this.read_while(); case this.tok.T_DO: - return this.next().read_do(); + return this.read_do(); case this.tok.T_COMMENT: return this.read_comment(); @@ -221,60 +226,58 @@ module.exports = { case this.tok.T_DOC_COMMENT: return this.read_doc_comment(); - case this.tok.T_RETURN: - result = this.node("return"); - expr = null; - if (!this.next().is("EOS")) { - expr = this.read_expr(); - } + case this.tok.T_RETURN: { + const result = this.node("return"); + this.next(); + const expr = this.read_optional_expr(";"); this.expectEndOfStatement(); return result(expr); + } // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L429 case this.tok.T_BREAK: case this.tok.T_CONTINUE: { - result = this.node( - this.token === this.tok.T_CONTINUE ? "continue" : "break" + const result = this.node( + this.token === this.tok.T_CONTINUE ? "continue" : "break", ); - let level = null; - this.next(); // look ahead - if (this.token !== ";") { - level = this.read_expr(); - } + this.next(); + const level = this.read_optional_expr(";"); this.expectEndOfStatement(); return result(level); } - case this.tok.T_GLOBAL: - result = this.node("global"); - items = this.next().read_list(this.read_simple_variable, ","); + case this.tok.T_GLOBAL: { + const result = this.node("global"); + const items = this.next().read_list(this.read_simple_variable, ","); this.expectEndOfStatement(); return result(items); + } - case this.tok.T_STATIC: - current = [this.token, this.lexer.getState()]; - result = this.node("static"); + case this.tok.T_STATIC: { + const current = [this.token, this.lexer.getState()]; + const result = this.node(); if (this.next().token === this.tok.T_DOUBLE_COLON) { // static keyword for a class this.lexer.tokens.push(current); - expr = this.next().read_expr(); - this.expect(";") && this.next(); - return expr; + const expr = this.next().read_expr(); + this.expectEndOfStatement(expr); + return result("expressionstatement", expr); } if (this.token === this.tok.T_FUNCTION) { return this.read_function(true, [0, 1, 0]); } - items = this.read_variable_declarations(); + const items = this.read_variable_declarations(); this.expectEndOfStatement(); - return result(items); + return result("static", items); + } case this.tok.T_ECHO: { - result = this.node("echo"); + const result = this.node("echo"); const text = this.text(); const shortForm = text === " this._docIndex + ) { + body.push(this.node("noop")()); + } this.expect(this.tok.T_ENDDECLARE) && this.next(); this.expectEndOfStatement(); mode = this.ast.declare.MODE_SHORT; @@ -332,73 +343,102 @@ module.exports = { // @todo : check declare_statement from php / not valid body.push(this.read_top_statement()); } + if ( + body.length === 0 && + this.extractDoc && + this._docs.length > this._docIndex + ) { + body.push(this.node("noop")()); + } this.expect("}") && this.next(); mode = this.ast.declare.MODE_BLOCK; } else { this.expect(";") && this.next(); mode = this.ast.declare.MODE_NONE; } - return result(what, body, mode); + return result(directives, body, mode); } case this.tok.T_TRY: return this.read_try(); - case this.tok.T_THROW: - result = this.node("throw"); - expr = this.next().read_expr(); + case this.tok.T_THROW: { + const result = this.node("throw"); + const expr = this.next().read_expr(); this.expectEndOfStatement(); return result(expr); + } - case ";": // ignore this (extra ponctuation) + // ignore this (extra ponctuation) + case ";": { this.next(); return null; + } - case this.tok.T_STRING: - current = [this.token, this.lexer.getState()]; - label = this.text(); + case this.tok.T_STRING: { + const result = this.node(); + const current = [this.token, this.lexer.getState()]; + const labelNameText = this.text(); + let labelName = this.node("identifier"); // AST : https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L457 if (this.next().token === ":") { - result = this.node("label"); + labelName = labelName(labelNameText); this.next(); - return result(label); + return result("label", labelName); + } else { + labelName.destroy(); } // default fallback expr / T_STRING '::' (etc...) + result.destroy(); this.lexer.tokens.push(current); - expr = this.next().read_expr(); - this.expectEndOfStatement(); - return expr; + const statement = this.node("expressionstatement"); + const expr = this.next().read_expr(); + this.expectEndOfStatement(expr); + return statement(expr); + } - case this.tok.T_GOTO: - result = this.node("goto"); - label = null; + case this.tok.T_GOTO: { + const result = this.node("goto"); + let labelName = null; if (this.next().expect(this.tok.T_STRING)) { - label = this.text(); - this.next().expectEndOfStatement(); + labelName = this.node("identifier"); + const name = this.text(); + this.next(); + labelName = labelName(name); + this.expectEndOfStatement(); } - return result(label); + return result(labelName); + } - default: + default: { // default fallback expr - let statement = this.node("expressionstatement"); - expr = this.read_expr(); + const statement = this.node("expressionstatement"); + const expr = this.read_expr(); this.expectEndOfStatement(expr); return statement(expr); + } } }, - /** + /* * ```ebnf * code_block ::= '{' (inner_statements | top_statements) '}' * ``` */ - read_code_block: function(top) { + read_code_block: function (top) { const result = this.node("block"); this.expect("{") && this.next(); const body = top ? this.read_top_statements() : this.read_inner_statements(); + if ( + body.length === 0 && + this.extractDoc && + this._docs.length > this._docIndex + ) { + body.push(this.node("noop")()); + } this.expect("}") && this.next(); return result(null, body); - } + }, }; diff --git a/src/parser/switch.js b/src/parser/switch.js index 41c69c86c..07c1785e7 100644 --- a/src/parser/switch.js +++ b/src/parser/switch.js @@ -6,7 +6,7 @@ "use strict"; module.exports = { - /** + /* * Reads a switch statement * ```ebnf * switch ::= T_SWITCH '(' expr ')' switch_case_list @@ -14,9 +14,9 @@ module.exports = { * @return {Switch} * @see http://php.net/manual/en/control-structures.switch.php */ - read_switch: function() { - this.expect(this.tok.T_SWITCH) && this.next(); + read_switch: function () { const result = this.node("switch"); + this.expect(this.tok.T_SWITCH) && this.next(); this.expect("(") && this.next(); const test = this.read_expr(); this.expect(")") && this.next(); @@ -24,13 +24,13 @@ module.exports = { const body = this.read_switch_case_list(); return result(test, body, shortForm); }, - /** + /* * ```ebnf * switch_case_list ::= '{' ';'? case_list* '}' | ':' ';'? case_list* T_ENDSWITCH ';' * ``` * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L566 */ - read_switch_case_list: function() { + read_switch_case_list: function () { // DETECT SWITCH MODE let expect = null; const result = this.node("block"); @@ -42,15 +42,23 @@ module.exports = { } else { this.expect(["{", ":"]); } + this.next(); // OPTIONNAL ';' // https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L570 - if (this.next().token === ";") { + if (this.token === ";") { this.next(); } // EXTRACTING CASES while (this.token !== this.EOF && this.token !== expect) { items.push(this.read_case_list(expect)); } + if ( + items.length === 0 && + this.extractDoc && + this._docs.length > this._docIndex + ) { + items.push(this.node("noop")()); + } // CHECK END TOKEN this.expect(expect) && this.next(); if (expect === this.tok.T_ENDSWITCH) { @@ -58,34 +66,34 @@ module.exports = { } return result(null, items); }, - /** + /* * ```ebnf * case_list ::= ((T_CASE expr) | T_DEFAULT) (':' | ';') inner_statement* * ``` */ - read_case_list: function(stopToken) { + read_case_list: function (stopToken) { const result = this.node("case"); let test = null; - let body = null; - const items = []; if (this.token === this.tok.T_CASE) { test = this.next().read_expr(); } else if (this.token === this.tok.T_DEFAULT) { - // the defaut entry - no condition + // the default entry - no condition this.next(); } else { this.expect([this.tok.T_CASE, this.tok.T_DEFAULT]); } + // case_separator this.expect([":", ";"]) && this.next(); - body = this.node("block"); + const body = this.node("block"); + const items = []; while ( - this.token != this.EOF && + this.token !== this.EOF && this.token !== stopToken && this.token !== this.tok.T_CASE && this.token !== this.tok.T_DEFAULT ) { items.push(this.read_inner_statement()); } - return result(test, items.length > 0 ? body(null, items) : null); - } + return result(test, body(null, items)); + }, }; diff --git a/src/parser/try.js b/src/parser/try.js index 9433d84ea..60c396116 100644 --- a/src/parser/try.js +++ b/src/parser/try.js @@ -6,18 +6,18 @@ "use strict"; module.exports = { - /** + /* * ```ebnf * try ::= T_TRY '{' inner_statement* '}' * ( - * T_CATCH '(' namespace_name variable ')' '{' inner_statement* '}' + * T_CATCH '(' namespace_name (variable)? ')' '{' inner_statement* '}' * )* * (T_FINALLY '{' inner_statement* '}')? * ``` * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L448 * @return {Try} */ - read_try: function() { + read_try: function () { this.expect(this.tok.T_TRY); const result = this.node("try"); let always = null; @@ -28,7 +28,10 @@ module.exports = { const item = this.node("catch"); this.next().expect("(") && this.next(); const what = this.read_list(this.read_namespace_name, "|", false); - const variable = this.read_variable(true, false, false); + let variable = null; + if (this.version < 800 || this.token === this.tok.T_VARIABLE) { + variable = this.read_variable(true, false); + } this.expect(")"); catches.push(item(this.next().read_statement(), what, variable)); } @@ -36,5 +39,5 @@ module.exports = { always = this.next().read_statement(); } return result(body, catches, always); - } + }, }; diff --git a/src/parser/utils.js b/src/parser/utils.js index 8ef78c197..73734fc54 100644 --- a/src/parser/utils.js +++ b/src/parser/utils.js @@ -6,40 +6,77 @@ "use strict"; module.exports = { - /** + /* * Reads a short form of tokens * @param {Number} token - The ending token * @return {Block} */ - read_short_form: function(token) { + read_short_form: function (token) { const body = this.node("block"); const items = []; + /* istanbul ignore next */ if (this.expect(":")) this.next(); while (this.token != this.EOF && this.token !== token) { items.push(this.read_inner_statement()); } + if ( + items.length === 0 && + this.extractDoc && + this._docs.length > this._docIndex + ) { + items.push(this.node("noop")()); + } + /* istanbul ignore next */ if (this.expect(token)) this.next(); this.expectEndOfStatement(); return body(null, items); }, - /** + /* + * https://wiki.php.net/rfc/trailing-comma-function-calls + * @param {*} item + * @param {*} separator + */ + read_function_list: function (item, separator) { + const result = []; + do { + if (this.token == separator && this.version >= 703 && result.length > 0) { + result.push(this.node("noop")()); + break; + } + result.push(item.apply(this, [])); + if (this.token != separator) { + break; + } + if (this.next().token == ")" && this.version >= 703) { + break; + } + } while (this.token != this.EOF); + return result; + }, + + /* * Helper : reads a list of tokens / sample : T_STRING ',' T_STRING ... * ```ebnf * list ::= separator? ( item separator )* item * ``` */ - read_list: function(item, separator, preserveFirstSeparator) { + read_list: function (item, separator, preserveFirstSeparator) { const result = []; if (this.token == separator) { - if (preserveFirstSeparator) result.push(null); + if (preserveFirstSeparator) { + result.push(typeof item === "function" ? this.node("noop")() : null); + } this.next(); } if (typeof item === "function") { do { - result.push(item.apply(this, [])); + const itemResult = item.apply(this, []); + if (itemResult) { + result.push(itemResult); + } if (this.token != separator) { break; } @@ -60,7 +97,7 @@ module.exports = { return result; }, - /** + /* * Reads a list of names separated by a comma * * ```ebnf @@ -73,13 +110,29 @@ module.exports = { * ``` * * @see https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L726 - * @return {Identifier[]} + * @return {Reference[]} */ - read_name_list: function() { + read_name_list: function () { return this.read_list(this.read_namespace_name, ",", false); }, - /** + /* + * Reads the byref token and assign it to the specified node + * @param {*} cb + */ + read_byref: function (cb) { + let byref = this.node("byref"); + this.next(); + byref = byref(null); + const result = cb(); + if (result) { + this.ast.swapLocations(result, byref, result, this); + result.byref = true; + } + return result; + }, + + /* * Reads a list of variables declarations * * ```ebnf @@ -89,22 +142,23 @@ module.exports = { * * Sample code : * ```php - * func()->property // chained calls * ``` */ - read_variable: function(read_only, encapsed, byref) { + read_variable: function (read_only, encapsed) { let result; - // check the byref flag - if (!byref && this.token === "&") { - byref = true; - this.next(); + if (this.token === "&") { + return this.read_byref( + this.read_variable.bind(this, read_only, encapsed), + ); } // reads the entry point if (this.is([this.tok.T_VARIABLE, "$"])) { - result = this.read_reference_variable(encapsed, byref); + result = this.read_reference_variable(encapsed); } else if ( this.is([ this.tok.T_NS_SEPARATOR, this.tok.T_STRING, - this.tok.T_NAMESPACE + this.tok.T_NAME_RELATIVE, + this.tok.T_NAME_QUALIFIED, + this.tok.T_NAME_FULLY_QUALIFIED, + this.tok.T_NAMESPACE, ]) ) { result = this.node(); const name = this.read_namespace_name(); - if (this.token != this.tok.T_DOUBLE_COLON && this.token != "(") { + if ( + this.token != this.tok.T_DOUBLE_COLON && + this.token != "(" && + ["parentreference", "selfreference"].indexOf(name.kind) === -1 + ) { // @see parser.js line 130 : resolves a conflict with scalar const literal = name.name.toLowerCase(); if (literal === "true") { - result = result("boolean", true, name.name); + result = name.destroy(result("boolean", true, name.name)); } else if (literal === "false") { - result = result("boolean", false, name.name); + result = name.destroy(result("boolean", false, name.name)); + } else if (literal === "null") { + result = name.destroy(result("nullkeyword", name.name)); } else { - // @todo null keyword ? - result = result("constref", name); + result.destroy(name); + result = name; } } else { // @fixme possible #193 bug + result.destroy(name); result = name; } } else if (this.token === this.tok.T_STATIC) { - result = this.node("constref"); + result = this.node("staticreference"); + const raw = this.text(); this.next(); - result = result("static"); + result = result(raw); } else { this.expect("VARIABLE"); } @@ -75,24 +86,30 @@ module.exports = { }, // resolves a static call - read_static_getter: function(what, encapsed) { + read_static_getter: function (what, encapsed) { const result = this.node("staticlookup"); let offset, name; if (this.next().is([this.tok.T_VARIABLE, "$"])) { - offset = this.read_reference_variable(encapsed, false); + offset = this.read_reference_variable(encapsed); } else if ( this.token === this.tok.T_STRING || this.token === this.tok.T_CLASS || - (this.php7 && this.is("IDENTIFIER")) + (this.version >= 700 && this.is("IDENTIFIER")) ) { - offset = this.node("constref"); + offset = this.node("identifier"); name = this.text(); this.next(); offset = offset(name); + } else if (this.token === "{") { + offset = this.node("literal"); + name = this.next().read_expr(); + this.expect("}") && this.next(); + offset = offset("literal", name, null); + this.expect("("); } else { this.error([this.tok.T_VARIABLE, this.tok.T_STRING]); // graceful mode : set getter as error node and continue - offset = this.node("constref"); + offset = this.node("identifier"); name = this.text(); this.next(); offset = offset(name); @@ -100,13 +117,61 @@ module.exports = { return result(what, offset); }, - recursive_variable_chain_scan: function( - result, - read_only, - encapsed, - dereferencable - ) { - let name, node, offset; + read_what: function (is_static_lookup = false) { + let what = null; + let name = null; + switch (this.next().token) { + case this.tok.T_STRING: + what = this.node("identifier"); + name = this.text(); + this.next(); + what = what(name); + + if (is_static_lookup && this.token === this.tok.T_OBJECT_OPERATOR) { + this.error(); + } + break; + case this.tok.T_VARIABLE: + what = this.node("variable"); + name = this.text().substring(1); + this.next(); + what = what(name, false); + break; + case "$": + what = this.node(); + this.next().expect(["$", "{", this.tok.T_VARIABLE]); + if (this.token === "{") { + // $obj->${$varname} + name = this.next().read_expr(); + this.expect("}") && this.next(); + what = what("variable", name, true); + } else { + // $obj->$$varname + name = this.read_expr(); + what = what("variable", name, false); + } + break; + case "{": + what = this.node("encapsedpart"); + name = this.next().read_expr(); + this.expect("}") && this.next(); + what = what(name, "complex", false); + break; + default: + this.error([this.tok.T_STRING, this.tok.T_VARIABLE, "$", "{"]); + // graceful mode : set what as error mode & continue + what = this.node("identifier"); + name = this.text(); + this.next(); + what = what(name); + break; + } + + return what; + }, + + recursive_variable_chain_scan: function (result, read_only, encapsed) { + let node, offset; recursive_scan_loop: while (this.token != this.EOF) { switch (this.token) { case "(": @@ -114,122 +179,60 @@ module.exports = { // @fixme : add more informations & test return result; } else { - result = this.node("call")( - result, - this.read_function_argument_list() - ); + result = this.node("call")(result, this.read_argument_list()); } break; case "[": + case "{": { + const backet = this.token; + const isSquareBracket = backet === "["; node = this.node("offsetlookup"); this.next(); offset = false; if (encapsed) { offset = this.read_encaps_var_offset(); - this.expect("]") && this.next(); + this.expect(isSquareBracket ? "]" : "}") && this.next(); } else { + const isCallableVariable = isSquareBracket + ? this.token !== "]" + : this.token !== "}"; // callable_variable : https://github.com/php/php-src/blob/493524454d66adde84e00d249d607ecd540de99f/Zend/zend_language_parser.y#L1122 - if (this.token !== "]") { + if (isCallableVariable) { offset = this.read_expr(); - this.expect("]") && this.next(); + this.expect(isSquareBracket ? "]" : "}") && this.next(); } else { this.next(); } } result = node(result, offset); break; + } case this.tok.T_DOUBLE_COLON: // @see https://github.com/glayzzle/php-parser/issues/107#issuecomment-354104574 - if (result.kind === "staticlookup") { + if ( + result.kind === "staticlookup" && + result.offset.kind === "identifier" + ) { this.error(); } node = this.node("staticlookup"); - if ( - this.next().token === this.tok.T_STRING || - (this.php7 && this.is("IDENTIFIER")) - ) { - offset = this.node("constref"); - name = this.text(); - this.next(); - offset = offset(name); + result = node(result, this.read_what(true)); - if (this.token === this.tok.T_OBJECT_OPERATOR) { - this.error(); - } - } else { - this.error(this.tok.T_STRING); - // fallback on a constref node - offset = this.node("constref")(this.text()); - this.next(); - } - result = node(result, offset); + // fix 185 // static lookup dereferencables are limited to staticlookup over functions - if (dereferencable && this.token !== "(") { + /*if (dereferencable && this.token !== "(") { this.error("("); - } + }*/ break; case this.tok.T_OBJECT_OPERATOR: { node = this.node("propertylookup"); - let what = null; - switch (this.next().token) { - case this.tok.T_STRING: - what = this.node("constref"); - name = this.text(); - this.next(); - what = what(name); - if (this.token === this.tok.T_VARIABLE) { - const inner = this.node("variable"); - name = this.text().substring(1); - this.next(); - what = this.node("encapsed")( - [what, inner(name, false, false)], - null, - "offset" - ); - if (what.loc && what.value[0].loc) { - what.loc.start = what.value[0].loc.start; - } - } else if (this.token === "{") { - const expr = this.next().read_expr(); - this.expect("}") && this.next(); - what = this.node("encapsed")([what, expr], null, "offset"); - if (what.loc && what.value[0].loc) { - what.loc.start = what.value[0].loc.start; - } - } - break; - case this.tok.T_VARIABLE: - what = this.node("variable"); - name = this.text().substring(1); - this.next(); - what = what(name, false, false); - break; - case "$": - this.next().expect(["{", this.tok.T_VARIABLE]); - if (this.token === "{") { - // $obj->${$varname} - what = this.next().read_expr(); - this.expect("}") && this.next(); - } else { - // $obj->$$varname - what = this.read_expr(); - } - break; - case "{": - what = this.next().read_expr(); - this.expect("}") && this.next(); - break; - default: - this.error([this.tok.T_STRING, this.tok.T_VARIABLE]); - // graceful mode : set what as error mode & continue - what = this.node("constref"); - name = this.text(); - this.next(); - what = what(name); - break; - } - result = node(result, what); + result = node(result, this.read_what()); + break; + } + case this.tok.T_NULLSAFE_OBJECT_OPERATOR: { + node = this.node("nullsafepropertylookup"); + result = node(result, this.read_what()); break; } default: @@ -238,37 +241,43 @@ module.exports = { } return result; }, - /** + /* * https://github.com/php/php-src/blob/493524454d66adde84e00d249d607ecd540de99f/Zend/zend_language_parser.y#L1231 */ - read_encaps_var_offset: function() { + read_encaps_var_offset: function () { let offset = this.node(); if (this.token === this.tok.T_STRING) { const text = this.text(); this.next(); - offset = offset("constref", text); + offset = offset("identifier", text); } else if (this.token === this.tok.T_NUM_STRING) { const num = this.text(); this.next(); offset = offset("number", num, null); + } else if (this.token === "-") { + this.next(); + const num = -1 * this.text(); + this.expect(this.tok.T_NUM_STRING) && this.next(); + offset = offset("number", num, null); } else if (this.token === this.tok.T_VARIABLE) { const name = this.text().substring(1); this.next(); - offset = offset("variable", name, false, false); + offset = offset("variable", name, false); } else { this.expect([ this.tok.T_STRING, this.tok.T_NUM_STRING, - this.tok.T_VARIABLE + "-", + this.tok.T_VARIABLE, ]); - // fallback : consider as constref + // fallback : consider as identifier const text = this.text(); this.next(); - offset = offset("constref", text); + offset = offset("identifier", text); } return offset; }, - /** + /* * ```ebnf * reference_variable ::= simple_variable ('[' OFFSET ']')* | '{' EXPR '}' * ``` @@ -279,21 +288,13 @@ module.exports = { * $foo[123]{1}; // gets the 2nd char from the 123 array entry * */ - read_reference_variable: function(encapsed, byref) { - let result = this.read_simple_variable(byref); + read_reference_variable: function (encapsed) { + let result = this.read_simple_variable(); let offset; while (this.token != this.EOF) { const node = this.node(); - if (this.token == "[") { - offset = null; - if (encapsed) { - offset = this.next().read_encaps_var_offset(); - } else { - offset = this.next().token === "]" ? null : this.read_dim_offset(); - } - this.expect("]") && this.next(); - result = node("offsetlookup", result, offset); - } else if (this.token == "{" && !encapsed) { + if (this.token == "{" && !encapsed) { + // @fixme check coverage, not sure thats working offset = this.next().read_expr(); this.expect("}") && this.next(); result = node("offsetlookup", result, offset); @@ -304,12 +305,12 @@ module.exports = { } return result; }, - /** + /* * ```ebnf * simple_variable ::= T_VARIABLE | '$' '{' expr '}' | '$' simple_variable * ``` */ - read_simple_variable: function(byref) { + read_simple_variable: function () { let result = this.node("variable"); let name; if ( @@ -319,7 +320,7 @@ module.exports = { // plain variable name name = this.text().substring(1); this.next(); - result = result(name, byref, false); + result = result(name, false); } else { if (this.token === "$") this.next(); // dynamic variable name @@ -327,18 +328,18 @@ module.exports = { case "{": { const expr = this.next().read_expr(); this.expect("}") && this.next(); - result = result(expr, byref, true); + result = result(expr, true); break; } case "$": // $$$var - result = result(this.read_simple_variable(false), byref); + result = result(this.read_simple_variable(), false); break; case this.tok.T_VARIABLE: { // $$var name = this.text().substring(1); const node = this.node("variable"); this.next(); - result = result(node(name, false, false), byref, false); + result = result(node(name, false), false); break; } default: @@ -346,9 +347,9 @@ module.exports = { // graceful mode name = this.text(); this.next(); - result = result(name, byref, false); + result = result(name, false); } } return result; - } + }, }; diff --git a/src/tokens.js b/src/tokens.js index d4ccadd3b..fbb5e220c 100644 --- a/src/tokens.js +++ b/src/tokens.js @@ -5,279 +5,173 @@ */ "use strict"; +/** + * @readonly + * @memberOf module:php-parser + * + * @enum {number} + **/ +const TokenNames = { + T_HALT_COMPILER: 101, + T_USE: 102, + T_ENCAPSED_AND_WHITESPACE: 103, + T_OBJECT_OPERATOR: 104, + T_STRING: 105, + T_DOLLAR_OPEN_CURLY_BRACES: 106, + T_STRING_VARNAME: 107, + T_CURLY_OPEN: 108, + T_NUM_STRING: 109, + T_ISSET: 110, + T_EMPTY: 111, + T_INCLUDE: 112, + T_INCLUDE_ONCE: 113, + T_EVAL: 114, + T_REQUIRE: 115, + T_REQUIRE_ONCE: 116, + T_NAMESPACE: 117, + T_NS_SEPARATOR: 118, + T_AS: 119, + T_IF: 120, + T_ENDIF: 121, + T_WHILE: 122, + T_DO: 123, + T_FOR: 124, + T_SWITCH: 125, + T_BREAK: 126, + T_CONTINUE: 127, + T_RETURN: 128, + T_GLOBAL: 129, + T_STATIC: 130, + T_ECHO: 131, + T_INLINE_HTML: 132, + T_UNSET: 133, + T_FOREACH: 134, + T_DECLARE: 135, + T_TRY: 136, + T_THROW: 137, + T_GOTO: 138, + T_FINALLY: 139, + T_CATCH: 140, + T_ENDDECLARE: 141, + T_LIST: 142, + T_CLONE: 143, + T_PLUS_EQUAL: 144, + T_MINUS_EQUAL: 145, + T_MUL_EQUAL: 146, + T_DIV_EQUAL: 147, + T_CONCAT_EQUAL: 148, + T_MOD_EQUAL: 149, + T_AND_EQUAL: 150, + T_OR_EQUAL: 151, + T_XOR_EQUAL: 152, + T_SL_EQUAL: 153, + T_SR_EQUAL: 154, + T_INC: 155, + T_DEC: 156, + T_BOOLEAN_OR: 157, + T_BOOLEAN_AND: 158, + T_LOGICAL_OR: 159, + T_LOGICAL_AND: 160, + T_LOGICAL_XOR: 161, + T_SL: 162, + T_SR: 163, + T_IS_IDENTICAL: 164, + T_IS_NOT_IDENTICAL: 165, + T_IS_EQUAL: 166, + T_IS_NOT_EQUAL: 167, + T_IS_SMALLER_OR_EQUAL: 168, + T_IS_GREATER_OR_EQUAL: 169, + T_INSTANCEOF: 170, + T_INT_CAST: 171, + T_DOUBLE_CAST: 172, + T_STRING_CAST: 173, + T_ARRAY_CAST: 174, + T_OBJECT_CAST: 175, + T_BOOL_CAST: 176, + T_UNSET_CAST: 177, + T_EXIT: 178, + T_PRINT: 179, + T_YIELD: 180, + T_YIELD_FROM: 181, + T_FUNCTION: 182, + T_DOUBLE_ARROW: 183, + T_DOUBLE_COLON: 184, + T_ARRAY: 185, + T_CALLABLE: 186, + T_CLASS: 187, + T_ABSTRACT: 188, + T_TRAIT: 189, + T_FINAL: 190, + T_EXTENDS: 191, + T_INTERFACE: 192, + T_IMPLEMENTS: 193, + T_VAR: 194, + T_PUBLIC: 195, + T_PROTECTED: 196, + T_PRIVATE: 197, + T_CONST: 198, + T_NEW: 199, + T_INSTEADOF: 200, + T_ELSEIF: 201, + T_ELSE: 202, + T_ENDSWITCH: 203, + T_CASE: 204, + T_DEFAULT: 205, + T_ENDFOR: 206, + T_ENDFOREACH: 207, + T_ENDWHILE: 208, + T_CONSTANT_ENCAPSED_STRING: 209, + T_LNUMBER: 210, + T_DNUMBER: 211, + T_LINE: 212, + T_FILE: 213, + T_DIR: 214, + T_TRAIT_C: 215, + T_METHOD_C: 216, + T_FUNC_C: 217, + T_NS_C: 218, + T_START_HEREDOC: 219, + T_END_HEREDOC: 220, + T_CLASS_C: 221, + T_VARIABLE: 222, + T_OPEN_TAG: 223, + T_OPEN_TAG_WITH_ECHO: 224, + T_CLOSE_TAG: 225, + T_WHITESPACE: 226, + T_COMMENT: 227, + T_DOC_COMMENT: 228, + T_ELLIPSIS: 229, + T_COALESCE: 230, + T_POW: 231, + T_POW_EQUAL: 232, + T_SPACESHIP: 233, + T_COALESCE_EQUAL: 234, + T_FN: 235, + T_NULLSAFE_OBJECT_OPERATOR: 236, + T_MATCH: 237, + T_ATTRIBUTE: 238, + T_ENUM: 239, + T_READ_ONLY: 240, + T_NAME_RELATIVE: 241, + T_NAME_QUALIFIED: 242, + T_NAME_FULLY_QUALIFIED: 243, +}; + /** * PHP AST Tokens - * @type {Object} + * @readonly + * @memberOf module:php-parser + * + * @type {object} + * @property {Object.} values + * @property {TokenNames} names */ -module.exports = { - values: { - 101: "T_HALT_COMPILER", - 102: "T_USE", - 103: "T_ENCAPSED_AND_WHITESPACE", - 104: "T_OBJECT_OPERATOR", - 105: "T_STRING", - 106: "T_DOLLAR_OPEN_CURLY_BRACES", - 107: "T_STRING_VARNAME", - 108: "T_CURLY_OPEN", - 109: "T_NUM_STRING", - 110: "T_ISSET", - 111: "T_EMPTY", - 112: "T_INCLUDE", - 113: "T_INCLUDE_ONCE", - 114: "T_EVAL", - 115: "T_REQUIRE", - 116: "T_REQUIRE_ONCE", - 117: "T_NAMESPACE", - 118: "T_NS_SEPARATOR", - 119: "T_AS", - 120: "T_IF", - 121: "T_ENDIF", - 122: "T_WHILE", - 123: "T_DO", - 124: "T_FOR", - 125: "T_SWITCH", - 126: "T_BREAK", - 127: "T_CONTINUE", - 128: "T_RETURN", - 129: "T_GLOBAL", - 130: "T_STATIC", - 131: "T_ECHO", - 132: "T_INLINE_HTML", - 133: "T_UNSET", - 134: "T_FOREACH", - 135: "T_DECLARE", - 136: "T_TRY", - 137: "T_THROW", - 138: "T_GOTO", - 139: "T_FINALLY", - 140: "T_CATCH", - 141: "T_ENDDECLARE", - 142: "T_LIST", - 143: "T_CLONE", - 144: "T_PLUS_EQUAL", - 145: "T_MINUS_EQUAL", - 146: "T_MUL_EQUAL", - 147: "T_DIV_EQUAL", - 148: "T_CONCAT_EQUAL", - 149: "T_MOD_EQUAL", - 150: "T_AND_EQUAL", - 151: "T_OR_EQUAL", - 152: "T_XOR_EQUAL", - 153: "T_SL_EQUAL", - 154: "T_SR_EQUAL", - 155: "T_INC", - 156: "T_DEC", - 157: "T_BOOLEAN_OR", - 158: "T_BOOLEAN_AND", - 159: "T_LOGICAL_OR", - 160: "T_LOGICAL_AND", - 161: "T_LOGICAL_XOR", - 162: "T_SL", - 163: "T_SR", - 164: "T_IS_IDENTICAL", - 165: "T_IS_NOT_IDENTICAL", - 166: "T_IS_EQUAL", - 167: "T_IS_NOT_EQUAL", - 168: "T_IS_SMALLER_OR_EQUAL", - 169: "T_IS_GREATER_OR_EQUAL", - 170: "T_INSTANCEOF", - 171: "T_INT_CAST", - 172: "T_DOUBLE_CAST", - 173: "T_STRING_CAST", - 174: "T_ARRAY_CAST", - 175: "T_OBJECT_CAST", - 176: "T_BOOL_CAST", - 177: "T_UNSET_CAST", - 178: "T_EXIT", - 179: "T_PRINT", - 180: "T_YIELD", - 181: "T_YIELD_FROM", - 182: "T_FUNCTION", - 183: "T_DOUBLE_ARROW", - 184: "T_DOUBLE_COLON", - 185: "T_ARRAY", - 186: "T_CALLABLE", - 187: "T_CLASS", - 188: "T_ABSTRACT", - 189: "T_TRAIT", - 190: "T_FINAL", - 191: "T_EXTENDS", - 192: "T_INTERFACE", - 193: "T_IMPLEMENTS", - 194: "T_VAR", - 195: "T_PUBLIC", - 196: "T_PROTECTED", - 197: "T_PRIVATE", - 198: "T_CONST", - 199: "T_NEW", - 200: "T_INSTEADOF", - 201: "T_ELSEIF", - 202: "T_ELSE", - 203: "T_ENDSWITCH", - 204: "T_CASE", - 205: "T_DEFAULT", - 206: "T_ENDFOR", - 207: "T_ENDFOREACH", - 208: "T_ENDWHILE", - 209: "T_CONSTANT_ENCAPSED_STRING", - 210: "T_LNUMBER", - 211: "T_DNUMBER", - 212: "T_LINE", - 213: "T_FILE", - 214: "T_DIR", - 215: "T_TRAIT_C", - 216: "T_METHOD_C", - 217: "T_FUNC_C", - 218: "T_NS_C", - 219: "T_START_HEREDOC", - 220: "T_END_HEREDOC", - 221: "T_CLASS_C", - 222: "T_VARIABLE", - 223: "T_OPEN_TAG", - 224: "T_OPEN_TAG_WITH_ECHO", - 225: "T_CLOSE_TAG", - 226: "T_WHITESPACE", - 227: "T_COMMENT", - 228: "T_DOC_COMMENT", - 229: "T_ELLIPSIS", - 230: "T_COALESCE", - 231: "T_POW", - 232: "T_POW_EQUAL", - 233: "T_SPACESHIP" - }, - names: { - T_HALT_COMPILER: 101, - T_USE: 102, - T_ENCAPSED_AND_WHITESPACE: 103, - T_OBJECT_OPERATOR: 104, - T_STRING: 105, - T_DOLLAR_OPEN_CURLY_BRACES: 106, - T_STRING_VARNAME: 107, - T_CURLY_OPEN: 108, - T_NUM_STRING: 109, - T_ISSET: 110, - T_EMPTY: 111, - T_INCLUDE: 112, - T_INCLUDE_ONCE: 113, - T_EVAL: 114, - T_REQUIRE: 115, - T_REQUIRE_ONCE: 116, - T_NAMESPACE: 117, - T_NS_SEPARATOR: 118, - T_AS: 119, - T_IF: 120, - T_ENDIF: 121, - T_WHILE: 122, - T_DO: 123, - T_FOR: 124, - T_SWITCH: 125, - T_BREAK: 126, - T_CONTINUE: 127, - T_RETURN: 128, - T_GLOBAL: 129, - T_STATIC: 130, - T_ECHO: 131, - T_INLINE_HTML: 132, - T_UNSET: 133, - T_FOREACH: 134, - T_DECLARE: 135, - T_TRY: 136, - T_THROW: 137, - T_GOTO: 138, - T_FINALLY: 139, - T_CATCH: 140, - T_ENDDECLARE: 141, - T_LIST: 142, - T_CLONE: 143, - T_PLUS_EQUAL: 144, - T_MINUS_EQUAL: 145, - T_MUL_EQUAL: 146, - T_DIV_EQUAL: 147, - T_CONCAT_EQUAL: 148, - T_MOD_EQUAL: 149, - T_AND_EQUAL: 150, - T_OR_EQUAL: 151, - T_XOR_EQUAL: 152, - T_SL_EQUAL: 153, - T_SR_EQUAL: 154, - T_INC: 155, - T_DEC: 156, - T_BOOLEAN_OR: 157, - T_BOOLEAN_AND: 158, - T_LOGICAL_OR: 159, - T_LOGICAL_AND: 160, - T_LOGICAL_XOR: 161, - T_SL: 162, - T_SR: 163, - T_IS_IDENTICAL: 164, - T_IS_NOT_IDENTICAL: 165, - T_IS_EQUAL: 166, - T_IS_NOT_EQUAL: 167, - T_IS_SMALLER_OR_EQUAL: 168, - T_IS_GREATER_OR_EQUAL: 169, - T_INSTANCEOF: 170, - T_INT_CAST: 171, - T_DOUBLE_CAST: 172, - T_STRING_CAST: 173, - T_ARRAY_CAST: 174, - T_OBJECT_CAST: 175, - T_BOOL_CAST: 176, - T_UNSET_CAST: 177, - T_EXIT: 178, - T_PRINT: 179, - T_YIELD: 180, - T_YIELD_FROM: 181, - T_FUNCTION: 182, - T_DOUBLE_ARROW: 183, - T_DOUBLE_COLON: 184, - T_ARRAY: 185, - T_CALLABLE: 186, - T_CLASS: 187, - T_ABSTRACT: 188, - T_TRAIT: 189, - T_FINAL: 190, - T_EXTENDS: 191, - T_INTERFACE: 192, - T_IMPLEMENTS: 193, - T_VAR: 194, - T_PUBLIC: 195, - T_PROTECTED: 196, - T_PRIVATE: 197, - T_CONST: 198, - T_NEW: 199, - T_INSTEADOF: 200, - T_ELSEIF: 201, - T_ELSE: 202, - T_ENDSWITCH: 203, - T_CASE: 204, - T_DEFAULT: 205, - T_ENDFOR: 206, - T_ENDFOREACH: 207, - T_ENDWHILE: 208, - T_CONSTANT_ENCAPSED_STRING: 209, - T_LNUMBER: 210, - T_DNUMBER: 211, - T_LINE: 212, - T_FILE: 213, - T_DIR: 214, - T_TRAIT_C: 215, - T_METHOD_C: 216, - T_FUNC_C: 217, - T_NS_C: 218, - T_START_HEREDOC: 219, - T_END_HEREDOC: 220, - T_CLASS_C: 221, - T_VARIABLE: 222, - T_OPEN_TAG: 223, - T_OPEN_TAG_WITH_ECHO: 224, - T_CLOSE_TAG: 225, - T_WHITESPACE: 226, - T_COMMENT: 227, - T_DOC_COMMENT: 228, - T_ELLIPSIS: 229, - T_COALESCE: 230, - T_POW: 231, - T_POW_EQUAL: 232, - T_SPACESHIP: 233 - } +const tokens = { + values: Object.entries(TokenNames).reduce( + (result, [key, value]) => ({ ...result, [value]: key }), + {}, + ), + names: TokenNames, }; + +module.exports = Object.freeze(tokens); diff --git a/test/ast.test.js b/test/ast.test.js new file mode 100644 index 000000000..863f6f1df --- /dev/null +++ b/test/ast.test.js @@ -0,0 +1,45 @@ +const parser = require("./main"); + +describe("Test AST class (edge cases)", function () { + it("test source without location", function () { + const test = parser.create({ + ast: { + withPositions: false, + withSource: true, + }, + }); + const ast = test.parseEval("echo $foo;"); + const echo = ast.children[0]; + expect(echo.loc.source).toBe("echo $foo;"); + expect(echo.loc.start).not.toBeNull(); + expect(echo.loc.end).not.toBeNull(); + + const variable = echo.expressions[0]; + expect(variable.loc.source).toBe("$foo"); + }); + it("test undefined node", function () { + const test = parser.create(); + expect(() => { + const node = test.parser.node("foo"); + node(); + }).toThrow(/foo/); + }); + it("test debug mode", function () { + const test = parser.create({ + parser: { + debug: true, + }, + }); + test.parseEval("1 + 1;"); + }); + it("test debug mode / errors", function () { + const test = parser.create({ + parser: { + debug: true, + }, + }); + expect(() => { + test.parseEval("1 + ;"); + }).toThrow(); + }); +}); diff --git a/test/benchmark.js b/test/benchmark.js new file mode 100644 index 000000000..8cf22c747 --- /dev/null +++ b/test/benchmark.js @@ -0,0 +1,31 @@ +const parser = require("./main"); +const Benchmark = require("benchmark"); +const suite = new Benchmark.Suite(); + +const code = ` + { + console.log(String(event.target)); +}); +suite.run(); diff --git a/test/benchmark2.js b/test/benchmark2.js new file mode 100644 index 000000000..d03e6cee7 --- /dev/null +++ b/test/benchmark2.js @@ -0,0 +1,18 @@ +const parser = require("./main"); + +const code = ` + 123; +} +`, + { + parser: { + debug: true, + extractDoc: true, + }, + ast: { + withPositions: true, + withSource: true, + }, + }, +); +console.log(util.inspect(ast, false, 10, true)); diff --git a/test/location.test.js b/test/location.test.js index b0206adae..ef30e626b 100644 --- a/test/location.test.js +++ b/test/location.test.js @@ -1,140 +1,140 @@ -var parser = require("./main"); +const parser = require("./main"); -describe("Test offsets", function() { +describe("Test offsets", function () { // init a new parser instance - var test = parser.create({ + const test = parser.create({ ast: { withPositions: true, - withSource: true + withSource: true, }, parser: { - extractDoc: true + extractDoc: true, // debug: true }, lexer: { // debug: true - } + }, }); - var lines = ["// a comment", 'echo "string";', "$a = true;"]; - var text = lines.join("\r\n"); - var ast = test.parseEval(text); + const lines = ["// a comment", 'echo "string";', "$a = true;"]; + const text = lines.join("\r\n"); + const ast = test.parseEval(text); - describe("to program node", function() { - it("test line", function() { + describe("to program node", function () { + it("test line", function () { expect(ast.loc.start.line).toBe(1); expect(ast.loc.end.line).toBe(lines.length); }); - it("test column", function() { + it("test column", function () { expect(ast.loc.start.column).toBe(0); expect(ast.loc.end.column).toBe(lines[lines.length - 1].length); }); - it("test offsets", function() { + it("test offsets", function () { expect(ast.loc.start.offset).toBe(0); expect(ast.loc.end.offset).toBe(text.length); }); }); - describe("to comment node", function() { - it("test line", function() { + describe("to comment node", function () { + it("test line", function () { expect(ast.comments[0].loc.start.line).toBe(1); expect(ast.comments[0].loc.end.line).toBe(2); }); - it("test column", function() { + it("test column", function () { expect(ast.comments[0].loc.start.column).toBe(0); expect(ast.comments[0].loc.end.column).toBe(0); }); - it("test offsets", function() { + it("test offsets", function () { expect(ast.comments[0].loc.start.offset).toBe(0); expect(ast.comments[0].loc.end.offset).toBe(lines[0].length + 2); - expect(ast.comments[0].loc.source).toBe(lines[0] + '\r\n'); + expect(ast.comments[0].loc.source).toBe(lines[0] + "\r\n"); }); }); - describe("on echo node", function() { - it("test line", function() { + describe("on echo node", function () { + it("test line", function () { expect(ast.children[0].loc.start.line).toBe(2); expect(ast.children[0].loc.end.line).toBe(2); }); - it("test column", function() { + it("test column", function () { expect(ast.children[0].loc.start.column).toBe(0); expect(ast.children[0].loc.end.column).toBe(14); }); - it("test offsets", function() { + it("test offsets", function () { expect(ast.children[0].loc.start.offset).toBe(14); expect(ast.children[0].loc.end.offset).toBe(28); expect(ast.children[0].loc.source).toBe(lines[1]); }); }); - describe("on text node", function() { - const arg = ast.children[0].arguments[0]; - it("test line", function() { + describe("on text node", function () { + const arg = ast.children[0].expressions[0]; + it("test line", function () { expect(arg.loc.start.line).toBe(2); expect(arg.loc.end.line).toBe(2); }); - it("test column", function() { + it("test column", function () { expect(arg.loc.start.column).toBe(5); expect(arg.loc.end.column).toBe(13); }); - it("test offsets", function() { + it("test offsets", function () { expect(arg.loc.source).toBe('"string"'); }); }); - describe("on assign node", function() { - it("test line", function() { + describe("on assign node", function () { + it("test line", function () { expect(ast.children[1].loc.start.line).toBe(3); expect(ast.children[1].loc.end.line).toBe(3); }); - it("test column", function() { + it("test column", function () { expect(ast.children[1].loc.start.column).toBe(0); // ignored ';' because it was eaten by expr and assign // was retrieved by expr_item without it expect(ast.children[1].loc.end.column).toBe(10); }); - it("test offsets", function() { + it("test offsets", function () { expect(ast.children[1].loc.source).toBe(lines[2].substring(0, 10)); }); }); - describe("on variable node", function() { + describe("on variable node", function () { const node = ast.children[1].expression.left; - it("test line", function() { + it("test line", function () { expect(node.loc.start.line).toBe(3); expect(node.loc.end.line).toBe(3); }); - it("test column", function() { + it("test column", function () { expect(node.loc.start.column).toBe(0); expect(node.loc.end.column).toBe(2); }); - it("test offsets", function() { + it("test offsets", function () { expect(node.loc.source).toBe("$a"); }); }); - describe("on boolean node", function() { + describe("on boolean node", function () { const node = ast.children[1].expression.right; - it("test line", function() { + it("test line", function () { expect(node.loc.start.line).toBe(3); expect(node.loc.end.line).toBe(3); }); - it("test column", function() { + it("test column", function () { expect(node.loc.start.column).toBe(5); expect(node.loc.end.column).toBe(9); }); - it("test offsets", function() { + it("test offsets", function () { expect(node.loc.source).toBe("true"); }); }); - describe("test block statements", function() { - it("test if", function() { - const ast = test.parseEval('if(true) {}\n//foo\necho $bar;'); + describe("test block statements", function () { + it("test if", function () { + const ast = test.parseEval("if(true) {}\n//foo\necho $bar;"); expect(ast.children[0].loc.start.line).toBe(1); expect(ast.children[0].loc.end.line).toBe(1); expect(ast.children[1].loc.start.line).toBe(3); expect(ast.children[1].loc.end.line).toBe(3); }); - }) + }); }); diff --git a/test/main.js b/test/main.js index 79f165adc..b5098f7b8 100644 --- a/test/main.js +++ b/test/main.js @@ -5,7 +5,7 @@ * @url http://glayzzle.com */ -var parser = require("../src/index"); +const parser = require("../src/index"); // @todo : move here the debug code // @todo : add an automated token check (with php7) module.exports = parser; diff --git a/test/perf.test.js b/test/perf.test.js deleted file mode 100644 index 66945efa0..000000000 --- a/test/perf.test.js +++ /dev/null @@ -1,117 +0,0 @@ -var parser = require("./main"); - -describe("Performance tests", function() { - var code = ` - 1000) { - speed = speed / 1000; - if (speed > 1000) { - speed = speed / 1000; - speed = Math.round(speed * 100) / 100 + "M"; - } else { - speed = Math.round(speed * 100) / 100 + "K"; - } - } - console.log(" + Tokens speed => " + speed + "/sec"); - - speed = 1000 / duration * (code.length * iter); - // speed.should.be.greaterThan(10e5 * 2 * 0.8); - - if (speed > 1024) { - speed = speed / 1024; - if (speed > 1024) { - speed = speed / 1024; - speed = Math.round(speed * 100) / 100 + "M"; - } else { - speed = Math.round(speed * 100) / 100 + "K"; - } - } - console.log(" + Reading speed => " + speed + "/sec"); - }); - - it("parser", function() { - var reader = new parser(); - var nodeSize = 0; - var countNode = function(node) { - nodeSize++; - for (var k in node) { - if (node[k]) { - if (node[k].kind) { - countNode(node[k]); - } else if (Array.isArray(node[k])) { - for (var i = 0; i < node[k].length; i++) { - if (node[k][i] && node[k][i].kind) { - countNode(node[k][i]); - } - } - } - } - } - }; - countNode(reader.parseCode(code)); - - var hrTime = process.hrtime(); - var iter = 100; - var start = hrTime[0] * 1000000 + hrTime[1] / 1000; - for (var i = 0; i < iter; i++) { - reader.parseCode(code); - } - hrTime = process.hrtime(); - var end = hrTime[0] * 1000000 + hrTime[1] / 1000; - var duration = (end - start) / 1000; // in MS - var speed = 1000 / duration * (nodeSize * iter); - // speed.should.be.greaterThan(10e4); - - if (speed > 1000) { - speed = speed / 1000; - if (speed > 1000) { - speed = speed / 1000; - speed = Math.round(speed * 100) / 100 + "M"; - } else { - speed = Math.round(speed * 100) / 100 + "K"; - } - } - console.log(" + Nodes speed => " + speed + "/sec"); - - speed = 1000 / duration * (code.length * iter); - // speed.should.be.greaterThan(10e5 * 1 * 0.8); - - if (speed > 1024) { - speed = speed / 1024; - if (speed > 1024) { - speed = speed / 1024; - speed = Math.round(speed * 100) / 100 + "M"; - } else { - speed = Math.round(speed * 100) / 100 + "K"; - } - } - console.log(" + Overall speed => " + speed + "/sec"); - }); -}); diff --git a/test/precedence.test.js b/test/precedence.test.js index 4bc3eb900..50e60606e 100644 --- a/test/precedence.test.js +++ b/test/precedence.test.js @@ -1,126 +1,191 @@ -var parser = require("./main"); +const parser = require("./main"); /** * Check precedence by using parenthesis on node B */ -var checkPrecedence = function(a, b) { - if (!a || !b) - return false; - for (var k in b) { - if (k === 'parenthesizedExpression') continue; - if (b.hasOwnProperty(k)) { - if (!a.hasOwnProperty(k)) - return false; - if (typeof b[k] === "object") { - checkPrecedence(a[k], b[k]); - } else { - expect(a[k]).toEqual(b[k]); - } - } +function filterKey(fn, obj) { + if (Array.isArray(obj)) { + return obj.map((e) => filterKey(fn, e)); } - return true; -}; -var shouldBeSame = function(a, b) { - var ast = parser.parseEval([ - a + ";", - b + ";" - ].join("\n")); - let result = checkPrecedence(ast.children[0], ast.children[1]); - if (!result) { - console.log("Parsed :", ast.children[0]); - console.log("Expected :", ast.children[1]); + if (typeof obj === "object" && obj !== null) { + return Object.keys(obj) + .filter(fn) + .reduce( + (result, key) => ({ + ...result, + [key]: filterKey(fn, obj[key]), + }), + {}, + ); } - expect(result).toBeTruthy(); -}; + + return obj; +} + +function shouldBeSame(a, b) { + const fn = (key) => key !== "parenthesizedExpression"; + expect(filterKey(fn, parser.parseEval(a))).toEqual( + filterKey(fn, parser.parseEval(b)), + ); +} // START TESTS HERE -describe("Test precedence", function() { - it("test *", function() { + +describe("Test infrastructure", function () { + it("should filter parenthesizedExpression prop", function () { + const fn = (key) => key !== "parenthesizedExpression"; + expect( + filterKey(fn, { foo: "bar", parenthesizedExpression: true }), + ).toEqual({ foo: "bar" }); + expect( + filterKey(fn, { x: { foo: "bar", parenthesizedExpression: true } }), + ).toEqual({ x: { foo: "bar" } }); + expect( + filterKey(fn, [{ foo: "bar", parenthesizedExpression: true }]), + ).toEqual([{ foo: "bar" }]); + }); +}); + +describe("Test precedence", function () { + it("test *", function () { shouldBeSame("5 * 3 - 2", "(5 * 3) - 2"); shouldBeSame("2 - 5 * 3", "2 - (5 * 3)"); }); - it("test /", function() { + it("test /", function () { shouldBeSame("5 / 3 + 2", "(5 / 3) + 2"); shouldBeSame("5 + 3 / 2", "5 + (3 / 2)"); }); - it("test %", function() { + it("test %", function () { shouldBeSame("5 % 3 . 2", "(5 % 3) . 2"); }); - it("test instanceof", function() { - shouldBeSame("3 instanceof 2 * 5", "(3 instanceof 2) * 5"); + it("test instanceof", function () { + shouldBeSame("$a instanceof $b && $c", "($a instanceof $b) && $c"); }); - it("test <<", function() { + it("test <<", function () { shouldBeSame("1 + 3 << 5", "(1 + 3) << 5"); }); - it("test ==", function() { + it("test ==", function () { shouldBeSame("1 + 5 == 3", "(1 + 5 ) == 3"); }); - it("test &", function() { + it("test &", function () { shouldBeSame("1 == 2 & 3", "(1 == 2) & 3"); }); - it("test ^", function() { + it("test ^", function () { shouldBeSame("1 & 2 ^ 3", "(1 & 2) ^ 3"); }); - it("test |", function() { + it("test |", function () { shouldBeSame("1 ^ 2 | 3", "(1 ^ 2) | 3"); }); - it("test &&", function() { + it("test &&", function () { shouldBeSame("1 | 2 && 3", "(1 | 2) && 3"); }); - it("test ||", function() { + it("test ||", function () { shouldBeSame("1 && 2 || 3", "(1 && 2) || 3"); }); - it("test ??", function() { + it("test ??", function () { shouldBeSame("1 || 2 ?? 3", "(1 || 2) ?? 3"); }); - it("test ?:", function() { + it("test ?? right-associative", function () { + shouldBeSame("1 ?? 2 ?? 3", "1 ?? (2 ?? 3)"); + }); + it("test ?? precedence", function () { + shouldBeSame("1 ?? 2 and 3", "(1 ?? 2) and 3"); + }); + it("test ** precedence", function () { + shouldBeSame("1 ** 2 + 3", "(1 ** 2) + 3"); + }); + it("test ** right-associative", function () { + shouldBeSame("1 ** 2 ** 3", "1 ** (2 ** 3)"); + }); + it("test ?:", function () { shouldBeSame("1 ?? 2 ? 3 : 5", "(1 ?? 2) ? 3 : 5"); shouldBeSame("1 and 2 ? 3 : 5", "1 and (2 ? 3 : 5)"); }); - it("test =", function() { + it("test =", function () { shouldBeSame("5 + $a = 1", "5 + ($a = 1)"); shouldBeSame("5 XOR $a += 1", "5 XOR ($a += 1)"); }); - it("test OR", function() { + it("test OR", function () { shouldBeSame("5 XOR 4 OR 3", "(5 XOR 4) OR 3"); shouldBeSame("5 OR 4 XOR 3", "5 OR (4 XOR 3)"); }); - it("test XOR", function() { + it("test XOR", function () { shouldBeSame("5 AND 4 XOR 3", "(5 AND 4) XOR 3"); shouldBeSame("5 XOR 4 AND 3", "5 XOR (4 AND 3)"); }); - it("test AND", function() { + it("test AND", function () { shouldBeSame("5 + 4 AND 3", "(5 + 4) AND 3"); shouldBeSame("5 AND 4 + 3", "5 AND (4 + 3)"); }); - it("test unary : !", function() { - shouldBeSame("!4 instanceof 3", "(!4) instanceof 3"); - shouldBeSame("!4 + 5 instanceof 3", "(!4) + (5 instanceof 3)"); + it("test unary : !", function () { + shouldBeSame("!$a instanceof $b", "(!$a) instanceof $b"); + shouldBeSame("!$a + $b instanceof $c", "(!$a) + ($b instanceof $c)"); shouldBeSame("6 + !4 + 5", "6 + (!4) + 5"); shouldBeSame("if($a && !$b) {}", "if($a && (!$b)) {}"); }); - it("test concat", function() { + it("test concat", function () { shouldBeSame('"a"."b"."c"."d"', '((("a"."b")."c")."d")'); }); - it("test retif", function() { - shouldBeSame("$a ? 1 : $b ? 2 : $c ? 3 : 4", "(($a ? 1 : $b) ? 2 : $c) ? 3 : 4"); + it("test retif", function () { + shouldBeSame( + "$a ? 1 : $b ? 2 : $c ? 3 : 4", + "(($a ? 1 : $b) ? 2 : $c) ? 3 : 4", + ); }); - it("test + / *", function() { + it("test + / *", function () { shouldBeSame("1 + 2 * 3", "1 + (2 * 3)"); }); // https://github.com/glayzzle/php-parser/issues/81 - it("test assign with and", function() { + it("test assign with and", function () { shouldBeSame("$a and $b = $c and $d", "($a and ($b = $c)) and $d"); }); - it("test assign list", function() { + it("test assign list", function () { shouldBeSame("$a = $b = $c", "($a = ($b = $c))"); }); - it("test assign with &&", function() { + it("test assign with &&", function () { shouldBeSame("$a && $b = $c && $d", "$a && ($b = ($c && $d))"); }); - /*it("test cast", function() { + it("test static lookup offsets", function () { + shouldBeSame("(Foo::$bar)['baz']();", "Foo::$bar['baz']();"); + }); + it("test silent node / bin", function () { + shouldBeSame("@foo() || @foo();", "(@foo()) || (@foo());"); + }); + it("test silent node / div", function () { + shouldBeSame("@$i / 0;", "@($i) / 0;"); + }); + it("test silent node / retif", function () { + shouldBeSame("@$var ? 1 : 2;", "(@$var) ? 1 : 2;"); + }); + it("test silent node / ret if", function () { + shouldBeSame( + "@$i == true ? @$foo : @$bar;", + "@($i) == true ? @($foo) : @($bar);", + ); + }); + it("test silent node - bugfix #355", function () { + shouldBeSame( + "echo 'pre' . (@$_GET['foo'] === 'bar' ? 'ok' : 'ko') . 'post'", + "echo 'pre' . (@($_GET['foo']) === 'bar' ? 'ok' : 'ko') . 'post'", + ); + }); + it("test silent node - bugfix #356", function () { + shouldBeSame("@$var += 10", "@($var += 10)"); + }); + it("test silent node / cast", function () { + shouldBeSame("@(int)$i + 1;", "@((int)$i) + 1;"); + }); + it("test silent node / property lookup", function () { + shouldBeSame("@$foo->bar;", "@($foo)->bar;"); + }); + it("test cast", function () { shouldBeSame("$a = (string)$b . $c", "$a = ((string)$b) . $c"); shouldBeSame("$a = (string)$b->foo . $c", "$a = ((string)$b->foo) . $c"); - });*/ + shouldBeSame("(bool) $var ? 1 : 2;", "((bool)$var) ? 1 : 2;"); + }); + + it("test unary / retif", function () { + shouldBeSame("$a = +(+$var ? 1 : 2)", "$a = +((+$var) ? 1 : 2)"); + }); }); diff --git a/test/snapshot/__snapshots__/acid.test.js.snap b/test/snapshot/__snapshots__/acid.test.js.snap index 4a6a5c3a0..66955f4bb 100644 --- a/test/snapshot/__snapshots__/acid.test.js.snap +++ b/test/snapshot/__snapshots__/acid.test.js.snap @@ -2,7 +2,7 @@ exports[`Acid level 1 1`] = ` Program { - "children": Array [ + "children": [ Inline { "kind": "inline", "loc": Location { @@ -25,9 +25,9 @@ Program { ", }, Echo { - "arguments": Array [ + "expressions": [ Call { - "arguments": Array [], + "arguments": [], "kind": "call", "loc": Location { "end": Position { @@ -35,15 +35,15 @@ Program { "line": 2, "offset": 32, }, - "source": "()", + "source": "php_version()", "start": Position { - "column": 15, + "column": 4, "line": 2, - "offset": 30, + "offset": 19, }, }, - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "loc": Location { "end": Position { "column": 15, @@ -79,7 +79,59 @@ Program { "shortForm": true, }, Declare { - "children": Array [], + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 20, + "line": 4, + "offset": 63, + }, + "source": "strict_types", + "start": Position { + "column": 8, + "line": 4, + "offset": 51, + }, + }, + "name": "strict_types", + }, + "kind": "declaredirective", + "loc": Location { + "end": Position { + "column": 22, + "line": 4, + "offset": 65, + }, + "source": "strict_types=1", + "start": Position { + "column": 8, + "line": 4, + "offset": 51, + }, + }, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 22, + "line": 4, + "offset": 65, + }, + "source": "1", + "start": Position { + "column": 21, + "line": 4, + "offset": 64, + }, + }, + "value": "1", + }, + }, + ], "kind": "declare", "loc": Location { "end": Position { @@ -95,25 +147,6 @@ Program { }, }, "mode": "none", - "what": Object { - "strict_types": Number { - "kind": "number", - "loc": Location { - "end": Position { - "column": 22, - "line": 4, - "offset": 65, - }, - "source": "1", - "start": Position { - "column": 21, - "line": 4, - "offset": 64, - }, - }, - "value": "1", - }, - }, }, ExpressionStatement { "expression": Include { @@ -168,28 +201,9 @@ Program { "offset": 68, }, }, - "trailingComments": Array [ - CommentBlock { - "kind": "commentblock", - "loc": Location { - "end": Position { - "column": 46, - "line": 7, - "offset": 139, - }, - "source": "/** a comment before the namespace comment **/", - "start": Position { - "column": 0, - "line": 7, - "offset": 93, - }, - }, - "value": "/** a comment before the namespace comment **/", - }, - ], }, Namespace { - "children": Array [ + "children": [ Inline { "kind": "inline", "loc": Location { @@ -206,35 +220,14 @@ Program { }, }, "raw": "Hello", - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "loc": Location { - "end": Position { - "column": 0, - "line": 11, - "offset": 199, - }, - "source": "# single line comment -", - "start": Position { - "column": 2, - "line": 10, - "offset": 177, - }, - }, - "value": "# single line comment -", - }, - ], "value": "Hello", }, UseGroup { - "items": Array [ + "items": [ UseItem { "alias": null, "kind": "useitem", - "leadingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", "loc": Location { @@ -251,6 +244,7 @@ Program { "offset": 224, }, }, + "offset": 224, "value": "// sample code ", }, @@ -272,9 +266,25 @@ Program { "type": null, }, UseItem { - "alias": "fooBar", + "alias": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 17, + "line": 15, + "offset": 283, + }, + "source": "fooBar", + "start": Position { + "column": 11, + "line": 15, + "offset": 277, + }, + }, + "name": "fooBar", + }, "kind": "useitem", - "leadingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", "loc": Location { @@ -291,6 +301,7 @@ Program { "offset": 252, }, }, + "offset": 252, "value": "// with alias ", }, @@ -313,6 +324,28 @@ Program { }, ], "kind": "usegroup", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 11, + "offset": 199, + }, + "source": "# single line comment +", + "start": Position { + "column": 2, + "line": 10, + "offset": 177, + }, + }, + "offset": 177, + "value": "# single line comment +", + }, + ], "loc": Location { "end": Position { "column": 3, @@ -335,9 +368,25 @@ Program { "type": "function", }, UseGroup { - "items": Array [ + "items": [ UseItem { - "alias": "nsBar", + "alias": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 18, + "line": 17, + "offset": 307, + }, + "source": "nsBar", + "start": Position { + "column": 13, + "line": 17, + "offset": 302, + }, + }, + "name": "nsBar", + }, "kind": "useitem", "loc": Location { "end": Position { @@ -373,9 +422,64 @@ Program { "name": null, "type": null, }, - Constant { - "kind": "constant", - "leadingComments": Array [ + ConstantStatement { + "constants": [ + Constant { + "kind": "constant", + "loc": Location { + "end": Position { + "column": 28, + "line": 20, + "offset": 360, + }, + "source": "FOOBAR = 'foo & bar'", + "start": Position { + "column": 8, + "line": 20, + "offset": 340, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 14, + "line": 20, + "offset": 346, + }, + "source": "FOOBAR", + "start": Position { + "column": 8, + "line": 20, + "offset": 340, + }, + }, + "name": "FOOBAR", + }, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 28, + "line": 20, + "offset": 360, + }, + "source": "'foo & bar'", + "start": Position { + "column": 17, + "line": 20, + "offset": 349, + }, + }, + "raw": "'foo & bar'", + "unicode": false, + "value": "foo & bar", + }, + }, + ], + "kind": "constantstatement", + "leadingComments": [ CommentLine { "kind": "commentline", "loc": Location { @@ -392,47 +496,28 @@ Program { "offset": 312, }, }, + "offset": 312, "value": "// generic constant ", }, ], "loc": Location { "end": Position { - "column": 28, + "column": 29, "line": 20, - "offset": 360, + "offset": 361, }, - "source": "FOOBAR = 'foo & bar'", + "source": "const FOOBAR = 'foo & bar';", "start": Position { - "column": 8, + "column": 2, "line": 20, - "offset": 340, - }, - }, - "name": "FOOBAR", - "value": String { - "isDoubleQuote": false, - "kind": "string", - "loc": Location { - "end": Position { - "column": 28, - "line": 20, - "offset": 360, - }, - "source": "'foo & bar'", - "start": Position { - "column": 17, - "line": 20, - "offset": 349, - }, + "offset": 334, }, - "raw": "'foo & bar'", - "unicode": false, - "value": "foo & bar", }, }, Class { - "body": Array [ + "attrGroups": [], + "body": [ TraitUse { "adaptations": null, "kind": "traituse", @@ -442,16 +527,16 @@ Program { "line": 26, "offset": 455, }, - "source": "Line;", + "source": "use Line;", "start": Position { - "column": 8, + "column": 4, "line": 26, - "offset": 450, + "offset": 446, }, }, - "traits": Array [ - Identifier { - "kind": "identifier", + "traits": [ + Name { + "kind": "name", "loc": Location { "end": Position { "column": 12, @@ -471,11 +556,11 @@ Program { ], }, TraitUse { - "adaptations": Array [ + "adaptations": [ TraitPrecedence { - "instead": Array [ - Identifier { - "kind": "identifier", + "instead": [ + Name { + "kind": "name", "loc": Location { "end": Position { "column": 28, @@ -507,9 +592,25 @@ Program { "offset": 481, }, }, - "method": "baz", - "trait": Identifier { + "method": Identifier { "kind": "identifier", + "loc": Location { + "end": Position { + "column": 14, + "line": 28, + "offset": 489, + }, + "source": "baz", + "start": Position { + "column": 11, + "line": 28, + "offset": 486, + }, + }, + "name": "baz", + }, + "trait": Name { + "kind": "name", "loc": Location { "end": Position { "column": 9, @@ -528,7 +629,23 @@ Program { }, }, TraitAlias { - "as": "baz", + "as": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 21, + "line": 29, + "offset": 526, + }, + "source": "baz", + "start": Position { + "column": 18, + "line": 29, + "offset": 523, + }, + }, + "name": "baz", + }, "kind": "traitalias", "loc": Location { "end": Position { @@ -543,9 +660,25 @@ Program { "offset": 511, }, }, - "method": "foo", - "trait": Identifier { + "method": Identifier { "kind": "identifier", + "loc": Location { + "end": Position { + "column": 14, + "line": 29, + "offset": 519, + }, + "source": "foo", + "start": Position { + "column": 11, + "line": 29, + "offset": 516, + }, + }, + "name": "foo", + }, + "trait": Name { + "kind": "name", "loc": Location { "end": Position { "column": 9, @@ -572,19 +705,19 @@ Program { "line": 30, "offset": 533, }, - "source": "foo, bar { + "source": "use foo, bar { foo::baz insteadof bar; bar::foo as baz; }", "start": Position { - "column": 8, + "column": 4, "line": 27, - "offset": 464, + "offset": 460, }, }, - "traits": Array [ - Identifier { - "kind": "identifier", + "traits": [ + Name { + "kind": "name", "loc": Location { "end": Position { "column": 11, @@ -601,8 +734,8 @@ Program { "name": "foo", "resolution": "uqn", }, - Identifier { - "kind": "identifier", + Name { + "kind": "name", "loc": Location { "end": Position { "column": 16, @@ -622,9 +755,63 @@ Program { ], }, ClassConstant { - "isAbstract": false, - "isFinal": false, - "isStatic": false, + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "loc": Location { + "end": Position { + "column": 27, + "line": 31, + "offset": 561, + }, + "source": "FOOBAR = 'BARFOO'", + "start": Position { + "column": 10, + "line": 31, + "offset": 544, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 16, + "line": 31, + "offset": 550, + }, + "source": "FOOBAR", + "start": Position { + "column": 10, + "line": 31, + "offset": 544, + }, + }, + "name": "FOOBAR", + }, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 27, + "line": 31, + "offset": 561, + }, + "source": "'BARFOO'", + "start": Position { + "column": 19, + "line": 31, + "offset": 553, + }, + }, + "raw": "'BARFOO'", + "unicode": false, + "value": "BARFOO", + }, + }, + ], + "final": false, "kind": "classconstant", "loc": Location { "end": Position { @@ -639,34 +826,13 @@ Program { "offset": 544, }, }, - "name": "FOOBAR", - "value": String { - "isDoubleQuote": false, - "kind": "string", - "loc": Location { - "end": Position { - "column": 27, - "line": 31, - "offset": 561, - }, - "source": "'BARFOO'", - "start": Position { - "column": 19, - "line": 31, - "offset": 553, - }, - }, - "raw": "'BARFOO'", - "unicode": false, - "value": "BARFOO", - }, + "nullable": false, + "type": null, "visibility": "", }, - Property { - "isAbstract": false, - "isFinal": false, + PropertyStatement { "isStatic": false, - "kind": "property", + "kind": "propertystatement", "loc": Location { "end": Position { "column": 5, @@ -683,152 +849,198 @@ Program { "offset": 577, }, }, - "name": "dwarf", - "value": Array { - "items": Array [ - Entry { - "key": String { - "isDoubleQuote": false, - "kind": "string", - "loc": Location { - "end": Position { - "column": 14, - "line": 33, - "offset": 602, - }, - "source": "'sneezy'", - "start": Position { - "column": 6, - "line": 33, - "offset": 594, - }, - }, - "raw": "'sneezy'", - "unicode": false, - "value": "sneezy", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "loc": Location { + "end": Position { + "column": 5, + "line": 35, + "offset": 648, + }, + "source": "$dwarf = [ + 'sneezy' => 'achoum', + 'bashful' => 'tadah' + ]", + "start": Position { + "column": 14, + "line": 32, + "offset": 577, }, - "kind": "entry", + }, + "name": Identifier { + "kind": "identifier", "loc": Location { "end": Position { - "column": 26, - "line": 33, - "offset": 614, + "column": 20, + "line": 32, + "offset": 583, }, - "source": "'sneezy' => 'achoum'", + "source": "$dwarf", "start": Position { - "column": 6, - "line": 33, - "offset": 594, + "column": 14, + "line": 32, + "offset": 577, }, }, - "value": String { - "isDoubleQuote": false, - "kind": "string", - "loc": Location { - "end": Position { - "column": 26, - "line": 33, - "offset": 614, + "name": "dwarf", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 14, + "line": 33, + "offset": 602, + }, + "source": "'sneezy'", + "start": Position { + "column": 6, + "line": 33, + "offset": 594, + }, + }, + "raw": "'sneezy'", + "unicode": false, + "value": "sneezy", }, - "source": "'achoum'", - "start": Position { - "column": 18, - "line": 33, - "offset": 606, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 26, + "line": 33, + "offset": 614, + }, + "source": "'sneezy' => 'achoum'", + "start": Position { + "column": 6, + "line": 33, + "offset": 594, + }, + }, + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 26, + "line": 33, + "offset": 614, + }, + "source": "'achoum'", + "start": Position { + "column": 18, + "line": 33, + "offset": 606, + }, + }, + "raw": "'achoum'", + "unicode": false, + "value": "achoum", }, }, - "raw": "'achoum'", - "unicode": false, - "value": "achoum", - }, - }, - Entry { - "key": String { - "isDoubleQuote": false, - "kind": "string", - "loc": Location { - "end": Position { - "column": 15, - "line": 34, - "offset": 631, + Entry { + "byRef": false, + "key": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 15, + "line": 34, + "offset": 631, + }, + "source": "'bashful'", + "start": Position { + "column": 6, + "line": 34, + "offset": 622, + }, + }, + "raw": "'bashful'", + "unicode": false, + "value": "bashful", }, - "source": "'bashful'", - "start": Position { - "column": 6, - "line": 34, - "offset": 622, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 26, + "line": 34, + "offset": 642, + }, + "source": "'bashful' => 'tadah'", + "start": Position { + "column": 6, + "line": 34, + "offset": 622, + }, + }, + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 26, + "line": 34, + "offset": 642, + }, + "source": "'tadah'", + "start": Position { + "column": 19, + "line": 34, + "offset": 635, + }, + }, + "raw": "'tadah'", + "unicode": false, + "value": "tadah", }, }, - "raw": "'bashful'", - "unicode": false, - "value": "bashful", - }, - "kind": "entry", + ], + "kind": "array", "loc": Location { "end": Position { - "column": 26, - "line": 34, - "offset": 642, - }, - "source": "'bashful' => 'tadah'", - "start": Position { - "column": 6, - "line": 34, - "offset": 622, - }, - }, - "value": String { - "isDoubleQuote": false, - "kind": "string", - "loc": Location { - "end": Position { - "column": 26, - "line": 34, - "offset": 642, - }, - "source": "'tadah'", - "start": Position { - "column": 19, - "line": 34, - "offset": 635, - }, + "column": 5, + "line": 35, + "offset": 648, }, - "raw": "'tadah'", - "unicode": false, - "value": "tadah", - }, - }, - ], - "kind": "array", - "loc": Location { - "end": Position { - "column": 5, - "line": 35, - "offset": 648, - }, - "source": "[ + "source": "[ 'sneezy' => 'achoum', 'bashful' => 'tadah' ]", - "start": Position { - "column": 23, - "line": 32, - "offset": 586, + "start": Position { + "column": 23, + "line": 32, + "offset": 586, + }, + }, + "shortForm": true, }, }, - "shortForm": true, - }, + ], "visibility": "protected", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Foreach { "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "loc": Location { @@ -837,19 +1049,39 @@ Program { "line": 42, "offset": 855, }, - "source": "Hey ho $name, $greeting !\\"", + "source": ""Hey ho $name, $greeting !"", "start": Position { - "column": 14, + "column": 13, "line": 42, - "offset": 829, + "offset": 828, }, }, - "raw": "\\"Hey ho $name, $greeting !\\"", + "raw": ""Hey ho $name, $greeting !"", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 21, + "line": 42, + "offset": 836, + }, + "source": "Hey ho ", + "start": Position { + "column": 14, + "line": 42, + "offset": 829, + }, + }, + "raw": "Hey ho ", + "unicode": false, + "value": "Hey ho ", + }, + "kind": "encapsedpart", "loc": Location { "end": Position { "column": 21, @@ -863,14 +1095,29 @@ Program { "offset": 829, }, }, - "raw": "Hey ho ", - "unicode": false, - "value": "Hey ho ", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": false, - "kind": "variable", + "expression": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 26, + "line": 42, + "offset": 841, + }, + "source": "$name", + "start": Position { + "column": 21, + "line": 42, + "offset": 836, + }, + }, + "name": "name", + }, + "kind": "encapsedpart", "loc": Location { "end": Position { "column": 26, @@ -884,11 +1131,31 @@ Program { "offset": 836, }, }, - "name": "name", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 28, + "line": 42, + "offset": 843, + }, + "source": ", ", + "start": Position { + "column": 26, + "line": 42, + "offset": 841, + }, + }, + "raw": ", ", + "unicode": false, + "value": ", ", + }, + "kind": "encapsedpart", "loc": Location { "end": Position { "column": 28, @@ -902,14 +1169,29 @@ Program { "offset": 841, }, }, - "raw": ", ", - "unicode": false, - "value": ", ", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": false, - "kind": "variable", + "expression": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 37, + "line": 42, + "offset": 852, + }, + "source": "$greeting", + "start": Position { + "column": 28, + "line": 42, + "offset": 843, + }, + }, + "name": "greeting", + }, + "kind": "encapsedpart", "loc": Location { "end": Position { "column": 37, @@ -923,11 +1205,31 @@ Program { "offset": 843, }, }, - "name": "greeting", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 39, + "line": 42, + "offset": 854, + }, + "source": " !", + "start": Position { + "column": 37, + "line": 42, + "offset": 852, + }, + }, + "raw": " !", + "unicode": false, + "value": " !", + }, + "kind": "encapsedpart", "loc": Location { "end": Position { "column": 39, @@ -941,9 +1243,7 @@ Program { "offset": 852, }, }, - "raw": " !", - "unicode": false, - "value": " !", + "syntax": null, }, ], }, @@ -955,7 +1255,7 @@ Program { "line": 42, "offset": 856, }, - "source": "echo \\"Hey ho $name, $greeting !\\";", + "source": "echo "Hey ho $name, $greeting !";", "start": Position { "column": 8, "line": 42, @@ -967,7 +1267,6 @@ Program { Continue { "kind": "continue", "level": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -1008,7 +1307,7 @@ Program { "offset": 887, }, "source": "{ - echo \\"Hey ho $name, $greeting !\\"; + echo "Hey ho $name, $greeting !"; continue $foo; }", "start": Position { @@ -1019,7 +1318,6 @@ Program { }, }, "key": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -1038,7 +1336,7 @@ Program { "name": "name", }, "kind": "foreach", - "leadingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", "loc": Location { @@ -1055,6 +1353,7 @@ Program { "offset": 744, }, }, + "offset": 744, "value": "// do not wanna do ", }, @@ -1065,14 +1364,14 @@ Program { "line": 44, "offset": 887, }, - "source": "($this->dwarf as $name => $greeting) { - echo \\"Hey ho $name, $greeting !\\"; + "source": "foreach($this->dwarf as $name => $greeting) { + echo "Hey ho $name, $greeting !"; continue $foo; }", "start": Position { - "column": 13, + "column": 6, "line": 41, - "offset": 776, + "offset": 769, }, }, "shortForm": false, @@ -1084,15 +1383,15 @@ Program { "line": 41, "offset": 789, }, - "source": "->dwarf", + "source": "$this->dwarf", "start": Position { - "column": 19, + "column": 14, "line": 41, - "offset": 782, + "offset": 777, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 26, @@ -1109,7 +1408,6 @@ Program { "name": "dwarf", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -1129,7 +1427,6 @@ Program { }, }, "value": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -1156,7 +1453,7 @@ Program { "line": 45, "offset": 928, }, - "source": "throw new \\\\ComeToHome('Thats it');", + "source": "throw new \\ComeToHome('Thats it');", "start": Position { "column": 6, "line": 45, @@ -1164,7 +1461,7 @@ Program { }, }, "what": New { - "arguments": Array [ + "arguments": [ String { "isDoubleQuote": false, "kind": "string", @@ -1193,30 +1490,30 @@ Program { "line": 45, "offset": 927, }, - "source": "\\\\ComeToHome('Thats it')", + "source": "new \\ComeToHome('Thats it')", "start": Position { - "column": 16, + "column": 12, "line": 45, - "offset": 904, + "offset": 900, }, }, - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "loc": Location { "end": Position { "column": 27, "line": 45, "offset": 915, }, - "source": "\\\\ComeToHome", + "source": "\\ComeToHome", "start": Position { "column": 16, "line": 45, "offset": 904, }, }, - "name": "\\\\ComeToHome", - "resolution": "qn", + "name": "\\ComeToHome", + "resolution": "fqn", }, }, }, @@ -1231,10 +1528,10 @@ Program { "source": "{ // do not wanna do foreach($this->dwarf as $name => $greeting) { - echo \\"Hey ho $name, $greeting !\\"; + echo "Hey ho $name, $greeting !"; continue $foo; } - throw new \\\\ComeToHome('Thats it'); + throw new \\ComeToHome('Thats it'); }", "start": Position { "column": 40, @@ -1246,9 +1543,10 @@ Program { "byref": false, "isAbstract": false, "isFinal": true, + "isReadonly": false, "isStatic": false, "kind": "method", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", "loc": Location { @@ -1266,6 +1564,7 @@ Program { "offset": 654, }, }, + "offset": 654, "value": "/** * Something is done here */", @@ -1277,11 +1576,11 @@ Program { "line": 46, "offset": 934, }, - "source": "function doSomething()", + "source": "final public function doSomething()", "start": Position { - "column": 17, + "column": 4, "line": 39, - "offset": 713, + "offset": 700, }, }, "name": Identifier { @@ -1300,7 +1599,6 @@ Program { }, }, "name": "doSomething", - "resolution": "rn", }, "nullable": false, "type": null, @@ -1308,16 +1606,16 @@ Program { }, ], "extends": null, - "implements": Array [ - Identifier { - "kind": "identifier", + "implements": [ + Name { + "kind": "name", "loc": Location { "end": Position { "column": 51, "line": 25, "offset": 439, }, - "source": "namespace\\\\fooBaz", + "source": "namespace\\fooBaz", "start": Position { "column": 35, "line": 25, @@ -1331,8 +1629,9 @@ Program { "isAbstract": true, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", "loc": Location { @@ -1350,6 +1649,7 @@ Program { "offset": 365, }, }, + "offset": 365, "value": "/** * a class */", @@ -1361,7 +1661,7 @@ Program { "line": 47, "offset": 938, }, - "source": "class fooBar implements namespace\\\\fooBaz { + "source": "abstract class fooBar implements namespace\\fooBaz { use Line; use foo, bar { foo::baz insteadof bar; @@ -1378,28 +1678,47 @@ Program { final public function doSomething() { // do not wanna do foreach($this->dwarf as $name => $greeting) { - echo \\"Hey ho $name, $greeting !\\"; + echo "Hey ho $name, $greeting !"; continue $foo; } - throw new \\\\ComeToHome('Thats it'); + throw new \\ComeToHome('Thats it'); } }", "start": Position { - "column": 11, + "column": 2, "line": 25, - "offset": 399, + "offset": 390, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 23, + "line": 25, + "offset": 411, + }, + "source": "fooBar", + "start": Position { + "column": 17, + "line": 25, + "offset": 405, + }, }, + "name": "fooBar", }, - "name": "fooBar", }, Interface { - "body": Array [ + "attrGroups": [], + "body": [ Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": null, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "loc": Location { @@ -1408,11 +1727,11 @@ Program { "line": 50, "offset": 1014, }, - "source": "function Am_I_Uggly() : bool", + "source": "public function Am_I_Uggly() : bool", "start": Position { - "column": 11, + "column": 4, "line": 50, - "offset": 986, + "offset": 979, }, }, "name": Identifier { @@ -1431,11 +1750,10 @@ Program { }, }, "name": "Am_I_Uggly", - "resolution": "rn", }, "nullable": false, - "type": Identifier { - "kind": "identifier", + "type": TypeReference { + "kind": "typereference", "loc": Location { "end": Position { "column": 39, @@ -1450,16 +1768,18 @@ Program { }, }, "name": "bool", - "resolution": "uqn", + "raw": "bool", }, "visibility": "public", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": null, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "loc": Location { @@ -1468,11 +1788,11 @@ Program { "line": 51, "offset": 1054, }, - "source": "function broken() : bool", + "source": "protected function broken() : bool", "start": Position { - "column": 14, + "column": 4, "line": 51, - "offset": 1030, + "offset": 1020, }, }, "name": Identifier { @@ -1491,11 +1811,10 @@ Program { }, }, "name": "broken", - "resolution": "rn", }, "nullable": false, - "type": Identifier { - "kind": "identifier", + "type": TypeReference { + "kind": "typereference", "loc": Location { "end": Position { "column": 38, @@ -1510,16 +1829,18 @@ Program { }, }, "name": "bool", - "resolution": "uqn", + "raw": "bool", }, "visibility": "protected", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": null, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": true, "kind": "method", "loc": Location { @@ -1528,11 +1849,11 @@ Program { "line": 52, "offset": 1111, }, - "source": "function isWhiteSnowAlive() : bool", + "source": "static protected function isWhiteSnowAlive() : bool", "start": Position { - "column": 21, + "column": 4, "line": 52, - "offset": 1077, + "offset": 1060, }, }, "name": Identifier { @@ -1551,11 +1872,10 @@ Program { }, }, "name": "isWhiteSnowAlive", - "resolution": "rn", }, "nullable": false, - "type": Identifier { - "kind": "identifier", + "type": TypeReference { + "kind": "typereference", "loc": Location { "end": Position { "column": 55, @@ -1570,14 +1890,14 @@ Program { }, }, "name": "bool", - "resolution": "uqn", + "raw": "bool", }, "visibility": "protected", }, ], - "extends": Array [ - Identifier { - "kind": "identifier", + "extends": [ + Name { + "kind": "name", "loc": Location { "end": Position { "column": 32, @@ -1613,12 +1933,29 @@ Program { "offset": 942, }, }, - "name": "Miror", + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 17, + "line": 49, + "offset": 957, + }, + "source": "Miror", + "start": Position { + "column": 12, + "line": 49, + "offset": 952, + }, + }, + "name": "Miror", + }, }, _Function { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Yield { "key": String { @@ -1656,7 +1993,6 @@ Program { }, }, "value": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -1707,7 +2043,7 @@ Program { }, }, "value": Call { - "arguments": Array [ + "arguments": [ Number { "kind": "number", "loc": Location { @@ -1733,15 +2069,15 @@ Program { "line": 57, "offset": 1187, }, - "source": "(50)", + "source": "iter(50)", "start": Position { - "column": 19, + "column": 15, "line": 57, - "offset": 1183, + "offset": 1179, }, }, - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "loc": Location { "end": Position { "column": 19, @@ -1825,17 +2161,18 @@ Program { }, }, "name": "iter", - "resolution": "rn", }, "nullable": false, "type": null, }, Trait { - "body": Array [ + "body": [ Method { - "arguments": Array [ + "arguments": [ Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", "loc": Location { "end": Position { @@ -1850,10 +2187,27 @@ Program { "offset": 1234, }, }, - "name": "arrow", - "nullable": false, - "type": Identifier { + "name": Identifier { "kind": "identifier", + "loc": Location { + "end": Position { + "column": 36, + "line": 61, + "offset": 1245, + }, + "source": "$arrow", + "start": Position { + "column": 30, + "line": 61, + "offset": 1239, + }, + }, + "name": "arrow", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", "loc": Location { "end": Position { "column": 29, @@ -1868,7 +2222,7 @@ Program { }, }, "name": "bool", - "resolution": "uqn", + "raw": "bool", }, "value": Boolean { "kind": "boolean", @@ -1891,13 +2245,31 @@ Program { "variadic": false, }, ], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Switch { "body": Block { - "children": Array [ + "children": [ Case { - "body": null, + "body": Block { + "children": [], + "kind": "block", + "loc": Location { + "end": Position { + "column": 19, + "line": 63, + "offset": 1314, + }, + "source": " + ", + "start": Position { + "column": 8, + "line": 64, + "offset": 1323, + }, + }, + }, "kind": "case", "loc": Location { "end": Position { @@ -1935,12 +2307,11 @@ Program { }, Case { "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2081,12 +2452,11 @@ Program { }, Case { "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2237,7 +2607,7 @@ Program { "line": 70, "offset": 1450, }, - "source": "($this->style) { + "source": "switch($this->style) { case 'dot': case 'point': $body = '......'; @@ -2247,9 +2617,9 @@ Program { break; }", "start": Position { - "column": 12, + "column": 6, "line": 62, - "offset": 1278, + "offset": 1272, }, }, "shortForm": false, @@ -2261,15 +2631,15 @@ Program { "line": 62, "offset": 1291, }, - "source": "->style", + "source": "$this->style", "start": Position { - "column": 18, + "column": 13, "line": 62, - "offset": 1284, + "offset": 1279, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 25, @@ -2286,7 +2656,6 @@ Program { "name": "style", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2310,7 +2679,6 @@ Program { "expr": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2378,7 +2746,6 @@ Program { }, "parenthesizedExpression": true, "test": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2464,6 +2831,7 @@ Program { "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "loc": Location { @@ -2472,11 +2840,11 @@ Program { "line": 72, "offset": 1498, }, - "source": "function draw(bool $arrow = false) : string", + "source": "public function draw(bool $arrow = false) : string", "start": Position { - "column": 11, + "column": 4, "line": 61, - "offset": 1220, + "offset": 1213, }, }, "name": Identifier { @@ -2495,11 +2863,10 @@ Program { }, }, "name": "draw", - "resolution": "rn", }, "nullable": false, - "type": Identifier { - "kind": "identifier", + "type": TypeReference { + "kind": "typereference", "loc": Location { "end": Position { "column": 54, @@ -2514,14 +2881,15 @@ Program { }, }, "name": "string", - "resolution": "uqn", + "raw": "string", }, "visibility": "public", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Return { "expr": Magic { "kind": "magic", @@ -2577,6 +2945,7 @@ Program { "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "loc": Location { @@ -2585,11 +2954,11 @@ Program { "line": 75, "offset": 1563, }, - "source": "function shuut()", + "source": "private function shuut()", "start": Position { - "column": 12, + "column": 4, "line": 73, - "offset": 1511, + "offset": 1503, }, }, "name": Identifier { @@ -2608,15 +2977,12 @@ Program { }, }, "name": "shuut", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "private", }, ], - "extends": null, - "implements": null, "kind": "trait", "loc": Location { "end": Position { @@ -2647,37 +3013,32 @@ Program { "offset": 1196, }, }, - "name": "Line", - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "loc": Location { - "end": Position { - "column": 0, - "line": 79, - "offset": 1591, - }, - "source": "// this is SPARTA ! -", - "start": Position { - "column": 2, - "line": 78, - "offset": 1571, - }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 12, + "line": 60, + "offset": 1206, + }, + "source": "Line", + "start": Position { + "column": 8, + "line": 60, + "offset": 1202, }, - "value": "// this is SPARTA ! -", }, - ], + "name": "Line", + }, }, _Function { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Global { - "items": Array [ + "items": [ Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2715,7 +3076,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2747,22 +3107,39 @@ Program { }, }, "operator": "=", - "right": Number { - "kind": "number", + "right": Unary { + "kind": "unary", "loc": Location { "end": Position { - "column": 14, + "column": 15, "line": 82, - "offset": 1657, + "offset": 1658, }, - "source": "-", + "source": "-1", "start": Position { "column": 13, "line": 82, "offset": 1656, }, }, - "value": "-1", + "type": "-", + "what": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 15, + "line": 82, + "offset": 1658, + }, + "source": "1", + "start": Position { + "column": 14, + "line": 82, + "offset": 1657, + }, + }, + "value": "1", + }, }, }, "kind": "expressionstatement", @@ -2788,20 +3165,35 @@ Program { "line": 83, "offset": 1665, }, - "source": ":", + "source": "next:", "start": Position { - "column": 4, + "column": 0, "line": 83, - "offset": 1664, + "offset": 1660, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 4, + "line": 83, + "offset": 1664, + }, + "source": "next", + "start": Position { + "column": 0, + "line": 83, + "offset": 1660, + }, }, + "name": "next", }, - "name": "next", }, ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2841,11 +3233,11 @@ Program { "line": 84, "offset": 1696, }, - "source": "[++$index]", + "source": "$persians[++$index]", "start": Position { - "column": 20, + "column": 11, "line": 84, - "offset": 1686, + "offset": 1677, }, }, "offset": Pre { @@ -2865,7 +3257,6 @@ Program { }, "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2885,7 +3276,6 @@ Program { }, }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2922,10 +3312,10 @@ Program { }, If { "alternate": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Call { - "arguments": Array [ + "arguments": [ variadic { "kind": "variadic", "loc": Location { @@ -2942,7 +3332,6 @@ Program { }, }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -2969,11 +3358,11 @@ Program { "line": 88, "offset": 1791, }, - "source": "(...$foo);", + "source": "$guy->kick(...$foo);", "start": Position { - "column": 16, + "column": 6, "line": 88, - "offset": 1781, + "offset": 1771, }, }, "what": PropertyLookup { @@ -2984,15 +3373,15 @@ Program { "line": 88, "offset": 1781, }, - "source": "->kick", + "source": "$guy->kick", "start": Position { - "column": 10, + "column": 6, "line": 88, - "offset": 1775, + "offset": 1771, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 16, @@ -3009,7 +3398,6 @@ Program { "name": "kick", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -3063,11 +3451,11 @@ Program { }, }, "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Silent { "expr": Call { - "arguments": Array [], + "arguments": [], "kind": "call", "loc": Location { "end": Position { @@ -3075,11 +3463,11 @@ Program { "line": 86, "offset": 1750, }, - "source": "()", + "source": "$guy->kill()", "start": Position { - "column": 17, + "column": 7, "line": 86, - "offset": 1748, + "offset": 1738, }, }, "what": PropertyLookup { @@ -3090,15 +3478,15 @@ Program { "line": 86, "offset": 1748, }, - "source": "->kill", + "source": "$guy->kill", "start": Position { - "column": 11, + "column": 7, "line": 86, - "offset": 1742, + "offset": 1738, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 17, @@ -3115,7 +3503,6 @@ Program { "name": "kill", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -3207,7 +3594,7 @@ Program { "left": Bin { "kind": "bin", "left": Call { - "arguments": Array [ + "arguments": [ Number { "kind": "number", "loc": Location { @@ -3250,15 +3637,15 @@ Program { "line": 85, "offset": 1716, }, - "source": "(0, 10)", + "source": "rand(0, 10)", "start": Position { - "column": 11, + "column": 7, "line": 85, - "offset": 1709, + "offset": 1705, }, }, - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "loc": Location { "end": Position { "column": 11, @@ -3278,11 +3665,11 @@ Program { }, "loc": Location { "end": Position { - "column": 29, + "column": 20, "line": 85, - "offset": 1727, + "offset": 1718, }, - "source": "rand(0, 10)>5 || false", + "source": "rand(0, 10)>5", "start": Position { "column": 7, "line": 85, @@ -3314,11 +3701,11 @@ Program { "line": 85, "offset": 1727, }, - "source": "5 || false", + "source": "rand(0, 10)>5 || false", "start": Position { - "column": 19, + "column": 7, "line": 85, - "offset": 1717, + "offset": 1705, }, }, "right": Boolean { @@ -3346,7 +3733,23 @@ Program { "alternate": null, "body": Goto { "kind": "goto", - "label": "next", + "label": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 49, + "line": 90, + "offset": 1847, + }, + "source": "next", + "start": Position { + "column": 45, + "line": 90, + "offset": 1843, + }, + }, + "name": "next", + }, "loc": Location { "end": Position { "column": 50, @@ -3376,27 +3779,10 @@ Program { }, }, "shortForm": false, - "test": Cast { - "kind": "cast", - "loc": Location { - "end": Position { - "column": 38, - "line": 90, - "offset": 1836, - }, - "source": "(int)$index < count($persians)", - "start": Position { - "column": 8, - "line": 90, - "offset": 1806, - }, - }, - "raw": "(int)", - "type": "int", - "what": Bin { - "kind": "bin", - "left": Variable { - "byref": false, + "test": Bin { + "kind": "bin", + "left": Cast { + "expr": Variable { "curly": false, "kind": "variable", "loc": Location { @@ -3414,76 +3800,91 @@ Program { }, "name": "index", }, + "kind": "cast", "loc": Location { "end": Position { - "column": 38, + "column": 19, "line": 90, - "offset": 1836, + "offset": 1817, }, - "source": "$index < count($persians)", + "source": "(int)$index", "start": Position { - "column": 13, + "column": 8, "line": 90, - "offset": 1811, + "offset": 1806, }, }, - "right": Call { - "arguments": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "loc": Location { - "end": Position { - "column": 37, - "line": 90, - "offset": 1835, - }, - "source": "$persians", - "start": Position { - "column": 28, - "line": 90, - "offset": 1826, - }, + "raw": "(int)", + "type": "int", + }, + "loc": Location { + "end": Position { + "column": 38, + "line": 90, + "offset": 1836, + }, + "source": "(int)$index < count($persians)", + "start": Position { + "column": 8, + "line": 90, + "offset": 1806, + }, + }, + "right": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 37, + "line": 90, + "offset": 1835, + }, + "source": "$persians", + "start": Position { + "column": 28, + "line": 90, + "offset": 1826, }, - "name": "persians", }, - ], - "kind": "call", + "name": "persians", + }, + ], + "kind": "call", + "loc": Location { + "end": Position { + "column": 38, + "line": 90, + "offset": 1836, + }, + "source": "count($persians)", + "start": Position { + "column": 22, + "line": 90, + "offset": 1820, + }, + }, + "what": Name { + "kind": "name", "loc": Location { "end": Position { - "column": 38, - "line": 90, - "offset": 1836, - }, - "source": "($persians)", - "start": Position { "column": 27, "line": 90, "offset": 1825, }, - }, - "what": Identifier { - "kind": "identifier", - "loc": Location { - "end": Position { - "column": 27, - "line": 90, - "offset": 1825, - }, - "source": "count", - "start": Position { - "column": 22, - "line": 90, - "offset": 1820, - }, + "source": "count", + "start": Position { + "column": 22, + "line": 90, + "offset": 1820, }, - "name": "count", - "resolution": "uqn", }, + "name": "count", + "resolution": "uqn", }, - "type": "<", }, + "type": "<", }, }, Return { @@ -3585,6 +3986,28 @@ next: }, "byref": false, "kind": "function", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 79, + "offset": 1591, + }, + "source": "// this is SPARTA ! +", + "start": Position { + "column": 2, + "line": 78, + "offset": 1571, + }, + }, + "offset": 1571, + "value": "// this is SPARTA ! +", + }, + ], "loc": Location { "end": Position { "column": 3, @@ -3614,11 +4037,10 @@ next: }, }, "name": "sparta", - "resolution": "rn", }, "nullable": true, - "type": Identifier { - "kind": "identifier", + "type": TypeReference { + "kind": "typereference", "loc": Location { "end": Position { "column": 26, @@ -3633,14 +4055,13 @@ next: }, }, "name": "int", - "resolution": "uqn", + "raw": "int", }, }, ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -3687,7 +4108,7 @@ next: if (isset($bipbip, $ex)) unset($bipbip, $ex); return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt(); } @@ -3699,7 +4120,7 @@ next: // @todo $this->a_$foo return $$foo ?? false; } - return empty(namespace\\\\FOOBAR); + return empty(namespace\\FOOBAR); };", "start": Position { "column": 2, @@ -3709,9 +4130,11 @@ next: }, "operator": "=", "right": Closure { - "arguments": Array [ + "arguments": [ Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", "loc": Location { "end": Position { @@ -3726,10 +4149,27 @@ next: "offset": 1893, }, }, - "name": "bar", - "nullable": true, - "type": Identifier { + "name": Identifier { "kind": "identifier", + "loc": Location { + "end": Position { + "column": 27, + "line": 95, + "offset": 1902, + }, + "source": "$bar", + "start": Position { + "column": 23, + "line": 95, + "offset": 1898, + }, + }, + "name": "bar", + }, + "nullable": true, + "readonly": false, + "type": TypeReference { + "kind": "typereference", "loc": Location { "end": Position { "column": 22, @@ -3744,7 +4184,7 @@ next: }, }, "name": "int", - "resolution": "uqn", + "raw": "int", }, "value": Number { "kind": "number", @@ -3766,12 +4206,26 @@ next: "variadic": false, }, ], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Static { - "items": Array [ + "kind": "static", + "loc": Location { + "end": Position { + "column": 19, + "line": 96, + "offset": 1953, + }, + "source": "static $banana;", + "start": Position { + "column": 4, + "line": 96, + "offset": 1938, + }, + }, + "variables": [ Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -3790,33 +4244,18 @@ next: "name": "banana", }, ], - "kind": "static", - "loc": Location { - "end": Position { - "column": 19, - "line": 96, - "offset": 1953, - }, - "source": "static $banana;", - "start": Position { - "column": 4, - "line": 96, - "offset": 1938, - }, - }, }, If { "alternate": If { "alternate": Block { - "children": Array [ + "children": [ For { "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -3853,7 +4292,6 @@ next: "left": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -3920,7 +4358,6 @@ next: "right": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -3993,7 +4430,6 @@ next: "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4068,11 +4504,11 @@ next: "line": 125, "offset": 2747, }, - "source": "[++$i]", + "source": "$this->$x[++$i]", "start": Position { - "column": 25, + "column": 16, "line": 125, - "offset": 2741, + "offset": 2732, }, }, "offset": Pre { @@ -4092,7 +4528,6 @@ next: }, "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4119,15 +4554,14 @@ next: "line": 125, "offset": 2741, }, - "source": "->$x", + "source": "$this->$x", "start": Position { - "column": 21, + "column": 16, "line": 125, - "offset": 2737, + "offset": 2732, }, }, "offset": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4146,7 +4580,6 @@ next: "name": "x", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4221,29 +4654,8 @@ next: "offset": 2679, }, }, - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "loc": Location { - "end": Position { - "column": 0, - "line": 128, - "offset": 2803, - }, - "source": "// @todo $this->a_$foo -", - "start": Position { - "column": 6, - "line": 127, - "offset": 2780, - }, - }, - "value": "// @todo $this->a_$foo -", - }, - ], }, - "increment": Array [ + "increment": [ Post { "kind": "post", "loc": Location { @@ -4261,7 +4673,6 @@ next: }, "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4281,11 +4692,10 @@ next: }, }, ], - "init": Array [ + "init": [ Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4343,22 +4753,21 @@ next: "line": 126, "offset": 2773, }, - "source": "($i = 0; $i < count($this->banana); $i++) { + "source": "for($i = 0; $i < count($this->banana); $i++) { $x %= ($i * 2) / ($i - 1); $what = $this->$x[++$i] ? 'yes!': 'noo!'; }", "start": Position { - "column": 9, + "column": 6, "line": 123, - "offset": 2637, + "offset": 2634, }, }, "shortForm": false, - "test": Array [ + "test": [ Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4390,7 +4799,7 @@ next: }, }, "right": Call { - "arguments": Array [ + "arguments": [ PropertyLookup { "kind": "propertylookup", "loc": Location { @@ -4399,15 +4808,15 @@ next: "line": 123, "offset": 2670, }, - "source": "->banana", + "source": "$this->banana", "start": Position { - "column": 34, + "column": 29, "line": 123, - "offset": 2662, + "offset": 2657, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 42, @@ -4424,7 +4833,6 @@ next: "name": "banana", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4451,15 +4859,15 @@ next: "line": 123, "offset": 2671, }, - "source": "($this->banana)", + "source": "count($this->banana)", "start": Position { - "column": 28, + "column": 23, "line": 123, - "offset": 2656, + "offset": 2651, }, }, - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "loc": Location { "end": Position { "column": 28, @@ -4485,7 +4893,6 @@ next: "expr": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4502,7 +4909,6 @@ next: }, }, "name": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4555,16 +4961,38 @@ next: "type": "??", }, "kind": "return", - "loc": Location { - "end": Position { - "column": 28, - "line": 128, - "offset": 2831, - }, - "source": "return $$foo ?? false;", - "start": Position { - "column": 6, - "line": 128, + "leadingComments": [ + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 128, + "offset": 2803, + }, + "source": "// @todo $this->a_$foo +", + "start": Position { + "column": 6, + "line": 127, + "offset": 2780, + }, + }, + "offset": 2780, + "value": "// @todo $this->a_$foo +", + }, + ], + "loc": Location { + "end": Position { + "column": 28, + "line": 128, + "offset": 2831, + }, + "source": "return $$foo ?? false;", + "start": Position { + "column": 6, + "line": 128, "offset": 2809, }, }, @@ -4593,16 +5021,29 @@ next: }, }, "body": Block { - "children": Array [ + "children": [ Try { "always": Block { - "children": Array [ + "children": [ If { "alternate": null, "body": Unset { - "arguments": Array [ + "kind": "unset", + "loc": Location { + "end": Position { + "column": 53, + "line": 115, + "offset": 2471, + }, + "source": "unset($bipbip, $ex);", + "start": Position { + "column": 33, + "line": 115, + "offset": 2451, + }, + }, + "variables": [ Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4621,7 +5062,6 @@ next: "name": "bipbip", }, Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4640,20 +5080,6 @@ next: "name": "ex", }, ], - "kind": "unset", - "loc": Location { - "end": Position { - "column": 53, - "line": 115, - "offset": 2471, - }, - "source": "unset($bipbip, $ex);", - "start": Position { - "column": 33, - "line": 115, - "offset": 2451, - }, - }, }, "kind": "if", "loc": Location { @@ -4671,9 +5097,22 @@ next: }, "shortForm": false, "test": Isset { - "arguments": Array [ + "kind": "isset", + "loc": Location { + "end": Position { + "column": 31, + "line": 115, + "offset": 2449, + }, + "source": "isset($bipbip, $ex)", + "start": Position { + "column": 12, + "line": 115, + "offset": 2430, + }, + }, + "variables": [ Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4692,7 +5131,6 @@ next: "name": "bipbip", }, Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -4711,25 +5149,11 @@ next: "name": "ex", }, ], - "kind": "isset", - "loc": Location { - "end": Position { - "column": 31, - "line": 115, - "offset": 2449, - }, - "source": "isset($bipbip, $ex)", - "start": Position { - "column": 12, - "line": 115, - "offset": 2430, - }, - }, }, }, Return { "expr": Call { - "arguments": Array [], + "arguments": [], "kind": "call", "loc": Location { "end": Position { @@ -4737,11 +5161,15 @@ next: "line": 120, "offset": 2605, }, - "source": "()", + "source": "new class extends fooBar { + function goatIt() { + return "meeeh"; + } + })->goatIt()", "start": Position { - "column": 18, - "line": 120, - "offset": 2603, + "column": 16, + "line": 116, + "offset": 2488, }, }, "what": PropertyLookup { @@ -4752,15 +5180,19 @@ next: "line": 120, "offset": 2603, }, - "source": "->goatIt", + "source": "new class extends fooBar { + function goatIt() { + return "meeeh"; + } + })->goatIt", "start": Position { - "column": 10, - "line": 120, - "offset": 2595, + "column": 16, + "line": 116, + "offset": 2488, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 18, @@ -4777,7 +5209,7 @@ next: "name": "goatIt", }, "what": New { - "arguments": Array [], + "arguments": [], "kind": "new", "loc": Location { "end": Position { @@ -4785,24 +5217,26 @@ next: "line": 120, "offset": 2594, }, - "source": "class extends fooBar { + "source": "new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } }", "start": Position { - "column": 20, + "column": 16, "line": 116, - "offset": 2492, + "offset": 2488, }, }, "parenthesizedExpression": true, "what": Class { - "body": Array [ + "attrGroups": [], + "body": [ Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Return { "expr": String { "isDoubleQuote": true, @@ -4813,14 +5247,14 @@ next: "line": 118, "offset": 2571, }, - "source": "\\"meeeh\\"", + "source": ""meeeh"", "start": Position { "column": 19, "line": 118, "offset": 2564, }, }, - "raw": "\\"meeeh\\"", + "raw": ""meeeh"", "unicode": false, "value": "meeeh", }, @@ -4831,7 +5265,7 @@ next: "line": 118, "offset": 2572, }, - "source": "return \\"meeeh\\";", + "source": "return "meeeh";", "start": Position { "column": 12, "line": 118, @@ -4848,7 +5282,7 @@ next: "offset": 2584, }, "source": "{ - return \\"meeeh\\"; + return "meeeh"; }", "start": Position { "column": 28, @@ -4860,6 +5294,7 @@ next: "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "loc": Location { @@ -4891,15 +5326,14 @@ next: }, }, "name": "goatIt", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "", }, ], - "extends": Identifier { - "kind": "identifier", + "extends": Name { + "kind": "name", "loc": Location { "end": Position { "column": 40, @@ -4920,6 +5354,7 @@ next: "isAbstract": false, "isAnonymous": true, "isFinal": false, + "isReadonly": false, "kind": "class", "loc": Location { "end": Position { @@ -4929,7 +5364,7 @@ next: }, "source": "class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } }", "start": Position { @@ -4952,7 +5387,7 @@ next: }, "source": "return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt();", "start": Position { @@ -4974,7 +5409,7 @@ next: if (isset($bipbip, $ex)) unset($bipbip, $ex); return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt(); }", @@ -4986,12 +5421,11 @@ next: }, }, "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -5039,7 +5473,6 @@ next: }, }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -5076,11 +5509,13 @@ next: }, ExpressionStatement { "expression": Call { - "arguments": Array [ + "arguments": [ Array { - "items": Array [ - Number { - "kind": "number", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", "loc": Location { "end": Position { "column": 33, @@ -5094,10 +5529,29 @@ next: "offset": 2327, }, }, - "value": "1", + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 33, + "line": 111, + "offset": 2328, + }, + "source": "1", + "start": Position { + "column": 32, + "line": 111, + "offset": 2327, + }, + }, + "value": "1", + }, }, - Number { - "kind": "number", + Entry { + "byRef": false, + "key": null, + "kind": "entry", "loc": Location { "end": Position { "column": 36, @@ -5111,10 +5565,29 @@ next: "offset": 2330, }, }, - "value": "2", + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 36, + "line": 111, + "offset": 2331, + }, + "source": "2", + "start": Position { + "column": 35, + "line": 111, + "offset": 2330, + }, + }, + "value": "2", + }, }, - Number { - "kind": "number", + Entry { + "byRef": false, + "key": null, + "kind": "entry", "loc": Location { "end": Position { "column": 39, @@ -5128,7 +5601,24 @@ next: "offset": 2333, }, }, - "value": "3", + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 39, + "line": 111, + "offset": 2334, + }, + "source": "3", + "start": Position { + "column": 38, + "line": 111, + "offset": 2333, + }, + }, + "value": "3", + }, }, ], "kind": "array", @@ -5155,11 +5645,11 @@ next: "line": 111, "offset": 2337, }, - "source": "([1, 2, 3]);", + "source": "$bipbip->crazy()->boom([1, 2, 3]);", "start": Position { - "column": 30, + "column": 8, "line": 111, - "offset": 2325, + "offset": 2303, }, }, "what": PropertyLookup { @@ -5170,15 +5660,15 @@ next: "line": 111, "offset": 2325, }, - "source": "->boom", + "source": "$bipbip->crazy()->boom", "start": Position { - "column": 24, + "column": 8, "line": 111, - "offset": 2319, + "offset": 2303, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 30, @@ -5195,7 +5685,7 @@ next: "name": "boom", }, "what": Call { - "arguments": Array [], + "arguments": [], "kind": "call", "loc": Location { "end": Position { @@ -5203,11 +5693,11 @@ next: "line": 111, "offset": 2319, }, - "source": "()", + "source": "$bipbip->crazy()", "start": Position { - "column": 22, + "column": 8, "line": 111, - "offset": 2317, + "offset": 2303, }, }, "what": PropertyLookup { @@ -5218,15 +5708,15 @@ next: "line": 111, "offset": 2317, }, - "source": "->crazy", + "source": "$bipbip->crazy", "start": Position { - "column": 15, + "column": 8, "line": 111, - "offset": 2310, + "offset": 2303, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 22, @@ -5243,7 +5733,6 @@ next: "name": "crazy", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -5299,13 +5788,13 @@ next: }, }, }, - "catches": Array [ + "catches": [ Catch { "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Call { - "arguments": Array [], + "arguments": [], "kind": "call", "loc": Location { "end": Position { @@ -5313,11 +5802,11 @@ next: "line": 113, "offset": 2399, }, - "source": "();", + "source": "$ex->printStackTrace();", "start": Position { - "column": 28, + "column": 8, "line": 113, - "offset": 2396, + "offset": 2376, }, }, "what": PropertyLookup { @@ -5328,15 +5817,15 @@ next: "line": 113, "offset": 2396, }, - "source": "->printStackTrace", + "source": "$ex->printStackTrace", "start": Position { - "column": 11, + "column": 8, "line": 113, - "offset": 2379, + "offset": 2376, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 28, @@ -5353,7 +5842,6 @@ next: "name": "printStackTrace", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -5423,7 +5911,6 @@ next: }, }, "variable": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -5441,9 +5928,9 @@ next: }, "name": "ex", }, - "what": Array [ - Identifier { - "kind": "identifier", + "what": [ + Name { + "kind": "name", "loc": Location { "end": Position { "column": 18, @@ -5460,8 +5947,8 @@ next: "name": "Coco", "resolution": "uqn", }, - Identifier { - "kind": "identifier", + Name { + "kind": "name", "loc": Location { "end": Position { "column": 22, @@ -5497,7 +5984,7 @@ next: if (isset($bipbip, $ex)) unset($bipbip, $ex); return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt(); }", @@ -5526,7 +6013,7 @@ next: if (isset($bipbip, $ex)) unset($bipbip, $ex); return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt(); } @@ -5555,7 +6042,7 @@ next: if (isset($bipbip, $ex)) unset($bipbip, $ex); return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt(); } @@ -5593,7 +6080,6 @@ next: "what": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -5625,8 +6111,8 @@ next: }, }, "parenthesizedExpression": true, - "right": ConstRef { - "kind": "constref", + "right": Name { + "kind": "name", "loc": Location { "end": Position { "column": 45, @@ -5640,34 +6126,18 @@ next: "offset": 2236, }, }, - "name": Identifier { - "kind": "identifier", - "loc": Location { - "end": Position { - "column": 45, - "line": 108, - "offset": 2242, - }, - "source": "Banana", - "start": Position { - "column": 39, - "line": 108, - "offset": 2236, - }, - }, - "name": "Banana", - "resolution": "uqn", - }, + "name": "Banana", + "resolution": "uqn", }, "type": "instanceof", }, }, }, "body": Block { - "children": Array [ + "children": [ While { "body": Block { - "children": Array [ + "children": [ If { "alternate": Continue { "kind": "continue", @@ -5687,11 +6157,11 @@ next: }, }, "body": Block { - "children": Array [ + "children": [ Break { "kind": "break", - "level": ConstRef { - "kind": "constref", + "level": Name { + "kind": "name", "loc": Location { "end": Position { "column": 19, @@ -5705,24 +6175,8 @@ next: "offset": 2074, }, }, - "name": Identifier { - "kind": "identifier", - "loc": Location { - "end": Position { - "column": 19, - "line": 100, - "offset": 2077, - }, - "source": "foo", - "start": Position { - "column": 16, - "line": 100, - "offset": 2074, - }, - }, - "name": "foo", - "resolution": "uqn", - }, + "name": "foo", + "resolution": "uqn", }, "loc": Location { "end": Position { @@ -5773,27 +6227,11 @@ next: }, }, "shortForm": false, - "test": Cast { - "kind": "cast", - "loc": Location { - "end": Position { - "column": 48, - "line": 99, - "offset": 2054, - }, - "source": "(int)calculateMeaningOfLife() === 42", - "start": Position { - "column": 12, - "line": 99, - "offset": 2018, - }, - }, - "raw": "(int)", - "type": "int", - "what": Bin { - "kind": "bin", - "left": Call { - "arguments": Array [], + "test": Bin { + "kind": "bin", + "left": Cast { + "expr": Call { + "arguments": [], "kind": "call", "loc": Location { "end": Position { @@ -5801,15 +6239,15 @@ next: "line": 99, "offset": 2047, }, - "source": "()", + "source": "calculateMeaningOfLife()", "start": Position { - "column": 39, + "column": 17, "line": 99, - "offset": 2045, + "offset": 2023, }, }, - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "loc": Location { "end": Position { "column": 39, @@ -5827,38 +6265,54 @@ next: "resolution": "uqn", }, }, + "kind": "cast", "loc": Location { "end": Position { - "column": 48, + "column": 41, "line": 99, - "offset": 2054, + "offset": 2047, }, - "source": "calculateMeaningOfLife() === 42", + "source": "(int)calculateMeaningOfLife()", "start": Position { - "column": 17, + "column": 12, "line": 99, - "offset": 2023, + "offset": 2018, }, }, - "right": Number { - "kind": "number", - "loc": Location { - "end": Position { - "column": 48, - "line": 99, - "offset": 2054, - }, - "source": "42", - "start": Position { - "column": 46, - "line": 99, - "offset": 2052, - }, + "raw": "(int)", + "type": "int", + }, + "loc": Location { + "end": Position { + "column": 48, + "line": 99, + "offset": 2054, + }, + "source": "(int)calculateMeaningOfLife() === 42", + "start": Position { + "column": 12, + "line": 99, + "offset": 2018, + }, + }, + "right": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 48, + "line": 99, + "offset": 2054, + }, + "source": "42", + "start": Position { + "column": 46, + "line": 99, + "offset": 2052, }, - "value": "42", }, - "type": "===", + "value": "42", }, + "type": "===", }, }, ], @@ -5888,20 +6342,19 @@ next: "line": 102, "offset": 2111, }, - "source": "($bar) { + "source": "while($bar) { if ((int)calculateMeaningOfLife() === 42) { break foo; } else continue; }", "start": Position { - "column": 11, + "column": 6, "line": 98, - "offset": 1997, + "offset": 1992, }, }, "shortForm": false, "test": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -5922,7 +6375,7 @@ next: }, Do { "body": Block { - "children": Array [ + "children": [ Inline { "kind": "inline", "loc": Location { @@ -5972,15 +6425,15 @@ next: "line": 107, "offset": 2196, }, - "source": "{ + "source": "do { ?> Caesar: here I was goatIt(); } @@ -6079,7 +6532,6 @@ next: "test": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -6118,15 +6570,15 @@ next: "line": 97, "offset": 1982, }, - "source": "::NUMBAR", + "source": "fooBar::NUMBAR", "start": Position { - "column": 20, + "column": 14, "line": 97, - "offset": 1974, + "offset": 1968, }, }, - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "loc": Location { "end": Position { "column": 28, @@ -6142,8 +6594,8 @@ next: }, "name": "NUMBAR", }, - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "loc": Location { "end": Position { "column": 20, @@ -6166,42 +6618,24 @@ next: }, Return { "expr": Empty { - "arguments": Array [ - ConstRef { - "kind": "constref", - "loc": Location { - "end": Position { - "column": 33, - "line": 130, - "offset": 2871, - }, - "source": "namespace\\\\FOOBAR", - "start": Position { - "column": 17, - "line": 130, - "offset": 2855, - }, + "expression": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 33, + "line": 130, + "offset": 2871, }, - "name": Identifier { - "kind": "identifier", - "loc": Location { - "end": Position { - "column": 33, - "line": 130, - "offset": 2871, - }, - "source": "namespace\\\\FOOBAR", - "start": Position { - "column": 17, - "line": 130, - "offset": 2855, - }, - }, - "name": "FOOBAR", - "resolution": "rn", + "source": "namespace\\FOOBAR", + "start": Position { + "column": 17, + "line": 130, + "offset": 2855, }, }, - ], + "name": "FOOBAR", + "resolution": "rn", + }, "kind": "empty", "loc": Location { "end": Position { @@ -6209,7 +6643,7 @@ next: "line": 130, "offset": 2872, }, - "source": "empty(namespace\\\\FOOBAR)", + "source": "empty(namespace\\FOOBAR)", "start": Position { "column": 11, "line": 130, @@ -6224,7 +6658,7 @@ next: "line": 130, "offset": 2873, }, - "source": "return empty(namespace\\\\FOOBAR);", + "source": "return empty(namespace\\FOOBAR);", "start": Position { "column": 4, "line": 130, @@ -6263,7 +6697,7 @@ next: if (isset($bipbip, $ex)) unset($bipbip, $ex); return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt(); } @@ -6275,7 +6709,7 @@ next: // @todo $this->a_$foo return $$foo ?? false; } - return empty(namespace\\\\FOOBAR); + return empty(namespace\\FOOBAR); }", "start": Position { "column": 57, @@ -6301,8 +6735,8 @@ next: }, }, "nullable": false, - "type": Identifier { - "kind": "identifier", + "type": TypeReference { + "kind": "typereference", "loc": Location { "end": Position { "column": 56, @@ -6317,11 +6751,10 @@ next: }, }, "name": "bool", - "resolution": "uqn", + "raw": "bool", }, - "uses": Array [ + "uses": [ Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -6372,7 +6805,7 @@ next: if (isset($bipbip, $ex)) unset($bipbip, $ex); return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt(); } @@ -6384,7 +6817,7 @@ next: // @todo $this->a_$foo return $$foo ?? false; } - return empty(namespace\\\\FOOBAR); + return empty(namespace\\FOOBAR); };", "start": Position { "column": 2, @@ -6397,9 +6830,9 @@ next: "alternate": If { "alternate": null, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "loc": Location { @@ -6408,19 +6841,39 @@ next: "line": 136, "offset": 2947, }, - "source": "ls -larth\`", + "source": "\`ls -larth\`", "start": Position { - "column": 10, + "column": 9, "line": 136, - "offset": 2937, + "offset": 2936, }, }, "raw": "\`ls -larth\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 19, + "line": 136, + "offset": 2946, + }, + "source": "ls -larth", + "start": Position { + "column": 10, + "line": 136, + "offset": 2937, + }, + }, + "raw": "ls -larth", + "unicode": false, + "value": "ls -larth", + }, + "kind": "encapsedpart", "loc": Location { "end": Position { "column": 19, @@ -6434,9 +6887,7 @@ next: "offset": 2937, }, }, - "raw": "ls -larth", - "unicode": false, - "value": "ls -larth", + "syntax": null, }, ], }, @@ -6490,7 +6941,6 @@ next: }, "shortForm": true, "test": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -6510,9 +6960,9 @@ next: }, }, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "loc": Location { @@ -6521,19 +6971,39 @@ next: "line": 134, "offset": 2908, }, - "source": "bar&\`", + "source": "\`bar&\`", "start": Position { - "column": 10, + "column": 9, "line": 134, - "offset": 2903, + "offset": 2902, }, }, "raw": "\`bar&\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 14, + "line": 134, + "offset": 2907, + }, + "source": "bar&", + "start": Position { + "column": 10, + "line": 134, + "offset": 2903, + }, + }, + "raw": "bar&", + "unicode": false, + "value": "bar&", + }, + "kind": "encapsedpart", "loc": Location { "end": Position { "column": 14, @@ -6547,9 +7017,7 @@ next: "offset": 2903, }, }, - "raw": "bar&", - "unicode": false, - "value": "bar&", + "syntax": null, }, ], }, @@ -6608,7 +7076,6 @@ next: }, "shortForm": true, "test": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -6626,38 +7093,32 @@ next: }, "name": "foo", }, - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "loc": Location { - "end": Position { - "column": 0, - "line": 140, - "offset": 2977, - }, - "source": "// list version -", - "start": Position { - "column": 2, - "line": 139, - "offset": 2961, - }, - }, - "value": "// list version -", - }, - ], }, ExpressionStatement { "expression": Assign { "kind": "assign", "left": List { - "arguments": Array [ - null, - Variable { - "byref": false, - "curly": false, - "kind": "variable", + "items": [ + Noop { + "kind": "noop", + "loc": Location { + "end": Position { + "column": 7, + "line": 140, + "offset": 2984, + }, + "source": "", + "start": Position { + "column": 7, + "line": 140, + "offset": 2984, + }, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", "loc": Location { "end": Position { "column": 10, @@ -6671,50 +7132,30 @@ next: "offset": 2985, }, }, - "name": "a", - }, - List { - "arguments": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "loc": Location { - "end": Position { - "column": 19, - "line": 140, - "offset": 2996, - }, - "source": "$b", - "start": Position { - "column": 17, - "line": 140, - "offset": 2994, - }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 10, + "line": 140, + "offset": 2987, }, - "name": "b", - }, - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "loc": Location { - "end": Position { - "column": 23, - "line": 140, - "offset": 3000, - }, - "source": "$c", - "start": Position { - "column": 21, - "line": 140, - "offset": 2998, - }, + "source": "$a", + "start": Position { + "column": 8, + "line": 140, + "offset": 2985, }, - "name": "c", }, - ], - "kind": "list", + "name": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", "loc": Location { "end": Position { "column": 24, @@ -6728,7 +7169,100 @@ next: "offset": 2989, }, }, - "shortForm": false, + "unpack": false, + "value": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 19, + "line": 140, + "offset": 2996, + }, + "source": "$b", + "start": Position { + "column": 17, + "line": 140, + "offset": 2994, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 19, + "line": 140, + "offset": 2996, + }, + "source": "$b", + "start": Position { + "column": 17, + "line": 140, + "offset": 2994, + }, + }, + "name": "b", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 23, + "line": 140, + "offset": 3000, + }, + "source": "$c", + "start": Position { + "column": 21, + "line": 140, + "offset": 2998, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 23, + "line": 140, + "offset": 3000, + }, + "source": "$c", + "start": Position { + "column": 21, + "line": 140, + "offset": 2998, + }, + }, + "name": "c", + }, + }, + ], + "kind": "list", + "loc": Location { + "end": Position { + "column": 24, + "line": 140, + "offset": 3001, + }, + "source": "list($b, $c)", + "start": Position { + "column": 12, + "line": 140, + "offset": 2989, + }, + }, + "shortForm": false, + }, }, ], "kind": "list", @@ -6762,9 +7296,11 @@ next: }, "operator": "=", "right": Array { - "items": Array [ - Number { - "kind": "number", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", "loc": Location { "end": Position { "column": 30, @@ -6778,46 +7314,29 @@ next: "offset": 3006, }, }, - "value": "1", - }, - Array { - "items": Array [ - Number { - "kind": "number", - "loc": Location { - "end": Position { - "column": 34, - "line": 140, - "offset": 3011, - }, - "source": "2", - "start": Position { - "column": 33, - "line": 140, - "offset": 3010, - }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 30, + "line": 140, + "offset": 3007, }, - "value": "2", - }, - Number { - "kind": "number", - "loc": Location { - "end": Position { - "column": 37, - "line": 140, - "offset": 3014, - }, - "source": "3", - "start": Position { - "column": 36, - "line": 140, - "offset": 3013, - }, + "source": "1", + "start": Position { + "column": 29, + "line": 140, + "offset": 3006, }, - "value": "3", }, - ], - "kind": "array", + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", "loc": Location { "end": Position { "column": 38, @@ -6831,7 +7350,98 @@ next: "offset": 3009, }, }, - "shortForm": true, + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 34, + "line": 140, + "offset": 3011, + }, + "source": "2", + "start": Position { + "column": 33, + "line": 140, + "offset": 3010, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 34, + "line": 140, + "offset": 3011, + }, + "source": "2", + "start": Position { + "column": 33, + "line": 140, + "offset": 3010, + }, + }, + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 37, + "line": 140, + "offset": 3014, + }, + "source": "3", + "start": Position { + "column": 36, + "line": 140, + "offset": 3013, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 37, + "line": 140, + "offset": 3014, + }, + "source": "3", + "start": Position { + "column": 36, + "line": 140, + "offset": 3013, + }, + }, + "value": "3", + }, + }, + ], + "kind": "array", + "loc": Location { + "end": Position { + "column": 38, + "line": 140, + "offset": 3015, + }, + "source": "[2, 3]", + "start": Position { + "column": 32, + "line": 140, + "offset": 3009, + }, + }, + "shortForm": true, + }, }, ], "kind": "array", @@ -6852,6 +7462,28 @@ next: }, }, "kind": "expressionstatement", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 140, + "offset": 2977, + }, + "source": "// list version +", + "start": Position { + "column": 2, + "line": 139, + "offset": 2961, + }, + }, + "offset": 2961, + "value": "// list version +", + }, + ], "loc": Location { "end": Position { "column": 40, @@ -6870,12 +7502,27 @@ next: "expression": Assign { "kind": "assign", "left": List { - "arguments": Array [ - null, - Variable { - "byref": false, - "curly": false, - "kind": "variable", + "items": [ + Noop { + "kind": "noop", + "loc": Location { + "end": Position { + "column": 3, + "line": 141, + "offset": 3021, + }, + "source": "", + "start": Position { + "column": 3, + "line": 141, + "offset": 3021, + }, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", "loc": Location { "end": Position { "column": 6, @@ -6889,51 +7536,30 @@ next: "offset": 3022, }, }, - "name": "a", - }, - Array { - "items": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "loc": Location { - "end": Position { - "column": 10, - "line": 141, - "offset": 3028, - }, - "source": "$b", - "start": Position { - "column": 8, - "line": 141, - "offset": 3026, - }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 6, + "line": 141, + "offset": 3024, }, - "name": "b", - }, - null, - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "loc": Location { - "end": Position { - "column": 15, - "line": 141, - "offset": 3033, - }, - "source": "$c", - "start": Position { - "column": 13, - "line": 141, - "offset": 3031, - }, + "source": "$a", + "start": Position { + "column": 4, + "line": 141, + "offset": 3022, }, - "name": "c", }, - ], - "kind": "array", + "name": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", "loc": Location { "end": Position { "column": 16, @@ -6947,7 +7573,116 @@ next: "offset": 3025, }, }, - "shortForm": true, + "unpack": false, + "value": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 10, + "line": 141, + "offset": 3028, + }, + "source": "$b", + "start": Position { + "column": 8, + "line": 141, + "offset": 3026, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 10, + "line": 141, + "offset": 3028, + }, + "source": "$b", + "start": Position { + "column": 8, + "line": 141, + "offset": 3026, + }, + }, + "name": "b", + }, + }, + Noop { + "kind": "noop", + "loc": Location { + "end": Position { + "column": 11, + "line": 141, + "offset": 3029, + }, + "source": " ", + "start": Position { + "column": 12, + "line": 141, + "offset": 3030, + }, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 15, + "line": 141, + "offset": 3033, + }, + "source": "$c", + "start": Position { + "column": 13, + "line": 141, + "offset": 3031, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 15, + "line": 141, + "offset": 3033, + }, + "source": "$c", + "start": Position { + "column": 13, + "line": 141, + "offset": 3031, + }, + }, + "name": "c", + }, + }, + ], + "kind": "list", + "loc": Location { + "end": Position { + "column": 16, + "line": 141, + "offset": 3034, + }, + "source": "[$b, ,$c]", + "start": Position { + "column": 7, + "line": 141, + "offset": 3025, + }, + }, + "shortForm": true, + }, }, ], "kind": "list", @@ -6981,7 +7716,6 @@ next: }, "operator": "=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -7017,7 +7751,7 @@ next: }, ExpressionStatement { "expression": Print { - "arguments": Encapsed { + "expression": Encapsed { "kind": "encapsed", "label": "BAZ", "loc": Location { @@ -7026,24 +7760,47 @@ next: "line": 144, "offset": 3074, }, - "source": " Hello world + "source": "<<Hellodwarf as $name => $greeting) { - echo \\"Hey ho $name, $greeting !\\"; + echo "Hey ho $name, $greeting !"; continue $foo; } - throw new \\\\ComeToHome('Thats it'); + throw new \\ComeToHome('Thats it'); } } @@ -7419,7 +8200,7 @@ next: if (isset($bipbip, $ex)) unset($bipbip, $ex); return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt(); } @@ -7431,7 +8212,7 @@ next: // @todo $this->a_$foo return $$foo ?? false; } - return empty(namespace\\\\FOOBAR); + return empty(namespace\\FOOBAR); }; if ($foo): @@ -7463,7 +8244,7 @@ FOO "offset": 140, }, }, - "name": "foo\\\\bar", + "name": "foo\\bar", "withBrackets": true, }, Halt { @@ -7486,7 +8267,7 @@ THE END ... }, }, ], - "comments": Array [ + "comments": [ CommentBlock { "kind": "commentblock", "loc": Location { @@ -7502,6 +8283,7 @@ THE END ... "offset": 93, }, }, + "offset": 93, "value": "/** a comment before the namespace comment **/", }, CommentLine { @@ -7520,6 +8302,7 @@ THE END ... "offset": 177, }, }, + "offset": 177, "value": "# single line comment ", }, @@ -7539,6 +8322,7 @@ THE END ... "offset": 224, }, }, + "offset": 224, "value": "// sample code ", }, @@ -7558,6 +8342,7 @@ THE END ... "offset": 252, }, }, + "offset": 252, "value": "// with alias ", }, @@ -7577,6 +8362,7 @@ THE END ... "offset": 312, }, }, + "offset": 312, "value": "// generic constant ", }, @@ -7597,6 +8383,7 @@ THE END ... "offset": 365, }, }, + "offset": 365, "value": "/** * a class */", @@ -7618,6 +8405,7 @@ THE END ... "offset": 654, }, }, + "offset": 654, "value": "/** * Something is done here */", @@ -7638,6 +8426,7 @@ THE END ... "offset": 744, }, }, + "offset": 744, "value": "// do not wanna do ", }, @@ -7657,6 +8446,7 @@ THE END ... "offset": 1571, }, }, + "offset": 1571, "value": "// this is SPARTA ! ", }, @@ -7676,6 +8466,7 @@ THE END ... "offset": 2780, }, }, + "offset": 2780, "value": "// @todo $this->a_$foo ", }, @@ -7695,11 +8486,12 @@ THE END ... "offset": 2961, }, }, + "offset": 2961, "value": "// list version ", }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { @@ -7714,7 +8506,7 @@ declare(strict_types=1); include_once 'foo.php'; /** a comment before the namespace comment **/ -namespace foo\\\\bar { +namespace foo\\bar { ?>Hellodwarf as $name => $greeting) { - echo \\"Hey ho $name, $greeting !\\"; + echo "Hey ho $name, $greeting !"; continue $foo; } - throw new \\\\ComeToHome('Thats it'); + throw new \\ComeToHome('Thats it'); } } @@ -7824,7 +8616,7 @@ next: if (isset($bipbip, $ex)) unset($bipbip, $ex); return (new class extends fooBar { function goatIt() { - return \\"meeeh\\"; + return "meeeh"; } })->goatIt(); } @@ -7836,7 +8628,7 @@ next: // @todo $this->a_$foo return $$foo ?? false; } - return empty(namespace\\\\FOOBAR); + return empty(namespace\\FOOBAR); }; if ($foo): diff --git a/test/snapshot/__snapshots__/array.test.js.snap b/test/snapshot/__snapshots__/array.test.js.snap index 3127d4b24..57818c9bf 100644 --- a/test/snapshot/__snapshots__/array.test.js.snap +++ b/test/snapshot/__snapshots__/array.test.js.snap @@ -1,176 +1,152 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Array without keys deference array 1`] = ` +exports[`Array without keys array with empty values #2 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { - "expression": Assign { - "kind": "assign", - "left": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "a", - }, - "operator": "=", - "right": Call { - "arguments": Array [], - "kind": "call", - "what": PropertyLookup { - "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", - "name": "foo", + "expression": Array { + "items": [ + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", }, - "what": OffsetLookup { - "kind": "offsetlookup", - "offset": OffsetLookup { - "kind": "offsetlookup", - "offset": Number { - "kind": "number", - "value": "1", - }, - "what": Call { - "arguments": Array [], - "kind": "call", - "what": PropertyLookup { - "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", - "name": "bar", - }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "foo", - }, - }, - }, - }, - "what": Call { - "arguments": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "foo", - }, - ], - "kind": "call", - "what": Array { - "items": Array [ - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"a\\"", - "unicode": false, - "value": "a", - }, - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"b\\"", - "unicode": false, - "value": "b", - }, - ], - "kind": "array", - "shortForm": true, - }, - }, + }, + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", }, }, - }, - }, - "kind": "expressionstatement", - }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Array without keys mixed tests / coverage test empty array 1`] = ` -Program { - "children": Array [ - ExpressionStatement { - "expression": Assign { - "kind": "assign", - "left": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "a", - }, - "operator": "=", - "right": Array { - "items": Array [], - "kind": "array", - "shortForm": true, - }, - }, - "kind": "expressionstatement", - }, - ExpressionStatement { - "expression": Assign { - "kind": "assign", - "left": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "b", - }, - "operator": "=", - "right": Array { - "items": Array [], - "kind": "array", - "shortForm": false, - }, + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'baz'", + "unicode": false, + "value": "baz", + }, + }, + ], + "kind": "array", + "shortForm": true, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Array without keys mixed tests / coverage test short form / keys 1`] = ` +exports[`Array without keys array with empty values #3 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Array { - "items": Array [ + "items": [ + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, Entry { - "key": Number { - "kind": "number", - "value": "0", - }, + "byRef": false, + "key": null, "kind": "entry", - "value": Variable { - "byref": true, - "curly": false, - "kind": "variable", - "name": "foo", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", }, }, + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, Entry { - "key": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "bar", + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", }, + }, + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, + Entry { + "byRef": false, + "key": null, "kind": "entry", + "unpack": false, "value": String { - "isDoubleQuote": true, + "isDoubleQuote": false, "kind": "string", - "raw": "\\"foobar\\"", + "raw": "'baz'", "unicode": false, - "value": "foobar", + "value": "baz", }, }, + Noop { + "kind": "noop", + }, ], "kind": "array", "shortForm": true, @@ -178,151 +154,179 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Array without keys of arrays 1`] = ` +exports[`Array without keys array with empty values 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Array { - "items": Array [ - Array { - "items": Array [ - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item1\\"", - "unicode": false, - "value": "item1", - }, - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item2\\"", - "unicode": false, - "value": "item2", - }, - ], - "kind": "array", - "shortForm": false, + "items": [ + Noop { + "kind": "noop", }, - Array { - "items": Array [ - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item3\\"", - "unicode": false, - "value": "item3", - }, - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item4\\"", - "unicode": false, - "value": "item4", - }, - ], - "kind": "array", - "shortForm": false, + Noop { + "kind": "noop", }, - Array { - "items": Array [ - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item5\\"", - "unicode": false, - "value": "item5", - }, - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item6\\"", - "unicode": false, - "value": "item6", - }, - ], - "kind": "array", - "shortForm": false, + Noop { + "kind": "noop", + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + }, + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'baz'", + "unicode": false, + "value": "baz", + }, }, ], "kind": "array", - "shortForm": false, + "shortForm": true, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Array without keys of numbers 1`] = ` +exports[`Array without keys array with multiple trailing commas #2 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Array { - "items": Array [ - Number { - "kind": "number", - "value": "1", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + }, + Noop { + "kind": "noop", }, - Number { - "kind": "number", - "value": "2.5", + Noop { + "kind": "noop", }, - Number { - "kind": "number", - "value": "0x1000", + Noop { + "kind": "noop", + }, + Noop { + "kind": "noop", }, ], "kind": "array", - "shortForm": false, + "shortForm": true, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Array without keys of objects 1`] = ` +exports[`Array without keys array with multiple trailing commas 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Array { - "items": Array [ - New { - "arguments": Array [], - "kind": "new", - "what": Identifier { - "kind": "identifier", - "name": "foo", - "resolution": "uqn", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", }, }, - New { - "arguments": Array [], - "kind": "new", - "what": Identifier { - "kind": "identifier", - "name": "stdClass", - "resolution": "uqn", + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", }, }, - New { - "arguments": Array [], - "kind": "new", - "what": Identifier { - "kind": "identifier", - "name": "bar", - "resolution": "uqn", - }, + Noop { + "kind": "noop", }, ], "kind": "array", @@ -331,77 +335,1018 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Array without keys of strings 1`] = ` +exports[`Array without keys array with trailing commas #3 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Array { - "items": Array [ - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item1\\"", - "unicode": false, - "value": "item1", - }, - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item2\\"", - "unicode": false, - "value": "item2", - }, - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item3\\"", - "unicode": false, - "value": "item3", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, }, ], "kind": "array", - "shortForm": false, + "shortForm": true, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys array with trailing commas #4 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys array with trailing commas #5 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys array without trailing commas #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys array without trailing commas 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys byRef 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'test'", + "unicode": false, + "value": "test", + }, + }, + Entry { + "byRef": true, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + Entry { + "byRef": true, + "key": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'test'", + "unicode": false, + "value": "test", + }, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys deference array 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + ], + "kind": "call", + "what": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""a"", + "unicode": false, + "value": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""b"", + "unicode": false, + "value": "b", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys mixed tests / coverage test empty array 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": Array { + "items": [], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "operator": "=", + "right": Array { + "items": [], + "kind": "array", + "shortForm": false, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys mixed tests / coverage test short form / keys 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": true, + "key": Number { + "kind": "number", + "value": "0", + }, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + Entry { + "byRef": false, + "key": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""foobar"", + "unicode": false, + "value": "foobar", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys non empty array 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1.1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'test'", + "unicode": false, + "value": "test", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""test"", + "unicode": false, + "value": "test", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": NullKeyword { + "kind": "nullkeyword", + "raw": "null", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys of arrays 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item1"", + "unicode": false, + "value": "item1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item2"", + "unicode": false, + "value": "item2", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item3"", + "unicode": false, + "value": "item3", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item4"", + "unicode": false, + "value": "item4", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item5"", + "unicode": false, + "value": "item5", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item6"", + "unicode": false, + "value": "item6", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys of numbers 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "2.5", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "0x1000", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys of objects 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "stdClass", + "resolution": "uqn", + }, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys of strings 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item1"", + "unicode": false, + "value": "item1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item2"", + "unicode": false, + "value": "item2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item3"", + "unicode": false, + "value": "item3", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], "kind": "program", } `; exports[`Array without keys of strings and numbers 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Array { - "items": Array [ - Number { - "kind": "number", - "value": "1", - }, - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item2\\"", - "unicode": false, - "value": "item2", - }, - Number { - "kind": "number", - "value": "3", - }, - String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"item4\\"", - "unicode": false, - "value": "item4", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item2"", + "unicode": false, + "value": "item2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""item4"", + "unicode": false, + "value": "item4", + }, }, ], "kind": "array", @@ -410,34 +1355,49 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Array without keys of variables 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Array { - "items": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "obj1", - }, - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "obj2", - }, - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "obj3", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "obj1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "obj2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "obj3", + }, }, ], "kind": "array", @@ -446,7 +1406,448 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys single and empty (short form) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [], + "kind": "array", + "shortForm": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys single and empty 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [], + "kind": "array", + "shortForm": false, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys spread operator 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'banana'", + "unicode": false, + "value": "banana", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'orange'", + "unicode": false, + "value": "orange", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "parts", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'watermelon'", + "unicode": false, + "value": "watermelon", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "arr1", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "0", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "arr1", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "arr1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "arr2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "111", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "arr1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "arr1", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "getArr", + "resolution": "uqn", + }, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'c'", + "unicode": false, + "value": "c", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": New { + "arguments": [ + Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'a'", + "unicode": false, + "value": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'b'", + "unicode": false, + "value": "b", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'c'", + "unicode": false, + "value": "c", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + ], + "kind": "new", + "what": Name { + "kind": "name", + "name": "ArrayIterator", + "resolution": "uqn", + }, + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Array without keys spread operator with reference 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "arr", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": undefined, + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '&' on line 1", + "token": "'&'", + }, + ], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/arrowfunc.test.js.snap b/test/snapshot/__snapshots__/arrowfunc.test.js.snap new file mode 100644 index 000000000..06086991b --- /dev/null +++ b/test/snapshot/__snapshots__/arrowfunc.test.js.snap @@ -0,0 +1,546 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`arrow function argument 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": null, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`arrow function argument by ref 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": true, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": null, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`arrow function arguments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": null, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`arrow function error / arrow functions before PHP 7.4 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "fn1", + }, + "operator": "=", + "right": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "x", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "fn", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "x", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "y", + }, + "type": "+", + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ';' on line 1", + "token": "'=>' (T_DOUBLE_ARROW)", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '=>' (T_DOUBLE_ARROW) on line 1", + "token": "'=>' (T_DOUBLE_ARROW)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '$x' (T_VARIABLE), expecting ';' on line 1", + "token": "'$x' (T_VARIABLE)", + }, + ], + "kind": "program", +} +`; + +exports[`arrow function error / empty not allowed 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": undefined, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": null, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected ';' on line 1", + "token": "';'", + }, + ], + "kind": "program", +} +`; + +exports[`arrow function error / fn fails on php7.4 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [ + Return { + "expr": Variable { + "curly": false, + "kind": "variable", + "name": "arg", + }, + "kind": "return", + }, + ], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [ + Error { + "expected": "(", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'fn' (T_FN), expecting '(' on line 1", + "token": "'fn' (T_FN)", + }, + ], + "kind": "program", +} +`; + +exports[`arrow function error / fn passes on php7.3 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [ + Return { + "expr": Variable { + "curly": false, + "kind": "variable", + "name": "arg", + }, + "kind": "return", + }, + ], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "fn", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`arrow function inside call 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Variable { + "curly": false, + "kind": "variable", + "name": "arg", + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": null, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`arrow function return type 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": true, + "type": TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`arrow function simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": null, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/assign.test.js.snap b/test/snapshot/__snapshots__/assign.test.js.snap new file mode 100644 index 000000000..69241ab07 --- /dev/null +++ b/test/snapshot/__snapshots__/assign.test.js.snap @@ -0,0 +1,543 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`assign %= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "%=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign &= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "&=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign **= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "**=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign *= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "*=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign += 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "+=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign .= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": ".=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign /= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "/=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign <<= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "<<=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign >>= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": ">>=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign ??= (php < 7) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": RetIf { + "falseExpr": undefined, + "kind": "retif", + "test": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "trueExpr": undefined, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '?' on line 1", + "token": "'?'", + }, + Error { + "expected": ":", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '=', expecting ':' on line 1", + "token": "'='", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '=' on line 1", + "token": "'='", + }, + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '$var' (T_VARIABLE), expecting ';' on line 1", + "token": "'$var' (T_VARIABLE)", + }, + ], + "kind": "program", +} +`; + +exports[`assign ??= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "??=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign ??= with bin 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "??=", + "right": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Number { + "kind": "number", + "value": "10", + }, + "type": "+", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign ^= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "^=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign |= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "|=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign -= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "-=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign multiple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "1", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`assign with ref 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/ast.test.js.snap b/test/snapshot/__snapshots__/ast.test.js.snap index 53b61ae83..91208a884 100644 --- a/test/snapshot/__snapshots__/ast.test.js.snap +++ b/test/snapshot/__snapshots__/ast.test.js.snap @@ -2,7 +2,7 @@ exports[`Test AST structure #176 - lost \`?>\` in program node 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Magic { "kind": "magic", @@ -38,7 +38,7 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { @@ -60,9 +60,9 @@ Program { exports[`Test AST structure fix #120 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": false, "kind": "string", @@ -81,20 +81,20 @@ Program { "value": " !", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure fix #127 - echo statements 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"hello\\"", + "raw": ""hello"", "unicode": false, "value": "hello", }, @@ -108,33 +108,83 @@ Program { "value": " world", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure fix #127 - inline 1`] = ` Program { - "children": Array [ + "children": [ Inline { "kind": "inline", "raw": "?>?>", "value": "?>?>", }, ], - "errors": Array [], + "errors": [], + "kind": "program", +} +`; + +exports[`Test AST structure fix #370 - classreference instead identifier(classreferent) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": Name { + "kind": "name", + "name": "test", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test AST structure fix #370 - nullkeyword 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": NullKeyword { + "kind": "nullkeyword", + "raw": "Null", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], "kind": "program", } `; exports[`Test AST structure test clone 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -143,7 +193,6 @@ Program { "right": Clone { "kind": "clone", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", @@ -153,19 +202,18 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure test coalesce operator 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", @@ -174,7 +222,6 @@ Program { "right": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -190,78 +237,89 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure test constants 1`] = ` Program { - "children": Array [ - Constant { - "kind": "constant", - "name": "FOO", - "value": Number { - "kind": "number", - "value": "3.14", - }, + "children": [ + ConstantStatement { + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "value": Number { + "kind": "number", + "value": "3.14", + }, + }, + ], + "kind": "constantstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure test die/exit 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Exit { - "kind": "exit", - "status": String { + "expression": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"bye\\"", + "raw": ""bye"", "unicode": false, "value": "bye", }, + "kind": "exit", "useDie": true, }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Exit { - "kind": "exit", - "status": Number { - "kind": "number", - "value": "-1", + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Number { + "kind": "number", + "value": "1", + }, }, + "kind": "exit", "useDie": false, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure test echo, isset, unset, empty 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ RetIf { "falseExpr": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"ko\\"", + "raw": ""ko"", "unicode": false, "value": "ko", }, "kind": "retif", "test": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "expr", @@ -270,7 +328,7 @@ Program { "trueExpr": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"ok\\"", + "raw": ""ok"", "unicode": false, "value": "ok", }, @@ -281,10 +339,10 @@ Program { }, ExpressionStatement { "expression": Print { - "arguments": String { + "expression": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"some text\\"", + "raw": ""some text"", "unicode": false, "value": "some text", }, @@ -294,65 +352,59 @@ Program { }, ExpressionStatement { "expression": Isset { - "arguments": Array [ + "kind": "isset", + "variables": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", }, Variable { - "byref": false, "curly": false, "kind": "variable", "name": "bar", }, ], - "kind": "isset", }, "kind": "expressionstatement", }, Unset { - "arguments": Array [ + "kind": "unset", + "variables": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", }, ], - "kind": "unset", }, ExpressionStatement { "expression": Empty { - "arguments": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "var", - }, - ], + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, "kind": "empty", }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure test eval 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Eval { "kind": "eval", "source": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"return true;\\"", + "raw": ""return true;"", "unicode": false, "value": "return true;", }, @@ -360,14 +412,14 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure test include / require 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Include { "kind": "include", @@ -376,7 +428,7 @@ Program { "target": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"file.php\\"", + "raw": ""file.php"", "unicode": false, "value": "file.php", }, @@ -390,19 +442,16 @@ Program { "require": false, "target": Bin { "kind": "bin", - "left": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "PATH", - "resolution": "uqn", - }, + "left": Name { + "kind": "name", + "name": "PATH", + "resolution": "uqn", }, "parenthesizedExpression": true, "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"/file.php\\"", + "raw": ""/file.php"", "unicode": false, "value": "/file.php", }, @@ -419,7 +468,7 @@ Program { "target": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"req.php\\"", + "raw": ""req.php"", "unicode": false, "value": "req.php", }, @@ -434,7 +483,7 @@ Program { "target": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"file.php\\"", + "raw": ""file.php"", "unicode": false, "value": "file.php", }, @@ -442,21 +491,21 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure test inline 1`] = ` Program { - "children": Array [ + "children": [ Inline { "kind": "inline", "raw": "Hello ", "value": "Hello ", }, Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": false, "kind": "string", @@ -475,16 +524,72 @@ Program { "value": " !", }, ], - "errors": Array [], + "errors": [], + "kind": "program", +} +`; + +exports[`Test AST structure test invalid namespace separator 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Error { + "expected": "SCALAR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '\\' (T_NS_SEPARATOR) on line 1", + "token": "'\\' (T_NS_SEPARATOR)", + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "1", + }, + }, + "kind": "expressionstatement", + }, + Inline { + "kind": "inline", + "raw": " + !", + "value": " !", + }, + ], + "errors": [ + Error { + "expected": "SCALAR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '\\' (T_NS_SEPARATOR) on line 1", + "token": "'\\' (T_NS_SEPARATOR)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '$var' (T_VARIABLE), expecting ';' on line 1", + "token": "'$var' (T_VARIABLE)", + }, + ], "kind": "program", } `; exports[`Test AST structure test magics 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Magic { "kind": "magic", "raw": "__FILE__", @@ -500,35 +605,40 @@ Program { "shortForm": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test AST structure test program 1`] = ` Program { - "children": Array [], - "errors": Array [], + "children": [], + "errors": [], "kind": "program", } `; exports[`Test AST structure test shell 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "raw": "\`ls -larth\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "ls -larth", - "unicode": false, - "value": "ls -larth", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "ls -larth", + "unicode": false, + "value": "ls -larth", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -537,7 +647,7 @@ Program { "shortForm": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/attributes.test.js.snap b/test/snapshot/__snapshots__/attributes.test.js.snap new file mode 100644 index 000000000..36fb1d4f0 --- /dev/null +++ b/test/snapshot/__snapshots__/attributes.test.js.snap @@ -0,0 +1,2692 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Parse Attributes can parse anon-class attributes 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": New { + "arguments": [], + "kind": "new", + "what": Class { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "T", + }, + ], + "kind": "attrgroup", + }, + ], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": true, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": null, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse anonymous function attributes 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "Pure", + }, + ], + "kind": "attrgroup", + }, + ], + "body": Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": null, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "A", + }, + ], + "kind": "attrgroup", + }, + ], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse attributes in inner statements 1`] = ` +Program { + "children": [ + Namespace { + "children": [ + _Function { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Return { + "expr": Closure { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "C", + }, + ], + "kind": "attrgroup", + }, + ], + "body": Closure { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "Pure", + }, + ], + "kind": "attrgroup", + }, + ], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [], + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": null, + }, + "kind": "return", + }, + ], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "type": null, + }, + ], + "kind": "namespace", + "name": "A", + "withBrackets": true, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse attributes with namespace 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "\\JetBrains\\PhpStorm\\Pure", + }, + ], + "kind": "attrgroup", + }, + ], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse class attributes 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "Deprecated", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""use NewClass"", + "unicode": false, + "value": "use NewClass", + }, + ], + "kind": "attribute", + "name": "replace", + }, + ], + "kind": "attrgroup", + }, + ], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "DepClass", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse class const attributes 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "B", + }, + ], + "kind": "attrgroup", + }, + ], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "B", + }, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse class property attributes 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "B", + }, + ], + "kind": "attrgroup", + }, + ], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "B", + "resolution": "uqn", + }, + "value": null, + }, + ], + "visibility": "public", + }, + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "C", + }, + ], + "kind": "attrgroup", + }, + ], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "c", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "C", + "resolution": "uqn", + }, + "value": null, + }, + ], + "visibility": "private", + }, + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "D", + }, + ], + "kind": "attrgroup", + }, + ], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "d", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], + "visibility": "protected", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse interface attributes 1`] = ` +Program { + "children": [ + Interface { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "A", + }, + ], + "kind": "attrgroup", + }, + ], + "body": [ + ClassConstant { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "C", + }, + ], + "kind": "attrgroup", + }, + ], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "D", + }, + "value": Number { + "kind": "number", + "value": "0", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "", + }, + Method { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "E", + }, + ], + "kind": "attrgroup", + }, + ], + "body": null, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "f", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "kind": "interface", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse method attributes 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "Pure", + }, + ], + "kind": "attrgroup", + }, + ], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "m", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Test", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse multi-line attributes 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "One", + }, + Attribute { + "args": [], + "kind": "attribute", + "name": "Two", + }, + Attribute { + "args": [], + "kind": "attribute", + "name": "Three", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "Four", + }, + ], + "kind": "attrgroup", + }, + ], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Multi", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse param attributes 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "Unsigned", + }, + ], + "kind": "attrgroup", + }, + ], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "n", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "f", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse params with argument labels 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [ + namedargument { + "kind": "namedargument", + "name": "value", + "value": Number { + "kind": "number", + "value": "1234", + }, + }, + ], + "kind": "attribute", + "name": "MyAttribute", + }, + ], + "kind": "attrgroup", + }, + ], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse params with bitwise operations 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": "|", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att2", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att2", + "resolution": "uqn", + }, + }, + "type": "&", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att3", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att3", + "resolution": "uqn", + }, + }, + "type": "^", + }, + ], + "kind": "attribute", + "name": "Att3", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Unary { + "kind": "unary", + "type": "~", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att4", + "resolution": "uqn", + }, + }, + }, + ], + "kind": "attribute", + "name": "Att4", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att5", + "resolution": "uqn", + }, + }, + "right": Number { + "kind": "number", + "value": "1", + }, + "type": ">>", + }, + ], + "kind": "attribute", + "name": "Att5", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att6", + "resolution": "uqn", + }, + }, + "right": Number { + "kind": "number", + "value": "1", + }, + "type": "<<", + }, + ], + "kind": "attribute", + "name": "Att6", + }, + ], + "kind": "attrgroup", + }, + ], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "comments": [], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse params with comments 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "Unsigned", + }, + ], + "kind": "attrgroup", + }, + ], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 26, + "value": "/* Pure */", + }, + ], + "name": "Pure", + }, + ], + "kind": "attrgroup", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 0, + "value": "// Line 1 +", + }, + ], + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 66, + "value": "// Try using b +", + }, + ], + "name": "Deprecated", + }, + ], + "kind": "attrgroup", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 43, + "value": "// Line 3 +", + }, + ], + }, + ], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "type": null, + }, + ], + "comments": [ + CommentLine { + "kind": "commentline", + "offset": 0, + "value": "// Line 1 +", + }, + CommentBlock { + "kind": "commentblock", + "offset": 26, + "value": "/* Pure */", + }, + CommentLine { + "kind": "commentline", + "offset": 43, + "value": "// Line 3 +", + }, + CommentLine { + "kind": "commentline", + "offset": 66, + "value": "// Try using b +", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse params with end characters 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""])}>"", + "unicode": false, + "value": "])}>", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + ], + "kind": "attribute", + "name": "End", + }, + ], + "kind": "attrgroup", + }, + ], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "End", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse params with logical operations 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": "||", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att2", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att2", + "resolution": "uqn", + }, + }, + "type": "&&", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att3", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att3", + "resolution": "uqn", + }, + }, + "type": "or", + }, + ], + "kind": "attribute", + "name": "Att3", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att4", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att4", + "resolution": "uqn", + }, + }, + "type": "and", + }, + ], + "kind": "attribute", + "name": "Att4", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att5", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att5", + "resolution": "uqn", + }, + }, + "type": "xor", + }, + ], + "kind": "attribute", + "name": "Att5", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Unary { + "kind": "unary", + "type": "!", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att6", + "resolution": "uqn", + }, + }, + }, + ], + "kind": "attribute", + "name": "Att6", + }, + ], + "kind": "attrgroup", + }, + ], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "comments": [], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse params with mathematical expressions 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": Bin { + "kind": "bin", + "left": Bin { + "kind": "bin", + "left": Bin { + "kind": "bin", + "left": Unary { + "kind": "unary", + "type": "-", + "what": Number { + "kind": "number", + "value": "20", + }, + }, + "right": Bin { + "kind": "bin", + "left": Unary { + "kind": "unary", + "type": "+", + "what": Number { + "kind": "number", + "value": "10", + }, + }, + "parenthesizedExpression": true, + "right": Number { + "kind": "number", + "value": "5", + }, + "type": "/", + }, + "type": "*", + }, + "right": Number { + "kind": "number", + "value": "2", + }, + "type": "%", + }, + "right": Bin { + "kind": "bin", + "left": Number { + "kind": "number", + "value": "8", + }, + "right": Number { + "kind": "number", + "value": "2", + }, + "type": "**", + }, + "type": "+", + }, + "right": Unary { + "kind": "unary", + "type": "+", + "what": Unary { + "kind": "unary", + "type": "-", + "what": Number { + "kind": "number", + "value": "2", + }, + }, + }, + "type": "-", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + ], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "comments": [], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse params with string concatenation 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""a"", + "unicode": false, + "value": "a", + }, + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""b"", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""a"", + "unicode": false, + "value": "a", + }, + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""b"", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'a'", + "unicode": false, + "value": "a", + }, + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""b"", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'a'", + "unicode": false, + "value": "a", + }, + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""b"", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""a"", + "unicode": false, + "value": "a", + }, + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'b'", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""a"", + "unicode": false, + "value": "a", + }, + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'b'", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'a'", + "unicode": false, + "value": "a", + }, + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'b'", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'a'", + "unicode": false, + "value": "a", + }, + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'b'", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att2", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""b"", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""b"", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'b'", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'b'", + "unicode": false, + "value": "b", + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""a"", + "unicode": false, + "value": "a", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""a"", + "unicode": false, + "value": "a", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'a'", + "unicode": false, + "value": "a", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'a'", + "unicode": false, + "value": "a", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Bin { + "kind": "bin", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "what": Name { + "kind": "name", + "name": "Att1", + "resolution": "uqn", + }, + }, + "type": ".", + }, + ], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + ], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "comments": [], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes can parse parms with array values 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [ + Array { + "items": [ + Entry { + "byRef": false, + "key": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""a"", + "unicode": false, + "value": "a", + }, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'b'", + "unicode": false, + "value": "b", + }, + "kind": "entry", + "unpack": false, + "value": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "class", + }, + "what": Name { + "kind": "name", + "name": "Test", + "resolution": "uqn", + }, + }, + }, + Entry { + "byRef": false, + "key": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'c'", + "unicode": false, + "value": "c", + }, + "kind": "entry", + "unpack": false, + "value": Array { + "items": [], + "kind": "array", + "shortForm": true, + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + ], + "kind": "attribute", + "name": "List", + }, + ], + "kind": "attrgroup", + }, + ], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes doesnt parse attributes for assignments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "1", + }, + }, + "kind": "expressionstatement", + }, + ], + "comments": [], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes doesnt repeat attributes from previous function 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [], + "kind": "attribute", + "name": "Att1", + }, + ], + "kind": "attrgroup", + }, + ], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "c", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "d", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes parses attributes as comments for PHP < 8 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 45, + "value": "#[Att2] +", + }, + ], + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 9, + "value": "#[Att1] +", + }, + ], + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + }, + ], + "comments": [ + CommentLine { + "kind": "commentline", + "offset": 9, + "value": "#[Att1] +", + }, + CommentLine { + "kind": "commentline", + "offset": 45, + "value": "#[Att2] +", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Parse Attributes parses this complicated edge case 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": Identifier { + "kind": "identifier", + "name": "Assert", + }, + "kind": "useitem", + "name": "Symfony\\Component\\Validator\\Constraints", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": null, + }, + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [ + AttrGroup { + "attrs": [ + Attribute { + "args": [ + namedargument { + "kind": "namedargument", + "name": "allowNull", + "value": Boolean { + "kind": "boolean", + "raw": "false", + "value": false, + }, + }, + namedargument { + "kind": "namedargument", + "name": "groups", + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + ], + "kind": "attribute", + "name": "Assert\\NotBlank", + }, + Attribute { + "args": [ + namedargument { + "kind": "namedargument", + "name": "max", + "value": Number { + "kind": "number", + "value": "255", + }, + }, + namedargument { + "kind": "namedargument", + "name": "groups", + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + ], + "kind": "attribute", + "name": "Assert\\Length", + }, + ], + "kind": "attrgroup", + }, + ], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "value", + }, + "nullable": true, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + "value": NullKeyword { + "kind": "nullkeyword", + "raw": "null", + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "ValueModel", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/bin.test.js.snap b/test/snapshot/__snapshots__/bin.test.js.snap new file mode 100644 index 000000000..859c2ea69 --- /dev/null +++ b/test/snapshot/__snapshots__/bin.test.js.snap @@ -0,0 +1,1197 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`bin != 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "!=", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin !== 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "!==", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin % 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "%", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin & 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "&", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin && 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "&&", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin * 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "*", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin ** 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "**", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin ** right-associative 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "right": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "c", + }, + "type": "**", + }, + "type": "**", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin + 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "+", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin . 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": ".", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin / 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "/", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin < 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "<", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin << 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "<<", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin <= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "<=", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin <=> 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "<=>", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin == 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "==", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin === 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "===", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin > 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": ">", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin >= 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": ">=", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin >> 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": ">>", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin ?? (php < 7) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": RetIf { + "falseExpr": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "retif", + "test": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "trueExpr": undefined, + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '?' on line 1", + "token": "'?'", + }, + Error { + "expected": ":", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '$var' (T_VARIABLE), expecting ':' on line 1", + "token": "'$var' (T_VARIABLE)", + }, + ], + "kind": "program", +} +`; + +exports[`bin ?? 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "??", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin ?? right-associative 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "right": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "c", + }, + "type": "??", + }, + "type": "??", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin ^ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "^", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin | 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "|", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin || 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "||", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin - 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "-", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin and 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "and", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin assign 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "+", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin instanceof 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Name { + "kind": "name", + "name": "MyClass", + "resolution": "uqn", + }, + "type": "instanceof", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin instanceof parent 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + "type": "instanceof", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin instanceof self 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + "type": "instanceof", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin instanceof static 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": StaticReference { + "kind": "staticreference", + "raw": "static", + }, + "type": "instanceof", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin instanceof variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "instanceof", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin multiple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Bin { + "kind": "bin", + "left": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "+", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "+", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin multiple instanceof static 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": StaticReference { + "kind": "staticreference", + "raw": "static", + }, + "type": "instanceof", + }, + "right": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "right": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + "type": "instanceof", + }, + "type": "&&", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin or 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "or", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin parens 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "parenthesizedExpression": true, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "+", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin parens around \`and\` 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "parenthesizedExpression": true, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "and", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin parens around \`or\` 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "parenthesizedExpression": true, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "or", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin parens around \`xor\` 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "parenthesizedExpression": true, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "xor", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`bin xor 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "xor", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/block.test.js.snap b/test/snapshot/__snapshots__/block.test.js.snap new file mode 100644 index 000000000..6554522b6 --- /dev/null +++ b/test/snapshot/__snapshots__/block.test.js.snap @@ -0,0 +1,940 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`block check empty php blocks 1`] = ` +Program { + "children": [ + Inline { + "kind": "inline", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 8, + "value": "/** + * Comment header + */", + }, + ], + "raw": " +SOME HTML OUTPUT +", + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 64, + "value": "/* Inner comment */", + }, + ], + "value": "SOME HTML OUTPUT +", + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 8, + "value": "/** + * Comment header + */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 64, + "value": "/* Inner comment */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block check empty php file 1`] = ` +Program { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 8, + "value": "/** + * Comment header + */", + }, + ], + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 8, + "value": "/** + * Comment header + */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty class block 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "foo", + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 12, + "value": "/* 1 */", + }, + ], + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 12, + "value": "/* 1 */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty declare block 1`] = ` +Program { + "children": [ + Declare { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 18, + "value": "/* 1 */", + }, + ], + }, + ], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "tick", + }, + "kind": "declaredirective", + "value": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "kind": "declare", + "mode": "block", + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 18, + "value": "/* 1 */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty declare short form 1`] = ` +Program { + "children": [ + Declare { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 17, + "value": "/* 1 */", + }, + ], + }, + ], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "tick", + }, + "kind": "declaredirective", + "value": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "kind": "declare", + "mode": "short", + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 17, + "value": "/* 1 */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty for 1`] = ` +Program { + "children": [ + For { + "body": Block { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* foo */", + }, + ], + }, + ], + "kind": "block", + }, + "increment": [], + "init": [], + "kind": "for", + "shortForm": false, + "test": [], + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* foo */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty for short form 1`] = ` +Program { + "children": [ + For { + "body": Block { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* foo */", + }, + ], + }, + ], + "kind": "block", + }, + "increment": [], + "init": [], + "kind": "for", + "shortForm": true, + "test": [], + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* foo */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty foreach 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 24, + "value": "/* foo */", + }, + ], + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 24, + "value": "/* foo */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty foreach short form 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 23, + "value": "/* foo */", + }, + ], + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": true, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 23, + "value": "/* foo */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty function block 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 17, + "value": "/* 1 */", + }, + ], + }, + ], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 17, + "value": "/* 1 */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty if #2 short form 1`] = ` +Program { + "children": [ + If { + "alternate": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* pre */", + }, + ], + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 24, + "value": "/* inner */", + }, + ], + }, + "kind": "if", + "shortForm": true, + "test": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 43, + "value": "/* out */", + }, + ], + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* pre */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 24, + "value": "/* inner */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 43, + "value": "/* out */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty if #3 short form 1`] = ` +Program { + "children": [ + If { + "alternate": If { + "alternate": Block { + "children": [], + "kind": "block", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 50, + "value": "/* bar */", + }, + ], + }, + "body": Block { + "children": [], + "kind": "block", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 34, + "value": "/* baz */", + }, + ], + }, + "kind": "if", + "shortForm": true, + "test": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + "body": Block { + "children": [], + "kind": "block", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* foo */", + }, + ], + }, + "kind": "if", + "shortForm": true, + "test": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* foo */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 34, + "value": "/* baz */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 50, + "value": "/* bar */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty if 1`] = ` +Program { + "children": [ + If { + "alternate": null, + "body": Block { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 11, + "value": "/* foo */", + }, + ], + }, + ], + "kind": "block", + }, + "kind": "if", + "shortForm": false, + "test": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 11, + "value": "/* foo */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty if short form 1`] = ` +Program { + "children": [ + If { + "alternate": null, + "body": Block { + "children": [], + "kind": "block", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* foo */", + }, + ], + }, + "kind": "if", + "shortForm": true, + "test": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 10, + "value": "/* foo */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty method block 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 30, + "value": "/* 1 */", + }, + ], + }, + ], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "bar", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 30, + "value": "/* 1 */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty namespace block 1`] = ` +Program { + "children": [ + Namespace { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 16, + "value": "/* 1 */", + }, + ], + }, + ], + "kind": "namespace", + "name": "foo", + "withBrackets": true, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 16, + "value": "/* 1 */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty statement 1`] = ` +Program { + "children": [], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 0, + "value": "/* 1 */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 9, + "value": "/* 2 */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 20, + "value": "/* 3 */", + }, + ], + "errors": [], + "kind": "program", + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 0, + "value": "/* 1 */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 9, + "value": "/* 2 */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 20, + "value": "/* 3 */", + }, + ], +} +`; + +exports[`block empty switch 1`] = ` +Program { + "children": [ + Switch { + "body": Block { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 15, + "value": "/* foo */", + }, + ], + }, + ], + "kind": "block", + }, + "kind": "switch", + "shortForm": false, + "test": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 15, + "value": "/* foo */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty switch case short form 1`] = ` +Program { + "children": [ + Switch { + "body": Block { + "children": [ + Case { + "body": Block { + "children": [], + "kind": "block", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 22, + "value": "/* foo */", + }, + ], + }, + "kind": "case", + "test": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "kind": "block", + }, + "kind": "switch", + "shortForm": true, + "test": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 22, + "value": "/* foo */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block empty switch short form 1`] = ` +Program { + "children": [ + Switch { + "body": Block { + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 14, + "value": "/* foo */", + }, + ], + }, + ], + "kind": "block", + }, + "kind": "switch", + "shortForm": true, + "test": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 14, + "value": "/* foo */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`block single 1`] = ` +Program { + "children": [ + Block { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "1", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + ], + "comments": [], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/boolean.test.js.snap b/test/snapshot/__snapshots__/boolean.test.js.snap new file mode 100644 index 000000000..b629ed3ee --- /dev/null +++ b/test/snapshot/__snapshots__/boolean.test.js.snap @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`boolean assign (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Boolean { + "kind": "boolean", + "raw": "false", + "value": false, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean assign 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/break.test.js.snap b/test/snapshot/__snapshots__/break.test.js.snap new file mode 100644 index 000000000..7855e22f8 --- /dev/null +++ b/test/snapshot/__snapshots__/break.test.js.snap @@ -0,0 +1,117 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`break argument 0 1`] = ` +Program { + "children": [ + Break { + "kind": "break", + "level": Number { + "kind": "number", + "value": "0", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`break argument 1 1`] = ` +Program { + "children": [ + Break { + "kind": "break", + "level": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`break argument 2 1`] = ` +Program { + "children": [ + Break { + "kind": "break", + "level": Number { + "kind": "number", + "value": "2", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`break should fail when no ';' at end 1`] = ` +Program { + "children": [ + Break { + "kind": "break", + "level": undefined, + }, + ], + "errors": [ + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error on line 1", + "token": "the end of file (EOF)", + }, + ], + "kind": "program", +} +`; + +exports[`break simple 1`] = ` +Program { + "children": [ + Break { + "kind": "break", + "level": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`break with expression 1`] = ` +Program { + "children": [ + Break { + "kind": "break", + "level": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`break with parens 1`] = ` +Program { + "children": [ + Break { + "kind": "break", + "level": Number { + "kind": "number", + "parenthesizedExpression": true, + "value": "1", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/buffer.test.js.snap b/test/snapshot/__snapshots__/buffer.test.js.snap index d5ecae39b..44e8a8139 100644 --- a/test/snapshot/__snapshots__/buffer.test.js.snap +++ b/test/snapshot/__snapshots__/buffer.test.js.snap @@ -2,13 +2,13 @@ exports[`Test buffers handles buffers as input 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"test\\"", + "raw": ""test"", "unicode": false, "value": "test", }, @@ -17,7 +17,7 @@ Program { "shortForm": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/byref.test.js.snap b/test/snapshot/__snapshots__/byref.test.js.snap new file mode 100644 index 000000000..90966c843 --- /dev/null +++ b/test/snapshot/__snapshots__/byref.test.js.snap @@ -0,0 +1,1004 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`byref call result 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "right": Call { + "arguments": [ + Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "b", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref callable variable #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref callable variable #3 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref callable variable #4 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref callable variable #5 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Name { + "kind": "name", + "name": "CONSTANT", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref callable variable #6 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref callable variable #7 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "test", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref callable variable #8 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref callable variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref closure 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "message", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref foreach (key/value) 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [], + "kind": "block", + }, + "key": Variable { + "curly": false, + "kind": "variable", + "name": "key", + }, + "kind": "foreach", + "shortForm": false, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "arr", + }, + "value": Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "val", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref foreach 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "arr", + }, + "value": Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "value", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref function definition 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": true, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "bar", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": true, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref new class 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "right": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref offset lookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "bar", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref propertylookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "test", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref return statement 1`] = ` +Program { + "children": [ + Return { + "expr": Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "foo", + }, + "kind": "return", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref static lookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref staticlookup #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref staticlookup #3 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + }, + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref staticlookup #4 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref staticlookup #5 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref staticlookup #6 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref staticlookup #7 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "getElementByPath", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref staticlookup #8 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "getElementByPath", + }, + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref staticlookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref variadic 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": true, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "var", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": true, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref with bin #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + "right": Number { + "kind": "number", + "value": "1", + }, + "type": "+", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`byref with bin 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "type": "||", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/call.test.js.snap b/test/snapshot/__snapshots__/call.test.js.snap new file mode 100644 index 000000000..3cb9f66b4 --- /dev/null +++ b/test/snapshot/__snapshots__/call.test.js.snap @@ -0,0 +1,1759 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Test call array 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Foo"", + "unicode": false, + "value": "Foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""bar"", + "unicode": false, + "value": "bar", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call array parens 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Foo"", + "unicode": false, + "value": "Foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""bar"", + "unicode": false, + "value": "bar", + }, + }, + ], + "kind": "array", + "parenthesizedExpression": true, + "shortForm": false, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call comments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 10, + "value": "// comment +", + }, + ], + "unpack": false, + "value": Number { + "kind": "number", + "value": "100", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "0", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "comments": [ + CommentLine { + "kind": "commentline", + "offset": 10, + "value": "// comment +", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call doesnt confused static methods with named arguments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": Name { + "kind": "name", + "name": "a", + "resolution": "uqn", + }, + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call handles spread operator at call site 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + variadic { + "kind": "variadic", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + variadic { + "kind": "variadic", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "baz", + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [ + variadic { + "kind": "variadic", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + variadic { + "kind": "variadic", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "baz", + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside offsetlookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""offset"", + "unicode": false, + "value": "offset", + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside propertylookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (3) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (4) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (5) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (6) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (7) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (8) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""property"", + "unicode": false, + "value": "property", + }, + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (9) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (10) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Name { + "kind": "name", + "name": "Order", + "resolution": "uqn", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup (11) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Literal { + "kind": "literal", + "value": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + }, + "what": Name { + "kind": "name", + "name": "Order", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call inside staticlookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call keyword as named argument 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + namedargument { + "kind": "namedargument", + "name": "array", + "value": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call mix of unnamed and named arguments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Number { + "kind": "number", + "value": "50", + }, + namedargument { + "kind": "namedargument", + "name": "num", + "value": Number { + "kind": "number", + "value": "100", + }, + }, + namedargument { + "kind": "namedargument", + "name": "start_index", + "value": Number { + "kind": "number", + "value": "0", + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call multiple (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call multiple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Call { + "arguments": [], + "kind": "call", + "what": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call multiple arguments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "c", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call named arguments in php 8.0 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + namedargument { + "kind": "namedargument", + "name": "a", + "value": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call nested 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Call { + "arguments": [ + Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call nullsafepropertylookup (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call nullsafepropertylookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call offsetlookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""index"", + "unicode": false, + "value": "index", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call parent 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call propertylookup (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call propertylookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call self 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call single argument 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call static 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": StaticReference { + "kind": "staticreference", + "raw": "static", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call staticlookup (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call staticlookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call string 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": String { + "isDoubleQuote": true, + "kind": "string", + "parenthesizedExpression": true, + "raw": ""func"", + "unicode": false, + "value": "func", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call trailing comma #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""method"", + "unicode": false, + "value": "method", + }, + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""bar"", + "unicode": false, + "value": "bar", + }, + ], + "kind": "call", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call trailing comma #3 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""method"", + "unicode": false, + "value": "method", + }, + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""bar"", + "unicode": false, + "value": "bar", + }, + ], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call trailing comma 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""method"", + "unicode": false, + "value": "method", + }, + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""bar"", + "unicode": false, + "value": "bar", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call variable function (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "func", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call variable function (3) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "func", + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test call variable function 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "func", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/class.test.js.snap b/test/snapshot/__snapshots__/class.test.js.snap index c77f9c887..068548dfe 100644 --- a/test/snapshot/__snapshots__/class.test.js.snap +++ b/test/snapshot/__snapshots__/class.test.js.snap @@ -1,25 +1,63 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Test classes 8.4 allow new without parenthesis 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "People", + "resolution": "uqn", + }, + }, + "right": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "name", + "resolution": "uqn", + }, + }, + "type": "->", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + exports[`Test classes Advanced tests 1`] = ` Program { - "children": Array [ + "children": [ Class { - "body": Array [ + "attrGroups": [], + "body": [ TraitUse { "adaptations": null, "kind": "traituse", - "traits": Array [ - Identifier { - "kind": "identifier", + "traits": [ + Name { + "kind": "name", "name": "A", "resolution": "uqn", }, ], }, TraitUse { - "adaptations": Array [ + "adaptations": [ TraitAlias { - "as": "bar", + "as": Identifier { + "kind": "identifier", + "name": "bar", + }, "kind": "traitalias", "method": "foo", "trait": null, @@ -27,80 +65,95 @@ Program { }, ], "kind": "traituse", - "trailingComments": Array [ + "traits": [ + Name { + "kind": "name", + "name": "B", + "resolution": "uqn", + }, + ], + }, + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 87, "value": "// comment ", }, CommentBlock { "kind": "commentblock", + "offset": 106, "value": "/* boo */", }, CommentBlock { "kind": "commentblock", + "offset": 124, "value": "/** doc * data foo */", }, ], - "traits": Array [ - Identifier { - "kind": "identifier", - "name": "B", - "resolution": "uqn", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "var", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, }, ], - }, - Property { - "isAbstract": false, - "isFinal": false, - "isStatic": false, - "kind": "property", - "name": "var", - "value": Boolean { - "kind": "boolean", - "raw": "true", - "value": true, - }, "visibility": null, }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [], + "children": [], "kind": "block", }, "byref": false, "isAbstract": false, "isFinal": true, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "__construct", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [], + "children": [], "kind": "block", }, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "boo", - "resolution": "rn", }, "nullable": false, "type": null, @@ -108,9 +161,9 @@ Program { }, ], "extends": null, - "implements": Array [ - Identifier { - "kind": "identifier", + "implements": [ + Name { + "kind": "name", "name": "boo", "resolution": "uqn", }, @@ -118,131 +171,156 @@ Program { "isAbstract": false, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", - "name": "foo", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, }, Interface { - "body": Array [ + "attrGroups": [], + "body": [ ClassConstant { - "isAbstract": false, - "isFinal": false, - "isStatic": false, + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + "value": Number { + "kind": "number", + "value": "1.5", + }, + }, + ], + "final": false, "kind": "classconstant", - "leadingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 332, "value": "// some doc ", }, ], - "name": "A", - "value": Number { - "kind": "number", - "value": "1.5", - }, + "nullable": false, + "type": null, "visibility": "", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": null, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 375, "value": "/** foo */", }, ], "name": Identifier { "kind": "identifier", "name": "foo", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "protected", }, ], - "extends": Array [ - Identifier { - "kind": "identifier", + "extends": [ + Name { + "kind": "name", "name": "something", "resolution": "uqn", }, ], "kind": "interface", - "name": "boo", + "name": Identifier { + "kind": "identifier", + "name": "boo", + }, }, Trait { - "body": Array [ + "body": [ ClassConstant { - "isAbstract": false, - "isFinal": false, - "isStatic": false, + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + "value": Number { + "kind": "number", + "value": "1.5", + }, + }, + ], + "final": false, "kind": "classconstant", - "leadingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 455, "value": "// some doc ", }, ], - "name": "A", - "value": Number { - "kind": "number", - "value": "1.5", - }, + "nullable": false, + "type": null, "visibility": "", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": null, "byref": false, "isAbstract": true, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "foo", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "protected", }, ], - "extends": Identifier { + "kind": "trait", + "name": Identifier { "kind": "identifier", - "name": "foo", - "resolution": "uqn", + "name": "line", }, - "implements": Array [ - Identifier { - "kind": "identifier", - "name": "boo", - "resolution": "uqn", - }, - ], - "kind": "trait", - "name": "line", }, ], - "comments": Array [ + "comments": [ CommentLine { "kind": "commentline", + "offset": 87, "value": "// comment ", }, CommentBlock { "kind": "commentblock", + "offset": 106, "value": "/* boo */", }, CommentBlock { "kind": "commentblock", + "offset": 124, "value": "/** doc * data foo @@ -250,115 +328,395 @@ Program { }, CommentLine { "kind": "commentline", + "offset": 332, "value": "// some doc ", }, CommentBlock { "kind": "commentblock", + "offset": 375, "value": "/** foo */", }, CommentLine { "kind": "commentline", + "offset": 455, "value": "// some doc ", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Test classes Test js properties 1`] = ` +exports[`Test classes Implement #183 : static keyword as identifier 1`] = ` Program { - "children": Array [ + "children": [ Class { - "body": Array [ - Property { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "baz", + }, + "what": StaticReference { + "kind": "staticreference", + "raw": "static", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "fooBar", + }, + "what": Name { + "kind": "name", + "name": "A", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "fooBaz", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "this", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, + "isStatic": true, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes Implement readonly property 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "uid", + }, + "nullable": false, + "readonly": true, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": null, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "User", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes Implement typed_properties_v2 / php74 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "prop", + }, + "nullable": true, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": NullKeyword { + "kind": "nullkeyword", + "raw": "null", + }, + }, + ], + "visibility": "public", + }, + PropertyStatement { + "isStatic": true, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "y", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + TypeReference { + "kind": "typereference", + "name": "float", + "raw": "float", + }, + TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + ], + }, + "value": null, + }, + ], + "visibility": "protected", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Test", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes Test js properties 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { "isStatic": true, - "kind": "property", - "name": "constructor", - "value": null, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "constructor", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], "visibility": "", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [], + "children": [], "kind": "block", }, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "constructor", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "public", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "constructor", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "this", }, }, "operator": "=", - "right": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "null", - "resolution": "uqn", - }, + "right": NullKeyword { + "kind": "nullkeyword", + "raw": "null", }, }, "kind": "expressionstatement", }, - Assign { - "kind": "assign", - "left": StaticLookup { - "kind": "staticlookup", - "offset": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "constructor", - }, - "what": Identifier { - "kind": "identifier", - "name": "self", - "resolution": "uqn", + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "constructor", + }, + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, }, - }, - "operator": "=", - "right": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "null", - "resolution": "uqn", + "operator": "=", + "right": NullKeyword { + "kind": "nullkeyword", + "raw": "null", }, }, + "kind": "expressionstatement", }, ], "kind": "block", @@ -366,12 +724,12 @@ Program { "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "__proto__", - "resolution": "rn", }, "nullable": false, "type": null, @@ -383,33 +741,38 @@ Program { "isAbstract": false, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", - "name": "__proto__", + "name": Identifier { + "kind": "identifier", + "name": "__proto__", + }, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test classes Test of silent mode 1`] = ` Program { - "children": Array [ + "children": [ Class { - "body": Array [ + "attrGroups": [], + "body": [ TraitUse { "adaptations": null, "kind": "traituse", - "traits": Array [ - Identifier { - "kind": "identifier", + "traits": [ + Name { + "kind": "name", "name": "A", "resolution": "uqn", }, ], }, TraitUse { - "adaptations": Array [ + "adaptations": [ TraitAlias { "as": null, "kind": "traitalias", @@ -426,9 +789,9 @@ Program { }, ], "kind": "traituse", - "traits": Array [ - Identifier { - "kind": "identifier", + "traits": [ + Name { + "kind": "name", "name": "B", "resolution": "uqn", }, @@ -440,11 +803,15 @@ Program { "isAbstract": false, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", - "name": "foo", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, }, ], - "errors": Array [ + "errors": [ Error { "expected": ";", "kind": "error", @@ -453,7 +820,7 @@ Program { "token": "'use' (T_USE)", }, Error { - "expected": Array [ + "expected": [ 119, 200, ], @@ -477,7 +844,7 @@ Program { "token": "';'", }, Error { - "expected": Array [ + "expected": [ 119, 200, ], @@ -498,71 +865,578 @@ Program { } `; -exports[`Test classes Validate usual declarations 1`] = ` +exports[`Test classes Test promoted class properties php 8 1`] = ` Program { - "children": Array [ + "children": [ Class { - "body": Array [ - ClassConstant { - "isAbstract": false, - "isFinal": false, - "isStatic": false, - "kind": "classconstant", - "name": "FOO", - "value": String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"azerty\\"", - "unicode": false, - "value": "azerty", - }, - "visibility": "", - }, - Property { - "isAbstract": false, + "attrGroups": [], + "body": [ + Method { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 1, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "id", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 4, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "name", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "c", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 2, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "req", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "ServerRequestInterface", + "resolution": "uqn", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "constructor", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "__proto__", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes Test promoted nullable properties php 8 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 1, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "maybe", + }, + "nullable": true, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 4, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "opt", + }, + "nullable": true, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "constructor", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "__proto__", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes Test promoted readonly class properties 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 1, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "id", + }, + "nullable": false, + "readonly": true, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "__construct", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Bob", + }, + }, + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 1, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "id", + }, + "nullable": false, + "readonly": true, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "__construct", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Bob2", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes Test that readonly method parameters are throwing errors 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 1, + "kind": "parameter", + "name": null, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": null, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "id", + }, + "nullable": false, + "readonly": true, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": null, + }, + ], + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Bob", + }, + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": undefined, + "kind": "error", + "line": 3, + "message": "readonly properties can be used only on class constructor on line 3", + "token": undefined, + }, + Error { + "expected": 222, + "kind": "error", + "line": 3, + "message": "Parse Error : syntax error, unexpected 'readonly' (T_READ_ONLY), expecting T_VARIABLE on line 3", + "token": "'readonly' (T_READ_ONLY)", + }, + Error { + "expected": [ + ",", + ")", + ], + "kind": "error", + "line": 3, + "message": "Parse Error : syntax error, unexpected 'readonly' (T_READ_ONLY) on line 3", + "token": "'readonly' (T_READ_ONLY)", + }, + Error { + "expected": ")", + "kind": "error", + "line": 3, + "message": "Parse Error : syntax error, unexpected 'readonly' (T_READ_ONLY), expecting ')' on line 3", + "token": "'readonly' (T_READ_ONLY)", + }, + Error { + "expected": "{", + "kind": "error", + "line": 3, + "message": "Parse Error : syntax error, unexpected 'readonly' (T_READ_ONLY), expecting '{' on line 3", + "token": "'readonly' (T_READ_ONLY)", + }, + Error { + "expected": [ + ",", + ";", + "=", + ], + "kind": "error", + "line": 3, + "message": "Parse Error : syntax error, unexpected ')' on line 3", + "token": "')'", + }, + Error { + "expected": ";", + "kind": "error", + "line": 3, + "message": "Parse Error : syntax error, unexpected ')', expecting ';' on line 3", + "token": "')'", + }, + Error { + "expected": [ + 198, + 222, + 182, + ], + "kind": "error", + "line": 3, + "message": "Parse Error : syntax error, unexpected '{' on line 3", + "token": "'{'", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 4, + "message": "Parse Error : syntax error, unexpected '}' on line 4", + "token": "'}'", + }, + ], + "kind": "program", +} +`; + +exports[`Test classes Validate usual declarations 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "FOO", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""azerty"", + "unicode": false, + "value": "azerty", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "", + }, + PropertyStatement { "isStatic": true, - "kind": "property", - "name": "var", - "value": null, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "var", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], "visibility": "public", }, Method { - "arguments": Array [ + "arguments": [ Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", - "name": "data", - "nullable": false, - "type": Identifier { + "name": Identifier { "kind": "identifier", - "name": "\\\\array", - "resolution": "fqn", + "name": "data", }, - "value": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "null", - "resolution": "uqn", - }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "array", + }, + "value": NullKeyword { + "kind": "nullkeyword", + "raw": "null", }, "variadic": false, }, ], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "data", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "this", @@ -570,7 +1444,6 @@ Program { }, "operator": "=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "data", @@ -584,66 +1457,80 @@ Program { "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "__construct", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "public", }, ClassConstant { - "isAbstract": false, - "isFinal": false, - "isStatic": false, + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "list", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""bar"", + "unicode": false, + "value": "bar", + }, + }, + ], + "final": false, "kind": "classconstant", - "name": "list", - "value": String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"bar\\"", - "unicode": false, - "value": "bar", - }, + "nullable": false, + "type": null, "visibility": "", }, Method { - "arguments": Array [ + "arguments": [ Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", - "name": "foo", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, "nullable": false, + "readonly": false, "type": null, "value": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "list", }, - "what": Identifier { - "kind": "identifier", - "name": "self", - "resolution": "uqn", + "what": SelfReference { + "kind": "selfreference", + "raw": "self", }, }, "variadic": false, }, ], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Return { "expr": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "list", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "this", @@ -657,74 +1544,95 @@ Program { "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "new", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "public", }, - Property { - "isAbstract": false, - "isFinal": false, + PropertyStatement { "isStatic": false, - "kind": "property", - "name": "foo", - "value": null, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], "visibility": "protected", }, - Property { - "isAbstract": false, - "isFinal": false, + PropertyStatement { "isStatic": false, - "kind": "property", - "name": "bar", - "value": null, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "bar", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], "visibility": "private", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [], + "children": [], "kind": "block", }, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "foobar", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "", }, ], - "extends": Identifier { - "kind": "identifier", + "extends": Name { + "kind": "name", "name": "bar", "resolution": "uqn", }, - "implements": Array [ - Identifier { - "kind": "identifier", + "implements": [ + Name { + "kind": "name", "name": "bim", "resolution": "uqn", }, - Identifier { - "kind": "identifier", + Name { + "kind": "name", "name": "bam", "resolution": "uqn", }, - Identifier { - "kind": "identifier", + Name { + "kind": "name", "name": "boum", "resolution": "uqn", }, @@ -732,132 +1640,174 @@ Program { "isAbstract": false, "isAnonymous": false, "isFinal": true, + "isReadonly": false, "kind": "class", - "name": "foo", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, }, Class { - "body": Array [ + "attrGroups": [], + "body": [ TraitUse { - "adaptations": Array [ + "adaptations": [ TraitPrecedence { - "instead": Array [ - Identifier { - "kind": "identifier", + "instead": [ + Name { + "kind": "name", "name": "A", "resolution": "uqn", }, ], "kind": "traitprecedence", - "method": "smallTalk", - "trait": Identifier { + "method": Identifier { "kind": "identifier", + "name": "smallTalk", + }, + "trait": Name { + "kind": "name", "name": "B", "resolution": "uqn", }, }, TraitPrecedence { - "instead": Array [ - Identifier { - "kind": "identifier", + "instead": [ + Name { + "kind": "name", "name": "B", "resolution": "uqn", }, - Identifier { - "kind": "identifier", + Name { + "kind": "name", "name": "C", "resolution": "uqn", }, ], "kind": "traitprecedence", - "method": "bigTalk", - "trait": Identifier { + "method": Identifier { "kind": "identifier", + "name": "bigTalk", + }, + "trait": Name { + "kind": "name", "name": "A", "resolution": "uqn", }, }, TraitAlias { - "as": "talk", + "as": Identifier { + "kind": "identifier", + "name": "talk", + }, "kind": "traitalias", - "method": "bigTalk", - "trait": Identifier { + "method": Identifier { "kind": "identifier", + "name": "bigTalk", + }, + "trait": Name { + "kind": "name", "name": "B", "resolution": "uqn", }, "visibility": "public", }, TraitAlias { - "as": "talk", + "as": Identifier { + "kind": "identifier", + "name": "talk", + }, "kind": "traitalias", - "method": "bigTalk", - "trait": Identifier { + "method": Identifier { "kind": "identifier", + "name": "bigTalk", + }, + "trait": Name { + "kind": "name", "name": "B", "resolution": "uqn", }, "visibility": "protected", }, TraitAlias { - "as": "talk", + "as": Identifier { + "kind": "identifier", + "name": "talk", + }, "kind": "traitalias", - "method": "bigTalk", - "trait": Identifier { + "method": Identifier { "kind": "identifier", + "name": "bigTalk", + }, + "trait": Name { + "kind": "name", "name": "B", "resolution": "uqn", }, "visibility": "private", }, TraitAlias { - "as": "list", + "as": Identifier { + "kind": "identifier", + "name": "list", + }, "kind": "traitalias", - "method": "new", - "trait": Identifier { + "method": Identifier { "kind": "identifier", + "name": "new", + }, + "trait": Name { + "kind": "name", "name": "A", "resolution": "uqn", }, "visibility": "", }, TraitAlias { - "as": "new", + "as": Identifier { + "kind": "identifier", + "name": "new", + }, "kind": "traitalias", - "method": "list", + "method": Identifier { + "kind": "identifier", + "name": "list", + }, "trait": null, "visibility": "", }, ], "kind": "traituse", - "traits": Array [ - Identifier { - "kind": "identifier", + "traits": [ + Name { + "kind": "name", "name": "A", "resolution": "uqn", }, - Identifier { - "kind": "identifier", + Name { + "kind": "name", "name": "B", "resolution": "uqn", }, ], }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": null, "byref": true, "isAbstract": true, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "foo", - "resolution": "rn", }, "nullable": false, - "type": Identifier { - "kind": "identifier", + "type": Name { + "kind": "name", "name": "bar", "resolution": "uqn", }, @@ -869,11 +1819,297 @@ Program { "isAbstract": true, "isAnonymous": false, "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "bar", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes abstract and final 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + }, + ], + "errors": [ + Error { + "expected": 187, + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'final' (T_FINAL), expecting T_CLASS on line 1", + "token": "'final' (T_FINAL)", + }, + ], + "kind": "program", +} +`; + +exports[`Test classes class name as identifier 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes empty 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes final and abstract 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + }, + ], + "errors": [ + Error { + "expected": 187, + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'abstract' (T_ABSTRACT), expecting T_CLASS on line 1", + "token": "'abstract' (T_ABSTRACT)", + }, + ], + "kind": "program", +} +`; + +exports[`Test classes handles property types with a leading \\ 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "baz", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "\\Bar", + "resolution": "fqn", + }, + "value": null, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes new without parenthesis throw errors in PHP < 8.4 1`] = `"New without parenthesis is not allowed before PHP 8.4 on line 1"`; + +exports[`Test classes readonly class in PHP8.2 should support abstract readonly 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": true, + "isAnonymous": false, + "isFinal": false, + "isReadonly": true, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes readonly class in PHP8.2 should support final readonly 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": true, + "isReadonly": true, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes readonly class in PHP8.2 should support readonly 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": true, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes readonly class in PHP8.2 should support readonly abstract 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": true, + "isAnonymous": false, + "isFinal": false, + "isReadonly": true, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test classes readonly class in PHP8.2 should support readonly final 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": true, + "isReadonly": true, "kind": "class", - "name": "bar", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/classconstant.test.js.snap b/test/snapshot/__snapshots__/classconstant.test.js.snap new file mode 100644 index 000000000..743c71381 --- /dev/null +++ b/test/snapshot/__snapshots__/classconstant.test.js.snap @@ -0,0 +1,476 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`classconstant final 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + ], + "final": true, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classconstant multiple 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "OTHER_CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Other hello world!"", + "unicode": false, + "value": "Other hello world!", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classconstant multiple 8.3 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "NAME_1", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "NAME_2", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Other hello world!"", + "unicode": false, + "value": "Other hello world!", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classconstant private 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "private", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classconstant protected 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "protected", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classconstant public 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classconstant simple 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classconstant simple using 8.3 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classconstant type hinted (supported) 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classconstant type hinted (unsupported) 1`] = `"Parse Error : syntax error, unexpected 'CONSTANT' (T_STRING), expecting '=' on line 1"`; diff --git a/test/snapshot/__snapshots__/classreference.test.js.snap b/test/snapshot/__snapshots__/classreference.test.js.snap new file mode 100644 index 000000000..13bf8cf32 --- /dev/null +++ b/test/snapshot/__snapshots__/classreference.test.js.snap @@ -0,0 +1,168 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`classreference argument type (2) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "Foo\\Foo", + "resolution": "qn", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classreference argument type 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classreference call 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classreference constant 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`classreference variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/clone.test.js.snap b/test/snapshot/__snapshots__/clone.test.js.snap new file mode 100644 index 000000000..9bfb63e0d --- /dev/null +++ b/test/snapshot/__snapshots__/clone.test.js.snap @@ -0,0 +1,50 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`clone assign 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Clone { + "kind": "clone", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`clone simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Clone { + "kind": "clone", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/closure.test.js.snap b/test/snapshot/__snapshots__/closure.test.js.snap new file mode 100644 index 000000000..0f802d252 --- /dev/null +++ b/test/snapshot/__snapshots__/closure.test.js.snap @@ -0,0 +1,729 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`closure argument 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure argument and use 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "curly": false, + "kind": "variable", + "name": "use", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure argument by ref 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": true, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure arguments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure arguments and uses 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "curly": false, + "kind": "variable", + "name": "use", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "use", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "use", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure empty 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure inside call 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [ + Return { + "expr": Variable { + "curly": false, + "kind": "variable", + "name": "arg", + }, + "kind": "return", + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [], + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure use 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "curly": false, + "kind": "variable", + "name": "message", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure use by ref 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "message", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`closure use multiple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "curly": false, + "kind": "variable", + "name": "message", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "message1", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "message2", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/comment.test.js.snap b/test/snapshot/__snapshots__/comment.test.js.snap index 9f8c7cc18..0288dac0c 100644 --- a/test/snapshot/__snapshots__/comment.test.js.snap +++ b/test/snapshot/__snapshots__/comment.test.js.snap @@ -2,19 +2,20 @@ exports[`Test comments issues fix #55 1`] = ` Program { - "children": Array [ + "children": [ If { "alternate": null, "body": Block { - "children": Array [ + "children": [ If { "alternate": null, "body": Block { - "children": Array [], + "children": [], "kind": "block", - "leadingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 51, "value": "// inner statements ", }, @@ -27,16 +28,17 @@ Program { "raw": "true", "value": true, }, - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "value": "// another comment -", - }, - ], }, ], "kind": "block", + "trailingComments": [ + CommentLine { + "kind": "commentline", + "offset": 88, + "value": "// another comment +", + }, + ], }, "kind": "if", "shortForm": true, @@ -45,50 +47,53 @@ Program { "raw": "true", "value": true, }, - "trailingComments": Array [ + "trailingComments": [ CommentLine { "kind": "commentline", + "offset": 122, "value": "// 2nd comment ", }, ], }, ], - "comments": Array [ + "comments": [ CommentLine { "kind": "commentline", + "offset": 51, "value": "// inner statements ", }, CommentLine { "kind": "commentline", + "offset": 88, "value": "// another comment ", }, CommentLine { "kind": "commentline", + "offset": 122, "value": "// 2nd comment ", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test comments issues fix #126 : new option 1`] = ` Program { - "children": Array [ + "children": [ If { "alternate": If { "alternate": null, "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -96,19 +101,21 @@ Program { "operator": "=", "right": Number { "kind": "number", - "trailingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* trailing 2 */", - }, - ], "value": "2", }, + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 119, + "value": "/* trailing 2 */", + }, + ], }, "kind": "expressionstatement", - "trailingComments": Array [ + "trailingComments": [ CommentLine { "kind": "commentline", + "offset": 148, "value": "// trailing assing ", }, @@ -116,15 +123,16 @@ Program { }, ], "kind": "block", - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "value": "// trailing elseif -", - }, - ], }, "kind": "if", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 57, + "value": "// Don't parsed :( +", + }, + ], "shortForm": false, "test": Boolean { "kind": "boolean", @@ -133,12 +141,11 @@ Program { }, }, "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -153,13 +160,6 @@ Program { }, ], "kind": "block", - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "value": "// Don't parsed :( -", - }, - ], }, "kind": "if", "shortForm": false, @@ -168,42 +168,53 @@ Program { "raw": "true", "value": true, }, + "trailingComments": [ + CommentLine { + "kind": "commentline", + "offset": 185, + "value": "// trailing elseif +", + }, + ], }, ], - "comments": Array [ + "comments": [ CommentLine { "kind": "commentline", + "offset": 57, "value": "// Don't parsed :( ", }, CommentBlock { "kind": "commentblock", + "offset": 119, "value": "/* trailing 2 */", }, CommentLine { "kind": "commentline", + "offset": 148, "value": "// trailing assing ", }, CommentLine { "kind": "commentline", + "offset": 185, "value": "// trailing elseif ", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test comments issues fix #189 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", @@ -211,19 +222,20 @@ Program { "operator": "=", "right": Bin { "kind": "bin", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 30, + "value": "// Comment 1 +", + }, + ], "left": Bin { "kind": "bin", "left": String { "isDoubleQuote": false, "kind": "string", "raw": "'string1'", - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "value": "// Comment 1 -", - }, - ], "unicode": false, "value": "string1", }, @@ -231,18 +243,6 @@ Program { "isDoubleQuote": false, "kind": "string", "raw": "'string2'", - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "value": "// Comment 2 -", - }, - CommentLine { - "kind": "commentline", - "value": "// Comment 3 -", - }, - ], "unicode": false, "value": "string2", }, @@ -251,6 +251,20 @@ Program { "right": String { "isDoubleQuote": false, "kind": "string", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 61, + "value": "// Comment 2 +", + }, + CommentLine { + "kind": "commentline", + "offset": 80, + "value": "// Comment 3 +", + }, + ], "raw": "'string3'", "unicode": false, "value": "string3", @@ -261,272 +275,937 @@ Program { "kind": "expressionstatement", }, ], - "comments": Array [ + "comments": [ CommentLine { "kind": "commentline", + "offset": 30, "value": "// Comment 1 ", }, CommentLine { "kind": "commentline", + "offset": 61, "value": "// Comment 2 ", }, CommentLine { "kind": "commentline", + "offset": 80, "value": "// Comment 3 ", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test comments issues fix #193 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "=", "right": Call { - "arguments": Array [], + "arguments": [], "kind": "call", "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", - "leadingComments": Array [ + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 29, + "value": "// Comment Before +", + }, + ], + "offset": Identifier { + "kind": "identifier", + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 70, "value": "// Comment After ", - }, - ], - "name": "each", + }, + ], + "name": "each", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "comments": [ + CommentLine { + "kind": "commentline", + "offset": 29, + "value": "// Comment Before +", + }, + CommentLine { + "kind": "commentline", + "offset": 70, + "value": "// Comment After +", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test comments issues fix #250 : Leading comments are treated as trailing comments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 6, + "line": 3, + "offset": 18, + }, + "source": "foo();", + "start": Position { + "column": 0, + "line": 3, + "offset": 12, + }, + }, + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 3, + "line": 3, + "offset": 15, + }, + "source": "foo", + "start": Position { + "column": 0, + "line": 3, + "offset": 12, + }, + }, + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 3, + "offset": 12, + }, + "source": "// leading +", + "start": Position { + "column": 0, + "line": 2, + "offset": 1, + }, + }, + "offset": 1, + "value": "// leading +", + }, + ], + "loc": Location { + "end": Position { + "column": 6, + "line": 3, + "offset": 18, + }, + "source": "foo();", + "start": Position { + "column": 0, + "line": 3, + "offset": 12, + }, + }, + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 19, + "line": 5, + "offset": 45, + }, + "source": "bar() /* inner */ ;", + "start": Position { + "column": 0, + "line": 5, + "offset": 26, + }, + }, + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "loc": Location { + "end": Position { + "column": 17, + "line": 5, + "offset": 43, + }, + "source": "/* inner */", + "start": Position { + "column": 6, + "line": 5, + "offset": 32, + }, + }, + "offset": 32, + "value": "/* inner */", + }, + ], + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 3, + "line": 5, + "offset": 29, + }, + "source": "bar", + "start": Position { + "column": 0, + "line": 5, + "offset": 26, + }, + }, + "name": "bar", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 5, + "offset": 26, + }, + "source": "// bar +", + "start": Position { + "column": 0, + "line": 4, + "offset": 19, + }, + }, + "offset": 19, + "value": "// bar +", + }, + ], + "loc": Location { + "end": Position { + "column": 19, + "line": 5, + "offset": 45, + }, + "source": "bar() /* inner */ ;", + "start": Position { + "column": 0, + "line": 5, + "offset": 26, + }, + }, + "trailingComments": [ + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 7, + "offset": 58, + }, + "source": "// trailing +", + "start": Position { + "column": 0, + "line": 6, + "offset": 46, + }, + }, + "offset": 46, + "value": "// trailing +", + }, + ], + }, + ], + "comments": [ + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 3, + "offset": 12, + }, + "source": "// leading +", + "start": Position { + "column": 0, + "line": 2, + "offset": 1, + }, + }, + "offset": 1, + "value": "// leading +", + }, + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 5, + "offset": 26, + }, + "source": "// bar +", + "start": Position { + "column": 0, + "line": 4, + "offset": 19, + }, + }, + "offset": 19, + "value": "// bar +", + }, + CommentBlock { + "kind": "commentblock", + "loc": Location { + "end": Position { + "column": 17, + "line": 5, + "offset": 43, + }, + "source": "/* inner */", + "start": Position { + "column": 6, + "line": 5, + "offset": 32, + }, + }, + "offset": 32, + "value": "/* inner */", + }, + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 7, + "offset": 58, + }, + "source": "// trailing +", + "start": Position { + "column": 0, + "line": 6, + "offset": 46, + }, + }, + "offset": 46, + "value": "// trailing +", + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 8, + "line": 7, + "offset": 66, + }, + "source": " +// leading +foo(); +// bar +bar() /* inner */ ; +// trailing + ", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test comments issues fix #278 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Return { + "expr": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + "kind": "return", + }, + ], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": true, + "kind": "method", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 51, + "value": "/** + * Description + */", + }, + ], + "name": Identifier { + "kind": "identifier", + "name": "bar", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Return { + "expr": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + "kind": "return", + }, + ], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": true, + "kind": "method", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 155, + "value": "/** + * Description + */", + }, + ], + "name": Identifier { + "kind": "identifier", + "name": "baz", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Return { + "expr": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + "kind": "return", + }, + ], + "kind": "block", + "trailingComments": [ + CommentLine { + "kind": "commentline", + "offset": 364, + "value": "// true trailing comment +", + }, + ], + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": true, + "kind": "method", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 261, + "value": "/** + * Description + */", + }, + ], + "name": Identifier { + "kind": "identifier", + "name": "woo", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 1, + "value": "/** + * Class description + */", + }, + ], + "name": Identifier { + "kind": "identifier", + "name": "FooClass", + }, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 1, + "value": "/** + * Class description + */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 51, + "value": "/** + * Description + */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 155, + "value": "/** + * Description + */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 261, + "value": "/** + * Description + */", + }, + CommentLine { + "kind": "commentline", + "offset": 364, + "value": "// true trailing comment +", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test comments issues fix call comments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Array { + "items": [], + "kind": "array", + "loc": Location { + "end": Position { + "column": 2, + "line": 3, + "offset": 25, + }, + "source": "array // comment +()", + "start": Position { + "column": 5, + "line": 2, + "offset": 6, + }, }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "var", - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "value": "// Comment Before + "shortForm": false, + }, + ], + "kind": "call", + "loc": Location { + "end": Position { + "column": 4, + "line": 3, + "offset": 27, + }, + "source": "call(array // comment +());", + "start": Position { + "column": 0, + "line": 2, + "offset": 1, + }, + }, + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 4, + "line": 2, + "offset": 5, + }, + "source": "call", + "start": Position { + "column": 0, + "line": 2, + "offset": 1, + }, + }, + "name": "call", + "resolution": "uqn", + "trailingComments": [ + CommentLine { + "kind": "commentline", + "loc": Location { + "end": Position { + "column": 0, + "line": 3, + "offset": 23, + }, + "source": "// comment ", + "start": Position { + "column": 11, + "line": 2, + "offset": 12, }, - ], + }, + "offset": 12, + "value": "// comment +", }, - }, + ], }, }, "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 4, + "line": 3, + "offset": 27, + }, + "source": "call(array // comment +());", + "start": Position { + "column": 0, + "line": 2, + "offset": 1, + }, + }, }, ], - "comments": Array [ + "comments": [ CommentLine { "kind": "commentline", - "value": "// Comment Before + "loc": Location { + "end": Position { + "column": 0, + "line": 3, + "offset": 23, + }, + "source": "// comment ", - }, - CommentLine { - "kind": "commentline", - "value": "// Comment After + "start": Position { + "column": 11, + "line": 2, + "offset": 12, + }, + }, + "offset": 12, + "value": "// comment ", }, ], - "errors": Array [], + "errors": [], "kind": "program", + "loc": Location { + "end": Position { + "column": 8, + "line": 4, + "offset": 36, + }, + "source": " +call(array // comment +()); + ", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, } `; exports[`Test comments issues impl #194 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", - "trailingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* trail foo */", - }, - ], }, "operator": "=", "right": Number { "kind": "number", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", - "value": "/* lead 1 */", + "offset": 37, + "value": "/* trail foo */", }, - ], - "trailingComments": Array [ CommentBlock { "kind": "commentblock", - "value": "/* trail 1 */", + "offset": 55, + "value": "/* lead 1 */", }, ], "value": "1", }, + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 70, + "value": "/* trail 1 */", + }, + ], }, "kind": "expressionstatement", - "leadingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 9, "value": "// lead assign ", }, ], - "trailingComments": Array [ + }, + ExpressionStatement { + "expression": Call { + "arguments": [ + String { + "isDoubleQuote": true, + "kind": "string", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 123, + "value": "/* lead arg */", + }, + ], + "raw": ""arg"", + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 144, + "value": "/* trail arg */", + }, + ], + "unicode": false, + "value": "arg", + }, + ], + "kind": "call", + "trailingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 162, + "value": "/* trail call */", + }, + ], + "what": Name { + "kind": "name", + "name": "callback", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 93, "value": "// lead call ", }, ], - }, - Call { - "arguments": Array [ - String { - "isDoubleQuote": true, - "kind": "string", - "leadingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* lead arg */", - }, - ], - "raw": "\\"arg\\"", - "trailingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* trail arg */", - }, - ], - "unicode": false, - "value": "arg", - }, - ], - "kind": "call", - "trailingComments": Array [ + "trailingComments": [ CommentBlock { "kind": "commentblock", - "value": "/* trail call */", + "offset": 189, + "value": "/* trail program */", }, ], - "what": Identifier { - "kind": "identifier", - "name": "callback", - "resolution": "uqn", - }, }, ], - "comments": Array [ + "comments": [ CommentLine { "kind": "commentline", + "offset": 9, "value": "// lead assign ", }, CommentBlock { "kind": "commentblock", + "offset": 37, "value": "/* trail foo */", }, CommentBlock { "kind": "commentblock", + "offset": 55, "value": "/* lead 1 */", }, CommentBlock { "kind": "commentblock", + "offset": 70, "value": "/* trail 1 */", }, CommentLine { "kind": "commentline", + "offset": 93, "value": "// lead call ", }, CommentBlock { "kind": "commentblock", + "offset": 123, "value": "/* lead arg */", }, CommentBlock { "kind": "commentblock", + "offset": 144, "value": "/* trail arg */", }, CommentBlock { "kind": "commentblock", + "offset": 162, "value": "/* trail call */", }, CommentBlock { "kind": "commentblock", + "offset": 189, "value": "/* trail program */", }, ], - "errors": Array [], + "errors": [], "kind": "program", - "trailingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* trail program */", - }, - ], } `; exports[`Test comments multi line comments test function 1`] = ` Program { - "children": Array [ + "children": [ _Function { - "arguments": Array [ + "arguments": [ Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 98, "value": "/* @var something */", }, ], - "name": "arg", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, "nullable": false, + "readonly": false, "type": null, "value": null, "variadic": false, }, ], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Return { "expr": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "arg", - "trailingComments": Array [ + "trailingComments": [ CommentBlock { "kind": "commentblock", + "offset": 168, "value": "/* ignore */", }, ], }, "kind": "return", - "leadingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 137, "value": "// inner ", }, @@ -537,9 +1216,10 @@ Program { }, "byref": true, "kind": "function", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 9, "value": "/** * Description */", @@ -547,104 +1227,132 @@ Program { ], "name": Identifier { "kind": "identifier", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 65, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 80, "value": "/* ignore */", }, ], "name": "name", - "resolution": "rn", }, "nullable": false, "type": null, }, ], - "comments": Array [ + "comments": [ CommentBlock { "kind": "commentblock", + "offset": 9, "value": "/** * Description */", }, CommentBlock { "kind": "commentblock", + "offset": 65, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 80, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 98, "value": "/* @var something */", }, CommentLine { "kind": "commentline", + "offset": 137, "value": "// inner ", }, CommentBlock { "kind": "commentblock", + "offset": 168, "value": "/* ignore */", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test comments multi line comments test if statements 1`] = ` Program { - "children": Array [ + "children": [ If { "alternate": If { "alternate": If { "alternate": Block { - "children": Array [], + "children": [], "kind": "block", - "leadingComments": Array [ + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 351, + "value": "/* ignore */", + }, CommentBlock { "kind": "commentblock", + "offset": 369, "value": "/* ignore */", }, ], }, "body": Block { - "children": Array [], + "children": [], "kind": "block", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 284, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 297, + "value": "/* ignore */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 311, "value": "/* ignore */", }, - ], - "trailingComments": Array [ CommentBlock { "kind": "commentblock", + "offset": 324, "value": "/* ignore */", }, ], }, "kind": "if", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 231, + "value": "/* ignore */", + }, + ], "shortForm": false, "test": Boolean { "kind": "boolean", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 251, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 265, "value": "/* ignore */", }, ], @@ -653,29 +1361,36 @@ Program { }, }, "body": Block { - "children": Array [], + "children": [], "kind": "block", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 190, "value": "/* ignore */", }, - ], - "trailingComments": Array [ CommentBlock { "kind": "commentblock", + "offset": 204, "value": "/* ignore */", }, ], }, "kind": "if", - "leadingComments": Array [ + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 89, + "value": "/* ignore */", + }, CommentBlock { "kind": "commentblock", + "offset": 107, "value": "/* ignore */", }, CommentLine { "kind": "commentline", + "offset": 128, "value": "// else with a inner if single statement : ", }, @@ -688,22 +1403,24 @@ Program { }, }, "body": Block { - "children": Array [], - "kind": "block", - "leadingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* ignore */", - }, - ], - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "value": "# inner statement + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 61, + "value": "# inner statement ", + }, + ], }, + ], + "kind": "block", + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 38, "value": "/* ignore */", }, ], @@ -712,13 +1429,15 @@ Program { "shortForm": false, "test": Boolean { "kind": "boolean", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 12, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 26, "value": "/* */", }, ], @@ -729,19 +1448,34 @@ Program { If { "alternate": null, "body": Block { - "children": Array [], + "children": [], "kind": "block", - "leadingComments": Array [ + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 415, + "value": "/* ignore */", + }, + CommentBlock { + "kind": "commentblock", + "offset": 430, + "value": "/* ignore */", + }, CommentBlock { "kind": "commentblock", + "offset": 451, "value": "/* ignore */", }, + ], + "trailingComments": [ CommentBlock { "kind": "commentblock", + "offset": 470, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 483, "value": "/* ignore */", }, ], @@ -753,385 +1487,465 @@ Program { "raw": "false", "value": false, }, - "trailingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* ignore */", - }, - CommentBlock { - "kind": "commentblock", - "value": "/* ignore */", - }, - ], }, ], - "comments": Array [ + "comments": [ CommentBlock { "kind": "commentblock", + "offset": 12, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 26, "value": "/* */", }, CommentBlock { "kind": "commentblock", + "offset": 38, "value": "/* ignore */", }, CommentLine { "kind": "commentline", + "offset": 61, "value": "# inner statement ", }, CommentBlock { "kind": "commentblock", + "offset": 89, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 107, "value": "/* ignore */", }, CommentLine { "kind": "commentline", + "offset": 128, "value": "// else with a inner if single statement : ", }, CommentBlock { "kind": "commentblock", + "offset": 190, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 204, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 231, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 251, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 265, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 284, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 297, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 311, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 324, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 351, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 369, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 415, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 430, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 451, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 470, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 483, "value": "/* ignore */", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test comments multi line comments test try statements 1`] = ` Program { - "children": Array [ + "children": [ Try { "always": Block { - "children": Array [], + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 218, + "value": "/* ignore */", + }, + ], + }, + ], "kind": "block", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", - "value": "/* yy */", + "offset": 182, + "value": "/* zz */", }, - ], - "trailingComments": Array [ CommentBlock { "kind": "commentblock", - "value": "/* ignore */", - }, - CommentLine { - "kind": "commentline", - "value": "// end -", + "offset": 199, + "value": "/* yy */", }, ], }, "body": Block { - "children": Array [], - "kind": "block", - "leadingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* ignore */", - }, - ], - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "value": "# inner statement + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentLine { + "kind": "commentline", + "offset": 36, + "value": "# inner statement ", + }, + ], }, + ], + "kind": "block", + "leadingComments": [ CommentBlock { "kind": "commentblock", - "value": "/* dd */", + "offset": 13, + "value": "/* ignore */", }, ], }, - "catches": Array [ + "catches": [ Catch { "body": Block { - "children": Array [], - "kind": "block", - "leadingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* dd */", + "children": [ + Noop { + "kind": "noop", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 163, + "value": "/* ee */", + }, + ], }, ], - "trailingComments": Array [ + "kind": "block", + "leadingComments": [ CommentBlock { "kind": "commentblock", - "value": "/* ee */", + "offset": 134, + "value": "/* bb */", }, CommentBlock { "kind": "commentblock", - "value": "/* zz */", + "offset": 144, + "value": "/* dd */", }, ], }, "kind": "catch", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 64, + "value": "/* dd */", + }, + ], "variable": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "e", - "trailingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", - "value": "/* bb */", + "offset": 122, + "value": "/* aa */", }, ], + "name": "e", }, - "what": Array [ - Identifier { - "kind": "identifier", - "leadingComments": Array [ + "what": [ + Name { + "kind": "name", + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 79, "value": "/* zz */", }, ], - "name": "\\\\Exception", - "resolution": "qn", - "trailingComments": Array [ + "name": "\\Exception", + "resolution": "fqn", + }, + Name { + "kind": "name", + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 99, "value": "/* 1 */", }, - ], - }, - Identifier { - "kind": "identifier", - "leadingComments": Array [ CommentBlock { "kind": "commentblock", + "offset": 109, "value": "/* 2 */", }, ], - "name": "\\\\Foo", - "resolution": "qn", - "trailingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* aa */", - }, - ], + "name": "\\Foo", + "resolution": "fqn", }, ], }, ], "kind": "try", + "trailingComments": [ + CommentLine { + "kind": "commentline", + "offset": 241, + "value": "// end +", + }, + ], }, ], - "comments": Array [ + "comments": [ CommentBlock { "kind": "commentblock", + "offset": 13, "value": "/* ignore */", }, CommentLine { "kind": "commentline", + "offset": 36, "value": "# inner statement ", }, CommentBlock { "kind": "commentblock", + "offset": 64, "value": "/* dd */", }, CommentBlock { "kind": "commentblock", + "offset": 79, "value": "/* zz */", }, CommentBlock { "kind": "commentblock", + "offset": 99, "value": "/* 1 */", }, CommentBlock { "kind": "commentblock", + "offset": 109, "value": "/* 2 */", }, CommentBlock { "kind": "commentblock", + "offset": 122, "value": "/* aa */", }, CommentBlock { "kind": "commentblock", + "offset": 134, "value": "/* bb */", }, CommentBlock { "kind": "commentblock", + "offset": 144, "value": "/* dd */", }, CommentBlock { "kind": "commentblock", + "offset": 163, "value": "/* ee */", }, CommentBlock { "kind": "commentblock", + "offset": 182, "value": "/* zz */", }, CommentBlock { "kind": "commentblock", + "offset": 199, "value": "/* yy */", }, CommentBlock { "kind": "commentblock", + "offset": 218, "value": "/* ignore */", }, CommentLine { "kind": "commentline", + "offset": 241, "value": "// end ", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test comments test classes 1`] = ` Program { - "children": Array [ + "children": [ Class { - "body": Array [ - Property { - "isAbstract": false, - "isFinal": false, + "attrGroups": [], + "body": [ + PropertyStatement { "isStatic": false, - "kind": "property", - "leadingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* ignore */", - }, + "kind": "propertystatement", + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 72, "value": "/* hehe */", }, CommentLine { "kind": "commentline", + "offset": 94, "value": "// @var test ", }, ], - "name": "test", - "value": null, - "visibility": "protected", - }, - Property { - "isAbstract": false, - "isFinal": false, - "isStatic": false, - "kind": "property", - "name": "toto", - "value": null, + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "toto", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], "visibility": "protected", }, - Property { - "isAbstract": false, - "isFinal": false, + PropertyStatement { "isStatic": true, - "kind": "property", - "leadingComments": Array [ + "kind": "propertystatement", + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 149, "value": "// ignored comment ", }, CommentBlock { "kind": "commentblock", + "offset": 177, "value": "/** @var Class */", }, ], - "name": "foo", - "value": Number { - "kind": "number", - "value": "123", - }, + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Number { + "kind": "number", + "value": "123", + }, + }, + ], "visibility": "public", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [], + "children": [], "kind": "block", }, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 239, "value": "/** ignored also **/", }, CommentBlock { "kind": "commentblock", + "offset": 269, "value": "/** * @return void */", @@ -1140,7 +1954,6 @@ Program { "name": Identifier { "kind": "identifier", "name": "void", - "resolution": "rn", }, "nullable": false, "type": null, @@ -1152,71 +1965,90 @@ Program { "isAbstract": false, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 7, "value": "/** * Description */", }, ], - "name": "name", + "name": Identifier { + "kind": "identifier", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 54, + "value": "/* ignore */", + }, + ], + "name": "name", + }, }, ], - "comments": Array [ + "comments": [ CommentBlock { "kind": "commentblock", + "offset": 7, "value": "/** * Description */", }, CommentBlock { "kind": "commentblock", + "offset": 54, "value": "/* ignore */", }, CommentBlock { "kind": "commentblock", + "offset": 72, "value": "/* hehe */", }, CommentLine { "kind": "commentline", + "offset": 94, "value": "// @var test ", }, CommentLine { "kind": "commentline", + "offset": 149, "value": "// ignored comment ", }, CommentBlock { "kind": "commentblock", + "offset": 177, "value": "/** @var Class */", }, CommentBlock { "kind": "commentblock", + "offset": 239, "value": "/** ignored also **/", }, CommentBlock { "kind": "commentblock", + "offset": 269, "value": "/** * @return void */", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test comments test single line comments 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", @@ -1224,59 +2056,67 @@ Program { "operator": "=", "right": Number { "kind": "number", - "trailingComments": Array [ - CommentLine { - "kind": "commentline", - "value": "// 123 -", - }, - ], "value": "123", }, + "trailingComments": [ + CommentLine { + "kind": "commentline", + "offset": 65, + "value": "// 123 +", + }, + ], }, "kind": "expressionstatement", - "leadingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 7, "value": "# some information ", }, CommentLine { "kind": "commentline", + "offset": 32, "value": "// another line ", }, ], - "trailingComments": Array [ + "trailingComments": [ CommentBlock { "kind": "commentblock", + "offset": 80, "value": "/* done */", }, ], }, ], - "comments": Array [ + "comments": [ CommentLine { "kind": "commentline", + "offset": 7, "value": "# some information ", }, CommentLine { "kind": "commentline", + "offset": 32, "value": "// another line ", }, CommentLine { "kind": "commentline", + "offset": 65, "value": "// 123 ", }, CommentBlock { "kind": "commentblock", + "offset": 80, "value": "/* done */", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/constantstatement.test.js.snap b/test/snapshot/__snapshots__/constantstatement.test.js.snap new file mode 100644 index 000000000..294dc9d86 --- /dev/null +++ b/test/snapshot/__snapshots__/constantstatement.test.js.snap @@ -0,0 +1,71 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`constantstatement multiple 1`] = ` +Program { + "children": [ + ConstantStatement { + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "OTHER_CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Other hello world!"", + "unicode": false, + "value": "Other hello world!", + }, + }, + ], + "kind": "constantstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`constantstatement simple 1`] = ` +Program { + "children": [ + ConstantStatement { + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + ], + "kind": "constantstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/continue.test.js.snap b/test/snapshot/__snapshots__/continue.test.js.snap new file mode 100644 index 000000000..7304d2d5f --- /dev/null +++ b/test/snapshot/__snapshots__/continue.test.js.snap @@ -0,0 +1,117 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`continue argument 0 1`] = ` +Program { + "children": [ + Continue { + "kind": "continue", + "level": Number { + "kind": "number", + "value": "0", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`continue argument 1 1`] = ` +Program { + "children": [ + Continue { + "kind": "continue", + "level": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`continue argument 2 1`] = ` +Program { + "children": [ + Continue { + "kind": "continue", + "level": Number { + "kind": "number", + "value": "2", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`continue should fail when no ';' at end 1`] = ` +Program { + "children": [ + Continue { + "kind": "continue", + "level": undefined, + }, + ], + "errors": [ + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error on line 1", + "token": "the end of file (EOF)", + }, + ], + "kind": "program", +} +`; + +exports[`continue simple 1`] = ` +Program { + "children": [ + Continue { + "kind": "continue", + "level": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`continue with expression 1`] = ` +Program { + "children": [ + Continue { + "kind": "continue", + "level": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`continue with parens 1`] = ` +Program { + "children": [ + Continue { + "kind": "continue", + "level": Number { + "kind": "number", + "parenthesizedExpression": true, + "value": "1", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/declare.test.js.snap b/test/snapshot/__snapshots__/declare.test.js.snap new file mode 100644 index 000000000..2c5cebf74 --- /dev/null +++ b/test/snapshot/__snapshots__/declare.test.js.snap @@ -0,0 +1,197 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`declare encoding 1`] = ` +Program { + "children": [ + Declare { + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "encoding", + }, + "kind": "declaredirective", + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'ISO-8859-1'", + "unicode": false, + "value": "ISO-8859-1", + }, + }, + ], + "kind": "declare", + "mode": "none", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`declare mode short 1`] = ` +Program { + "children": [ + Declare { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "ticks", + }, + "kind": "declaredirective", + "value": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "kind": "declare", + "mode": "short", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`declare multiple 1`] = ` +Program { + "children": [ + Declare { + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "A", + }, + "kind": "declaredirective", + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'B'", + "unicode": false, + "value": "B", + }, + }, + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "C", + }, + "kind": "declaredirective", + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'D'", + "unicode": false, + "value": "D", + }, + }, + ], + "kind": "declare", + "mode": "block", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`declare nested 1`] = ` +Program { + "children": [ + Declare { + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "ticks", + }, + "kind": "declaredirective", + "value": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "kind": "declare", + "mode": "block", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`declare strict_types 1`] = ` +Program { + "children": [ + Declare { + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "strict_types", + }, + "kind": "declaredirective", + "value": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "kind": "declare", + "mode": "none", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`declare ticks 1`] = ` +Program { + "children": [ + Declare { + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "ticks", + }, + "kind": "declaredirective", + "value": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "kind": "declare", + "mode": "none", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/echo.test.js.snap b/test/snapshot/__snapshots__/echo.test.js.snap new file mode 100644 index 000000000..8d9553a8b --- /dev/null +++ b/test/snapshot/__snapshots__/echo.test.js.snap @@ -0,0 +1,52 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`echo multiple 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`echo simple 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/empty.test.js.snap b/test/snapshot/__snapshots__/empty.test.js.snap new file mode 100644 index 000000000..61e4986b7 --- /dev/null +++ b/test/snapshot/__snapshots__/empty.test.js.snap @@ -0,0 +1,50 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`empty assign 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Empty { + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "empty", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`empty simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Empty { + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "empty", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/encapsed.test.js.snap b/test/snapshot/__snapshots__/encapsed.test.js.snap new file mode 100644 index 000000000..743c33a27 --- /dev/null +++ b/test/snapshot/__snapshots__/encapsed.test.js.snap @@ -0,0 +1,3566 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`encapsed curly #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$$juice} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "juice", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed curly #3 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$call()} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Call { + "arguments": [], + "kind": "call", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "call", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed curly 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$juice} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "juice", + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed dollar open curly braces #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string \${$juice} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "juice", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed dollar open curly braces #3 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string \${\${$juice}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "juice", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed dollar open curly braces #4 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string \${call()} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed dollar open curly braces #5 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string \${test[test]} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Name { + "kind": "name", + "name": "test", + "resolution": "uqn", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed dollar open curly braces #6 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string \${test[1]} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed dollar open curly braces #7 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string \${test[-1]} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Unary { + "kind": "unary", + "type": "-", + "what": Number { + "kind": "number", + "value": "1", + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed dollar open curly braces #8 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string \${test[$var]} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed dollar open curly braces 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string \${juice} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "juice", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed multiple nullsafepropertylookup (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj?->property?->property} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed multiple propertylookup (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj->property->property} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed negative offset in encapsed var offset 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""$var[-1]"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": -1, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed newline before closing curly (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$var +} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed no curly 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string $$juice string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string $", + "unicode": false, + "value": "string $", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "juice", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed nullsafepropertylookup (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj?->property} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed nullsafepropertylookup (simple syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string $obj?->property string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "?->property string", + "unicode": false, + "value": "?->property string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed nullsafepropertylookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": EncapsedPart { + "curly": false, + "expression": Encapsed { + "kind": "encapsed", + "raw": ""set{$type}"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "set", + "unicode": false, + "value": "set", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "type", + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + ], + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "this", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed nullsafepropertylookup and offsetlookup (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj?->values[3]?->name} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "name", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "3", + }, + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "values", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed nullsafepropertylookup by variable (2) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj?->{$array[1]}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed nullsafepropertylookup by variable (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj?->$var} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed nullsafepropertylookup with comments (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$var?->foo?->bar /* Comment */ } string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed nullsafepropertylookup with multiple call (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj?->call()?->call()} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Call { + "arguments": [], + "kind": "call", + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed offsetlookup (2) (simple syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string $array[koolaid1] string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Identifier { + "kind": "identifier", + "name": "koolaid1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed offsetlookup (3) (simple syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string $array[0][0] string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "0", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "[0] string", + "unicode": false, + "value": "[0] string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed offsetlookup (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$array["key"]} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""key"", + "unicode": false, + "value": "key", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed offsetlookup (simple syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string $array[0] string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "0", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed offsetlookup 2 (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$array[4][3]} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "3", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "4", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed offsetlookup 3 (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$arr[foo][3]} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "3", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "arr", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed offsetlookup 4 (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$arr["foo"][3]} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "3", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""foo"", + "unicode": false, + "value": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "arr", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed positive offset in encapsed var offset 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""$var[1]"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed propertylookup (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj->property} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed propertylookup (simple syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string $obj->property string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed propertylookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": EncapsedPart { + "curly": false, + "expression": Encapsed { + "kind": "encapsed", + "raw": ""set{$type}"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "set", + "unicode": false, + "value": "set", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "type", + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + ], + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "this", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed propertylookup by variable (2) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj->{$array[1]}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed propertylookup by variable (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj->$var} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed propertylookup with comments (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$var->foo->bar /* Comment */ } string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed propertylookup with multiple call (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj->call()->call()} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed staticlookup (2) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj::call()} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed staticlookup (3) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj::$var::$var} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed staticlookup (4) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$var::$target::$resource::$binary::$foo::$bar::$foobar::$bar::$foo::$foobar::$bar::$foo} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "foobar", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "foobar", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "binary", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "resource", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "target", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed staticlookup (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$obj::$var} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed string offset in encapsed var offset 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""$var[var]"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Identifier { + "kind": "identifier", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed string offset in encapsed var offset 2`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""$var[$var]"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed two variable (simple syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string $var->$var string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "->", + "unicode": false, + "value": "->", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed value of the var (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {\${$name}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "name", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed value of the var named by the return value (2) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {\${call()}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": true, + "kind": "variable", + "name": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed value of the var named by the return value (3) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {\${$obj->property}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": true, + "kind": "variable", + "name": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed value of the var named by the return value (4) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {\${$obj->call()}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": true, + "kind": "variable", + "name": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed value of the var named by the return value (5) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {\${$obj::$var}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": true, + "kind": "variable", + "name": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed value of the var named by the return value (6) (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {\${$obj::call()}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": true, + "kind": "variable", + "name": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed value of the var named by the return value (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {\${call()}} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": true, + "kind": "variable", + "name": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed variable (complex syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$var} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed variable (simple syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string $var string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed variable curly (simple syntax) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string \${var} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed variable with before closing curly 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string {$var } string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`encapsed variable with space opening before curly 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""string { $var} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string { ", + "unicode": false, + "value": "string { ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "} string", + "unicode": false, + "value": "} string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/enum.test.js.snap b/test/snapshot/__snapshots__/enum.test.js.snap new file mode 100644 index 000000000..0d32779aa --- /dev/null +++ b/test/snapshot/__snapshots__/enum.test.js.snap @@ -0,0 +1,589 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Test enums can alias cases 1`] = ` +Program { + "children": [ + Enum { + "attrGroups": [], + "body": [ + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "Bar", + }, + "value": null, + }, + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "Baz", + }, + "value": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "Bar", + }, + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "implements": null, + "kind": "enum", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + "valueType": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test enums can have functions 1`] = ` +Program { + "children": [ + Enum { + "attrGroups": [], + "body": [ + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "MyCase", + }, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "bar", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "void", + "raw": "void", + }, + "visibility": "public", + }, + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Echo { + "expressions": [ + PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "value", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "MyCase", + }, + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + }, + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": true, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "baz", + }, + "nullable": false, + "type": null, + "visibility": "protected", + }, + ], + "implements": null, + "kind": "enum", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + "valueType": Name { + "kind": "name", + "name": "int", + "resolution": "uqn", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test enums can implement interfaces 1`] = ` +Program { + "children": [ + Enum { + "attrGroups": [], + "body": [], + "implements": [ + Name { + "kind": "name", + "name": "Bar", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "Baz", + "resolution": "uqn", + }, + ], + "kind": "enum", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + "valueType": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test enums can use traits 1`] = ` +Program { + "children": [ + Enum { + "attrGroups": [], + "body": [ + TraitUse { + "adaptations": [ + TraitPrecedence { + "instead": [ + Name { + "kind": "name", + "name": "Bar", + "resolution": "uqn", + }, + ], + "kind": "traitprecedence", + "method": Identifier { + "kind": "identifier", + "name": "hello", + }, + "trait": Name { + "kind": "name", + "name": "Baz", + "resolution": "uqn", + }, + }, + TraitAlias { + "as": Identifier { + "kind": "identifier", + "name": "earth", + }, + "kind": "traitalias", + "method": Identifier { + "kind": "identifier", + "name": "world", + }, + "trait": Name { + "kind": "name", + "name": "Baz", + "resolution": "uqn", + }, + "visibility": "", + }, + ], + "kind": "traituse", + "traits": [ + Name { + "kind": "name", + "name": "Bar", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "Baz", + "resolution": "uqn", + }, + ], + }, + TraitUse { + "adaptations": null, + "kind": "traituse", + "traits": [ + Name { + "kind": "name", + "name": "Bax", + "resolution": "uqn", + }, + ], + }, + ], + "implements": null, + "kind": "enum", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + "valueType": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test enums can't be parsed with PHP < 8 1`] = `"Parse Error : syntax error, unexpected 'Foo' (T_STRING), expecting ';' on line 1"`; + +exports[`Test enums cannot have properties 1`] = `"Parse Error : syntax error, unexpected 'int' (T_STRING) on line 3"`; + +exports[`Test enums doesn't confuse enums with identifiers 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "enum", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Enum", + }, + }, + Interface { + "attrGroups": [], + "body": [], + "extends": null, + "kind": "interface", + "name": Identifier { + "kind": "identifier", + "name": "Enum", + }, + }, + Trait { + "body": [], + "kind": "trait", + "name": Identifier { + "kind": "identifier", + "name": "Enum", + }, + }, + _Function { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "enum", + }, + "nullable": false, + "type": null, + }, + Class { + "attrGroups": [], + "body": [], + "extends": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Enum", + }, + }, + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": [ + Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + ], + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Enum", + }, + }, + Class { + "attrGroups": [], + "body": [], + "extends": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Enum", + }, + }, + Enum { + "attrGroups": [], + "body": [], + "implements": null, + "kind": "enum", + "name": Identifier { + "kind": "identifier", + "name": "extendsFoo", + }, + "valueType": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test enums empty 1`] = ` +Program { + "children": [ + Enum { + "attrGroups": [], + "body": [], + "implements": null, + "kind": "enum", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + "valueType": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test enums may have a backing type 1`] = ` +Program { + "children": [ + Enum { + "attrGroups": [], + "body": [ + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "Hearts", + }, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'H'", + "unicode": false, + "value": "H", + }, + }, + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "Diamonds", + }, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'D'", + "unicode": false, + "value": "D", + }, + }, + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "Clubs", + }, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'C'", + "unicode": false, + "value": "C", + }, + }, + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "Spades", + }, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'S'", + "unicode": false, + "value": "S", + }, + }, + ], + "implements": null, + "kind": "enum", + "name": Identifier { + "kind": "identifier", + "name": "Suit", + }, + "valueType": Name { + "kind": "name", + "name": "string", + "resolution": "uqn", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test enums non-empty 1`] = ` +Program { + "children": [ + Enum { + "attrGroups": [], + "body": [ + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "Hearts", + }, + "value": null, + }, + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "Diamonds", + }, + "value": null, + }, + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "Clubs", + }, + "value": null, + }, + EnumCase { + "kind": "enumcase", + "name": Identifier { + "kind": "identifier", + "name": "Spades", + }, + "value": null, + }, + ], + "implements": null, + "kind": "enum", + "name": Identifier { + "kind": "identifier", + "name": "Suit", + }, + "valueType": null, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/eval.test.js.snap b/test/snapshot/__snapshots__/eval.test.js.snap new file mode 100644 index 000000000..af42e6f78 --- /dev/null +++ b/test/snapshot/__snapshots__/eval.test.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`eval simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Eval { + "kind": "eval", + "source": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""command"", + "unicode": false, + "value": "command", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/exit.test.js.snap b/test/snapshot/__snapshots__/exit.test.js.snap new file mode 100644 index 000000000..5b6e258b1 --- /dev/null +++ b/test/snapshot/__snapshots__/exit.test.js.snap @@ -0,0 +1,182 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`exit argument 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Exit { + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "exit", + "useDie": false, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`exit die 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Exit { + "expression": null, + "kind": "exit", + "useDie": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`exit die with empty expression 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Exit { + "expression": null, + "kind": "exit", + "useDie": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`exit die with expression 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Exit { + "expression": Bin { + "kind": "bin", + "left": Number { + "kind": "number", + "value": "10", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "+", + }, + "kind": "exit", + "useDie": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`exit die without expression 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Exit { + "expression": null, + "kind": "exit", + "useDie": true, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`exit exit with empty expression 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Exit { + "expression": null, + "kind": "exit", + "useDie": false, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`exit exit with expression 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Exit { + "expression": Bin { + "kind": "bin", + "left": Number { + "kind": "number", + "value": "10", + }, + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "type": "+", + }, + "kind": "exit", + "useDie": false, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`exit exit without expression 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Exit { + "expression": null, + "kind": "exit", + "useDie": false, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`exit simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Exit { + "expression": null, + "kind": "exit", + "useDie": false, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/expr.test.js.snap b/test/snapshot/__snapshots__/expr.test.js.snap index 6b6fc1052..ba219eb0d 100644 --- a/test/snapshot/__snapshots__/expr.test.js.snap +++ b/test/snapshot/__snapshots__/expr.test.js.snap @@ -2,12 +2,12 @@ exports[`Test expressions chaining calls (derefenceable) 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "bar", }, "what": OffsetLookup { @@ -18,28 +18,27 @@ Program { }, "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "foo", }, "what": Call { - "arguments": Array [], + "arguments": [], "kind": "call", "what": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "call", }, "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "b", }, "parenthesizedExpression": true, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -53,19 +52,19 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions chaining calls (derefenceable) 2`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "foo", }, "what": OffsetLookup { @@ -75,18 +74,36 @@ Program { "value": "0", }, "what": Array { - "items": Array [ - Number { - "kind": "number", - "value": "1", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, }, - Number { - "kind": "number", - "value": "2", + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "2", + }, }, - Number { - "kind": "number", - "value": "3", + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, }, ], "kind": "array", @@ -97,61 +114,55 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions chaining calls (derefenceable) 3`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Call { - "arguments": Array [], + "arguments": [], "kind": "call", "what": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "foo", }, - "what": PropertyLookup { - "kind": "propertylookup", - "offset": Encapsed { - "kind": "encapsed", - "type": "offset", - "value": Array [ - ConstRef { - "kind": "constref", - "name": "bar", - }, - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "baz", - }, - ], + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "baz", }, - "what": Call { - "arguments": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "foo", - }, - ], - "kind": "call", - "what": Post { - "kind": "post", - "parenthesizedExpression": true, - "type": "+", - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "a", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + ], + "kind": "call", + "what": Post { + "kind": "post", + "parenthesizedExpression": true, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, }, }, }, @@ -161,21 +172,20 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions chaining calls (derefenceable) 4`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Post { "kind": "post", "parenthesizedExpression": true, "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -183,27 +193,30 @@ Program { }, "kind": "expressionstatement", }, - StaticLookup { - "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "baz", - }, - "what": StaticLookup { + ExpressionStatement { + "expression": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "foo", - }, - "what": Identifier { + "offset": Identifier { "kind": "identifier", - "name": "bar", - "resolution": "uqn", + "name": "baz", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, }, }, + "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { "expected": ";", "kind": "error", @@ -225,100 +238,266 @@ Program { exports[`Test expressions chaining calls (derefenceable) 5`] = ` Program { - "children": Array [ - Call { - "arguments": Array [], - "kind": "call", - "what": StaticLookup { - "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "baz", - }, - "what": Call { - "arguments": Array [], - "kind": "call", - "what": StaticLookup { - "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "foo", - }, - "what": Call { - "arguments": Array [], - "kind": "call", - "what": Identifier { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "baz", + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { "kind": "identifier", - "name": "bar", - "resolution": "uqn", + "name": "foo", + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, }, }, }, }, }, + "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Test expressions should assign class static 1`] = ` +exports[`Test expressions fix #234 1`] = ` Program { - "children": Array [ - Assign { - "kind": "assign", - "left": StaticLookup { - "kind": "staticlookup", - "offset": Variable { - "byref": false, + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { "curly": false, "kind": "variable", - "name": "b", - }, - "what": Identifier { - "kind": "identifier", "name": "a", + }, + "operator": "=", + "right": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "0", + }, + "what": New { + "arguments": [], + "kind": "new", + "parenthesizedExpression": true, + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test expressions fix #235 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "self", "resolution": "uqn", }, }, - "operator": "=", - "right": Number { - "kind": "number", - "value": "1", + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "sElF", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "parent", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "pArEnT", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": StaticReference { + "kind": "staticreference", + "raw": "static", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Test expressions should fail to assign class constants 1`] = ` +exports[`Test expressions should assign class static 1`] = ` Program { - "children": Array [ - Assign { - "kind": "assign", - "left": StaticLookup { - "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "b", + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "what": Name { + "kind": "name", + "name": "a", + "resolution": "uqn", + }, }, - "what": Identifier { - "kind": "identifier", - "name": "foo", - "resolution": "uqn", + "operator": "=", + "right": Number { + "kind": "number", + "value": "1", }, }, - "operator": "=", - "right": Number { - "kind": "number", - "value": "1", + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test expressions should fail to assign class constants 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "b", + }, + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "1", + }, }, + "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { "expected": "VARIABLE", "kind": "error", @@ -333,52 +512,42 @@ Program { exports[`Test expressions should fail to assign constants 1`] = ` Program { - "children": Array [ - Assign { - "kind": "assign", - "left": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Name { + "kind": "name", "name": "a", "resolution": "uqn", }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "1", + }, }, - "operator": "=", - "right": Number { - "kind": "number", - "value": "1", - }, - }, - ], - "errors": Array [ - Error { - "expected": "VARIABLE", - "kind": "error", - "line": 1, - "message": "Parse Error : syntax error, unexpected '=' on line 1", - "token": "'='", + "kind": "expressionstatement", }, ], + "errors": [], "kind": "program", } `; exports[`Test expressions test assignements 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -390,14 +559,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": ".=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -409,14 +576,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "+=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -428,14 +593,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "-=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -447,14 +610,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "*=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -466,14 +627,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "**=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -485,14 +644,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "/=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -504,14 +661,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "&=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -523,14 +678,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "|=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -542,14 +695,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "%=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -561,14 +712,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "^=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -580,14 +729,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "<<=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -599,14 +746,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": ">>=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -615,14 +760,14 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions test binary 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Bin { "kind": "bin", @@ -674,14 +819,14 @@ Program { "left": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"1\\"", + "raw": ""1"", "unicode": false, "value": "1", }, "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"3\\"", + "raw": ""3"", "unicode": false, "value": "3", }, @@ -810,194 +955,181 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions test cast 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(int)", - "type": "int", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(int)", + "type": "int", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(integer)", - "type": "int", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(integer)", + "type": "int", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(bool)", - "type": "bool", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(bool)", + "type": "bool", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(boolean)", - "type": "bool", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(boolean)", + "type": "bool", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(float)", - "type": "float", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(float)", + "type": "float", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(double)", - "type": "float", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(double)", + "type": "float", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(real)", - "type": "float", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(real)", + "type": "float", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(string)", - "type": "string", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(string)", + "type": "string", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(binary)", - "type": "binary", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(binary)", + "type": "binary", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(array)", - "type": "array", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(array)", + "type": "array", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(object)", - "type": "object", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(object)", + "type": "object", }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Cast { - "kind": "cast", - "raw": "(unset)", - "type": "unset", - "what": Variable { - "byref": false, + "expr": Variable { "curly": false, "kind": "variable", "name": "var", }, + "kind": "cast", + "raw": "(unset)", + "type": "unset", }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions test cast extension - #171 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Variable { - "byref": false, "cast": "int", "curly": false, "kind": "variable", @@ -1008,7 +1140,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "int", "curly": false, "kind": "variable", @@ -1019,7 +1150,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "bool", "curly": false, "kind": "variable", @@ -1030,7 +1160,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "bool", "curly": false, "kind": "variable", @@ -1041,7 +1170,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "float", "curly": false, "kind": "variable", @@ -1052,7 +1180,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "float", "curly": false, "kind": "variable", @@ -1063,7 +1190,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "float", "curly": false, "kind": "variable", @@ -1074,7 +1200,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "string", "curly": false, "kind": "variable", @@ -1085,7 +1210,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "binary", "curly": false, "kind": "variable", @@ -1096,7 +1220,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "array", "curly": false, "kind": "variable", @@ -1107,7 +1230,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "object", "curly": false, "kind": "variable", @@ -1118,7 +1240,6 @@ Program { }, ExpressionStatement { "expression": Variable { - "byref": false, "cast": "unset", "curly": false, "kind": "variable", @@ -1128,54 +1249,105 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions test exit 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Exit { - "kind": "exit", - "status": Number { + "expression": Number { "kind": "number", "value": "1", }, + "kind": "exit", "useDie": false, }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Exit { + "expression": null, "kind": "exit", - "status": null, "useDie": true, }, "kind": "expressionstatement", }, ExpressionStatement { "expression": Exit { + "expression": null, "kind": "exit", - "status": null, "useDie": false, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], + "kind": "program", +} +`; + +exports[`Test expressions test fail new 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": New { + "arguments": [], + "kind": "new", + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Identifier { + "kind": "identifier", + "name": "0", + }, + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": [ + 105, + 109, + "-", + 222, + ], + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected '0' (T_LNUMBER) on line 2", + "token": "'0' (T_LNUMBER)", + }, + ], "kind": "program", } `; exports[`Test expressions test generators 1`] = ` Program { - "children": Array [ + "children": [ _Function { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Yield { "key": null, @@ -1191,10 +1363,10 @@ Program { "expression": YieldFrom { "kind": "yieldfrom", "value": Call { - "arguments": Array [], + "arguments": [], "kind": "call", - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "name": "foo", "resolution": "uqn", }, @@ -1210,7 +1382,6 @@ Program { }, "kind": "yield", "value": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1226,25 +1397,23 @@ Program { "name": Identifier { "kind": "identifier", "name": "gen", - "resolution": "rn", }, "nullable": false, "type": null, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions test if based returns 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1269,7 +1438,6 @@ Program { "test": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1297,7 +1465,6 @@ Program { }, "kind": "retif", "test": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1307,14 +1474,14 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions test incr/decr 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Post { "kind": "post", @@ -1333,7 +1500,6 @@ Program { }, "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -1385,7 +1551,6 @@ Program { }, "type": "-", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -1437,7 +1602,6 @@ Program { }, "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -1489,7 +1653,6 @@ Program { }, "type": "-", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -1524,7 +1687,7 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { @@ -1544,18 +1707,16 @@ Program { exports[`Test expressions test more binary ops (formerly bool) 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1568,13 +1729,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1587,13 +1746,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1606,13 +1763,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1625,13 +1780,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1644,13 +1797,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1663,13 +1814,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1682,13 +1831,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1701,13 +1848,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1720,13 +1865,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1739,13 +1882,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1758,13 +1899,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1777,13 +1916,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1796,13 +1933,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1815,13 +1950,11 @@ Program { "expression": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1831,19 +1964,18 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions test nested expressions precedence 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1876,7 +2008,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1910,7 +2041,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "c", @@ -1951,7 +2081,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "d", @@ -1981,31 +2110,30 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions test new 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "=", "right": New { - "arguments": Array [], + "arguments": [], "kind": "new", - "what": Identifier { - "kind": "identifier", - "name": "\\\\foo", - "resolution": "qn", + "what": Name { + "kind": "name", + "name": "\\foo", + "resolution": "fqn", }, }, }, @@ -2015,23 +2143,22 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "=", "right": New { - "arguments": Array [], + "arguments": [], "kind": "new", "what": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "class", }, - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "name": "foo", "resolution": "rn", }, @@ -2044,17 +2171,15 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "=", "right": New { - "arguments": Array [], + "arguments": [], "kind": "new", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", @@ -2067,25 +2192,25 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "=", "right": New { - "arguments": Array [], + "arguments": [], "kind": "new", "what": Class { - "body": Array [], - "extends": Identifier { - "kind": "identifier", + "attrGroups": [], + "body": [], + "extends": Name { + "kind": "name", "name": "foo", "resolution": "uqn", }, - "implements": Array [ - Identifier { - "kind": "identifier", + "implements": [ + Name { + "kind": "name", "name": "bar", "resolution": "uqn", }, @@ -2093,6 +2218,7 @@ Program { "isAbstract": false, "isAnonymous": true, "isFinal": false, + "isReadonly": false, "kind": "class", "name": null, }, @@ -2101,21 +2227,81 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], + "kind": "program", +} +`; + +exports[`Test expressions test node references 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": StaticReference { + "kind": "staticreference", + "raw": "static", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], "kind": "program", } `; exports[`Test expressions test silent 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Silent { "expr": Call { - "arguments": Array [], + "arguments": [], "kind": "call", - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "name": "trigger_error", "resolution": "uqn", }, @@ -2125,20 +2311,19 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test expressions test unary 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Unary { "kind": "unary", "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", @@ -2151,7 +2336,6 @@ Program { "kind": "unary", "type": "~", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", @@ -2164,7 +2348,6 @@ Program { "kind": "unary", "type": "!", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", @@ -2177,7 +2360,6 @@ Program { "kind": "unary", "type": "-", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", @@ -2186,7 +2368,7 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/foreach.test.js.snap b/test/snapshot/__snapshots__/foreach.test.js.snap new file mode 100644 index 000000000..d75a9c7ce --- /dev/null +++ b/test/snapshot/__snapshots__/foreach.test.js.snap @@ -0,0 +1,722 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`foreach as list 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + Echo { + "expressions": [ + Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + "value": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + }, + ], + "kind": "list", + "shortForm": false, + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`foreach as list with key 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + Echo { + "expressions": [ + Variable { + "curly": false, + "kind": "variable", + "name": "v", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "key": Variable { + "curly": false, + "kind": "variable", + "name": "v", + }, + "kind": "foreach", + "shortForm": false, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + "value": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + }, + ], + "kind": "list", + "shortForm": false, + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`foreach as short list 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + Echo { + "expressions": [ + Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + "value": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + }, + ], + "kind": "list", + "shortForm": true, + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`foreach as short list with key 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + Echo { + "expressions": [ + Variable { + "curly": false, + "kind": "variable", + "name": "v", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "key": Variable { + "curly": false, + "kind": "variable", + "name": "v", + }, + "kind": "foreach", + "shortForm": false, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + "value": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + }, + ], + "kind": "list", + "shortForm": true, + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`foreach as variable 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + Echo { + "expressions": [ + Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`foreach as variable by ref 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + Echo { + "expressions": [ + Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + "value": Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`foreach unpacking #2 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "print_r", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "4", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`foreach unpacking #3 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "print_r", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "4", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`foreach unpacking #4 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "print_r", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "4", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`foreach unpacking 1`] = ` +Program { + "children": [ + Foreach { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "print_r", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "key": null, + "kind": "foreach", + "shortForm": false, + "source": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "4", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/function.test.js.snap b/test/snapshot/__snapshots__/function.test.js.snap index 99c2585b2..2879e51d4 100644 --- a/test/snapshot/__snapshots__/function.test.js.snap +++ b/test/snapshot/__snapshots__/function.test.js.snap @@ -1,62 +1,1097 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Function tests Test readonly function properties are only for class constructor 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 1, + "kind": "parameter", + "name": null, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": null, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "fun", + }, + "nullable": false, + "type": null, + }, + ExpressionStatement { + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "id", + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + Block { + "children": [], + "kind": "block", + }, + ], + "errors": [ + Error { + "expected": undefined, + "kind": "error", + "line": 2, + "message": "readonly properties can be used only on class constructor on line 2", + "token": undefined, + }, + Error { + "expected": 222, + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected 'readonly' (T_READ_ONLY), expecting T_VARIABLE on line 2", + "token": "'readonly' (T_READ_ONLY)", + }, + Error { + "expected": [ + ",", + ")", + ], + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected 'readonly' (T_READ_ONLY) on line 2", + "token": "'readonly' (T_READ_ONLY)", + }, + Error { + "expected": ")", + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected 'readonly' (T_READ_ONLY), expecting ')' on line 2", + "token": "'readonly' (T_READ_ONLY)", + }, + Error { + "expected": "{", + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected 'readonly' (T_READ_ONLY), expecting '{' on line 2", + "token": "'readonly' (T_READ_ONLY)", + }, + Error { + "expected": 187, + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected 'int' (T_STRING), expecting T_CLASS on line 2", + "token": "'int' (T_STRING)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected ')', expecting ';' on line 2", + "token": "')'", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected ')' on line 2", + "token": "')'", + }, + Error { + "expected": ";", + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected '{', expecting ';' on line 2", + "token": "'{'", + }, + ], + "kind": "program", +} +`; + +exports[`Function tests array pass by reference are not confused with intersection 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": true, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "params", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "array", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests first class callable support 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "callable", + }, + "operator": "=", + "right": Call { + "arguments": [ + VariadicPlaceholder { + "kind": "variadicplaceholder", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "strlen", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "callable", + }, + "operator": "=", + "right": Call { + "arguments": [ + VariadicPlaceholder { + "kind": "variadicplaceholder", + }, + ], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "doSomething", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "item", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "callable", + }, + "operator": "=", + "right": Call { + "arguments": [ + VariadicPlaceholder { + "kind": "variadicplaceholder", + }, + ], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "doSomething", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "item", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "callable", + }, + "operator": "=", + "right": Call { + "arguments": [ + VariadicPlaceholder { + "kind": "variadicplaceholder", + }, + ], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "doSomething", + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests first class callable support requires PHP 8.1+ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "callable", + }, + "operator": "=", + "right": Call { + "arguments": [ + variadic { + "kind": "variadic", + "what": undefined, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "strlen", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": "EXPR", + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected ')' on line 2", + "token": "')'", + }, + Error { + "expected": ")", + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected ';', expecting ')' on line 2", + "token": "';'", + }, + ], + "kind": "program", +} +`; + +exports[`Function tests implement #113 : typehint nodes 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": Number { + "kind": "number", + "value": "1", + }, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "float", + "raw": "float", + }, + "value": Number { + "kind": "number", + "value": "1", + }, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "c", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "bool", + "raw": "bool", + }, + "value": Number { + "kind": "number", + "value": "1", + }, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "d", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "e", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "callable", + "raw": "callable", + }, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "f", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "int\\bar", + "resolution": "qn", + }, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": true, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "params", + }, + "nullable": true, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "array", + }, + "value": null, + "variadic": true, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": true, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": true, + "type": TypeReference { + "kind": "typereference", + "name": "object", + "raw": "object", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + exports[`Function tests implement #196 : set function name as identifier 1`] = ` Program { - "children": Array [ + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "leadingComments": [ + CommentBlock { + "kind": "commentblock", + "offset": 18, + "value": "/* f */", + }, + ], + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "f", + }, + "nullable": false, + "type": null, + }, + ], + "comments": [ + CommentBlock { + "kind": "commentblock", + "offset": 18, + "value": "/* f */", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests spread array pass by reference are not intersection 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": true, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "params", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "array", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": true, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test arrow function php 7.4 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test danging comma in closure use-block php 8.0 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "curly": false, + "kind": "variable", + "name": "one", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test danging comma in closure use-block with multiple php 8.0 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "curly": false, + "kind": "variable", + "name": "one", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "two", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test danging comma in closure use-block with multiple/refs php 8.0 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "one", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "two", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "curly": false, + "kind": "variable", + "name": "three", + }, + Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "four", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test danging comma in closure use-block with refs php 8.0 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "one", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test danging comma in function php 8.0 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "c", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test double danging comma in closure use-block php 8.0 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "curly": false, + "kind": "variable", + "name": "one", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": 222, + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected ',', expecting T_VARIABLE on line 1", + "token": "','", + }, + ], + "kind": "program", +} +`; + +exports[`Function tests test function intersection types 1`] = ` +Program { + "children": [ _Function { - "arguments": Array [ + "arguments": [ Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", - "name": "a", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, "nullable": false, - "type": null, + "readonly": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + TypeReference { + "kind": "typereference", + "name": "float", + "raw": "float", + }, + ], + }, + "value": Number { + "kind": "number", + "value": "1", + }, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "readonly": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "Bar", + "resolution": "uqn", + }, + ], + }, "value": null, "variadic": false, }, ], + "attrGroups": [], "body": Block { - "children": Array [], + "children": [], "kind": "block", }, "byref": false, "kind": "function", "name": Identifier { "kind": "identifier", - "name": "f", - "resolution": "rn", - "trailingComments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* f */", + "name": "foo", + }, + "nullable": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", }, ], }, - "nullable": false, - "type": null, - }, - ], - "comments": Array [ - CommentBlock { - "kind": "commentblock", - "value": "/* f */", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Function tests test function parsing 1`] = ` Program { - "children": Array [ + "children": [ _Function { - "arguments": Array [ + "arguments": [ Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", - "name": "a", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, "nullable": false, + "readonly": false, "type": null, "value": Number { "kind": "number", @@ -65,34 +1100,47 @@ Program { "variadic": false, }, Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", - "name": "b", - "nullable": false, - "type": Identifier { + "name": Identifier { "kind": "identifier", - "name": "\\\\callable", - "resolution": "fqn", + "name": "b", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "callable", + "raw": "callable", }, "value": null, "variadic": false, }, Parameter { + "attrGroups": [], "byref": true, + "flags": 0, "kind": "parameter", - "name": "params", - "nullable": true, - "type": Identifier { + "name": Identifier { "kind": "identifier", - "name": "\\\\array", - "resolution": "fqn", + "name": "params", + }, + "nullable": true, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "array", }, "value": null, "variadic": true, }, ], + "attrGroups": [], "body": Block { - "children": Array [], + "children": [], "kind": "block", }, "byref": true, @@ -100,11 +1148,10 @@ Program { "name": Identifier { "kind": "identifier", "name": "foo", - "resolution": "rn", }, "nullable": true, - "type": Identifier { - "kind": "identifier", + "type": Name { + "kind": "name", "name": "boolean", "resolution": "uqn", }, @@ -113,26 +1160,32 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "=", "right": Closure { - "arguments": Array [ + "arguments": [ Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", - "name": "b", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, "nullable": false, + "readonly": false, "type": null, "value": null, "variadic": false, }, ], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Return { "expr": Boolean { "kind": "boolean", @@ -148,12 +1201,12 @@ Program { "isStatic": false, "kind": "closure", "nullable": false, - "type": Identifier { - "kind": "identifier", - "name": "\\\\array", - "resolution": "fqn", + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "array", }, - "uses": Array [ + "uses": [ Variable { "byref": true, "curly": false, @@ -161,7 +1214,6 @@ Program { "name": "c", }, Variable { - "byref": false, "curly": false, "kind": "variable", "name": "d", @@ -175,41 +1227,66 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", }, "operator": "=", "right": Call { - "arguments": Array [ + "arguments": [ variadic { "kind": "variadic", "what": Array { - "items": Array [ - Number { - "kind": "number", - "value": "1", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, }, - ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "null", - "resolution": "uqn", + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": NullKeyword { + "kind": "nullkeyword", + "raw": "null", }, }, - Number { - "kind": "number", - "value": "1", + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, }, - Number { - "kind": "number", - "value": "2", + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "2", + }, }, - Number { - "kind": "number", - "value": "3", + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, }, ], "kind": "array", @@ -218,8 +1295,8 @@ Program { }, ], "kind": "call", - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "name": "foo", "resolution": "uqn", }, @@ -228,32 +1305,136 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test function union types 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + TypeReference { + "kind": "typereference", + "name": "float", + "raw": "float", + }, + ], + }, + "value": Number { + "kind": "number", + "value": "1", + }, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "Bar", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + ], + }, + }, + ], + "errors": [], "kind": "program", } `; exports[`Function tests test reserved word for function name error 1`] = ` Program { - "children": Array [ + "children": [ _Function { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [], + "children": [], "kind": "block", }, "byref": false, "kind": "function", "name": Identifier { "kind": "identifier", - "name": "false", - "resolution": "rn", + "name": false, }, "nullable": false, "type": null, }, ], - "errors": Array [ + "errors": [ Error { "expected": 105, "kind": "error", @@ -266,23 +1447,237 @@ Program { } `; +exports[`Function tests test short function intersection types 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "readonly": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + TypeReference { + "kind": "typereference", + "name": "float", + "raw": "float", + }, + ], + }, + "value": Number { + "kind": "number", + "value": "1", + }, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "readonly": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "Bar", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": String { + "isDoubleQuote": true, + "kind": "string", + "raw": """", + "unicode": false, + "value": "", + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test short function union types 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Closure { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + TypeReference { + "kind": "typereference", + "name": "float", + "raw": "float", + }, + ], + }, + "value": Number { + "kind": "number", + "value": "1", + }, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "Bar", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": String { + "isDoubleQuote": true, + "kind": "string", + "raw": """", + "unicode": false, + "value": "", + }, + "byref": false, + "isStatic": false, + "kind": "arrowfunc", + "nullable": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + exports[`Function tests test static closure 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "=", "right": Closure { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [], + "children": [], "kind": "block", }, "byref": false, @@ -290,80 +1685,102 @@ Program { "kind": "closure", "nullable": false, "type": null, - "uses": Array [], + "uses": [], }, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Function tests test variadic error 1`] = ` +exports[`Function tests test variadic call error 1`] = `"Unexpected non-variadic argument after a variadic argument on line 1"`; + +exports[`Function tests test variadic function error 1 1`] = `"Unexpected parameter after a variadic parameter on line 1"`; + +exports[`Function tests test variadic function error 2 1`] = `"Unexpected parameter after a variadic parameter on line 1"`; + +exports[`Function tests test without danging comma in closure use-block php 8.0 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "b", + "name": "test", }, "operator": "=", - "right": Call { - "arguments": Array [ - variadic { - "kind": "variadic", - "what": Array { - "items": Array [ - Number { - "kind": "number", - "value": "1", - }, - Number { - "kind": "number", - "value": "2", - }, - Number { - "kind": "number", - "value": "3", - }, - ], - "kind": "array", - "shortForm": true, - }, - }, + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "a", + "name": "one", }, ], - "kind": "call", - "what": Identifier { - "kind": "identifier", - "name": "foo", - "resolution": "uqn", - }, }, }, "kind": "expressionstatement", }, ], - "errors": Array [ - Error { - "expected": undefined, - "kind": "error", - "line": 1, - "message": "Unexpected argument after a variadic argument on line 1", - "token": undefined, + "errors": [], + "kind": "program", +} +`; + +exports[`Function tests test without danging comma in closure use-block with refs php 8.0 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Closure { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "isStatic": false, + "kind": "closure", + "nullable": false, + "type": null, + "uses": [ + Variable { + "byref": true, + "curly": false, + "kind": "variable", + "name": "one", + }, + ], + }, + }, + "kind": "expressionstatement", }, ], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/global.test.js.snap b/test/snapshot/__snapshots__/global.test.js.snap new file mode 100644 index 000000000..eeeb6d5e2 --- /dev/null +++ b/test/snapshot/__snapshots__/global.test.js.snap @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`global mutliple 1`] = ` +Program { + "children": [ + Global { + "items": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + ], + "kind": "global", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`global simple 1`] = ` +Program { + "children": [ + Global { + "items": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + "kind": "global", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/goto.test.js.snap b/test/snapshot/__snapshots__/goto.test.js.snap new file mode 100644 index 000000000..bb89ebc35 --- /dev/null +++ b/test/snapshot/__snapshots__/goto.test.js.snap @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`goto simple 1`] = ` +Program { + "children": [ + Goto { + "kind": "goto", + "label": Identifier { + "kind": "identifier", + "name": "a", + }, + }, + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Foo"", + "unicode": false, + "value": "Foo", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`goto simple 2`] = ` +Program { + "children": [ + Goto { + "kind": "goto", + "label": Identifier { + "kind": "identifier", + "name": "longName", + }, + }, + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Foo"", + "unicode": false, + "value": "Foo", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/graceful.test.js.snap b/test/snapshot/__snapshots__/graceful.test.js.snap index e0250df40..d1bf9b28c 100644 --- a/test/snapshot/__snapshots__/graceful.test.js.snap +++ b/test/snapshot/__snapshots__/graceful.test.js.snap @@ -1,27 +1,73 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Test graceful mode to suppress errors interface 1`] = ` +Program { + "children": [ + Interface { + "attrGroups": [], + "body": [], + "extends": null, + "kind": "interface", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + }, + ], + "errors": [ + Error { + "expected": "{", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'implement' (T_STRING), expecting '{' on line 1", + "token": "'implement' (T_STRING)", + }, + Error { + "expected": [ + 198, + 182, + ], + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'baz' (T_STRING) on line 1", + "token": "'baz' (T_STRING)", + }, + Error { + "expected": [ + 198, + 182, + ], + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '{' on line 1", + "token": "'{'", + }, + ], + "kind": "program", +} +`; + exports[`Test graceful mode to suppress errors should contain 2 errors 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", }, "operator": "=", "right": Closure { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", @@ -39,13 +85,13 @@ Program { "kind": "closure", "nullable": false, "type": null, - "uses": Array [], + "uses": [], }, }, "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { "expected": "EXPR", "kind": "error", @@ -65,21 +111,211 @@ Program { } `; +exports[`Test graceful mode to suppress errors should fail ! 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Literal { + "kind": "literal", + "value": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test graceful mode to suppress errors should fail with '[' and '}' 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": "]", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '}', expecting ']' on line 1", + "token": "'}'", + }, + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '}', expecting ';' on line 1", + "token": "'}'", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '}' on line 1", + "token": "'}'", + }, + ], + "kind": "program", +} +`; + +exports[`Test graceful mode to suppress errors should fail with '{' and ']' 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": "}", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected ']', expecting '}' on line 1", + "token": "']'", + }, + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected ']', expecting ';' on line 1", + "token": "']'", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected ']' on line 1", + "token": "']'", + }, + ], + "kind": "program", +} +`; + +exports[`Test graceful mode to suppress errors staticlookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Literal { + "kind": "literal", + "value": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + }, + "what": Name { + "kind": "name", + "name": "Order", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": "(", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected ';', expecting '(' on line 1", + "token": "';'", + }, + ], + "kind": "program", +} +`; + exports[`Test graceful mode to suppress errors test class 1`] = ` Program { - "children": Array [ + "children": [ Class { - "body": Array [ - ClassConstant { - "isAbstract": false, - "isFinal": false, + "attrGroups": [], + "body": [ + PropertyStatement { "isStatic": false, - "kind": "classconstant", - "name": "A", - "value": Number { - "kind": "number", - "value": "1", - }, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "onst", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + "value": null, + }, + ], "visibility": "", }, ], @@ -88,28 +324,61 @@ Program { "isAbstract": false, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", - "name": "foo", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, }, ], - "errors": Array [ + "errors": [ Error { - "expected": Array [ + "expected": 222, + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'const' (T_CONST), expecting T_VARIABLE on line 1", + "token": "'const' (T_CONST)", + }, + Error { + "expected": [ + ",", + ";", + "=", + ], + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'A' (T_STRING) on line 1", + "token": "'A' (T_STRING)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'A' (T_STRING), expecting ';' on line 1", + "token": "'A' (T_STRING)", + }, + Error { + "expected": [ 198, 222, 182, ], "kind": "error", "line": 1, - "message": "Parse Error : syntax error, unexpected 'foo' (T_STRING) on line 1", - "token": "'foo' (T_STRING)", + "message": "Parse Error : syntax error, unexpected '=' on line 1", + "token": "'='", }, Error { - "expected": ";", + "expected": [ + 198, + 222, + 182, + ], "kind": "error", "line": 1, - "message": "Parse Error : syntax error, expecting ';' on line 1", - "token": "the end of file (EOF)", + "message": "Parse Error : syntax error, unexpected '1' (T_LNUMBER) on line 1", + "token": "'1' (T_LNUMBER)", }, Error { "expected": "}", @@ -125,12 +394,11 @@ Program { exports[`Test graceful mode to suppress errors test expr 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -139,7 +407,6 @@ Program { "right": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -154,14 +421,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", }, "operator": "=", "right": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -170,7 +435,7 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { "expected": "EXPR", "kind": "error", @@ -190,23 +455,148 @@ Program { } `; +exports[`Test graceful mode to suppress errors test flags (2) 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": null, + "byref": false, + "isAbstract": true, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "func", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + }, + ], + "errors": [ + Error { + "expected": 187, + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected 'final' (T_FINAL), expecting T_CLASS on line 2", + "token": "'final' (T_FINAL)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 4, + "message": "Parse Error : syntax error, expecting ';' on line 4", + "token": "the end of file (EOF)", + }, + Error { + "expected": "}", + "kind": "error", + "line": 4, + "message": "Parse Error : syntax error, expecting '}' on line 4", + "token": "the end of file (EOF)", + }, + ], + "kind": "program", +} +`; + +exports[`Test graceful mode to suppress errors test flags (3) 1`] = ` +Program { + "children": [ + Trait { + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": null, + "byref": false, + "isAbstract": true, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "name": Identifier { + "kind": "identifier", + "name": "func", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "kind": "trait", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + }, + ], + "errors": [ + Error { + "expected": 187, + "kind": "error", + "line": 2, + "message": "Parse Error : syntax error, unexpected 'final' (T_FINAL), expecting T_CLASS on line 2", + "token": "'final' (T_FINAL)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 4, + "message": "Parse Error : syntax error, expecting ';' on line 4", + "token": "the end of file (EOF)", + }, + Error { + "expected": "}", + "kind": "error", + "line": 4, + "message": "Parse Error : syntax error, expecting '}' on line 4", + "token": "the end of file (EOF)", + }, + ], + "kind": "program", +} +`; + exports[`Test graceful mode to suppress errors test flags 1`] = ` Program { - "children": Array [ + "children": [ Interface { - "body": Array [ + "attrGroups": [], + "body": [ Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": null, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", "name": "func", - "resolution": "rn", }, "nullable": false, "type": null, @@ -215,10 +605,13 @@ Program { ], "extends": null, "kind": "interface", - "name": "foo", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, }, ], - "errors": Array [ + "errors": [ Error { "expected": 187, "kind": "error", @@ -254,12 +647,11 @@ Program { exports[`Test graceful mode to suppress errors test function arguments 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Call { - "arguments": Array [ + "arguments": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "arg", @@ -268,12 +660,11 @@ Program { "kind": "call", "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "bar", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", @@ -286,24 +677,25 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", }, "operator": "=", "right": New { - "arguments": Array [ + "arguments": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "baz", }, + Noop { + "kind": "noop", + }, ], "kind": "new", - "what": Identifier { - "kind": "identifier", + "what": Name { + "kind": "name", "name": "bar", "resolution": "uqn", }, @@ -311,9 +703,12 @@ Program { }, "kind": "expressionstatement", }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, ExpressionStatement { "expression": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", @@ -325,34 +720,27 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [ - Error { - "expected": "EXPR", - "kind": "error", - "line": 2, - "message": "Parse Error : syntax error, unexpected ')' on line 2", - "token": "')'", - }, + "errors": [ Error { "expected": ")", "kind": "error", - "line": 2, - "message": "Parse Error : syntax error, unexpected ';', expecting ')' on line 2", - "token": "';'", + "line": 3, + "message": "Parse Error : syntax error, unexpected ',', expecting ')' on line 3", + "token": "','", }, Error { - "expected": "EXPR", + "expected": ";", "kind": "error", "line": 3, - "message": "Parse Error : syntax error, unexpected ',' on line 3", + "message": "Parse Error : syntax error, unexpected ',', expecting ';' on line 3", "token": "','", }, Error { - "expected": ")", + "expected": "EXPR", "kind": "error", "line": 3, - "message": "Parse Error : syntax error, unexpected '$foo' (T_VARIABLE), expecting ')' on line 3", - "token": "'$foo' (T_VARIABLE)", + "message": "Parse Error : syntax error, unexpected ',' on line 3", + "token": "','", }, Error { "expected": ";", @@ -382,27 +770,26 @@ Program { exports[`Test graceful mode to suppress errors test method chains 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "", }, "what": Call { - "arguments": Array [ + "arguments": [ Call { - "arguments": Array [], + "arguments": [], "kind": "call", "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "once", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "this", @@ -413,12 +800,11 @@ Program { "kind": "call", "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "expects", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "controller", @@ -429,11 +815,13 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { - "expected": Array [ + "expected": [ 105, 222, + "$", + "{", ], "kind": "error", "line": 4, @@ -444,3 +832,88 @@ Program { "kind": "program", } `; + +exports[`Test graceful mode to suppress errors trait 1`] = ` +Program { + "children": [ + Trait { + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "mplement", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + "value": null, + }, + ], + "visibility": "", + }, + ], + "kind": "trait", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + }, + ], + "errors": [ + Error { + "expected": "{", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'extends' (T_EXTENDS), expecting '{' on line 1", + "token": "'extends' (T_EXTENDS)", + }, + Error { + "expected": 222, + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'implement' (T_STRING), expecting T_VARIABLE on line 1", + "token": "'implement' (T_STRING)", + }, + Error { + "expected": [ + ",", + ";", + "=", + ], + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'baz' (T_STRING) on line 1", + "token": "'baz' (T_STRING)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'baz' (T_STRING), expecting ';' on line 1", + "token": "'baz' (T_STRING)", + }, + Error { + "expected": [ + 198, + 222, + 182, + ], + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '{' on line 1", + "token": "'{'", + }, + ], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/heredoc.test.js.snap b/test/snapshot/__snapshots__/heredoc.test.js.snap new file mode 100644 index 000000000..cdf9be706 --- /dev/null +++ b/test/snapshot/__snapshots__/heredoc.test.js.snap @@ -0,0 +1,2227 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`heredoc Can't parse multiple flexible nowdoc blocks with different indentation #508 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": Nowdoc { + "kind": "nowdoc", + "label": "EOT", + "raw": "<<<'EOT' + a + + EOT", + "value": "a +", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "operator": "=", + "right": Nowdoc { + "kind": "nowdoc", + "label": "EOT", + "raw": "<<<'EOT' + b + EOT", + "value": "b", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`heredoc Flexible heredoc syntax: 4 spaces of indentation 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Encapsed { + "kind": "encapsed", + "label": "END", + "raw": "<<bar[1]} + b + c + END", + "type": "heredoc", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " a + ", + "unicode": false, + "value": " a + ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " + b + c + ", + "unicode": false, + "value": " + b +c", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`heredoc empty 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Encapsed { + "kind": "encapsed", + "label": "TEST", + "raw": "<<foo. +Now, I am printing some {$foo->bar[1]}. +This should print a capital 'A': A +EOT", + "type": "heredoc", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "My name is "", + "unicode": false, + "value": "My name is "", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "name", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "". I am printing some ", + "unicode": false, + "value": "". I am printing some ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": ". +Now, I am printing some ", + "unicode": false, + "value": ". +Now, I am printing some ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": ". +This should print a capital 'A': A +", + "unicode": false, + "value": ". +This should print a capital 'A': A", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/if.test.js.snap b/test/snapshot/__snapshots__/if.test.js.snap index de74fbb94..79fac2e5e 100644 --- a/test/snapshot/__snapshots__/if.test.js.snap +++ b/test/snapshot/__snapshots__/if.test.js.snap @@ -2,18 +2,18 @@ exports[`Test IF statements test common cases 1`] = ` Program { - "children": Array [ + "children": [ If { "alternate": If { "alternate": If { "alternate": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"else\\"", + "raw": ""else"", "unicode": false, "value": "else", }, @@ -25,13 +25,13 @@ Program { "kind": "block", }, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"2nd\\"", + "raw": ""2nd"", "unicode": false, "value": "2nd", }, @@ -51,13 +51,13 @@ Program { }, }, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"false\\"", + "raw": ""false"", "unicode": false, "value": "false", }, @@ -77,13 +77,13 @@ Program { }, }, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"is true\\"", + "raw": ""is true"", "unicode": false, "value": "is true", }, @@ -103,14 +103,14 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test IF statements test issue #84 1`] = ` Program { - "children": Array [ + "children": [ Inline { "kind": "inline", "raw": " @@ -120,7 +120,7 @@ Program { }, If { "alternate": Block { - "children": Array [ + "children": [ Inline { "kind": "inline", "raw": " @@ -131,7 +131,7 @@ Program { "kind": "block", }, "body": Block { - "children": Array [ + "children": [ Inline { "kind": "inline", "raw": " @@ -156,14 +156,14 @@ Program { "value": " ", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test IF statements test issue #168 1`] = ` Program { - "children": Array [ + "children": [ If { "alternate": null, "body": null, @@ -183,7 +183,6 @@ Program { }, "shortForm": false, "test": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -222,7 +221,7 @@ Program { "value": " ", }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { @@ -243,7 +242,7 @@ Program { exports[`Test IF statements test issue #168 2`] = ` Program { - "children": Array [ + "children": [ If { "alternate": null, "body": null, @@ -263,7 +262,6 @@ Program { }, "shortForm": false, "test": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -302,7 +300,7 @@ Program { "value": " ", }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { @@ -323,7 +321,7 @@ Program { exports[`Test IF statements test issue #168 3`] = ` Program { - "children": Array [ + "children": [ If { "alternate": null, "body": null, @@ -344,7 +342,6 @@ Program { }, "shortForm": false, "test": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -364,7 +361,7 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { @@ -385,17 +382,17 @@ Program { exports[`Test IF statements test short form 1`] = ` Program { - "children": Array [ + "children": [ If { "alternate": If { "alternate": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"else\\"", + "raw": ""else"", "unicode": false, "value": "else", }, @@ -407,13 +404,13 @@ Program { "kind": "block", }, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"false\\"", + "raw": ""false"", "unicode": false, "value": "false", }, @@ -433,13 +430,13 @@ Program { }, }, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"is true\\"", + "raw": ""is true"", "unicode": false, "value": "is true", }, @@ -459,26 +456,26 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test IF statements test various cases 1`] = ` Program { - "children": Array [ + "children": [ If { "alternate": If { "alternate": If { "alternate": null, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"false\\"", + "raw": ""false"", "unicode": false, "value": "false", }, @@ -498,13 +495,13 @@ Program { }, }, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"false\\"", + "raw": ""false"", "unicode": false, "value": "false", }, @@ -524,13 +521,13 @@ Program { }, }, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"is true\\"", + "raw": ""is true"", "unicode": false, "value": "is true", }, @@ -551,13 +548,13 @@ Program { }, If { "alternate": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"false\\"", + "raw": ""false"", "unicode": false, "value": "false", }, @@ -569,13 +566,13 @@ Program { "kind": "block", }, "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"is true\\"", + "raw": ""is true"", "unicode": false, "value": "is true", }, @@ -595,7 +592,7 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/include.test.js.snap b/test/snapshot/__snapshots__/include.test.js.snap new file mode 100644 index 000000000..3959faa3e --- /dev/null +++ b/test/snapshot/__snapshots__/include.test.js.snap @@ -0,0 +1,97 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`include include 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Include { + "kind": "include", + "once": false, + "require": false, + "target": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`include include once 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Include { + "kind": "include", + "once": true, + "require": false, + "target": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`include require 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Include { + "kind": "include", + "once": false, + "require": true, + "target": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`include require_once 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Include { + "kind": "include", + "once": true, + "require": true, + "target": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/interface.test.js.snap b/test/snapshot/__snapshots__/interface.test.js.snap new file mode 100644 index 000000000..14dd6a85c --- /dev/null +++ b/test/snapshot/__snapshots__/interface.test.js.snap @@ -0,0 +1,127 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`interface extends 1`] = ` +Program { + "children": [ + Interface { + "attrGroups": [], + "body": [], + "extends": [ + Name { + "kind": "name", + "name": "B", + "resolution": "uqn", + }, + ], + "kind": "interface", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`interface interface name as identifier 1`] = ` +Program { + "children": [ + Interface { + "attrGroups": [], + "body": [], + "extends": null, + "kind": "interface", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`interface invalid private flag 1`] = ` +Program { + "children": [ + Interface { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "B", + }, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "kind": "interface", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "errors": [ + Error { + "expected": [ + 195, + 196, + ], + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'private' (T_PRIVATE) on line 1", + "token": "'private' (T_PRIVATE)", + }, + ], + "kind": "program", +} +`; + +exports[`interface multiple extends 1`] = ` +Program { + "children": [ + Interface { + "attrGroups": [], + "body": [], + "extends": [ + Name { + "kind": "name", + "name": "B", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "C", + "resolution": "uqn", + }, + ], + "kind": "interface", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/isset.test.js.snap b/test/snapshot/__snapshots__/isset.test.js.snap new file mode 100644 index 000000000..84adb6402 --- /dev/null +++ b/test/snapshot/__snapshots__/isset.test.js.snap @@ -0,0 +1,177 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`isset assign 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Isset { + "kind": "isset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`isset multiple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Isset { + "kind": "isset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`isset simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Isset { + "kind": "isset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`isset test errors 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Isset { + "kind": "isset", + "variables": [ + undefined, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected ')' on line 1", + "token": "')'", + }, + Error { + "expected": ")", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected ';', expecting ')' on line 1", + "token": "';'", + }, + ], + "kind": "program", +} +`; + +exports[`isset trailing comma #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Isset { + "kind": "isset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`isset trailing comma 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Isset { + "kind": "isset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/label.test.js.snap b/test/snapshot/__snapshots__/label.test.js.snap new file mode 100644 index 000000000..f3cf3887a --- /dev/null +++ b/test/snapshot/__snapshots__/label.test.js.snap @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`label simple 1`] = ` +Program { + "children": [ + Label { + "kind": "label", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + }, + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Foo"", + "unicode": false, + "value": "Foo", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`label simple 2`] = ` +Program { + "children": [ + Label { + "kind": "label", + "name": Identifier { + "kind": "identifier", + "name": "longName", + }, + }, + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""Foo"", + "unicode": false, + "value": "Foo", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/lexer.test.js.snap b/test/snapshot/__snapshots__/lexer.test.js.snap index 7384d062d..e71bb1665 100644 --- a/test/snapshot/__snapshots__/lexer.test.js.snap +++ b/test/snapshot/__snapshots__/lexer.test.js.snap @@ -1,12 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Test lexer initial state #263 - expect inline 1`] = ` +Program { + "children": [ + Inline { + "kind": "inline", + "raw": "", + "value": "", + }, + ], + "errors": [], + "kind": "program", +} +`; + exports[`Test lexer initial state parse asp echo tag 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -16,18 +29,17 @@ Program { "shortForm": true, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test lexer initial state parse asp tag 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -37,18 +49,17 @@ Program { "shortForm": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test lexer initial state parse short echo 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -58,18 +69,17 @@ Program { "shortForm": true, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test lexer initial state parse short tag 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -79,34 +89,34 @@ Program { "shortForm": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test lexer test #148 - sensitive lexer 1`] = ` -Array [ - Array [ +[ + [ "T_OPEN_TAG", "", 1, ], - Array [ + [ "T_WHITESPACE", " ", 1, ], - Array [ + [ "T_STRING", "list", 1, @@ -115,53 +125,81 @@ Array [ ] `; +exports[`Test lexer test #1003 - null-safe operator with reserved keyword 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "class", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + exports[`Test lexer test comments 1`] = ` Program { - "children": Array [ + "children": [ Inline { "kind": "inline", "raw": " ", - "trailingComments": Array [ + "value": " + ", + }, + Inline { + "kind": "inline", + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 20, "value": "// simple comment ", }, ], - "value": " + "raw": " ", + "value": " ", }, Inline { "kind": "inline", - "raw": " - ", - "trailingComments": Array [ + "leadingComments": [ CommentLine { "kind": "commentline", + "offset": 57, "value": "// another line ", }, ], + "raw": " + ", "value": " ", }, Inline { "kind": "inline", - "raw": " - ", - "trailingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", + "offset": 92, "value": "/**/", }, ], - "value": " ", - }, - Inline { - "kind": "inline", "raw": " ", - "trailingComments": Array [ + "trailingComments": [ CommentLine { "kind": "commentline", + "offset": 112, "value": "// last comment ", }, @@ -169,49 +207,53 @@ Program { "value": " ", }, ], - "comments": Array [ + "comments": [ CommentLine { "kind": "commentline", + "offset": 20, "value": "// simple comment ", }, CommentLine { "kind": "commentline", + "offset": 57, "value": "// another line ", }, CommentBlock { "kind": "commentblock", + "offset": 92, "value": "/**/", }, CommentLine { "kind": "commentline", + "offset": 112, "value": "// last comment ", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test lexer test tokens 1`] = ` -Array [ - Array [ +[ + [ "T_OPEN_TAG", " 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { "end": Position { - "column": 2, + "column": 8, "line": 1, - "offset": 2, + "offset": 8, }, "source": "$a", "start": Position { - "column": 0, + "column": 6, "line": 1, - "offset": 0, + "offset": 6, }, }, "name": "a", }, "loc": Location { "end": Position { - "column": 12, + "column": 17, "line": 1, - "offset": 12, + "offset": 17, }, - "source": "$a = $b + 1;", + "source": "$a = $b + 1", "start": Position { - "column": 0, + "column": 6, "line": 1, - "offset": 0, + "offset": 6, }, }, "operator": "=", "right": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { "end": Position { - "column": 7, + "column": 13, "line": 1, - "offset": 7, + "offset": 13, }, "source": "$b", "start": Position { - "column": 5, + "column": 11, "line": 1, - "offset": 5, + "offset": 11, }, }, "name": "b", }, "loc": Location { "end": Position { - "column": 11, + "column": 17, "line": 1, - "offset": 11, + "offset": 17, }, "source": "$b + 1", "start": Position { - "column": 5, + "column": 11, "line": 1, - "offset": 5, + "offset": 11, }, }, "right": Number { "kind": "number", "loc": Location { "end": Position { - "column": 11, + "column": 17, "line": 1, - "offset": 11, + "offset": 17, }, "source": "1", "start": Position { - "column": 10, + "column": 16, "line": 1, - "offset": 10, + "offset": 16, }, }, "value": "1", @@ -96,28 +94,28 @@ Program { "kind": "expressionstatement", "loc": Location { "end": Position { - "column": 12, + "column": 17, "line": 1, - "offset": 12, + "offset": 17, }, - "source": "$a = $b + 1;", + "source": "$a = $b + 1", "start": Position { - "column": 0, + "column": 6, "line": 1, - "offset": 0, + "offset": 6, }, }, }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { - "column": 12, + "column": 20, "line": 1, - "offset": 12, + "offset": 20, }, - "source": "$a = $b + 1;", + "source": "", "start": Position { "column": 0, "line": 1, @@ -127,92 +125,90 @@ Program { } `; -exports[`Test locations #164 : expr should avoid ?> 1`] = ` +exports[`Test locations test #164 : expr must include ; 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { "end": Position { - "column": 8, + "column": 2, "line": 1, - "offset": 8, + "offset": 2, }, "source": "$a", "start": Position { - "column": 6, + "column": 0, "line": 1, - "offset": 6, + "offset": 0, }, }, "name": "a", }, "loc": Location { "end": Position { - "column": 17, + "column": 12, "line": 1, - "offset": 17, + "offset": 12, }, - "source": "$a = $b + 1", + "source": "$a = $b + 1;", "start": Position { - "column": 6, + "column": 0, "line": 1, - "offset": 6, + "offset": 0, }, }, "operator": "=", "right": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { "end": Position { - "column": 13, + "column": 7, "line": 1, - "offset": 13, + "offset": 7, }, "source": "$b", "start": Position { - "column": 11, + "column": 5, "line": 1, - "offset": 11, + "offset": 5, }, }, "name": "b", }, "loc": Location { "end": Position { - "column": 17, + "column": 11, "line": 1, - "offset": 17, + "offset": 11, }, "source": "$b + 1", "start": Position { - "column": 11, + "column": 5, "line": 1, - "offset": 11, + "offset": 5, }, }, "right": Number { "kind": "number", "loc": Location { "end": Position { - "column": 17, + "column": 11, "line": 1, - "offset": 17, + "offset": 11, }, "source": "1", "start": Position { - "column": 16, + "column": 10, "line": 1, - "offset": 16, + "offset": 10, }, }, "value": "1", @@ -223,28 +219,13643 @@ Program { "kind": "expressionstatement", "loc": Location { "end": Position { - "column": 17, + "column": 12, "line": 1, - "offset": 17, + "offset": 12, }, - "source": "$a = $b + 1", + "source": "$a = $b + 1;", "start": Position { - "column": 6, + "column": 0, "line": 1, - "offset": 6, + "offset": 0, }, }, }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { - "column": 20, + "column": 12, "line": 1, - "offset": 20, + "offset": 12, }, - "source": "", + "source": "$a = $b + 1;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test #202 : include calling argument 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$arg", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "name": "arg", + }, + ], + "kind": "call", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "$foo->bar->baz($arg);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "what": PropertyLookup { + "kind": "propertylookup", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "$foo->bar->baz", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "baz", + "start": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + }, + "name": "baz", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "$foo->bar", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "bar", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "bar", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$foo", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "foo", + }, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "$foo->bar->baz($arg);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "$foo->bar->baz($arg);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test #230 : check location 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "$var1", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var1", + }, + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var1 + $var2", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var2", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "var2", + }, + "type": "+", + }, + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "$var1 + $var2 + $var3;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "$var3", + "start": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + }, + "name": "var3", + }, + "type": "+", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "$var1 + $var2 + $var3;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "$var1 + $var2 + $var3;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test #230 : check location on cast 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Cast { + "expr": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var1", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "var1", + }, + "kind": "cast", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "(string)$var1", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "raw": "(string)", + "type": "string", + }, + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "(string)$var1 + $var2;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "$var2", + "start": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + }, + "name": "var2", + }, + "type": "+", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "(string)$var1 + $var2;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "(string)$var1 + $var2;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test #230 : check location on retif 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": RetIf { + "falseExpr": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 57, + "line": 1, + "offset": 57, + }, + "source": "$innerFalse", + "start": Position { + "column": 45, + "line": 1, + "offset": 45, + }, + }, + "name": "innerFalse", + }, + "kind": "retif", + "loc": Location { + "end": Position { + "column": 57, + "line": 1, + "offset": 57, + }, + "source": "$var1 + $var2 ? true : $false ? $innerTrue : $innerFalse;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "test": RetIf { + "falseExpr": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "$false", + "start": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + }, + "name": "false", + }, + "kind": "retif", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "$var1 + $var2 ? true : $false", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "test": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "$var1", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var1", + }, + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var1 + $var2", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var2", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "var2", + }, + "type": "+", + }, + "trueExpr": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "true", + "start": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + }, + "raw": "true", + "value": true, + }, + }, + "trueExpr": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 42, + "line": 1, + "offset": 42, + }, + "source": "$innerTrue", + "start": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + }, + "name": "innerTrue", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 57, + "line": 1, + "offset": 57, + }, + "source": "$var1 + $var2 ? true : $false ? $innerTrue : $innerFalse;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 57, + "line": 1, + "offset": 57, + }, + "source": "$var1 + $var2 ? true : $false ? $innerTrue : $innerFalse;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test abstract class (inner statement) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": true, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 38, + "line": 1, + "offset": 38, + }, + "source": "abstract class Foo {}", + "start": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 35, + "line": 1, + "offset": 35, + }, + "source": "Foo", + "start": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + }, + "name": "Foo", + }, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 40, + "line": 1, + "offset": 40, + }, + "source": "{ abstract class Foo {} }", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + }, + "byref": false, + "kind": "function", + "loc": Location { + "end": Position { + "column": 40, + "line": 1, + "offset": 40, + }, + "source": "function foo()", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "foo", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 40, + "line": 1, + "offset": 40, + }, + "source": "function foo() { abstract class Foo {} }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test abstract class 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": true, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "abstract class Foo {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "Foo", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "abstract class Foo {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test array 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "1", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "1", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "2", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "2", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "3", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "3", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "value": "3", + }, + }, + ], + "kind": "array", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "array(1, 2, 3);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "array(1, 2, 3);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "array(1, 2, 3);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test array nested 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "array(1, 2, 3)", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "1", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "1", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + "source": "2", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + "source": "2", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "3", + "start": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "3", + "start": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + }, + "value": "3", + }, + }, + ], + "kind": "array", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "array(1, 2, 3)", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "shortForm": false, + }, + }, + ], + "kind": "array", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "array(array(1, 2, 3));", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "array(array(1, 2, 3));", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "array(array(1, 2, 3));", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test array short form 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 2, + "line": 1, + "offset": 2, + }, + "source": "1", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 2, + "line": 1, + "offset": 2, + }, + "source": "1", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "2", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "2", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "3", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "3", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "value": "3", + }, + }, + ], + "kind": "array", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "[1, 2, 3];", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": true, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "[1, 2, 3];", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "[1, 2, 3];", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test array short form nested 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "[1, 2, 3]", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 3, + "line": 1, + "offset": 3, + }, + "source": "1", + "start": Position { + "column": 2, + "line": 1, + "offset": 2, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 3, + "line": 1, + "offset": 3, + }, + "source": "1", + "start": Position { + "column": 2, + "line": 1, + "offset": 2, + }, + }, + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "2", + "start": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "2", + "start": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + }, + "value": "2", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "3", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "3", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "value": "3", + }, + }, + ], + "kind": "array", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "[1, 2, 3]", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "shortForm": true, + }, + }, + ], + "kind": "array", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "[[1, 2, 3]];", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": true, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "[[1, 2, 3]];", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "[[1, 2, 3]];", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test array with keys, byRef and unpack 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 60, + "line": 1, + "offset": 60, + }, + "source": "$var = [1, 'foo', 'test' => $foo, 'test' => &$foo, ...$var];", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "1", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "unpack": false, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "1", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + "source": "'foo'", + "start": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + }, + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + "source": "'foo'", + "start": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + }, + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + Entry { + "byRef": false, + "key": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 24, + "line": 1, + "offset": 24, + }, + "source": "'test'", + "start": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + }, + "raw": "'test'", + "unicode": false, + "value": "test", + }, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + "source": "'test' => $foo", + "start": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + "source": "$foo", + "start": Position { + "column": 28, + "line": 1, + "offset": 28, + }, + }, + "name": "foo", + }, + }, + Entry { + "byRef": true, + "key": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 40, + "line": 1, + "offset": 40, + }, + "source": "'test'", + "start": Position { + "column": 34, + "line": 1, + "offset": 34, + }, + }, + "raw": "'test'", + "unicode": false, + "value": "test", + }, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 49, + "line": 1, + "offset": 49, + }, + "source": "'test' => &$foo", + "start": Position { + "column": 34, + "line": 1, + "offset": 34, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 49, + "line": 1, + "offset": 49, + }, + "source": "$foo", + "start": Position { + "column": 45, + "line": 1, + "offset": 45, + }, + }, + "name": "foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 58, + "line": 1, + "offset": 58, + }, + "source": "...$var", + "start": Position { + "column": 51, + "line": 1, + "offset": 51, + }, + }, + "unpack": true, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 58, + "line": 1, + "offset": 58, + }, + "source": "$var", + "start": Position { + "column": 54, + "line": 1, + "offset": 54, + }, + }, + "name": "var", + }, + }, + ], + "kind": "array", + "loc": Location { + "end": Position { + "column": 59, + "line": 1, + "offset": 59, + }, + "source": "[1, 'foo', 'test' => $foo, 'test' => &$foo, ...$var]", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "shortForm": true, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 60, + "line": 1, + "offset": 60, + }, + "source": "$var = [1, 'foo', 'test' => $foo, 'test' => &$foo, ...$var];", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 60, + "line": 1, + "offset": 60, + }, + "source": "$var = [1, 'foo', 'test' => $foo, 'test' => &$foo, ...$var];", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test assign [] 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": OffsetLookup { + "kind": "offsetlookup", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "[]", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + "offset": false, + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + }, + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var[] = $var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "var", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var[] = $var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var[] = $var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test assign 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$var = true;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "true", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "raw": "true", + "value": true, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$var = true;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$var = true;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test assign by ref 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var = &$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$var", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "var", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var = &$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$var = &$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test assign mutliple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "$var = $other = true;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$other", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "name": "other", + }, + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "$other = true", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "operator": "=", + "right": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "true", + "start": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + }, + "raw": "true", + "value": true, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "$var = $other = true;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "$var = $other = true;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test bin 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "$var = $var + 100;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$var", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "$var + 100", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "right": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "100", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "value": "100", + }, + "type": "+", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "$var = $var + 100;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "$var = $var + 100;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test bin 2`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$var + 2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "2112", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "value": "2112", + }, + "type": "+", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$var + 2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$var + 2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test bin nested (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$var + $var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$var", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "name": "var", + }, + "type": "+", + }, + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var + $var + 2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "2112", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "value": "2112", + }, + "type": "+", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var + $var + 2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var + $var + 2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test bin nested 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$var + 2112", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "2112", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "value": "2112", + }, + "type": "+", + }, + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var + 2112 + $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "name": "var", + }, + "type": "+", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var + 2112 + $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var + 2112 + $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test break 1`] = ` +Program { + "children": [ + Break { + "kind": "break", + "level": null, + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "break;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "break;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test cast 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var = (int) "2112"", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Cast { + "expr": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": ""2112"", + "start": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + }, + "raw": ""2112"", + "unicode": false, + "value": "2112", + }, + "kind": "cast", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "(int) "2112"", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "raw": "(int)", + "type": "int", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var = (int) "2112"", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var = (int) "2112"", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test class (inner statement) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "class Foo {}", + "start": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 26, + "line": 1, + "offset": 26, + }, + "source": "Foo", + "start": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + }, + "name": "Foo", + }, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": "{ class Foo {} }", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + }, + "byref": false, + "kind": "function", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": "function foo()", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "foo", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": "function foo() { class Foo {} }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test class 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "class Foo {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "Foo", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "class Foo {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test clone 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Clone { + "kind": "clone", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "clone $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "$var", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "var", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "clone $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "clone $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test conststatement 1`] = ` +Program { + "children": [ + ConstantStatement { + "constants": [ + Constant { + "kind": "constant", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": "CONSTANT = "Hello world!"", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "CONSTANT", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": ""Hello world!"", + "start": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + }, + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + ], + "kind": "constantstatement", + "loc": Location { + "end": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + "source": "const CONSTANT = "Hello world!";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + "source": "const CONSTANT = "Hello world!";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test conststatement multiple 1`] = ` +Program { + "children": [ + ConstantStatement { + "constants": [ + Constant { + "kind": "constant", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": "CONSTANT = "Hello world!"", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "CONSTANT", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": ""Hello world!"", + "start": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + }, + "raw": ""Hello world!"", + "unicode": false, + "value": "Hello world!", + }, + }, + Constant { + "kind": "constant", + "loc": Location { + "end": Position { + "column": 70, + "line": 1, + "offset": 70, + }, + "source": "OTHER_CONSTANT = "Other hello world!"", + "start": Position { + "column": 33, + "line": 1, + "offset": 33, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 47, + "line": 1, + "offset": 47, + }, + "source": "OTHER_CONSTANT", + "start": Position { + "column": 33, + "line": 1, + "offset": 33, + }, + }, + "name": "OTHER_CONSTANT", + }, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 70, + "line": 1, + "offset": 70, + }, + "source": ""Other hello world!"", + "start": Position { + "column": 50, + "line": 1, + "offset": 50, + }, + }, + "raw": ""Other hello world!"", + "unicode": false, + "value": "Other hello world!", + }, + }, + ], + "kind": "constantstatement", + "loc": Location { + "end": Position { + "column": 71, + "line": 1, + "offset": 71, + }, + "source": "const CONSTANT = "Hello world!", OTHER_CONSTANT = "Other hello world!";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 71, + "line": 1, + "offset": 71, + }, + "source": "const CONSTANT = "Hello world!", OTHER_CONSTANT = "Other hello world!";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test continue 1`] = ` +Program { + "children": [ + Continue { + "kind": "continue", + "level": null, + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "continue;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "continue;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test declare 1`] = ` +Program { + "children": [ + Declare { + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "ticks", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "ticks", + }, + "kind": "declaredirective", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "ticks=1", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "1", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "value": "1", + }, + }, + ], + "kind": "declare", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "declare(ticks=1);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "mode": "none", + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "declare(ticks=1);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test declare block 1`] = ` +Program { + "children": [ + Declare { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 35, + "line": 1, + "offset": 35, + }, + "source": ""something"", + "start": Position { + "column": 24, + "line": 1, + "offset": 24, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 36, + "line": 1, + "offset": 36, + }, + "source": "echo "something";", + "start": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + }, + "shortForm": false, + }, + ], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "ticks", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "ticks", + }, + "kind": "declaredirective", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "ticks=1", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "1", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "value": "1", + }, + }, + ], + "kind": "declare", + "loc": Location { + "end": Position { + "column": 38, + "line": 1, + "offset": 38, + }, + "source": "declare(ticks=1) { echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "mode": "block", + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 38, + "line": 1, + "offset": 38, + }, + "source": "declare(ticks=1) { echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test declare directive (multiple) 1`] = ` +Program { + "children": [ + Declare { + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "A", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "A", + }, + "kind": "declaredirective", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "A='B'", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "'B'", + "start": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + }, + "raw": "'B'", + "unicode": false, + "value": "B", + }, + }, + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "C", + "start": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + }, + "name": "C", + }, + "kind": "declaredirective", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "C='D'", + "start": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + }, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "'D'", + "start": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + }, + "raw": "'D'", + "unicode": false, + "value": "D", + }, + }, + ], + "kind": "declare", + "loc": Location { + "end": Position { + "column": 26, + "line": 1, + "offset": 26, + }, + "source": "declare (A='B', C='D') { }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "mode": "block", + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 26, + "line": 1, + "offset": 26, + }, + "source": "declare (A='B', C='D') { }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test declare directive 1`] = ` +Program { + "children": [ + Declare { + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "strict_types", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "strict_types", + }, + "kind": "declaredirective", + "loc": Location { + "end": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + "source": "strict_types=1", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + "source": "1", + "start": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + }, + "value": "1", + }, + }, + ], + "kind": "declare", + "loc": Location { + "end": Position { + "column": 25, + "line": 1, + "offset": 25, + }, + "source": "declare (strict_types=1);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "mode": "none", + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 25, + "line": 1, + "offset": 25, + }, + "source": "declare (strict_types=1);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test do 1`] = ` +Program { + "children": [ + Do { + "body": Block { + "children": [ + Echo { + "expressions": [ + Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$i", + "start": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + }, + "name": "i", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "echo $i;", + "start": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + }, + "shortForm": false, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "{ echo $i; }", + "start": Position { + "column": 3, + "line": 1, + "offset": 3, + }, + }, + }, + "kind": "do", + "loc": Location { + "end": Position { + "column": 28, + "line": 1, + "offset": 28, + }, + "source": "do { echo $i; } while(true);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "test": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 26, + "line": 1, + "offset": 26, + }, + "source": "true", + "start": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + }, + "raw": "true", + "value": true, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 28, + "line": 1, + "offset": 28, + }, + "source": "do { echo $i; } while(true);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test echo 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + "source": ""something"", + "start": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "echo "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "echo "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test empty 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var = empty($var);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Empty { + "expression": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "$var", + "start": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + }, + "name": "var", + }, + "kind": "empty", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "empty($var)", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var = empty($var);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var = empty($var);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test encapsed heredoc 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "label": "EOD", + "loc": Location { + "end": Position { + "column": 4, + "line": 3, + "offset": 16, + }, + "source": "<< $b) echo "something"; elseif ($a < $b) echo "something"; else echo "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + "test": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "$a", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + "name": "a", + }, + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$a > $b", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$b", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "b", + }, + "type": ">", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 88, + "line": 1, + "offset": 88, + }, + "source": "if ($a > $b) echo "something"; elseif ($a < $b) echo "something"; else echo "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test if/elseif/else block 1`] = ` +Program { + "children": [ + If { + "alternate": If { + "alternate": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 97, + "line": 1, + "offset": 97, + }, + "source": ""something"", + "start": Position { + "column": 86, + "line": 1, + "offset": 86, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 98, + "line": 1, + "offset": 98, + }, + "source": "echo "something";", + "start": Position { + "column": 81, + "line": 1, + "offset": 81, + }, + }, + "shortForm": false, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 100, + "line": 1, + "offset": 100, + }, + "source": "{ echo "something"; }", + "start": Position { + "column": 79, + "line": 1, + "offset": 79, + }, + }, + }, + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 70, + "line": 1, + "offset": 70, + }, + "source": ""something"", + "start": Position { + "column": 59, + "line": 1, + "offset": 59, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 71, + "line": 1, + "offset": 71, + }, + "source": "echo "something";", + "start": Position { + "column": 54, + "line": 1, + "offset": 54, + }, + }, + "shortForm": false, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 73, + "line": 1, + "offset": 73, + }, + "source": "{ echo "something"; }", + "start": Position { + "column": 52, + "line": 1, + "offset": 52, + }, + }, + }, + "kind": "if", + "loc": Location { + "end": Position { + "column": 100, + "line": 1, + "offset": 100, + }, + "source": "elseif ($a < $b) { echo "something"; } else { echo "something"; }", + "start": Position { + "column": 35, + "line": 1, + "offset": 35, + }, + }, + "shortForm": false, + "test": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 45, + "line": 1, + "offset": 45, + }, + "source": "$a", + "start": Position { + "column": 43, + "line": 1, + "offset": 43, + }, + }, + "name": "a", + }, + "loc": Location { + "end": Position { + "column": 50, + "line": 1, + "offset": 50, + }, + "source": "$a < $b", + "start": Position { + "column": 43, + "line": 1, + "offset": 43, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 50, + "line": 1, + "offset": 50, + }, + "source": "$b", + "start": Position { + "column": 48, + "line": 1, + "offset": 48, + }, + }, + "name": "b", + }, + "type": "<", + }, + }, + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": ""something"", + "start": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + "source": "echo "something";", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "shortForm": false, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 34, + "line": 1, + "offset": 34, + }, + "source": "{ echo "something"; }", + "start": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + }, + }, + "kind": "if", + "loc": Location { + "end": Position { + "column": 100, + "line": 1, + "offset": 100, + }, + "source": "if ($a > $b) { echo "something"; } elseif ($a < $b) { echo "something"; } else { echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + "test": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "$a", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + "name": "a", + }, + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$a > $b", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$b", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "b", + }, + "type": ">", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 100, + "line": 1, + "offset": 100, + }, + "source": "if ($a > $b) { echo "something"; } elseif ($a < $b) { echo "something"; } else { echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test include 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Include { + "kind": "include", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "include "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "once": false, + "require": false, + "target": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": ""something"", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "include "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "include "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test interface 1`] = ` +Program { + "children": [ + Interface { + "attrGroups": [], + "body": [], + "extends": null, + "kind": "interface", + "loc": Location { + "end": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + "source": "interface Foo {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "Foo", + "start": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + }, + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + "source": "interface Foo {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test isset 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var = isset($var);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Isset { + "kind": "isset", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "isset($var)", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "$var", + "start": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + }, + "name": "var", + }, + ], + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var = isset($var);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var = isset($var);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test label #2 1`] = ` +Program { + "children": [ + Label { + "kind": "label", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "longName:", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "longName", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "longName", + }, + }, + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 26, + "line": 1, + "offset": 26, + }, + "source": ""something"", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 27, + "line": 1, + "offset": 27, + }, + "source": "echo "something";", + "start": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + }, + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 27, + "line": 1, + "offset": 27, + }, + "source": "longName: echo "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test label 1`] = ` +Program { + "children": [ + Label { + "kind": "label", + "loc": Location { + "end": Position { + "column": 2, + "line": 1, + "offset": 2, + }, + "source": "a:", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + "source": "a", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "a", + }, + }, + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": ""something"", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "echo "something";", + "start": Position { + "column": 3, + "line": 1, + "offset": 3, + }, + }, + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "a: echo "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test list 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "$a", + "start": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "$a", + "start": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + }, + "name": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$b", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$b", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "b", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "$c", + "start": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "$c", + "start": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + }, + "name": "c", + }, + }, + ], + "kind": "list", + "loc": Location { + "end": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + "source": "list($a, $b, $c)", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + }, + "loc": Location { + "end": Position { + "column": 24, + "line": 1, + "offset": 24, + }, + "source": "list($a, $b, $c) = $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + "source": "$var", + "start": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + }, + "name": "var", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 24, + "line": 1, + "offset": 24, + }, + "source": "list($a, $b, $c) = $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 24, + "line": 1, + "offset": 24, + }, + "source": "list($a, $b, $c) = $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test list short form 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 3, + "line": 1, + "offset": 3, + }, + "source": "$a", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 3, + "line": 1, + "offset": 3, + }, + "source": "$a", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "name": "a", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "$b", + "start": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "$b", + "start": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + }, + "name": "b", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$c", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$c", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "c", + }, + }, + ], + "kind": "list", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "[$a, $b, $c]", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": true, + }, + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "[$a, $b, $c] = $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "$var", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "name": "var", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "[$a, $b, $c] = $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "[$a, $b, $c] = $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test magic 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "__DIR__;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "raw": "__DIR__", + "value": "__DIR__", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "__DIR__;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "__DIR__;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test method (public) 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + "loc": Location { + "end": Position { + "column": 39, + "line": 1, + "offset": 39, + }, + "source": "{}", + "start": Position { + "column": 37, + "line": 1, + "offset": 37, + }, + }, + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "loc": Location { + "end": Position { + "column": 39, + "line": 1, + "offset": 39, + }, + "source": "public function method()", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 34, + "line": 1, + "offset": 34, + }, + "source": "method", + "start": Position { + "column": 28, + "line": 1, + "offset": 28, + }, + }, + "name": "method", + }, + "nullable": false, + "type": null, + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 41, + "line": 1, + "offset": 41, + }, + "source": "class Foo { public function method() {} }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "Foo", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 41, + "line": 1, + "offset": 41, + }, + "source": "class Foo { public function method() {} }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test method 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + Method { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + "loc": Location { + "end": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + "source": "{}", + "start": Position { + "column": 30, + "line": 1, + "offset": 30, + }, + }, + }, + "byref": false, + "isAbstract": false, + "isFinal": false, + "isReadonly": false, + "isStatic": false, + "kind": "method", + "loc": Location { + "end": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + "source": "function method()", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 27, + "line": 1, + "offset": 27, + }, + "source": "method", + "start": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + }, + "name": "method", + }, + "nullable": false, + "type": null, + "visibility": "", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 34, + "line": 1, + "offset": 34, + }, + "source": "class Foo { function method() {} }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "Foo", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 34, + "line": 1, + "offset": 34, + }, + "source": "class Foo { function method() {} }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test namespace 1`] = ` +Program { + "children": [ + Namespace { + "children": [], + "kind": "namespace", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "namespace my\\name;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "my\\name", + "withBrackets": false, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "namespace my\\name;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test namespace backets 1`] = ` +Program { + "children": [ + Namespace { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 36, + "line": 1, + "offset": 36, + }, + "source": ""something"", + "start": Position { + "column": 25, + "line": 1, + "offset": 25, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 37, + "line": 1, + "offset": 37, + }, + "source": "echo "something";", + "start": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + }, + "shortForm": false, + }, + ], + "kind": "namespace", + "loc": Location { + "end": Position { + "column": 39, + "line": 1, + "offset": 39, + }, + "source": "namespace my\\name { echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "my\\name", + "withBrackets": true, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 39, + "line": 1, + "offset": 39, + }, + "source": "namespace my\\name { echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test negative number 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "-2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "type": "-", + "what": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "2112", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "value": "2112", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "-2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "-2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test new 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "new Foo();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "Foo", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + "name": "Foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "new Foo();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "new Foo();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test new anonymous class 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "$var = new class {};", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": New { + "arguments": [], + "kind": "new", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "new class {}", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "what": Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": true, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "class {}", + "start": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + }, + "name": null, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "$var = new class {};", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "$var = new class {};", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test nowdoc 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Nowdoc { + "kind": "nowdoc", + "label": "EOD", + "loc": Location { + "end": Position { + "column": 4, + "line": 3, + "offset": 18, + }, + "source": "<<<'EOD' +Text +EOD;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "raw": "<<<'EOD' +Text +EOD", + "value": "Text", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 4, + "line": 3, + "offset": 18, + }, + "source": "<<<'EOD' +Text +EOD;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 4, + "line": 3, + "offset": 18, + }, + "source": "<<<'EOD' +Text +EOD;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test nowdoc assign 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 4, + "line": 3, + "offset": 25, + }, + "source": "$var = <<<'EOD' +Text +EOD;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Nowdoc { + "kind": "nowdoc", + "label": "EOD", + "loc": Location { + "end": Position { + "column": 3, + "line": 3, + "offset": 24, + }, + "source": "<<<'EOD' +Text +EOD", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "raw": "<<<'EOD' +Text +EOD", + "value": "Text", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 4, + "line": 3, + "offset": 25, + }, + "source": "$var = <<<'EOD' +Text +EOD;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 4, + "line": 3, + "offset": 25, + }, + "source": "$var = <<<'EOD' +Text +EOD;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test number 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "value": "2112", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "2112;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test offsetlookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 12, + "line": 2, + "offset": 13, + }, + "source": "$var", + "start": Position { + "column": 8, + "line": 2, + "offset": 9, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 18, + "line": 10, + "offset": 212, + }, + "source": "$var = $var + // Comment + [ 'foo' ] // Comment + // Comment + ['bar'] // Comment + // Comment + ['baz'] // Comment + // Comment + ['qqq'];", + "start": Position { + "column": 8, + "line": 2, + "offset": 9, + }, + }, + "operator": "=", + "right": OffsetLookup { + "kind": "offsetlookup", + "loc": Location { + "end": Position { + "column": 17, + "line": 10, + "offset": 211, + }, + "source": "$var + // Comment + [ 'foo' ] // Comment + // Comment + ['bar'] // Comment + // Comment + ['baz'] // Comment + // Comment + ['qqq']", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 16, + "line": 10, + "offset": 210, + }, + "source": "'qqq'", + "start": Position { + "column": 11, + "line": 10, + "offset": 205, + }, + }, + "raw": "'qqq'", + "unicode": false, + "value": "qqq", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "loc": Location { + "end": Position { + "column": 17, + "line": 8, + "offset": 161, + }, + "source": "$var + // Comment + [ 'foo' ] // Comment + // Comment + ['bar'] // Comment + // Comment + ['baz']", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 16, + "line": 8, + "offset": 160, + }, + "source": "'baz'", + "start": Position { + "column": 11, + "line": 8, + "offset": 155, + }, + }, + "raw": "'baz'", + "unicode": false, + "value": "baz", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "loc": Location { + "end": Position { + "column": 17, + "line": 6, + "offset": 111, + }, + "source": "$var + // Comment + [ 'foo' ] // Comment + // Comment + ['bar']", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 16, + "line": 6, + "offset": 110, + }, + "source": "'bar'", + "start": Position { + "column": 11, + "line": 6, + "offset": 105, + }, + }, + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "loc": Location { + "end": Position { + "column": 19, + "line": 4, + "offset": 61, + }, + "source": "$var + // Comment + [ 'foo' ]", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 17, + "line": 4, + "offset": 59, + }, + "source": "'foo'", + "start": Position { + "column": 12, + "line": 4, + "offset": 54, + }, + }, + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 19, + "line": 2, + "offset": 20, + }, + "source": "$var", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "name": "var", + }, + }, + }, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 18, + "line": 10, + "offset": 212, + }, + "source": "$var = $var + // Comment + [ 'foo' ] // Comment + // Comment + ['bar'] // Comment + // Comment + ['baz'] // Comment + // Comment + ['qqq'];", + "start": Position { + "column": 8, + "line": 2, + "offset": 9, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 8, + "line": 11, + "offset": 221, + }, + "source": " + $var = $var + // Comment + [ 'foo' ] // Comment + // Comment + ['bar'] // Comment + // Comment + ['baz'] // Comment + // Comment + ['qqq']; + ", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test parameter 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "?int $foo = 2112", + "start": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "$foo", + "start": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + }, + "name": "foo", + }, + "nullable": true, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "int", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "name": "int", + "raw": "int", + }, + "value": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "2112", + "start": Position { + "column": 25, + "line": 1, + "offset": 25, + }, + }, + "value": "2112", + }, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + "loc": Location { + "end": Position { + "column": 33, + "line": 1, + "offset": 33, + }, + "source": "{}", + "start": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + }, + }, + "byref": false, + "kind": "function", + "loc": Location { + "end": Position { + "column": 33, + "line": 1, + "offset": 33, + }, + "source": "function foo(?int $foo = 2112)", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "foo", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 33, + "line": 1, + "offset": 33, + }, + "source": "function foo(?int $foo = 2112) {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test post 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Post { + "kind": "post", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "$var++;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "$var++;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "$var++;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test pre 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Pre { + "kind": "pre", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "++$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "$var", + "start": Position { + "column": 2, + "line": 1, + "offset": 2, + }, + }, + "name": "var", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "++$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "++$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test print 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Print { + "expression": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": ""something"", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + "kind": "print", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "print "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "print "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "print "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test propertylookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 12, + "line": 2, + "offset": 13, + }, + "source": "$var", + "start": Position { + "column": 8, + "line": 2, + "offset": 9, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 19, + "line": 10, + "offset": 214, + }, + "source": "$var = $var + // Comment + ->each() // Comment + // Comment + ->map() // Comment + // Comment + ->first() // Comment + // Comment + ->dump();", + "start": Position { + "column": 8, + "line": 2, + "offset": 9, + }, + }, + "operator": "=", + "right": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 18, + "line": 10, + "offset": 213, + }, + "source": "$var + // Comment + ->each() // Comment + // Comment + ->map() // Comment + // Comment + ->first() // Comment + // Comment + ->dump()", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "what": PropertyLookup { + "kind": "propertylookup", + "loc": Location { + "end": Position { + "column": 16, + "line": 10, + "offset": 211, + }, + "source": "$var + // Comment + ->each() // Comment + // Comment + ->map() // Comment + // Comment + ->first() // Comment + // Comment + ->dump", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 16, + "line": 10, + "offset": 211, + }, + "source": "dump", + "start": Position { + "column": 12, + "line": 10, + "offset": 207, + }, + }, + "name": "dump", + }, + "what": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 19, + "line": 8, + "offset": 162, + }, + "source": "$var + // Comment + ->each() // Comment + // Comment + ->map() // Comment + // Comment + ->first()", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "what": PropertyLookup { + "kind": "propertylookup", + "loc": Location { + "end": Position { + "column": 17, + "line": 8, + "offset": 160, + }, + "source": "$var + // Comment + ->each() // Comment + // Comment + ->map() // Comment + // Comment + ->first", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 17, + "line": 8, + "offset": 160, + }, + "source": "first", + "start": Position { + "column": 12, + "line": 8, + "offset": 155, + }, + }, + "name": "first", + }, + "what": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 17, + "line": 6, + "offset": 110, + }, + "source": "$var + // Comment + ->each() // Comment + // Comment + ->map()", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "what": PropertyLookup { + "kind": "propertylookup", + "loc": Location { + "end": Position { + "column": 15, + "line": 6, + "offset": 108, + }, + "source": "$var + // Comment + ->each() // Comment + // Comment + ->map", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 15, + "line": 6, + "offset": 108, + }, + "source": "map", + "start": Position { + "column": 12, + "line": 6, + "offset": 105, + }, + }, + "name": "map", + }, + "what": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 18, + "line": 4, + "offset": 60, + }, + "source": "$var + // Comment + ->each()", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "what": PropertyLookup { + "kind": "propertylookup", + "loc": Location { + "end": Position { + "column": 16, + "line": 4, + "offset": 58, + }, + "source": "$var + // Comment + ->each", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 16, + "line": 4, + "offset": 58, + }, + "source": "each", + "start": Position { + "column": 12, + "line": 4, + "offset": 54, + }, + }, + "name": "each", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 19, + "line": 2, + "offset": 20, + }, + "source": "$var", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "name": "var", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 19, + "line": 10, + "offset": 214, + }, + "source": "$var = $var + // Comment + ->each() // Comment + // Comment + ->map() // Comment + // Comment + ->first() // Comment + // Comment + ->dump();", + "start": Position { + "column": 8, + "line": 2, + "offset": 9, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 8, + "line": 11, + "offset": 223, + }, + "source": " + $var = $var + // Comment + ->each() // Comment + // Comment + ->map() // Comment + // Comment + ->first() // Comment + // Comment + ->dump(); + ", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test retif 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 27, + "line": 1, + "offset": 27, + }, + "source": "$var = $var ? true : false;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": RetIf { + "falseExpr": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 26, + "line": 1, + "offset": 26, + }, + "source": "false", + "start": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + }, + "raw": "false", + "value": false, + }, + "kind": "retif", + "loc": Location { + "end": Position { + "column": 26, + "line": 1, + "offset": 26, + }, + "source": "$var ? true : false", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "test": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "$var", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "name": "var", + }, + "trueExpr": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "true", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "raw": "true", + "value": true, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 27, + "line": 1, + "offset": 27, + }, + "source": "$var = $var ? true : false;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 27, + "line": 1, + "offset": 27, + }, + "source": "$var = $var ? true : false;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test retif nested 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 79, + "line": 1, + "offset": 79, + }, + "source": "$var = ($one ? true : false) ? ($two ? true : false) : ($three ? true : false);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": RetIf { + "falseExpr": RetIf { + "falseExpr": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 77, + "line": 1, + "offset": 77, + }, + "source": "false", + "start": Position { + "column": 72, + "line": 1, + "offset": 72, + }, + }, + "raw": "false", + "value": false, + }, + "kind": "retif", + "loc": Location { + "end": Position { + "column": 77, + "line": 1, + "offset": 77, + }, + "source": "$three ? true : false", + "start": Position { + "column": 56, + "line": 1, + "offset": 56, + }, + }, + "parenthesizedExpression": true, + "test": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 62, + "line": 1, + "offset": 62, + }, + "source": "$three", + "start": Position { + "column": 56, + "line": 1, + "offset": 56, + }, + }, + "name": "three", + }, + "trueExpr": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 69, + "line": 1, + "offset": 69, + }, + "source": "true", + "start": Position { + "column": 65, + "line": 1, + "offset": 65, + }, + }, + "raw": "true", + "value": true, + }, + }, + "kind": "retif", + "loc": Location { + "end": Position { + "column": 78, + "line": 1, + "offset": 78, + }, + "source": "($one ? true : false) ? ($two ? true : false) : ($three ? true : false)", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "test": RetIf { + "falseExpr": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 27, + "line": 1, + "offset": 27, + }, + "source": "false", + "start": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + }, + "raw": "false", + "value": false, + }, + "kind": "retif", + "loc": Location { + "end": Position { + "column": 27, + "line": 1, + "offset": 27, + }, + "source": "$one ? true : false", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "parenthesizedExpression": true, + "test": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$one", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "one", + }, + "trueExpr": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + "source": "true", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "raw": "true", + "value": true, + }, + }, + "trueExpr": RetIf { + "falseExpr": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 51, + "line": 1, + "offset": 51, + }, + "source": "false", + "start": Position { + "column": 46, + "line": 1, + "offset": 46, + }, + }, + "raw": "false", + "value": false, + }, + "kind": "retif", + "loc": Location { + "end": Position { + "column": 51, + "line": 1, + "offset": 51, + }, + "source": "$two ? true : false", + "start": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + }, + "parenthesizedExpression": true, + "test": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 36, + "line": 1, + "offset": 36, + }, + "source": "$two", + "start": Position { + "column": 32, + "line": 1, + "offset": 32, + }, + }, + "name": "two", + }, + "trueExpr": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 43, + "line": 1, + "offset": 43, + }, + "source": "true", + "start": Position { + "column": 39, + "line": 1, + "offset": 39, + }, + }, + "raw": "true", + "value": true, + }, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 79, + "line": 1, + "offset": 79, + }, + "source": "$var = ($one ? true : false) ? ($two ? true : false) : ($three ? true : false);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 79, + "line": 1, + "offset": 79, + }, + "source": "$var = ($one ? true : false) ? ($two ? true : false) : ($three ? true : false);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test return 1`] = ` +Program { + "children": [ + Return { + "expr": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "1", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "value": "1", + }, + "kind": "return", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "return 1;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "return 1;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test silent 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "$var", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "$var = @call();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "operator": "=", + "right": Silent { + "expr": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "call()", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "call", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "silent", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "@call()", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "$var = @call();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "$var = @call();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test silent 2`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Silent { + "expr": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "call()", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "call", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "silent", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "@call();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "@call();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + "source": "@call();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test single call 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "call();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "call", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "call();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + "source": "call();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test static 1`] = ` +Program { + "children": [ + Static { + "kind": "static", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "static $a = 1;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "variables": [ + StaticVariable { + "defaultValue": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "1", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "value": "1", + }, + "kind": "staticvariable", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$a = 1", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "variable": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "$a", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "name": "a", + }, + }, + ], + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "static $a = 1;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test static multiple 1`] = ` +Program { + "children": [ + Static { + "kind": "static", + "loc": Location { + "end": Position { + "column": 30, + "line": 1, + "offset": 30, + }, + "source": "static $a = 1, $b = 2, $c = 3;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "variables": [ + StaticVariable { + "defaultValue": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "1", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "value": "1", + }, + "kind": "staticvariable", + "loc": Location { + "end": Position { + "column": 13, + "line": 1, + "offset": 13, + }, + "source": "$a = 1", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "variable": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "$a", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "name": "a", + }, + }, + StaticVariable { + "defaultValue": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "2", + "start": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + }, + "value": "2", + }, + "kind": "staticvariable", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "$b = 2", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "variable": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "$b", + "start": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + }, + "name": "b", + }, + }, + StaticVariable { + "defaultValue": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "3", + "start": Position { + "column": 28, + "line": 1, + "offset": 28, + }, + }, + "value": "3", + }, + "kind": "staticvariable", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "$c = 3", + "start": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + }, + "variable": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 25, + "line": 1, + "offset": 25, + }, + "source": "$c", + "start": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + }, + "name": "c", + }, + }, + ], + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 30, + "line": 1, + "offset": 30, + }, + "source": "static $a = 1, $b = 2, $c = 3;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test staticlookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 12, + "line": 2, + "offset": 13, + }, + "source": "$var", + "start": Position { + "column": 8, + "line": 2, + "offset": 9, + }, + }, + "name": "var", + }, + "loc": Location { + "end": Position { + "column": 19, + "line": 10, + "offset": 214, + }, + "source": "$var = $var + // Comment + ::each() // Comment + // Comment + ::map() // Comment + // Comment + ::first() // Comment + // Comment + ::dump();", + "start": Position { + "column": 8, + "line": 2, + "offset": 9, + }, + }, + "operator": "=", + "right": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 18, + "line": 10, + "offset": 213, + }, + "source": "$var + // Comment + ::each() // Comment + // Comment + ::map() // Comment + // Comment + ::first() // Comment + // Comment + ::dump()", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "what": StaticLookup { + "kind": "staticlookup", + "loc": Location { + "end": Position { + "column": 16, + "line": 10, + "offset": 211, + }, + "source": "$var + // Comment + ::each() // Comment + // Comment + ::map() // Comment + // Comment + ::first() // Comment + // Comment + ::dump", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 16, + "line": 10, + "offset": 211, + }, + "source": "dump", + "start": Position { + "column": 12, + "line": 10, + "offset": 207, + }, + }, + "name": "dump", + }, + "what": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 19, + "line": 8, + "offset": 162, + }, + "source": "$var + // Comment + ::each() // Comment + // Comment + ::map() // Comment + // Comment + ::first()", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "what": StaticLookup { + "kind": "staticlookup", + "loc": Location { + "end": Position { + "column": 17, + "line": 8, + "offset": 160, + }, + "source": "$var + // Comment + ::each() // Comment + // Comment + ::map() // Comment + // Comment + ::first", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 17, + "line": 8, + "offset": 160, + }, + "source": "first", + "start": Position { + "column": 12, + "line": 8, + "offset": 155, + }, + }, + "name": "first", + }, + "what": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 17, + "line": 6, + "offset": 110, + }, + "source": "$var + // Comment + ::each() // Comment + // Comment + ::map()", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "what": StaticLookup { + "kind": "staticlookup", + "loc": Location { + "end": Position { + "column": 15, + "line": 6, + "offset": 108, + }, + "source": "$var + // Comment + ::each() // Comment + // Comment + ::map", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 15, + "line": 6, + "offset": 108, + }, + "source": "map", + "start": Position { + "column": 12, + "line": 6, + "offset": 105, + }, + }, + "name": "map", + }, + "what": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 18, + "line": 4, + "offset": 60, + }, + "source": "$var + // Comment + ::each()", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "what": StaticLookup { + "kind": "staticlookup", + "loc": Location { + "end": Position { + "column": 16, + "line": 4, + "offset": 58, + }, + "source": "$var + // Comment + ::each", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "offset": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 16, + "line": 4, + "offset": 58, + }, + "source": "each", + "start": Position { + "column": 12, + "line": 4, + "offset": 54, + }, + }, + "name": "each", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 19, + "line": 2, + "offset": 20, + }, + "source": "$var", + "start": Position { + "column": 15, + "line": 2, + "offset": 16, + }, + }, + "name": "var", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 19, + "line": 10, + "offset": 214, + }, + "source": "$var = $var + // Comment + ::each() // Comment + // Comment + ::map() // Comment + // Comment + ::first() // Comment + // Comment + ::dump();", + "start": Position { + "column": 8, + "line": 2, + "offset": 9, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 8, + "line": 11, + "offset": 223, + }, + "source": " + $var = $var + // Comment + ::each() // Comment + // Comment + ::map() // Comment + // Comment + ::first() // Comment + // Comment + ::dump(); + ", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test string double quotes 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": ""string";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "raw": ""string"", + "unicode": false, + "value": "string", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": ""string";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": ""string";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test string single quotes 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "'string';", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "raw": "'string'", + "unicode": false, + "value": "string", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "'string';", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "'string';", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test switch 1`] = ` +Program { + "children": [ + Switch { + "body": Block { + "children": [], + "kind": "block", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "{}", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + }, + "kind": "switch", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "switch ($i) {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + "test": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "$i", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "i", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "switch ($i) {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test switch case 1`] = ` +Program { + "children": [ + Switch { + "body": Block { + "children": [ + Case { + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 38, + "line": 1, + "offset": 38, + }, + "source": ""something"", + "start": Position { + "column": 27, + "line": 1, + "offset": 27, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 39, + "line": 1, + "offset": 39, + }, + "source": "echo "something";", + "start": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + }, + "shortForm": false, + }, + Break { + "kind": "break", + "level": null, + "loc": Location { + "end": Position { + "column": 46, + "line": 1, + "offset": 46, + }, + "source": "break;", + "start": Position { + "column": 40, + "line": 1, + "offset": 40, + }, + }, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 46, + "line": 1, + "offset": 46, + }, + "source": "echo "something"; break;", + "start": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + }, + }, + "kind": "case", + "loc": Location { + "end": Position { + "column": 46, + "line": 1, + "offset": 46, + }, + "source": "case 0: echo "something"; break;", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "test": Number { + "kind": "number", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "0", + "start": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + }, + "value": "0", + }, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 48, + "line": 1, + "offset": 48, + }, + "source": "{ case 0: echo "something"; break; }", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + }, + "kind": "switch", + "loc": Location { + "end": Position { + "column": 48, + "line": 1, + "offset": 48, + }, + "source": "switch ($i) { case 0: echo "something"; break; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + "test": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "$i", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "i", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 48, + "line": 1, + "offset": 48, + }, + "source": "switch ($i) { case 0: echo "something"; break; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test switch default 1`] = ` +Program { + "children": [ + Switch { + "body": Block { + "children": [ + Case { + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 39, + "line": 1, + "offset": 39, + }, + "source": ""something"", + "start": Position { + "column": 28, + "line": 1, + "offset": 28, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 40, + "line": 1, + "offset": 40, + }, + "source": "echo "something";", + "start": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + }, + "shortForm": false, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 40, + "line": 1, + "offset": 40, + }, + "source": "echo "something";", + "start": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + }, + }, + "kind": "case", + "loc": Location { + "end": Position { + "column": 40, + "line": 1, + "offset": 40, + }, + "source": "default: echo "something";", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "test": null, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 42, + "line": 1, + "offset": 42, + }, + "source": "{ default: echo "something"; }", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + }, + "kind": "switch", + "loc": Location { + "end": Position { + "column": 42, + "line": 1, + "offset": 42, + }, + "source": "switch ($i) { default: echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + "test": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "$i", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "i", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 42, + "line": 1, + "offset": 42, + }, + "source": "switch ($i) { default: echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test ternary 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": RetIf { + "falseExpr": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": ""no"", + "start": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + }, + "raw": ""no"", + "unicode": false, + "value": "no", + }, + "kind": "retif", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "$valid ? "yes" : "no";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "test": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "$valid", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "valid", + }, + "trueExpr": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": ""yes"", + "start": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + }, + "raw": ""yes"", + "unicode": false, + "value": "yes", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "$valid ? "yes" : "no";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "$valid ? "yes" : "no";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test ternary no true expression 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": RetIf { + "falseExpr": String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": ""no"", + "start": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + }, + "raw": ""no"", + "unicode": false, + "value": "no", + }, + "kind": "retif", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "$valid ?: "no";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "test": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "$valid", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "valid", + }, + "trueExpr": null, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "$valid ?: "no";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "$valid ?: "no";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test trait 1`] = ` +Program { + "children": [ + Trait { + "body": [], + "kind": "trait", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "trait Foo {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "Foo", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "trait Foo {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test traituse 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + TraitUse { + "adaptations": null, + "kind": "traituse", + "loc": Location { + "end": Position { + "column": 22, + "line": 1, + "offset": 22, + }, + "source": "use Hello;", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "traits": [ + Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "Hello", + "start": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + }, + "name": "Hello", + "resolution": "uqn", + }, + ], + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 24, + "line": 1, + "offset": 24, + }, + "source": "class Foo { use Hello; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "Foo", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 24, + "line": 1, + "offset": 24, + }, + "source": "class Foo { use Hello; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test traituse adaptations 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + TraitUse { + "adaptations": [ + TraitPrecedence { + "instead": [ + Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 47, + "line": 1, + "offset": 47, + }, + "source": "A", + "start": Position { + "column": 46, + "line": 1, + "offset": 46, + }, + }, + "name": "A", + "resolution": "uqn", + }, + ], + "kind": "traitprecedence", + "loc": Location { + "end": Position { + "column": 47, + "line": 1, + "offset": 47, + }, + "source": "B::smallTalk insteadof A", + "start": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + }, + "method": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 35, + "line": 1, + "offset": 35, + }, + "source": "smallTalk", + "start": Position { + "column": 26, + "line": 1, + "offset": 26, + }, + }, + "name": "smallTalk", + }, + "trait": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 24, + "line": 1, + "offset": 24, + }, + "source": "B", + "start": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + }, + "name": "B", + "resolution": "uqn", + }, + }, + TraitAlias { + "as": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 68, + "line": 1, + "offset": 68, + }, + "source": "talk", + "start": Position { + "column": 64, + "line": 1, + "offset": 64, + }, + }, + "name": "talk", + }, + "kind": "traitalias", + "loc": Location { + "end": Position { + "column": 68, + "line": 1, + "offset": 68, + }, + "source": "B::bigTalk as talk", + "start": Position { + "column": 50, + "line": 1, + "offset": 50, + }, + }, + "method": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 60, + "line": 1, + "offset": 60, + }, + "source": "bigTalk", + "start": Position { + "column": 53, + "line": 1, + "offset": 53, + }, + }, + "name": "bigTalk", + }, + "trait": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 51, + "line": 1, + "offset": 51, + }, + "source": "B", + "start": Position { + "column": 50, + "line": 1, + "offset": 50, + }, + }, + "name": "B", + "resolution": "uqn", + }, + "visibility": "", + }, + TraitAlias { + "as": null, + "kind": "traitalias", + "loc": Location { + "end": Position { + "column": 91, + "line": 1, + "offset": 91, + }, + "source": "sayHello as protected", + "start": Position { + "column": 70, + "line": 1, + "offset": 70, + }, + }, + "method": "sayHello", + "trait": null, + "visibility": "protected", + }, + TraitAlias { + "as": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 127, + "line": 1, + "offset": 127, + }, + "source": "myPrivateHello", + "start": Position { + "column": 113, + "line": 1, + "offset": 113, + }, + }, + "name": "myPrivateHello", + }, + "kind": "traitalias", + "loc": Location { + "end": Position { + "column": 127, + "line": 1, + "offset": 127, + }, + "source": "sayHello as private myPrivateHello", + "start": Position { + "column": 93, + "line": 1, + "offset": 93, + }, + }, + "method": "sayHello", + "trait": null, + "visibility": "private", + }, + ], + "kind": "traituse", + "loc": Location { + "end": Position { + "column": 130, + "line": 1, + "offset": 130, + }, + "source": "use A, B { B::smallTalk insteadof A; B::bigTalk as talk; sayHello as protected; sayHello as private myPrivateHello; }", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "traits": [ + Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "A", + "start": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + }, + "name": "A", + "resolution": "uqn", + }, + Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "B", + "start": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + }, + "name": "B", + "resolution": "uqn", + }, + ], + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 132, + "line": 1, + "offset": 132, + }, + "source": "class Foo { use A, B { B::smallTalk insteadof A; B::bigTalk as talk; sayHello as protected; sayHello as private myPrivateHello; } }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "Foo", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 132, + "line": 1, + "offset": 132, + }, + "source": "class Foo { use A, B { B::smallTalk insteadof A; B::bigTalk as talk; sayHello as protected; sayHello as private myPrivateHello; } }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test traituse multiple 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + TraitUse { + "adaptations": null, + "kind": "traituse", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "use Hello, World;", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "traits": [ + Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 21, + "line": 1, + "offset": 21, + }, + "source": "Hello", + "start": Position { + "column": 16, + "line": 1, + "offset": 16, + }, + }, + "name": "Hello", + "resolution": "uqn", + }, + Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 28, + "line": 1, + "offset": 28, + }, + "source": "World", + "start": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + }, + "name": "World", + "resolution": "uqn", + }, + ], + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": "class Foo { use Hello, World; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 9, + "line": 1, + "offset": 9, + }, + "source": "Foo", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": "class Foo { use Hello, World; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test try 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "new Exception();", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "Exception", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "Exception", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "new Exception();", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + }, + "catches": [], + "kind": "try", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "try new Exception();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 20, + "line": 1, + "offset": 20, + }, + "source": "try new Exception();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test try/catch/finally 1`] = ` +Program { + "children": [ + Try { + "always": Block { + "children": [], + "kind": "block", + "loc": Location { + "end": Position { + "column": 41, + "line": 1, + "offset": 41, + }, + "source": "{}", + "start": Position { + "column": 39, + "line": 1, + "offset": 39, + }, + }, + }, + "body": Block { + "children": [], + "kind": "block", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "{}", + "start": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + }, + }, + "catches": [ + Catch { + "body": Block { + "children": [], + "kind": "block", + "loc": Location { + "end": Position { + "column": 30, + "line": 1, + "offset": 30, + }, + "source": "{}", + "start": Position { + "column": 28, + "line": 1, + "offset": 28, + }, + }, + }, + "kind": "catch", + "loc": Location { + "end": Position { + "column": 30, + "line": 1, + "offset": 30, + }, + "source": "catch (Exception $e) {}", + "start": Position { + "column": 7, + "line": 1, + "offset": 7, + }, + }, + "variable": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 26, + "line": 1, + "offset": 26, + }, + "source": "$e", + "start": Position { + "column": 24, + "line": 1, + "offset": 24, + }, + }, + "name": "e", + }, + "what": [ + Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 23, + "line": 1, + "offset": 23, + }, + "source": "Exception", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "name": "Exception", + "resolution": "uqn", + }, + ], + }, + ], + "kind": "try", + "loc": Location { + "end": Position { + "column": 41, + "line": 1, + "offset": 41, + }, + "source": "try {} catch (Exception $e) {} finally {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 41, + "line": 1, + "offset": 41, + }, + "source": "try {} catch (Exception $e) {} finally {}", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test unary 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "!$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "type": "!", + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "$var", + "start": Position { + "column": 1, + "line": 1, + "offset": 1, + }, + }, + "name": "var", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "!$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + "source": "!$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test unset 1`] = ` +Program { + "children": [ + Unset { + "kind": "unset", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "unset($foo);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "$foo", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "foo", + }, + ], + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "unset($foo);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "var", + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + "source": "$var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test variadic 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + variadic { + "kind": "variadic", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "...$var", + "start": Position { + "column": 5, + "line": 1, + "offset": 5, + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + "source": "$var", + "start": Position { + "column": 8, + "line": 1, + "offset": 8, + }, + }, + "name": "var", + }, + }, + ], + "kind": "call", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "call(...$var);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 4, + "line": 1, + "offset": 4, + }, + "source": "call", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "call(...$var);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + "source": "call(...$var);", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test while 1`] = ` +Program { + "children": [ + While { + "body": Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 28, + "line": 1, + "offset": 28, + }, + "source": ""something"", + "start": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "echo "something";", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + "shortForm": false, + }, + "kind": "while", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "while(true) echo "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + "test": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "true", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "raw": "true", + "value": true, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 29, + "line": 1, + "offset": 29, + }, + "source": "while(true) echo "something";", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test while block 1`] = ` +Program { + "children": [ + While { + "body": Block { + "children": [ + Echo { + "expressions": [ + String { + "isDoubleQuote": true, + "kind": "string", + "loc": Location { + "end": Position { + "column": 30, + "line": 1, + "offset": 30, + }, + "source": ""something"", + "start": Position { + "column": 19, + "line": 1, + "offset": 19, + }, + }, + "raw": ""something"", + "unicode": false, + "value": "something", + }, + ], + "kind": "echo", + "loc": Location { + "end": Position { + "column": 31, + "line": 1, + "offset": 31, + }, + "source": "echo "something";", + "start": Position { + "column": 14, + "line": 1, + "offset": 14, + }, + }, + "shortForm": false, + }, + ], + "kind": "block", + "loc": Location { + "end": Position { + "column": 33, + "line": 1, + "offset": 33, + }, + "source": "{ echo "something"; }", + "start": Position { + "column": 12, + "line": 1, + "offset": 12, + }, + }, + }, + "kind": "while", + "loc": Location { + "end": Position { + "column": 33, + "line": 1, + "offset": 33, + }, + "source": "while(true) { echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "shortForm": false, + "test": Boolean { + "kind": "boolean", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "true", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "raw": "true", + "value": true, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 33, + "line": 1, + "offset": 33, + }, + "source": "while(true) { echo "something"; }", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test yield 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Yield { + "key": null, + "kind": "yield", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "yield $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "value": Variable { + "curly": false, + "kind": "variable", + "loc": Location { + "end": Position { + "column": 10, + "line": 1, + "offset": 10, + }, + "source": "$var", + "start": Position { + "column": 6, + "line": 1, + "offset": 6, + }, + }, + "name": "var", + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "yield $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + "source": "yield $var;", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, +} +`; + +exports[`Test locations test yield from 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": YieldFrom { + "kind": "yieldfrom", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "yield from from();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + "value": Call { + "arguments": [], + "kind": "call", + "loc": Location { + "end": Position { + "column": 17, + "line": 1, + "offset": 17, + }, + "source": "from()", + "start": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + }, + "what": Name { + "kind": "name", + "loc": Location { + "end": Position { + "column": 15, + "line": 1, + "offset": 15, + }, + "source": "from", + "start": Position { + "column": 11, + "line": 1, + "offset": 11, + }, + }, + "name": "from", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "yield from from();", + "start": Position { + "column": 0, + "line": 1, + "offset": 0, + }, + }, + }, + ], + "errors": [], + "kind": "program", + "loc": Location { + "end": Position { + "column": 18, + "line": 1, + "offset": 18, + }, + "source": "yield from from();", "start": Position { "column": 0, "line": 1, diff --git a/test/snapshot/__snapshots__/loop.test.js.snap b/test/snapshot/__snapshots__/loop.test.js.snap index d7c2fb66f..459835953 100644 --- a/test/snapshot/__snapshots__/loop.test.js.snap +++ b/test/snapshot/__snapshots__/loop.test.js.snap @@ -2,16 +2,21 @@ exports[`Test loops statements (for, while) fix #122 1`] = ` Program { - "children": Array [ + "children": [ Foreach { "body": ExpressionStatement { "expression": Array { - "items": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "foo", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, }, ], "kind": "array", @@ -20,7 +25,6 @@ Program { "kind": "expressionstatement", }, "key": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "bar", @@ -28,7 +32,6 @@ Program { "kind": "foreach", "shortForm": false, "source": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", @@ -40,40 +43,57 @@ Program { "kind": "expressionstatement", }, Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"$k -> $v -\\"", + "raw": ""$k -> $v +"", "type": "string", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": false, - "kind": "variable", - "name": "k", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "k", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -> ", - "unicode": false, - "value": " -> ", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " -> ", + "unicode": false, + "value": " -> ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": false, - "kind": "variable", - "name": "v", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "v", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -", - "unicode": false, - "value": " + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " ", + "unicode": false, + "value": "", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -82,7 +102,7 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { "expected": "VARIABLE", "kind": "error", @@ -125,43 +145,60 @@ Program { exports[`Test loops statements (for, while) fix #122 2`] = ` Program { - "children": Array [ + "children": [ Foreach { "body": Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"$k -> $v -\\"", + "raw": ""$k -> $v +"", "type": "string", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": false, - "kind": "variable", - "name": "k", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "k", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -> ", - "unicode": false, - "value": " -> ", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " -> ", + "unicode": false, + "value": " -> ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": false, - "kind": "variable", - "name": "v", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "v", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -", - "unicode": false, - "value": " + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " ", + "unicode": false, + "value": "", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -170,12 +207,17 @@ Program { "shortForm": false, }, "key": List { - "arguments": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "bar", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, }, ], "kind": "list", @@ -184,20 +226,18 @@ Program { "kind": "foreach", "shortForm": false, "source": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", }, "value": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", }, }, ], - "errors": Array [ + "errors": [ Error { "expected": undefined, "kind": "error", @@ -212,16 +252,16 @@ Program { exports[`Test loops statements (for, while) test do 1`] = ` Program { - "children": Array [ + "children": [ Do { "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"something\\"", + "raw": ""something"", "unicode": false, "value": "something", }, @@ -240,19 +280,18 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test loops statements (for, while) test for 1`] = ` Program { - "children": Array [ + "children": [ For { "body": Echo { - "arguments": Array [ + "expressions": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "i", @@ -261,23 +300,21 @@ Program { "kind": "echo", "shortForm": false, }, - "increment": Array [ + "increment": [ Post { "kind": "post", "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "i", }, }, ], - "init": Array [ + "init": [ Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "i", @@ -291,7 +328,6 @@ Program { Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -305,11 +341,10 @@ Program { ], "kind": "for", "shortForm": false, - "test": Array [ + "test": [ Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "i", @@ -321,7 +356,6 @@ Program { "type": "<", }, Variable { - "byref": false, "curly": false, "kind": "variable", "name": "ok", @@ -330,11 +364,10 @@ Program { }, For { "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Variable { - "byref": false, "curly": false, "kind": "variable", "name": "ok", @@ -361,57 +394,74 @@ Program { ], "kind": "block", }, - "increment": Array [], - "init": Array [], + "increment": [], + "init": [], "kind": "for", "shortForm": true, - "test": Array [], + "test": [], }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test loops statements (for, while) test foreach 1`] = ` Program { - "children": Array [ + "children": [ Foreach { "body": Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"$k -> $v -\\"", + "raw": ""$k -> $v +"", "type": "string", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": false, - "kind": "variable", - "name": "k", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "k", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -> ", - "unicode": false, - "value": " -> ", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " -> ", + "unicode": false, + "value": " -> ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": false, - "kind": "variable", - "name": "v", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "v", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -", - "unicode": false, - "value": " + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " ", + "unicode": false, + "value": "", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -429,7 +479,6 @@ Program { "name": "foo", }, "value": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "v", @@ -437,42 +486,59 @@ Program { }, Foreach { "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"$a -> $b -\\"", + "raw": ""$a -> $b +"", "type": "string", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": false, - "kind": "variable", - "name": "a", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -> ", - "unicode": false, - "value": " -> ", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " -> ", + "unicode": false, + "value": " -> ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": false, - "kind": "variable", - "name": "b", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -", - "unicode": false, - "value": " + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " ", + "unicode": false, + "value": "", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -484,7 +550,6 @@ Program { "kind": "block", }, "key": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -492,52 +557,98 @@ Program { "kind": "foreach", "shortForm": true, "source": Array { - "items": Array [ - Array { - "items": Array [ - Number { - "kind": "number", - "value": "1", - }, - Number { - "kind": "number", - "value": "2", - }, - ], - "kind": "array", - "shortForm": true, + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "1", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "2", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, }, - Array { - "items": Array [ - Number { - "kind": "number", - "value": "3", - }, - Number { - "kind": "number", - "value": "4", - }, - ], - "kind": "array", - "shortForm": true, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "4", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, }, ], "kind": "array", "shortForm": true, }, "value": List { - "arguments": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "c", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "c", + }, }, - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "d", + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "d", + }, }, ], "kind": "list", @@ -545,23 +656,23 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test loops statements (for, while) test while test default form 1`] = ` Program { - "children": Array [ + "children": [ While { "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"go\\"", + "raw": ""go"", "unicode": false, "value": "go", }, @@ -581,23 +692,23 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test loops statements (for, while) test while test short form 1`] = ` Program { - "children": Array [ + "children": [ While { "body": Block { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"short\\"", + "raw": ""short"", "unicode": false, "value": "short", }, @@ -617,7 +728,7 @@ Program { }, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/magic.test.js.snap b/test/snapshot/__snapshots__/magic.test.js.snap new file mode 100644 index 000000000..696ee8e30 --- /dev/null +++ b/test/snapshot/__snapshots__/magic.test.js.snap @@ -0,0 +1,154 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`magic __CLASS__ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "raw": "__CLASS__", + "value": "__CLASS__", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`magic __DIR__ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "raw": "__DIR__", + "value": "__DIR__", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`magic __FILE__ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "raw": "__FILE__", + "value": "__FILE__", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`magic __FUNCTION__ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "raw": "__FUNCTION__", + "value": "__FUNCTION__", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`magic __LINE__ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "raw": "__LINE__", + "value": "__LINE__", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`magic __LINE__ lowercase 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "raw": "__line__", + "value": "__LINE__", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`magic __METHOD__ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "raw": "__METHOD__", + "value": "__METHOD__", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`magic __NAMESPACE__ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "raw": "__NAMESPACE__", + "value": "__NAMESPACE__", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`magic __TRAIT__ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Magic { + "kind": "magic", + "raw": "__TRAIT__", + "value": "__TRAIT__", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/match.test.js.snap b/test/snapshot/__snapshots__/match.test.js.snap new file mode 100644 index 000000000..42ef068a5 --- /dev/null +++ b/test/snapshot/__snapshots__/match.test.js.snap @@ -0,0 +1,455 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`match can be nested 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "v", + }, + "operator": "=", + "right": Match { + "arms": [ + MatchArm { + "body": Match { + "arms": [ + MatchArm { + "body": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'Connect'", + "unicode": false, + "value": "Connect", + }, + "conds": [ + Number { + "kind": "number", + "value": "1", + }, + ], + "kind": "matcharm", + }, + MatchArm { + "body": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'Auth'", + "unicode": false, + "value": "Auth", + }, + "conds": [ + Number { + "kind": "number", + "value": "2", + }, + ], + "kind": "matcharm", + }, + ], + "cond": Variable { + "curly": false, + "kind": "variable", + "name": "err", + }, + "kind": "match", + }, + "conds": [ + NullKeyword { + "kind": "nullkeyword", + "raw": "null", + }, + ], + "kind": "matcharm", + }, + MatchArm { + "body": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'Ok'", + "unicode": false, + "value": "Ok", + }, + "conds": [ + Match { + "arms": [ + MatchArm { + "body": Number { + "kind": "number", + "value": "0", + }, + "conds": [ + Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + ], + "kind": "matcharm", + }, + MatchArm { + "body": Unary { + "kind": "unary", + "type": "-", + "what": Number { + "kind": "number", + "value": "1", + }, + }, + "conds": [ + Boolean { + "kind": "boolean", + "raw": "false", + "value": false, + }, + ], + "kind": "matcharm", + }, + ], + "cond": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "kind": "match", + }, + ], + "kind": "matcharm", + }, + ], + "cond": Call { + "arguments": [ + Number { + "kind": "number", + "value": "1", + }, + Number { + "kind": "number", + "value": "2", + }, + Number { + "kind": "number", + "value": "3", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "callMe", + "resolution": "uqn", + }, + }, + "kind": "match", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`match can be parsed 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Match { + "arms": [ + MatchArm { + "body": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'yes'", + "unicode": false, + "value": "yes", + }, + "conds": [ + Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + ], + "kind": "matcharm", + }, + MatchArm { + "body": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'no'", + "unicode": false, + "value": "no", + }, + "conds": [ + Boolean { + "kind": "boolean", + "raw": "false", + "value": false, + }, + ], + "kind": "matcharm", + }, + MatchArm { + "body": NullKeyword { + "kind": "nullkeyword", + "raw": "null", + }, + "conds": null, + "kind": "matcharm", + }, + ], + "cond": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "kind": "match", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`match can have hanging comma 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Match { + "arms": [ + MatchArm { + "body": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'ok'", + "unicode": false, + "value": "ok", + }, + "conds": [ + Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + ], + "kind": "matcharm", + }, + MatchArm { + "body": Throw { + "kind": "throw", + "what": New { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'Nope'", + "unicode": false, + "value": "Nope", + }, + ], + "kind": "new", + "what": Name { + "kind": "name", + "name": "Exception", + "resolution": "uqn", + }, + }, + }, + "conds": [ + Boolean { + "kind": "boolean", + "raw": "false", + "value": false, + }, + ], + "kind": "matcharm", + }, + ], + "cond": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "kind": "match", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`match can have lhs, functions 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Match { + "arms": [ + MatchArm { + "body": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'yes'", + "unicode": false, + "value": "yes", + }, + "conds": [ + Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "test", + "resolution": "uqn", + }, + }, + Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "abc", + "resolution": "uqn", + }, + }, + ], + "kind": "matcharm", + }, + MatchArm { + "body": NullKeyword { + "kind": "nullkeyword", + "raw": "null", + }, + "conds": null, + "kind": "matcharm", + }, + ], + "cond": Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + "kind": "match", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`match can have multiple values 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "operator": "=", + "right": Match { + "arms": [ + MatchArm { + "body": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "run", + "resolution": "uqn", + }, + }, + "conds": [ + Number { + "kind": "number", + "value": "0", + }, + Number { + "kind": "number", + "value": "1", + }, + Number { + "kind": "number", + "value": "2", + }, + Number { + "kind": "number", + "value": "3", + }, + ], + "kind": "matcharm", + }, + MatchArm { + "body": NullKeyword { + "kind": "nullkeyword", + "raw": "null", + }, + "conds": null, + "kind": "matcharm", + }, + ], + "cond": Name { + "kind": "name", + "name": "trye", + "resolution": "uqn", + }, + "kind": "match", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/namespace.test.js.snap b/test/snapshot/__snapshots__/namespace.test.js.snap index 2dd2a4bd6..c59e4055c 100644 --- a/test/snapshot/__snapshots__/namespace.test.js.snap +++ b/test/snapshot/__snapshots__/namespace.test.js.snap @@ -2,9 +2,9 @@ exports[`Test namespace statements allow trailing comma for grouped namespaces #177 1`] = ` Program { - "children": Array [ + "children": [ UseGroup { - "items": Array [ + "items": [ UseItem { "alias": null, "kind": "useitem", @@ -25,25 +25,24 @@ Program { }, ], "kind": "usegroup", - "name": "Foo\\\\Bar", + "name": "Foo\\Bar", "type": null, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test namespace statements check silent mode 1`] = ` Program { - "children": Array [ + "children": [ Namespace { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", @@ -59,15 +58,15 @@ Program { }, ], "kind": "namespace", - "name": Identifier { - "kind": "identifier", + "name": Name { + "kind": "name", "name": "", - "resolution": "qn", + "resolution": "fqn", }, "withBrackets": false, }, ], - "errors": Array [ + "errors": [ Error { "expected": 105, "kind": "error", @@ -76,7 +75,7 @@ Program { "token": "'$var' (T_VARIABLE)", }, Error { - "expected": Array [ + "expected": [ "{", ";", ], @@ -90,13 +89,43 @@ Program { } `; +exports[`Test namespace statements fix #246 - doesn't work properly for \`FULL_QUALIFIED_NAME\` 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + "operator": "=", + "right": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "\\Foo", + "resolution": "fqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + exports[`Test namespace statements read usegroup location correctly with docs 1`] = ` Program { - "children": Array [ + "children": [ Namespace { - "children": Array [ + "children": [ UseGroup { - "items": Array [ + "items": [ UseItem { "alias": null, "kind": "useitem", @@ -113,7 +142,7 @@ Program { "offset": 44, }, }, - "name": "Some\\\\other\\\\test", + "name": "Some\\other\\test", "type": null, }, ], @@ -135,12 +164,11 @@ Program { "type": null, }, Class { - "body": Array [ - Property { - "isAbstract": false, - "isFinal": false, + "attrGroups": [], + "body": [ + PropertyStatement { "isStatic": false, - "kind": "property", + "kind": "propertystatement", "loc": Location { "end": Position { "column": 20, @@ -154,14 +182,53 @@ Program { "offset": 184, }, }, - "name": "test", - "value": null, + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "loc": Location { + "end": Position { + "column": 20, + "line": 10, + "offset": 189, + }, + "source": null, + "start": Position { + "column": 15, + "line": 10, + "offset": 184, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 20, + "line": 10, + "offset": 189, + }, + "source": null, + "start": Position { + "column": 15, + "line": 10, + "offset": 184, + }, + }, + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], "visibility": "public", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Return { "expr": Boolean { "kind": "boolean", @@ -215,6 +282,7 @@ Program { "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "loc": Location { @@ -246,21 +314,20 @@ Program { }, }, "name": "test", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -327,7 +394,6 @@ Program { }, Return { "expr": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -379,6 +445,7 @@ Program { "byref": true, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "loc": Location { @@ -389,9 +456,9 @@ Program { }, "source": null, "start": Position { - "column": 15, + "column": 8, "line": 16, - "offset": 267, + "offset": 260, }, }, "name": Identifier { @@ -410,15 +477,14 @@ Program { }, }, "name": "passByReferenceTest", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "public", }, ], - "extends": Identifier { - "kind": "identifier", + "extends": Name { + "kind": "name", "loc": Location { "end": Position { "column": 27, @@ -435,9 +501,9 @@ Program { "name": "Bar", "resolution": "uqn", }, - "implements": Array [ - Identifier { - "kind": "identifier", + "implements": [ + Name { + "kind": "name", "loc": Location { "end": Position { "column": 42, @@ -454,8 +520,8 @@ Program { "name": "Baz", "resolution": "uqn", }, - Identifier { - "kind": "identifier", + Name { + "kind": "name", "loc": Location { "end": Position { "column": 48, @@ -476,8 +542,9 @@ Program { "isAbstract": false, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", - "leadingComments": Array [ + "leadingComments": [ CommentBlock { "kind": "commentblock", "loc": Location { @@ -493,8 +560,9 @@ Program { "offset": 68, }, }, + "offset": 68, "value": "/** - * @property \\\\Test\\\\test $test + * @property \\Test\\test $test */", }, ], @@ -511,7 +579,23 @@ Program { "offset": 124, }, }, - "name": "Foo", + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 15, + "line": 9, + "offset": 133, + }, + "source": null, + "start": Position { + "column": 12, + "line": 9, + "offset": 130, + }, + }, + "name": "Foo", + }, }, ], "kind": "namespace", @@ -528,11 +612,11 @@ Program { "offset": 7, }, }, - "name": "Test\\\\test\\\\test", + "name": "Test\\test\\test", "withBrackets": false, }, ], - "comments": Array [ + "comments": [ CommentBlock { "kind": "commentblock", "loc": Location { @@ -548,12 +632,13 @@ Program { "offset": 68, }, }, + "offset": 68, "value": "/** - * @property \\\\Test\\\\test $test + * @property \\Test\\test $test */", }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { @@ -573,11 +658,11 @@ Program { exports[`Test namespace statements read usegroup location correctly without docs 1`] = ` Program { - "children": Array [ + "children": [ Namespace { - "children": Array [ + "children": [ UseGroup { - "items": Array [ + "items": [ UseItem { "alias": null, "kind": "useitem", @@ -594,7 +679,7 @@ Program { "offset": 44, }, }, - "name": "Some\\\\other\\\\test", + "name": "Some\\other\\test", "type": null, }, ], @@ -616,12 +701,11 @@ Program { "type": null, }, Class { - "body": Array [ - Property { - "isAbstract": false, - "isFinal": false, + "attrGroups": [], + "body": [ + PropertyStatement { "isStatic": false, - "kind": "property", + "kind": "propertystatement", "loc": Location { "end": Position { "column": 20, @@ -635,14 +719,53 @@ Program { "offset": 184, }, }, - "name": "test", - "value": null, + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "loc": Location { + "end": Position { + "column": 20, + "line": 10, + "offset": 189, + }, + "source": null, + "start": Position { + "column": 15, + "line": 10, + "offset": 184, + }, + }, + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 20, + "line": 10, + "offset": 189, + }, + "source": null, + "start": Position { + "column": 15, + "line": 10, + "offset": 184, + }, + }, + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], "visibility": "public", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ Return { "expr": Boolean { "kind": "boolean", @@ -696,6 +819,7 @@ Program { "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "loc": Location { @@ -727,21 +851,20 @@ Program { }, }, "name": "test", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "", }, Method { - "arguments": Array [], + "arguments": [], + "attrGroups": [], "body": Block { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -808,7 +931,6 @@ Program { }, Return { "expr": Variable { - "byref": false, "curly": false, "kind": "variable", "loc": Location { @@ -860,6 +982,7 @@ Program { "byref": true, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "loc": Location { @@ -870,9 +993,9 @@ Program { }, "source": null, "start": Position { - "column": 15, + "column": 8, "line": 16, - "offset": 267, + "offset": 260, }, }, "name": Identifier { @@ -891,15 +1014,14 @@ Program { }, }, "name": "passByReferenceTest", - "resolution": "rn", }, "nullable": false, "type": null, "visibility": "public", }, ], - "extends": Identifier { - "kind": "identifier", + "extends": Name { + "kind": "name", "loc": Location { "end": Position { "column": 27, @@ -916,9 +1038,9 @@ Program { "name": "Bar", "resolution": "uqn", }, - "implements": Array [ - Identifier { - "kind": "identifier", + "implements": [ + Name { + "kind": "name", "loc": Location { "end": Position { "column": 42, @@ -935,8 +1057,8 @@ Program { "name": "Baz", "resolution": "uqn", }, - Identifier { - "kind": "identifier", + Name { + "kind": "name", "loc": Location { "end": Position { "column": 48, @@ -957,6 +1079,7 @@ Program { "isAbstract": false, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", "loc": Location { "end": Position { @@ -971,7 +1094,23 @@ Program { "offset": 124, }, }, - "name": "Foo", + "name": Identifier { + "kind": "identifier", + "loc": Location { + "end": Position { + "column": 15, + "line": 9, + "offset": 133, + }, + "source": null, + "start": Position { + "column": 12, + "line": 9, + "offset": 130, + }, + }, + "name": "Foo", + }, }, ], "kind": "namespace", @@ -988,11 +1127,11 @@ Program { "offset": 7, }, }, - "name": "Test\\\\test\\\\test", + "name": "Test\\test\\test", "withBrackets": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", "loc": Location { "end": Position { @@ -1010,17 +1149,112 @@ Program { } `; +exports[`Test namespace statements test bare namespace separator 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Error { + "expected": "SCALAR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '\\' (T_NS_SEPARATOR) on line 1", + "token": "'\\' (T_NS_SEPARATOR)", + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": "SCALAR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '\\' (T_NS_SEPARATOR) on line 1", + "token": "'\\' (T_NS_SEPARATOR)", + }, + ], + "kind": "program", +} +`; + +exports[`Test namespace statements test keywords 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "enum", + "resolution": "rn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "\\foo\\trait\\class", + "resolution": "fqn", + }, + }, + "kind": "expressionstatement", + }, + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "a", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "b", + "type": null, + }, + ], + "kind": "usegroup", + "name": "\\foo\\bar", + "type": null, + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Name { + "kind": "name", + "name": "bar", + "resolution": "rn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + exports[`Test namespace statements test multiple namespace 1`] = ` Program { - "children": Array [ + "children": [ Namespace { - "children": Array [ + "children": [ ExpressionStatement { "expression": Post { "kind": "post", "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "i", @@ -1030,17 +1264,16 @@ Program { }, ], "kind": "namespace", - "name": "\\\\foo", + "name": "\\foo", "withBrackets": true, }, Namespace { - "children": Array [ + "children": [ ExpressionStatement { "expression": Post { "kind": "post", "type": "+", "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -1050,27 +1283,26 @@ Program { }, ], "kind": "namespace", - "name": Array [ + "name": [ "", ], "withBrackets": true, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test namespace statements test namespace error 1`] = ` Program { - "children": Array [ + "children": [ Namespace { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", @@ -1086,15 +1318,15 @@ Program { }, ], "kind": "namespace", - "name": Identifier { - "kind": "identifier", + "name": Name { + "kind": "name", "name": "", - "resolution": "qn", + "resolution": "fqn", }, "withBrackets": false, }, ], - "errors": Array [ + "errors": [ Error { "expected": 105, "kind": "error", @@ -1103,7 +1335,7 @@ Program { "token": "'$var' (T_VARIABLE)", }, Error { - "expected": Array [ + "expected": [ "{", ";", ], @@ -1119,54 +1351,56 @@ Program { exports[`Test namespace statements test namespace keyword 1`] = ` Program { - "children": Array [ - Call { - "arguments": Array [], - "kind": "call", - "what": Identifier { - "kind": "identifier", - "name": "foo", - "resolution": "rn", + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "rn", + }, }, + "kind": "expressionstatement", }, ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "var", }, "operator": "=", - "right": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "bar", - "resolution": "rn", - }, + "right": Name { + "kind": "name", + "name": "bar", + "resolution": "rn", }, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test namespace statements test single namespace 1`] = ` Program { - "children": Array [ + "children": [ Namespace { - "children": Array [ + "children": [ UseGroup { - "items": Array [ + "items": [ UseItem { - "alias": "barBaz", + "alias": Identifier { + "kind": "identifier", + "name": "barBaz", + }, "kind": "useitem", - "name": "bar\\\\baz", + "name": "bar\\baz", "type": null, }, ], @@ -1175,17 +1409,23 @@ Program { "type": null, }, UseGroup { - "items": Array [ + "items": [ UseItem { - "alias": "barBaz", + "alias": Identifier { + "kind": "identifier", + "name": "barBaz", + }, "kind": "useitem", - "name": "bar\\\\baz", + "name": "bar\\baz", "type": null, }, UseItem { - "alias": "bazBoo", + "alias": Identifier { + "kind": "identifier", + "name": "bazBoo", + }, "kind": "useitem", - "name": "baz\\\\boo", + "name": "baz\\boo", "type": null, }, ], @@ -1194,17 +1434,23 @@ Program { "type": "const", }, UseGroup { - "items": Array [ + "items": [ UseItem { - "alias": "barBaz", + "alias": Identifier { + "kind": "identifier", + "name": "barBaz", + }, "kind": "useitem", - "name": "bar\\\\baz", + "name": "bar\\baz", "type": null, }, UseItem { - "alias": "bazBoo", + "alias": Identifier { + "kind": "identifier", + "name": "bazBoo", + }, "kind": "useitem", - "name": "baz\\\\boo", + "name": "baz\\boo", "type": null, }, ], @@ -1213,34 +1459,46 @@ Program { "type": "function", }, UseGroup { - "items": Array [ + "items": [ UseItem { - "alias": "BAZ_FOO", + "alias": Identifier { + "kind": "identifier", + "name": "BAZ_FOO", + }, "kind": "useitem", "name": "FOO", "type": "const", }, UseItem { - "alias": "BAZ_BOO", + "alias": Identifier { + "kind": "identifier", + "name": "BAZ_BOO", + }, "kind": "useitem", "name": "BOO", "type": "function", }, ], "kind": "usegroup", - "name": "bar\\\\baz", + "name": "bar\\baz", "type": null, }, UseGroup { - "items": Array [ + "items": [ UseItem { - "alias": "AZERTY_A", + "alias": Identifier { + "kind": "identifier", + "name": "AZERTY_A", + }, "kind": "useitem", "name": "A", "type": null, }, UseItem { - "alias": "AZERTY_B", + "alias": Identifier { + "kind": "identifier", + "name": "AZERTY_B", + }, "kind": "useitem", "name": "B", "type": null, @@ -1254,19 +1512,15 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", }, "operator": "=", - "right": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "barBaz", - "resolution": "rn", - }, + "right": Name { + "kind": "name", + "name": "barBaz", + "resolution": "rn", }, }, "kind": "expressionstatement", @@ -1275,19 +1529,15 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", }, "operator": "=", - "right": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "\\\\barBaz", - "resolution": "qn", - }, + "right": Name { + "kind": "name", + "name": "\\barBaz", + "resolution": "fqn", }, }, "kind": "expressionstatement", @@ -1296,19 +1546,15 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "c", }, "operator": "=", - "right": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "barBaz\\\\foo", - "resolution": "qn", - }, + "right": Name { + "kind": "name", + "name": "barBaz\\foo", + "resolution": "qn", }, }, "kind": "expressionstatement", @@ -1317,19 +1563,15 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "d", }, "operator": "=", - "right": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "barBaz", - "resolution": "uqn", - }, + "right": Name { + "kind": "name", + "name": "barBaz", + "resolution": "uqn", }, }, "kind": "expressionstatement", @@ -1340,36 +1582,48 @@ Program { "withBrackets": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test namespace statements work with declare statement 1`] = ` Program { - "children": Array [ + "children": [ Declare { - "children": Array [], + "children": [], + "directives": [ + DeclareDirective { + "key": Identifier { + "kind": "identifier", + "name": "strict_types", + }, + "kind": "declaredirective", + "value": Number { + "kind": "number", + "value": "1", + }, + }, + ], "kind": "declare", "mode": "none", - "what": Object { - "strict_types": Number { - "kind": "number", - "value": "1", - }, - }, }, Namespace { - "children": Array [ + "children": [ Class { - "body": Array [], + "attrGroups": [], + "body": [], "extends": null, "implements": null, "isAbstract": false, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", - "name": "bar", + "name": Identifier { + "kind": "identifier", + "name": "bar", + }, }, ], "kind": "namespace", @@ -1377,7 +1631,7 @@ Program { "withBrackets": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/new.test.js.snap b/test/snapshot/__snapshots__/new.test.js.snap new file mode 100644 index 000000000..58d7c35f8 --- /dev/null +++ b/test/snapshot/__snapshots__/new.test.js.snap @@ -0,0 +1,715 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`new #348 - byref usage deprecated 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": AssignRef { + "kind": "assignref", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "right": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": undefined, + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'new' (T_NEW) on line 1", + "token": "'new' (T_NEW)", + }, + ], + "kind": "program", +} +`; + +exports[`new anonymous 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": true, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": null, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new anonymous class #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": New { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + "kind": "new", + "what": Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": true, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": null, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new anonymous class #3 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": New { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + "kind": "new", + "what": Class { + "attrGroups": [], + "body": [], + "extends": Name { + "kind": "name", + "name": "SomeClass", + "resolution": "uqn", + }, + "implements": [ + Name { + "kind": "name", + "name": "SomeInterface", + "resolution": "uqn", + }, + ], + "isAbstract": false, + "isAnonymous": true, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": null, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new anonymous class 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": New { + "arguments": [], + "kind": "new", + "what": Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": true, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": null, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new anonymous no parens 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": true, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": null, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new anonymous with argument 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + "kind": "new", + "what": Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": true, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": null, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new anonymous with multiple argument 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "one", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "two", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "three", + }, + ], + "kind": "new", + "what": Class { + "attrGroups": [], + "body": [], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": true, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": null, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new no parens 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new parent 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new result from function 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": New { + "arguments": [], + "kind": "new", + "what": Call { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'d'", + "unicode": false, + "value": "d", + }, + ], + "kind": "call", + "what": Call { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'c'", + "unicode": false, + "value": "c", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "b", + "resolution": "uqn", + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new result from function with arguments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": New { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'e'", + "unicode": false, + "value": "e", + }, + ], + "kind": "new", + "what": Call { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'d'", + "unicode": false, + "value": "d", + }, + ], + "kind": "call", + "what": Call { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'c'", + "unicode": false, + "value": "c", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "b", + "resolution": "uqn", + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new self 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new simple (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "\\Foo", + "resolution": "fqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new simple (3) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "Foo\\Foo", + "resolution": "qn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new simple (4) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "\\Foo\\Foo", + "resolution": "fqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new static 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": StaticReference { + "kind": "staticreference", + "raw": "static", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new static array 1`] = ` +Program { + "children": [ + Return { + "expr": New { + "arguments": [], + "kind": "new", + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "map", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "mapping", + }, + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, + }, + }, + }, + "kind": "return", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new trailing comma 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""constructor"", + "unicode": false, + "value": "constructor", + }, + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""bar"", + "unicode": false, + "value": "bar", + }, + ], + "kind": "new", + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [], + "kind": "new", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`new with arguments 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": New { + "arguments": [ + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""constructor"", + "unicode": false, + "value": "constructor", + }, + String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""bar"", + "unicode": false, + "value": "bar", + }, + ], + "kind": "new", + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/nowdoc.test.js.snap b/test/snapshot/__snapshots__/nowdoc.test.js.snap new file mode 100644 index 000000000..73ee4fa13 --- /dev/null +++ b/test/snapshot/__snapshots__/nowdoc.test.js.snap @@ -0,0 +1,473 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`nowdoc Flexible nowdoc syntax: 4 spaces of indentation 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Nowdoc { + "kind": "nowdoc", + "label": "END", + "raw": "<<<'END' + a + b + c + END", + "value": " a + b +c", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc Flexible nowdoc syntax: with variables 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Nowdoc { + "kind": "nowdoc", + "label": "END", + "raw": "<<<'END' + a + {$foo->bar[1]} + b + c + END", + "value": " a + {$foo->bar[1]} + b +c", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc Followed by string interpolation 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "x", + }, + "operator": "=", + "right": Nowdoc { + "kind": "nowdoc", + "label": "NOWDOC", + "raw": "<<<'NOWDOC' + ... + NOWDOC", + "value": "...", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "y", + }, + "operator": "=", + "right": Encapsed { + "kind": "encapsed", + "raw": ""_$z"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "_", + "unicode": false, + "value": "_", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "z", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc empty 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Nowdoc { + "kind": "nowdoc", + "label": "TEST", + "raw": "<<<'TEST' +TEST", + "value": "", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc inside call 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [ + Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Nowdoc { + "kind": "nowdoc", + "label": "EOD", + "raw": "<<<'EOD' +foobar! +EOD +", + "value": "foobar!", + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "var_dump", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc inside class 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + ClassConstant { + "attrGroups": [], + "constants": [ + Constant { + "kind": "constant", + "name": Identifier { + "kind": "identifier", + "name": "BAR", + }, + "value": Nowdoc { + "kind": "nowdoc", + "label": "FOOBAR", + "raw": "<<<'FOOBAR' +Constant example +FOOBAR", + "value": "Constant example", + }, + }, + ], + "final": false, + "kind": "classconstant", + "nullable": false, + "type": null, + "visibility": "", + }, + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "baz", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Nowdoc { + "kind": "nowdoc", + "label": "FOOBAR", + "raw": "<<<'FOOBAR' +Property example +FOOBAR", + "value": "Property example", + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc inside function 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + Static { + "kind": "static", + "variables": [ + StaticVariable { + "defaultValue": Nowdoc { + "kind": "nowdoc", + "label": "LABEL", + "raw": "<<<'LABEL' +Nothing in here... +LABEL", + "value": "Nothing in here...", + }, + "kind": "staticvariable", + "variable": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + ], + }, + ], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc only newline 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Nowdoc { + "kind": "nowdoc", + "label": "TEST", + "raw": "<<<'TEST' + +TEST", + "value": "", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc simple 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Nowdoc { + "kind": "nowdoc", + "label": "EOD", + "raw": "<<<'EOD' +Example of string +spanning multiple lines +using heredoc syntax. +EOD", + "value": "Example of string +spanning multiple lines +using heredoc syntax.", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc space between <<< and label 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Nowdoc { + "kind": "nowdoc", + "label": "TEST", + "raw": "<<< 'TEST' + a + b +c +TEST", + "value": " a + b +c", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc tab between <<< and label 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Nowdoc { + "kind": "nowdoc", + "label": "TEST", + "raw": "<<< 'TEST' + a + b +c +TEST", + "value": " a + b +c", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc with space between <<< and label 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Nowdoc { + "kind": "nowdoc", + "label": "EOD", + "raw": "<<< 'EOD' +Example of string +spanning multiple lines +using heredoc syntax. +EOD", + "value": "Example of string +spanning multiple lines +using heredoc syntax.", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nowdoc with variables 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Nowdoc { + "kind": "nowdoc", + "label": "EOT", + "raw": "<<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should print a capital 'A': A +EOT", + "value": "My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should print a capital 'A': A", + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/nullsavepropertylookup.test.js.snap b/test/snapshot/__snapshots__/nullsavepropertylookup.test.js.snap new file mode 100644 index 000000000..76bb3a145 --- /dev/null +++ b/test/snapshot/__snapshots__/nullsavepropertylookup.test.js.snap @@ -0,0 +1,109 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`nullsavepropertylookup call 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nullsavepropertylookup multiple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property_2", + }, + "what": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property_1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nullsavepropertylookup simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`nullsavepropertylookup variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": NullSafePropertyLookup { + "kind": "nullsafepropertylookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/number.test.js.snap b/test/snapshot/__snapshots__/number.test.js.snap index 6679da870..608a99aad 100644 --- a/test/snapshot/__snapshots__/number.test.js.snap +++ b/test/snapshot/__snapshots__/number.test.js.snap @@ -1,13 +1,150 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Test numbers test common cases 1`] = ` +exports[`Test numbers binary with 2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "0", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'b2' (T_STRING), expecting ';' on line 1", + "token": "'b2' (T_STRING)", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error on line 1", + "token": "the end of file (EOF)", + }, + ], + "kind": "program", +} +`; + +exports[`Test numbers exponent empty 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "e", + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "7", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'EX' (T_STRING), expecting ';' on line 1", + "token": "'EX' (T_STRING)", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error on line 1", + "token": "the end of file (EOF)", + }, + ], + "kind": "program", +} +`; + +exports[`Test numbers exponent with letter 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "d", + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "7", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Name { + "kind": "name", + "name": "E", + "resolution": "uqn", + }, + "right": Name { + "kind": "name", + "name": "a", + "resolution": "uqn", + }, + "type": "-", + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'E' (T_STRING), expecting ';' on line 1", + "token": "'E' (T_STRING)", + }, + ], + "kind": "program", +} +`; + +exports[`Test numbers hexa without hex 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -15,7 +152,102 @@ Program { "operator": "=", "right": Number { "kind": "number", - "value": "-1.5", + "value": "0", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'xx' (T_STRING), expecting ';' on line 1", + "token": "'xx' (T_STRING)", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error on line 1", + "token": "the end of file (EOF)", + }, + ], + "kind": "program", +} +`; + +exports[`Test numbers multiple points 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "1.0", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Number { + "kind": "number", + "value": ".5", + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '.5' (T_DNUMBER), expecting ';' on line 1", + "token": "'.5' (T_DNUMBER)", + }, + ], + "kind": "program", +} +`; + +exports[`Test numbers test common cases 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Number { + "kind": "number", + "value": "1234", + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": Unary { + "kind": "unary", + "type": "-", + "what": Number { + "kind": "number", + "value": "1.5", + }, }, }, "kind": "expressionstatement", @@ -24,7 +256,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", @@ -41,7 +272,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "c", @@ -58,7 +288,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "c", @@ -75,7 +304,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "d", @@ -92,7 +320,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "d", @@ -109,7 +336,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "e", @@ -126,7 +352,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "f", @@ -143,7 +368,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "g", @@ -160,7 +384,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "h", @@ -174,89 +397,164 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Test numbers test edge cases 1`] = ` +exports[`Test numbers underscore #1 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "a", + "name": "e", }, "operator": "=", "right": Number { "kind": "number", - "value": "0", + "value": "7", }, }, "kind": "expressionstatement", }, - ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "xx", - "resolution": "uqn", - }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '__0' (T_STRING), expecting ';' on line 1", + "token": "'__0' (T_STRING)", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error on line 1", + "token": "the end of file (EOF)", }, + ], + "kind": "program", +} +`; + +exports[`Test numbers underscore #2 1`] = ` +Program { + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "b", + "name": "e", }, "operator": "=", "right": Number { "kind": "number", - "value": "0", + "value": "7.", }, }, "kind": "expressionstatement", }, - ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "b2", - "resolution": "uqn", - }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '_0' (T_STRING), expecting ';' on line 1", + "token": "'_0' (T_STRING)", }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error on line 1", + "token": "the end of file (EOF)", + }, + ], + "kind": "program", +} +`; + +exports[`Test numbers underscore #3 1`] = ` +Program { + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "c", + "name": "e", }, "operator": "=", "right": Number { "kind": "number", - "value": "01239", + "value": "7", }, }, "kind": "expressionstatement", }, + ExpressionStatement { + "expression": Name { + "kind": "name", + "name": "_", + "resolution": "uqn", + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Number { + "kind": "number", + "value": ".0", + }, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '_' (T_STRING), expecting ';' on line 1", + "token": "'_' (T_STRING)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '.0' (T_DNUMBER), expecting ';' on line 1", + "token": "'.0' (T_DNUMBER)", + }, + ], + "kind": "program", +} +`; + +exports[`Test numbers underscore #4 1`] = ` +Program { + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "d", + "name": "e", }, "operator": "=", "right": Number { @@ -266,31 +564,38 @@ Program { }, "kind": "expressionstatement", }, - Bin { - "kind": "bin", - "left": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "E", - "resolution": "uqn", - }, - }, - "right": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "a", - "resolution": "uqn", - }, - }, - "type": "-", + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", }, + ], + "errors": [ + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'e_0' (T_STRING), expecting ';' on line 1", + "token": "'e_0' (T_STRING)", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error on line 1", + "token": "the end of file (EOF)", + }, + ], + "kind": "program", +} +`; + +exports[`Test numbers underscore #5 1`] = ` +Program { + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "e", @@ -298,48 +603,80 @@ Program { "operator": "=", "right": Number { "kind": "number", - "value": "7", + "value": "7_", }, }, "kind": "expressionstatement", }, - ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "EX", - "resolution": "uqn", - }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { "expected": ";", "kind": "error", - "line": 2, - "message": "Parse Error : syntax error, unexpected 'xx' (T_STRING), expecting ';' on line 2", - "token": "'xx' (T_STRING)", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'e0' (T_STRING), expecting ';' on line 1", + "token": "'e0' (T_STRING)", }, Error { - "expected": ";", + "expected": "EXPR", "kind": "error", - "line": 3, - "message": "Parse Error : syntax error, unexpected 'b2' (T_STRING), expecting ';' on line 3", - "token": "'b2' (T_STRING)", + "line": 1, + "message": "Parse Error : syntax error on line 1", + "token": "the end of file (EOF)", }, - Error { - "expected": ";", - "kind": "error", - "line": 5, - "message": "Parse Error : syntax error, unexpected 'E' (T_STRING), expecting ';' on line 5", - "token": "'E' (T_STRING)", + ], + "kind": "program", +} +`; + +exports[`Test numbers variant (for coverage) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "d", + }, + "operator": "=", + "right": Number { + "kind": "number", + "value": "7", + }, + }, + "kind": "expressionstatement", }, + ExpressionStatement { + "expression": Bin { + "kind": "bin", + "left": Name { + "kind": "name", + "name": "e", + "resolution": "uqn", + }, + "right": Name { + "kind": "name", + "name": "a", + "resolution": "uqn", + }, + "type": "+", + }, + "kind": "expressionstatement", + }, + ], + "errors": [ Error { "expected": ";", "kind": "error", - "line": 6, - "message": "Parse Error : syntax error, unexpected 'EX' (T_STRING), expecting ';' on line 6", - "token": "'EX' (T_STRING)", + "line": 1, + "message": "Parse Error : syntax error, unexpected 'e' (T_STRING), expecting ';' on line 1", + "token": "'e' (T_STRING)", }, ], "kind": "program", diff --git a/test/snapshot/__snapshots__/offsetlookup.test.js.snap b/test/snapshot/__snapshots__/offsetlookup.test.js.snap new file mode 100644 index 000000000..f2de7e5ed --- /dev/null +++ b/test/snapshot/__snapshots__/offsetlookup.test.js.snap @@ -0,0 +1,535 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`offsetlookup call (curly) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`offsetlookup call 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`offsetlookup inside propertylookup (curly) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'string'", + "unicode": false, + "value": "string", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "baz", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "baz", + }, + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": RetIf { + "falseExpr": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'two'", + "unicode": false, + "value": "two", + }, + "kind": "retif", + "test": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "trueExpr": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'one'", + "unicode": false, + "value": "one", + }, + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`offsetlookup inside propertylookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'string'", + "unicode": false, + "value": "string", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "baz", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "baz", + }, + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": RetIf { + "falseExpr": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'two'", + "unicode": false, + "value": "two", + }, + "kind": "retif", + "test": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "trueExpr": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'one'", + "unicode": false, + "value": "one", + }, + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bzr_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`offsetlookup multiple (curly) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""second"", + "unicode": false, + "value": "second", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""first"", + "unicode": false, + "value": "first", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`offsetlookup multiple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""second"", + "unicode": false, + "value": "second", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""first"", + "unicode": false, + "value": "first", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`offsetlookup simple (curly) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""index"", + "unicode": false, + "value": "index", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`offsetlookup simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""index"", + "unicode": false, + "value": "index", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`offsetlookup variable (curly) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`offsetlookup variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/parentreference.test.js.snap b/test/snapshot/__snapshots__/parentreference.test.js.snap new file mode 100644 index 000000000..ec202a126 --- /dev/null +++ b/test/snapshot/__snapshots__/parentreference.test.js.snap @@ -0,0 +1,278 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`parentreference argument (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": ParentReference { + "kind": "parentreference", + "raw": "PARENT", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`parentreference argument 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`parentreference call 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`parentreference constant 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "CONSTANT", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`parentreference return type declarations (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": ParentReference { + "kind": "parentreference", + "raw": "PARENT", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`parentreference return type declarations 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`parentreference uppercase 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "call", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "PARENT", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`parentreference variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/php5.test.js.snap b/test/snapshot/__snapshots__/php5.test.js.snap index a8806ea52..e8fcd25a5 100644 --- a/test/snapshot/__snapshots__/php5.test.js.snap +++ b/test/snapshot/__snapshots__/php5.test.js.snap @@ -2,31 +2,36 @@ exports[`Test syntax parsing without PHP7 support special keywords should fail 1`] = ` Program { - "children": Array [ + "children": [ Class { - "body": Array [ + "attrGroups": [], + "body": [ Method { - "arguments": Array [ + "arguments": [ Parameter { + "attrGroups": [], "byref": false, + "flags": 0, "kind": "parameter", "name": null, "nullable": false, + "readonly": false, "type": null, "value": null, "variadic": false, }, ], + "attrGroups": [], "body": null, "byref": false, "isAbstract": false, "isFinal": false, + "isReadonly": false, "isStatic": false, "kind": "method", "name": Identifier { "kind": "identifier", - "name": "false", - "resolution": "rn", + "name": false, }, "nullable": false, "type": null, @@ -38,15 +43,19 @@ Program { "isAbstract": false, "isAnonymous": false, "isFinal": false, + "isReadonly": false, "kind": "class", - "name": "foo", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, }, ExpressionStatement { "expression": undefined, "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { "expected": "IDENTIFIER", "kind": "error", @@ -69,7 +78,7 @@ Program { "token": "'list' (T_LIST)", }, Error { - "expected": Array [ + "expected": [ ",", ")", ], @@ -93,7 +102,7 @@ Program { "token": "'list' (T_LIST)", }, Error { - "expected": Array [ + "expected": [ 198, 222, 182, @@ -104,7 +113,7 @@ Program { "token": "'list' (T_LIST)", }, Error { - "expected": Array [ + "expected": [ 198, 222, 182, @@ -115,7 +124,7 @@ Program { "token": "'('", }, Error { - "expected": Array [ + "expected": [ 198, 222, 182, @@ -126,7 +135,7 @@ Program { "token": "')'", }, Error { - "expected": Array [ + "expected": [ 198, 222, 182, diff --git a/test/snapshot/__snapshots__/php73.test.js.snap b/test/snapshot/__snapshots__/php73.test.js.snap new file mode 100644 index 000000000..f90e6f427 --- /dev/null +++ b/test/snapshot/__snapshots__/php73.test.js.snap @@ -0,0 +1,571 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Test syntax parsing with PHP 73 support https://wiki.php.net/rfc/list_reference_assignment 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + }, + Entry { + "byRef": true, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + }, + ], + "kind": "list", + "shortForm": true, + }, + "operator": "=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": List { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + }, + Entry { + "byRef": true, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + }, + ], + "kind": "list", + "shortForm": false, + }, + "operator": "=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "array", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test syntax parsing with PHP 73 support https://wiki.php.net/rfc/trailing-comma-function-calls 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "newArray", + }, + "operator": "=", + "right": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "arrayOne", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "arrayTwo", + }, + Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "array_merge", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "operator": "=", + "right": New { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'constructor'", + "unicode": false, + "value": "constructor", + }, + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + ], + "kind": "new", + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'method'", + "unicode": false, + "value": "method", + }, + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + ], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'invoke'", + "unicode": false, + "value": "invoke", + }, + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + ], + "kind": "call", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + "kind": "expressionstatement", + }, + Unset { + "kind": "unset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + ], + }, + ExpressionStatement { + "expression": Call { + "arguments": [ + Isset { + "kind": "isset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + ], + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "var_dump", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test syntax parsing with PHP 73 support https://wiki.php.net/rfc/trailing-comma-function-calls#errors 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "a", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "b", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": null, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "bar", + }, + "nullable": false, + "type": null, + }, + ExpressionStatement { + "expression": Call { + "arguments": [ + undefined, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [ + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'function'", + "unicode": false, + "value": "function", + }, + String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + Noop { + "kind": "noop", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [ + undefined, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'function'", + "unicode": false, + "value": "function", + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'bar'", + "unicode": false, + "value": "bar", + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": 222, + "kind": "error", + "line": 3, + "message": "Parse Error : syntax error, unexpected ')', expecting T_VARIABLE on line 3", + "token": "')'", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 7, + "message": "Parse Error : syntax error, unexpected ',' on line 7", + "token": "','", + }, + Error { + "expected": ")", + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected ',', expecting ')' on line 10", + "token": "','", + }, + Error { + "expected": ";", + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected ',', expecting ';' on line 10", + "token": "','", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected ',' on line 10", + "token": "','", + }, + Error { + "expected": ";", + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected ')', expecting ';' on line 10", + "token": "')'", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected ')' on line 10", + "token": "')'", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 12, + "message": "Parse Error : syntax error, unexpected ',' on line 12", + "token": "','", + }, + Error { + "expected": ")", + "kind": "error", + "line": 12, + "message": "Parse Error : syntax error, unexpected ''function'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' on line 12", + "token": "''function'' (T_CONSTANT_ENCAPSED_STRING)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 12, + "message": "Parse Error : syntax error, unexpected ''function'' (T_CONSTANT_ENCAPSED_STRING), expecting ';' on line 12", + "token": "''function'' (T_CONSTANT_ENCAPSED_STRING)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 12, + "message": "Parse Error : syntax error, unexpected ',', expecting ';' on line 12", + "token": "','", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 12, + "message": "Parse Error : syntax error, unexpected ',' on line 12", + "token": "','", + }, + Error { + "expected": ";", + "kind": "error", + "line": 12, + "message": "Parse Error : syntax error, unexpected ''bar'' (T_CONSTANT_ENCAPSED_STRING), expecting ';' on line 12", + "token": "''bar'' (T_CONSTANT_ENCAPSED_STRING)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 12, + "message": "Parse Error : syntax error, unexpected ')', expecting ';' on line 12", + "token": "')'", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 12, + "message": "Parse Error : syntax error, unexpected ')' on line 12", + "token": "')'", + }, + ], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/post.test.js.snap b/test/snapshot/__snapshots__/post.test.js.snap new file mode 100644 index 000000000..ad233a369 --- /dev/null +++ b/test/snapshot/__snapshots__/post.test.js.snap @@ -0,0 +1,241 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`post ++ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Post { + "kind": "post", + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`post ++ and + unary 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": Post { + "kind": "post", + "parenthesizedExpression": true, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`post ++ and - unary (with parens) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Post { + "kind": "post", + "parenthesizedExpression": true, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`post ++ and - unary 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Post { + "kind": "post", + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`post ++ and parens 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Post { + "kind": "post", + "parenthesizedExpression": true, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`post -- 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Post { + "kind": "post", + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`post -- and + unary (with parens) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": Post { + "kind": "post", + "parenthesizedExpression": true, + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`post -- and + unary 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": Post { + "kind": "post", + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`post -- and parens 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Post { + "kind": "post", + "parenthesizedExpression": true, + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`post -- and unary - 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Post { + "kind": "post", + "parenthesizedExpression": true, + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/pre.test.js.snap b/test/snapshot/__snapshots__/pre.test.js.snap new file mode 100644 index 000000000..aa1a5f8d3 --- /dev/null +++ b/test/snapshot/__snapshots__/pre.test.js.snap @@ -0,0 +1,241 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`pre ++ 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Pre { + "kind": "pre", + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`pre ++ and + unary 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": Pre { + "kind": "pre", + "parenthesizedExpression": true, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`pre ++ and - unary (with parens) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Pre { + "kind": "pre", + "parenthesizedExpression": true, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`pre ++ and - unary 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Pre { + "kind": "pre", + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`pre ++ and parens 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Pre { + "kind": "pre", + "parenthesizedExpression": true, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`pre -- 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Pre { + "kind": "pre", + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`pre -- and + unary (with parens) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": Pre { + "kind": "pre", + "parenthesizedExpression": true, + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`pre -- and + unary 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": Pre { + "kind": "pre", + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`pre -- and parens 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Pre { + "kind": "pre", + "parenthesizedExpression": true, + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`pre -- and unary - 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Pre { + "kind": "pre", + "parenthesizedExpression": true, + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/print.test.js.snap b/test/snapshot/__snapshots__/print.test.js.snap new file mode 100644 index 000000000..3008dfbf8 --- /dev/null +++ b/test/snapshot/__snapshots__/print.test.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`print simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Print { + "expression": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + "kind": "print", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/property.test.js.snap b/test/snapshot/__snapshots__/property.test.js.snap new file mode 100644 index 000000000..59f1edd5f --- /dev/null +++ b/test/snapshot/__snapshots__/property.test.js.snap @@ -0,0 +1,1118 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`property private 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], + "visibility": "private", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property private with value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Number { + "kind": "number", + "value": "10", + }, + }, + ], + "visibility": "private", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property protected 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], + "visibility": "protected", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property protected with value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Number { + "kind": "number", + "value": "10", + }, + }, + ], + "visibility": "protected", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property public 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property public static 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": true, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property public static with value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": true, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Number { + "kind": "number", + "value": "10", + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property public with value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Number { + "kind": "number", + "value": "10", + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property var 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + }, + ], + "visibility": null, + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property var with value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Number { + "kind": "number", + "value": "10", + }, + }, + ], + "visibility": null, + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property with array value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Boolean { + "kind": "boolean", + "raw": "false", + "value": false, + }, + }, + ], + "kind": "array", + "shortForm": false, + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property with bin value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Bin { + "kind": "bin", + "left": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'hello '", + "unicode": false, + "value": "hello ", + }, + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'world'", + "unicode": false, + "value": "world", + }, + "type": ".", + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property with bin value 2 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Bin { + "kind": "bin", + "left": Number { + "kind": "number", + "value": "1", + }, + "right": Number { + "kind": "number", + "value": "2", + }, + "type": "+", + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property with boolean value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property with constant value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Name { + "kind": "name", + "name": "CONSTANT", + "resolution": "uqn", + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property with double quotes string value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + }, + ], + "visibility": "public", + }, + ], + "extends": null, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "Foo", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`property with heredoc value 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + PropertyStatement { + "isStatic": false, + "kind": "propertystatement", + "properties": [ + Property { + "attrGroups": [], + "kind": "property", + "name": Identifier { + "kind": "identifier", + "name": "property", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": Encapsed { + "kind": "encapsed", + "label": "EOD", + "raw": "<< $", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -> $", - "unicode": false, - "value": " -> $", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " -> $", + "unicode": false, + "value": " -> $", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -150,7 +165,7 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { "expected": "\`", "kind": "error", @@ -165,19 +180,23 @@ Program { exports[`Test strings check infinite on \${ using backquotes 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "raw": "\`\${", "type": "shell", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": true, - "kind": "variable", - "name": undefined, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": undefined, + }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -186,7 +205,7 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { "expected": "EXPR", "kind": "error", @@ -215,19 +234,23 @@ Program { exports[`Test strings check infinite on \${ using doublequotes 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"\${", + "raw": ""\${", "type": "string", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": true, - "kind": "variable", - "name": undefined, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": undefined, + }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -236,7 +259,7 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { "expected": "EXPR", "kind": "error", @@ -252,10 +275,10 @@ Program { "token": "the end of file (EOF)", }, Error { - "expected": "\\"", + "expected": """, "kind": "error", "line": 1, - "message": "Parse Error : syntax error, expecting '\\"' on line 1", + "message": "Parse Error : syntax error, expecting '"' on line 1", "token": "the end of file (EOF)", }, ], @@ -265,26 +288,35 @@ Program { exports[`Test strings check infinite on \${ with arrow 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "raw": "\` -> \${", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -> ", - "unicode": false, - "value": " -> ", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " -> ", + "unicode": false, + "value": " -> ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": true, - "kind": "variable", - "name": undefined, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": undefined, + }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -293,7 +325,7 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { "expected": "EXPR", "kind": "error", @@ -322,20 +354,25 @@ Program { exports[`Test strings check infinite on { using backquotes 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "raw": "\`{", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "{", - "unicode": false, - "value": "{", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "{", + "unicode": false, + "value": "{", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -344,7 +381,7 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { "expected": "\`", "kind": "error", @@ -359,20 +396,25 @@ Program { exports[`Test strings check infinite on { using doublequotes 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"{", + "raw": ""{", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "{", - "unicode": false, - "value": "{", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "{", + "unicode": false, + "value": "{", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -381,12 +423,12 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { - "expected": "\\"", + "expected": """, "kind": "error", "line": 1, - "message": "Parse Error : syntax error, expecting '\\"' on line 1", + "message": "Parse Error : syntax error, expecting '"' on line 1", "token": "the end of file (EOF)", }, ], @@ -396,20 +438,25 @@ Program { exports[`Test strings check infinite on { with arrow 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "raw": "\` -> {", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -> {", - "unicode": false, - "value": " -> {", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " -> {", + "unicode": false, + "value": " -> {", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -418,7 +465,7 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { "expected": "\`", "kind": "error", @@ -433,19 +480,23 @@ Program { exports[`Test strings check infinite on {$ using backquotes 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "raw": "\`{$", "type": "shell", - "value": Array [ - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": "", + "value": [ + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "", + }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -454,9 +505,9 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { - "expected": Array [ + "expected": [ "{", "$", 222, @@ -487,19 +538,23 @@ Program { exports[`Test strings check infinite on {$ using doublequotes 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"{$", + "raw": ""{$", "type": "string", - "value": Array [ - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": "", + "value": [ + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "", + }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -508,9 +563,9 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { - "expected": Array [ + "expected": [ "{", "$", 222, @@ -528,10 +583,10 @@ Program { "token": "the end of file (EOF)", }, Error { - "expected": "\\"", + "expected": """, "kind": "error", "line": 1, - "message": "Parse Error : syntax error, expecting '\\"' on line 1", + "message": "Parse Error : syntax error, expecting '"' on line 1", "token": "the end of file (EOF)", }, ], @@ -541,26 +596,35 @@ Program { exports[`Test strings check infinite on {$ with arrow 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "raw": "\` -> {$", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -> ", - "unicode": false, - "value": " -> ", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " -> ", + "unicode": false, + "value": " -> ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": "", + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "", + }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -569,9 +633,9 @@ Program { "shortForm": false, }, ], - "errors": Array [ + "errors": [ Error { - "expected": Array [ + "expected": [ "{", "$", 222, @@ -600,436 +664,1260 @@ Program { } `; -exports[`Test strings encapsed variable / curly constant 1`] = ` -Program { - "children": Array [ - Echo { - "arguments": Array [ - Encapsed { - "kind": "encapsed", - "raw": "\\"Hello \${ obj }\\"", - "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "Hello ", - "unicode": false, - "value": "Hello ", - }, - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": ConstRef { - "kind": "constref", - "name": Identifier { - "kind": "identifier", - "name": "obj", - "resolution": "uqn", - }, - }, - }, - ], - }, - ], - "kind": "echo", - "shortForm": false, - }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Test strings encapsed variable / curly varname 1`] = ` +exports[`Test strings double quotes 1`] = ` Program { - "children": Array [ - Echo { - "arguments": Array [ - Encapsed { - "kind": "encapsed", - "raw": "\\"Hello \${obj}->name !\\"", - "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "Hello ", - "unicode": false, - "value": "Hello ", - }, - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": ConstRef { - "kind": "constref", - "name": "obj", - }, - }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "->name !", - "unicode": false, - "value": "->name !", - }, - ], + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", }, - ], - "kind": "echo", - "shortForm": false, - }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Test strings encapsed variable / offsetlookup 1`] = ` -Program { - "children": Array [ - Echo { - "arguments": Array [ - Encapsed { - "kind": "encapsed", - "raw": "\\"\${$parts[$i]}\\\\n\\"", - "type": "string", - "value": Array [ - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": OffsetLookup { - "kind": "offsetlookup", - "offset": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "i", - }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "parts", - }, - }, - }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "\\\\n", - "unicode": false, - "value": " + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\n"", + "unicode": false, + "value": " ", - }, - ], }, - ], - "kind": "echo", - "shortForm": false, + }, + "kind": "expressionstatement", }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Test strings fix #101 case 1 1`] = ` -Program { - "children": Array [ ExpressionStatement { - "expression": Encapsed { - "kind": "encapsed", - "raw": "\\"encapsed {$var}\\"", - "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "encapsed ", - "unicode": false, - "value": "encapsed ", - }, - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": "var", - }, - ], + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\r"", + "unicode": false, + "value": " +", + }, }, "kind": "expressionstatement", }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Test strings fix #101 case 2 1`] = ` -Program { - "children": Array [ ExpressionStatement { - "expression": Encapsed { - "kind": "encapsed", - "raw": "\\"encapsed {$arr[0]}\\"", + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\t"", + "unicode": false, + "value": " ", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\v"", + "unicode": false, + "value": " ", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\e"", + "unicode": false, + "value": "", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\f"", + "unicode": false, + "value": " ", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\\\"", + "unicode": false, + "value": "\\", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\$"", + "unicode": false, + "value": "$", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\""", + "unicode": false, + "value": """, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\141"", + "unicode": false, + "value": "a", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\7FF"", + "unicode": false, + "value": "FF", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\x61"", + "unicode": false, + "value": "a", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\x0Z"", + "unicode": false, + "value": "Z", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\xZZ"", + "unicode": false, + "value": "\\xZZ", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\u{0061}"", + "unicode": false, + "value": "a", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\u{}"", + "unicode": false, + "value": "\\u{}", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\u{0FFF}"", + "unicode": false, + "value": "࿿", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\u{0ZZZ}"", + "unicode": false, + "value": "\\u{0ZZZ}", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""cat\\u{1F639}"", + "unicode": false, + "value": "cat😹", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\u{D83D}\\u{DCA9}"", + "unicode": false, + "value": "💩", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""💩"", + "unicode": false, + "value": "💩", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\u{ZZZZ}\\u{ZZZZ}"", + "unicode": false, + "value": "\\u{ZZZZ}\\u{ZZZZ}", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""🌟"", + "unicode": false, + "value": "🌟", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""'"", + "unicode": false, + "value": "'", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\'"", + "unicode": false, + "value": "\\'", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""\\n | \\r | \\t | \\v | \\e | \\f | \\\\ | \\$ | \\" | \\141 | \\x61 | \\u{0061}"", + "unicode": false, + "value": " + | + | | |  | | \\ | $ | " | a | a | a", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings encapsed variable / curly constant 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Encapsed { + "kind": "encapsed", + "raw": ""Hello \${ obj }"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "Hello ", + "unicode": false, + "value": "Hello ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": Name { + "kind": "name", + "name": "obj", + "resolution": "uqn", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + ], + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings encapsed variable / curly varname 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Encapsed { + "kind": "encapsed", + "raw": ""Hello \${obj}->name !"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "Hello ", + "unicode": false, + "value": "Hello ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "->name !", + "unicode": false, + "value": "->name !", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings encapsed variable / offsetlookup 1`] = ` +Program { + "children": [ + Echo { + "expressions": [ + Encapsed { + "kind": "encapsed", + "raw": ""\${$parts[$i]}\\n"", + "type": "string", + "value": [ + EncapsedPart { + "curly": true, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "i", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "parts", + }, + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "\\n", + "unicode": false, + "value": "", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + ], + "kind": "echo", + "shortForm": false, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings fix #101 case 1 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""encapsed {$var}"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "encapsed ", + "unicode": false, + "value": "encapsed ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings fix #101 case 2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""encapsed {$arr[0]}"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "encapsed ", + "unicode": false, + "value": "encapsed ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "0", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "arr", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings fix #101 case 3 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""encapsed \${var}"", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "encapsed ", - "unicode": false, - "value": "encapsed ", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "encapsed ", + "unicode": false, + "value": "encapsed ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - OffsetLookup { - "kind": "offsetlookup", - "offset": Number { - "kind": "number", - "value": "0", + ], + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings fix #123 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "string", + }, + "operator": "=", + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'Avoid converting + chars, but \\' or \\\\ is ok.'", + "unicode": false, + "value": "Avoid converting + chars, but ' or \\ is ok.", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings fix #124 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "string", + }, + "operator": "=", + "right": Encapsed { + "kind": "encapsed", + "raw": ""He drank some $juices[koolaid1] juice."", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "He drank some ", + "unicode": false, + "value": "He drank some ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Identifier { + "kind": "identifier", + "name": "koolaid1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "juices", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " juice.", + "unicode": false, + "value": " juice.", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings fix #144 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Encapsed { + "kind": "encapsed", + "raw": ""encapsed \\" {$var}"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "encapsed \\" ", + "unicode": false, + "value": "encapsed " ", }, - "what": Variable { - "byref": false, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { "curly": false, "kind": "variable", - "name": "arr", + "name": "var", }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; -exports[`Test strings fix #101 case 3 1`] = ` +exports[`Test strings fix #149 1`] = ` Program { - "children": Array [ + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": "b"foo\\nbar"", + "unicode": true, + "value": "foo +bar", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings fix #251 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Encapsed { + "kind": "encapsed", + "raw": ""string \${juices['FOO']} string"", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "string ", + "unicode": false, + "value": "string ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": true, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'FOO'", + "unicode": false, + "value": "FOO", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "juices", + }, + }, + "kind": "encapsedpart", + "syntax": "simple", + }, + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " string", + "unicode": false, + "value": " string", + }, + "kind": "encapsedpart", + "syntax": null, + }, + ], + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings implement #116 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "operator": "=", + "right": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""foo\\nbar"", + "unicode": false, + "value": "foo +bar", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings single (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings single 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'string'", + "unicode": false, + "value": "string", + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test strings single quotes 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + }, + "kind": "expressionstatement", + }, ExpressionStatement { - "expression": Encapsed { - "kind": "encapsed", - "raw": "\\"encapsed \${var}\\"", - "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "encapsed ", - "unicode": false, - "value": "encapsed ", - }, - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": ConstRef { - "kind": "constref", - "name": "var", - }, - }, - ], + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'\\''", + "unicode": false, + "value": "'", + }, }, "kind": "expressionstatement", }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Test strings fix #123 1`] = ` -Program { - "children": Array [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "string", + "name": "var", }, "operator": "=", "right": String { "isDoubleQuote": false, "kind": "string", - "raw": "'Avoid converting - chars, but \\\\' or \\\\\\\\ is ok.'", + "raw": "'\\'\\'\\''", "unicode": false, - "value": "Avoid converting - chars, but ' or \\\\ is ok.", + "value": "'''", }, }, "kind": "expressionstatement", }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Test strings fix #124 1`] = ` -Program { - "children": Array [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "string", + "name": "var", }, "operator": "=", - "right": Encapsed { - "kind": "encapsed", - "raw": "\\"He drank some $juices[koolaid1] juice.\\"", - "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "He drank some ", - "unicode": false, - "value": "He drank some ", - }, - OffsetLookup { - "kind": "offsetlookup", - "offset": ConstRef { - "kind": "constref", - "name": "koolaid1", - }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "juices", - }, - }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " juice.", - "unicode": false, - "value": " juice.", - }, - ], + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'\\'foo'", + "unicode": false, + "value": "'foo", }, }, "kind": "expressionstatement", }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Test strings fix #144 1`] = ` -Program { - "children": Array [ ExpressionStatement { - "expression": Encapsed { - "kind": "encapsed", - "raw": "\\"encapsed \\\\\\" {$var}\\"", - "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "encapsed \\\\\\" ", - "unicode": false, - "value": "encapsed \\" ", - }, - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": "var", - }, - ], + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo\\''", + "unicode": false, + "value": "foo'", + }, }, "kind": "expressionstatement", }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Test strings fix #149 1`] = ` -Program { - "children": Array [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "a", + "name": "var", }, "operator": "=", "right": String { - "isDoubleQuote": true, + "isDoubleQuote": false, "kind": "string", - "raw": "b\\"foo\\\\nbar\\"", - "unicode": true, - "value": "foo -bar", + "raw": "'foo\\'foo'", + "unicode": false, + "value": "foo'foo", }, }, "kind": "expressionstatement", }, - ], - "errors": Array [], - "kind": "program", -} -`; - -exports[`Test strings implement #116 1`] = ` -Program { - "children": Array [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "a", + "name": "var", }, "operator": "=", "right": String { - "isDoubleQuote": true, + "isDoubleQuote": false, "kind": "string", - "raw": "\\"foo\\\\nbar\\"", + "raw": "'\\\\\\''", "unicode": false, - "value": "foo -bar", + "value": "\\'", }, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test strings test backquotes 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1039,19 +1927,28 @@ Program { "kind": "encapsed", "raw": "\`ls $cwd\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "ls ", - "unicode": false, - "value": "ls ", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "ls ", + "unicode": false, + "value": "ls ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": false, - "kind": "variable", - "name": "cwd", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "cwd", + }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -1062,7 +1959,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1072,24 +1968,32 @@ Program { "kind": "encapsed", "raw": "\`ls \${$cwd}\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "ls ", - "unicode": false, - "value": "ls ", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "ls ", + "unicode": false, + "value": "ls ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": true, - "kind": "variable", - "name": Variable { - "byref": false, + "expression": Variable { "curly": false, "kind": "variable", - "name": "cwd", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "cwd", + }, }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -1100,7 +2004,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1110,19 +2013,28 @@ Program { "kind": "encapsed", "raw": "\`ls {$cwd}\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "ls ", - "unicode": false, - "value": "ls ", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "ls ", + "unicode": false, + "value": "ls ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": "cwd", + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "cwd", + }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -1133,7 +2045,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1143,12 +2054,16 @@ Program { "kind": "encapsed", "raw": "\`$var\`", "type": "shell", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": false, - "kind": "variable", - "name": "var", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -1159,7 +2074,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1169,15 +2083,16 @@ Program { "kind": "encapsed", "raw": "\`\${var}\`", "type": "shell", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": true, - "kind": "variable", - "name": ConstRef { - "kind": "constref", + "expression": Variable { + "curly": false, + "kind": "variable", "name": "var", }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -1188,7 +2103,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1198,12 +2112,16 @@ Program { "kind": "encapsed", "raw": "\`{$var}\`", "type": "shell", - "value": Array [ - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": "var", + "value": [ + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -1214,7 +2132,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1224,7 +2141,7 @@ Program { "kind": "encapsed", "raw": "\`\`", "type": "shell", - "value": Array [], + "value": [], }, }, "kind": "expressionstatement", @@ -1233,7 +2150,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1241,15 +2157,20 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\`\\\\\`\`", + "raw": "\`\\\`\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "\\\\\`", - "unicode": false, - "value": "\\\\\`", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "\\\`", + "unicode": false, + "value": "\\\`", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -1260,7 +2181,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1270,13 +2190,18 @@ Program { "kind": "encapsed", "raw": "\`{\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "{", - "unicode": false, - "value": "{", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "{", + "unicode": false, + "value": "{", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -1287,7 +2212,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1297,13 +2221,18 @@ Program { "kind": "encapsed", "raw": "\`-{\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "-{", - "unicode": false, - "value": "-{", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "-{", + "unicode": false, + "value": "-{", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -1314,7 +2243,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1324,13 +2252,18 @@ Program { "kind": "encapsed", "raw": "\`-$\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "-$", - "unicode": false, - "value": "-$", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "-$", + "unicode": false, + "value": "-$", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -1341,7 +2274,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1351,13 +2283,18 @@ Program { "kind": "encapsed", "raw": "\`$\`", "type": "shell", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "$", - "unicode": false, - "value": "$", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "$", + "unicode": false, + "value": "$", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -1365,41 +2302,54 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test strings test binary with double quotes 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "b\\"\\\\colors contains >$colors<\\\\n\\"", + "raw": "b"\\colors contains >$colors<\\n"", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "\\\\colors contains >", - "unicode": false, - "value": "\\\\colors contains >", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "\\colors contains >", + "unicode": false, + "value": "\\colors contains >", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": false, - "kind": "variable", - "name": "colors", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "colors", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "<\\\\n", - "unicode": false, - "value": "< -", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "<\\n", + "unicode": false, + "value": "<", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -1408,19 +2358,18 @@ Program { "shortForm": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test strings test double quotes 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1429,7 +2378,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"$\\"", + "raw": ""$"", "unicode": false, "value": "$", }, @@ -1440,7 +2389,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1449,7 +2397,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"{\\"", + "raw": ""{"", "unicode": false, "value": "{", }, @@ -1460,7 +2408,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1469,7 +2416,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"-$-\\"", + "raw": ""-$-"", "unicode": false, "value": "-$-", }, @@ -1480,7 +2427,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1489,7 +2435,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"-{\\"", + "raw": ""-{"", "unicode": false, "value": "-{", }, @@ -1500,7 +2446,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1508,14 +2453,18 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"$b\\"", + "raw": ""$b"", "type": "string", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": false, - "kind": "variable", - "name": "b", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -1526,7 +2475,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1534,14 +2482,18 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"{$b}\\"", + "raw": ""{$b}"", "type": "string", - "value": Array [ - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": "b", + "value": [ + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -1552,7 +2504,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1560,19 +2511,22 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"\${$b}\\"", + "raw": ""\${$b}"", "type": "string", - "value": Array [ - Variable { - "byref": false, + "value": [ + EncapsedPart { "curly": true, - "kind": "variable", - "name": Variable { - "byref": false, + "expression": Variable { "curly": false, "kind": "variable", - "name": "b", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -1583,7 +2537,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1591,28 +2544,42 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"-$b?\\"", + "raw": ""-$b?"", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "-", - "unicode": false, - "value": "-", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "-", + "unicode": false, + "value": "-", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": false, - "kind": "variable", - "name": "b", + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "?", - "unicode": false, - "value": "?", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "?", + "unicode": false, + "value": "?", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -1623,7 +2590,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1631,21 +2597,30 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"-{$b}\\"", + "raw": ""-{$b}"", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "-", - "unicode": false, - "value": "-", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "-", + "unicode": false, + "value": "-", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, - "curly": true, - "kind": "variable", - "name": "b", + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -1656,7 +2631,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1664,26 +2638,34 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"-\${$b}\\"", + "raw": ""-\${$b}"", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "-", - "unicode": false, - "value": "-", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "-", + "unicode": false, + "value": "-", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": true, - "kind": "variable", - "name": Variable { - "byref": false, + "expression": Variable { "curly": false, "kind": "variable", - "name": "b", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, }, + "kind": "encapsedpart", + "syntax": "simple", }, ], }, @@ -1694,7 +2676,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1703,7 +2684,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"\\"", + "raw": """", "unicode": false, "value": "", }, @@ -1714,7 +2695,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -1723,81 +2703,64 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"\\\\\\"\\"", + "raw": ""\\""", "unicode": false, - "value": "\\"", + "value": """, }, }, "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test strings test empty nowdoc & heredoc contents 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", "label": "HDOC", - "raw": " + "raw": "<<docStar} \${$foo} \${targetDirs[1]} @@ -1814,119 +2777,157 @@ $test[1] $test->foo EOFX", "type": "heredoc", - "value": Array [ - PropertyLookup { - "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", - "name": "docStar", - }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "this", + "value": [ + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "docStar", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "this", + }, }, + "kind": "encapsedpart", + "syntax": "complex", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " ", - "unicode": false, - "value": " + "unicode": false, + "value": " ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": true, - "kind": "variable", - "name": Variable { - "byref": false, + "expression": Variable { "curly": false, "kind": "variable", - "name": "foo", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " ", - "unicode": false, - "value": " + "unicode": false, + "value": " ", + }, + "kind": "encapsedpart", + "syntax": null, }, - Variable { - "byref": false, + EncapsedPart { "curly": true, - "kind": "variable", - "name": OffsetLookup { + "expression": OffsetLookup { "kind": "offsetlookup", "offset": Number { "kind": "number", "value": "1", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "targetDirs", }, }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " ", - "unicode": false, - "value": " + "unicode": false, + "value": " ", - }, - OffsetLookup { - "kind": "offsetlookup", - "offset": Number { - "kind": "number", - "value": "1", }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "test", + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " ", - "unicode": false, - "value": " + "unicode": false, + "value": " ", - }, - PropertyLookup { - "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", - "name": "foo", }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "test", + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " -", - "unicode": false, - "value": " + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " ", + "unicode": false, + "value": "", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -1934,47 +2935,61 @@ EOFX", "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test strings test encapsed variable 1`] = ` Program { - "children": Array [ + "children": [ Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"Hello $obj->name !\\"", + "raw": ""Hello $obj->name !"", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "Hello ", - "unicode": false, - "value": "Hello ", - }, - PropertyLookup { - "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", - "name": "name", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "Hello ", + "unicode": false, + "value": "Hello ", }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "obj", + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "name", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": " !", - "unicode": false, - "value": " !", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": " !", + "unicode": false, + "value": " !", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -1983,38 +2998,52 @@ Program { "shortForm": false, }, Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"Hello $obj->foo->bar !\\"", + "raw": ""Hello $obj->foo->bar !"", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "Hello ", - "unicode": false, - "value": "Hello ", - }, - PropertyLookup { - "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", - "name": "foo", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "Hello ", + "unicode": false, + "value": "Hello ", }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "obj", + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "->bar !", - "unicode": false, - "value": "->bar !", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "->bar !", + "unicode": false, + "value": "->bar !", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -2023,38 +3052,52 @@ Program { "shortForm": false, }, Echo { - "arguments": Array [ + "expressions": [ Encapsed { "kind": "encapsed", - "raw": "\\"Hello $obj[1]->foo !\\"", + "raw": ""Hello $obj[1]->foo !"", "type": "string", - "value": Array [ - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "Hello ", - "unicode": false, - "value": "Hello ", - }, - OffsetLookup { - "kind": "offsetlookup", - "offset": Number { - "kind": "number", - "value": "1", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "Hello ", + "unicode": false, + "value": "Hello ", }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "obj", + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "obj", + }, }, + "kind": "encapsedpart", + "syntax": "simple", }, - String { - "isDoubleQuote": false, - "kind": "string", - "raw": "->foo !", - "unicode": false, - "value": "->foo !", + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "->foo !", + "unicode": false, + "value": "->foo !", + }, + "kind": "encapsedpart", + "syntax": null, }, ], }, @@ -2063,19 +3106,18 @@ Program { "shortForm": false, }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test strings test heredoc end of doc 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -2084,16 +3126,21 @@ Program { "right": Encapsed { "kind": "encapsed", "label": "EOF2", - "raw": " + "raw": "<<", 1, diff --git a/test/snapshot/__snapshots__/trait.test.js.snap b/test/snapshot/__snapshots__/trait.test.js.snap new file mode 100644 index 000000000..eec7a3c38 --- /dev/null +++ b/test/snapshot/__snapshots__/trait.test.js.snap @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`trait trait name as identifier 1`] = ` +Program { + "children": [ + Trait { + "body": [], + "kind": "trait", + "name": Identifier { + "kind": "identifier", + "name": "A", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/traitprecedence.test.js.snap b/test/snapshot/__snapshots__/traitprecedence.test.js.snap new file mode 100644 index 000000000..112fc3282 --- /dev/null +++ b/test/snapshot/__snapshots__/traitprecedence.test.js.snap @@ -0,0 +1,85 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`traitprecedence simple 1`] = ` +Program { + "children": [ + Class { + "attrGroups": [], + "body": [ + TraitUse { + "adaptations": [ + TraitPrecedence { + "instead": [ + Name { + "kind": "name", + "name": "A", + "resolution": "uqn", + }, + ], + "kind": "traitprecedence", + "method": Identifier { + "kind": "identifier", + "name": "smallTalk", + }, + "trait": Name { + "kind": "name", + "name": "B", + "resolution": "uqn", + }, + }, + TraitPrecedence { + "instead": [ + Name { + "kind": "name", + "name": "B", + "resolution": "uqn", + }, + ], + "kind": "traitprecedence", + "method": Identifier { + "kind": "identifier", + "name": "bigTalk", + }, + "trait": Name { + "kind": "name", + "name": "A", + "resolution": "uqn", + }, + }, + ], + "kind": "traituse", + "traits": [ + Name { + "kind": "name", + "name": "A", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "B", + "resolution": "uqn", + }, + ], + }, + ], + "extends": Name { + "kind": "name", + "name": "Base", + "resolution": "uqn", + }, + "implements": null, + "isAbstract": false, + "isAnonymous": false, + "isFinal": false, + "isReadonly": false, + "kind": "class", + "name": Identifier { + "kind": "identifier", + "name": "MyHelloWorld", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/try.test.js.snap b/test/snapshot/__snapshots__/try.test.js.snap new file mode 100644 index 000000000..b89c6a8fb --- /dev/null +++ b/test/snapshot/__snapshots__/try.test.js.snap @@ -0,0 +1,679 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`boolean finally 1`] = ` +Program { + "children": [ + Try { + "always": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something_other", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": Variable { + "curly": false, + "kind": "variable", + "name": "e", + }, + "what": [ + Name { + "kind": "name", + "name": "Exception", + "resolution": "uqn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean fully qualified name #2 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": Variable { + "curly": false, + "kind": "variable", + "name": "e", + }, + "what": [ + Name { + "kind": "name", + "name": "\\Exception\\Foo", + "resolution": "fqn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean fully qualified name 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": Variable { + "curly": false, + "kind": "variable", + "name": "e", + }, + "what": [ + Name { + "kind": "name", + "name": "\\Exception", + "resolution": "fqn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean multiple catch #2 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": Variable { + "curly": false, + "kind": "variable", + "name": "e", + }, + "what": [ + Name { + "kind": "name", + "name": "MyException", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "Foo\\Exception", + "resolution": "qn", + }, + Name { + "kind": "name", + "name": "\\Exception", + "resolution": "fqn", + }, + Name { + "kind": "name", + "name": "\\Exception\\Foo", + "resolution": "fqn", + }, + Name { + "kind": "name", + "name": "Exception", + "resolution": "rn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean multiple catch 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": Variable { + "curly": false, + "kind": "variable", + "name": "e", + }, + "what": [ + Name { + "kind": "name", + "name": "MyException", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "MyOtherException", + "resolution": "uqn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean multiple catch without variable 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": null, + "what": [ + Name { + "kind": "name", + "name": "MyException", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "MyOtherException", + "resolution": "uqn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean qualified name 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": Variable { + "curly": false, + "kind": "variable", + "name": "e", + }, + "what": [ + Name { + "kind": "name", + "name": "Foo\\Exception", + "resolution": "qn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean relative name 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": Variable { + "curly": false, + "kind": "variable", + "name": "e", + }, + "what": [ + Name { + "kind": "name", + "name": "Exception", + "resolution": "rn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean simple 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": Variable { + "curly": false, + "kind": "variable", + "name": "e", + }, + "what": [ + Name { + "kind": "name", + "name": "Exception", + "resolution": "uqn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`boolean without variable 1`] = ` +Program { + "children": [ + Try { + "always": null, + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "call", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "catches": [ + Catch { + "body": Block { + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "do_something", + "resolution": "uqn", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "kind": "catch", + "variable": null, + "what": [ + Name { + "kind": "name", + "name": "Exception", + "resolution": "uqn", + }, + ], + }, + ], + "kind": "try", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/typereference.test.js.snap b/test/snapshot/__snapshots__/typereference.test.js.snap new file mode 100644 index 000000000..2bf7a4023 --- /dev/null +++ b/test/snapshot/__snapshots__/typereference.test.js.snap @@ -0,0 +1,1801 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typereference array (argument) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "ARRAY", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference array (argument) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "array", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference array (return type declarations) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "ARRAY", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference array (return type declarations) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "array", + "raw": "array", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference bool (argument) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "bool", + "raw": "BOOL", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference bool (argument) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "bool", + "raw": "bool", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference bool (return type declarations) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "bool", + "raw": "BOOL", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference bool (return type declarations) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "bool", + "raw": "bool", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference callable (argument) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "callable", + "raw": "CALLABLE", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference callable (argument) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "callable", + "raw": "callable", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference callable (return type declarations) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "callable", + "raw": "CALLABLE", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference callable (return type declarations) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "callable", + "raw": "callable", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference class (2) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "Foo\\Foo", + "resolution": "qn", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference class (3) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference class (4) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": Name { + "kind": "name", + "name": "Foo\\Foo", + "resolution": "qn", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference class 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference float (argument) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "float", + "raw": "FLOAT", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference float (argument) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "float", + "raw": "float", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference float (return type declarations) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "float", + "raw": "FLOAT", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference float (return type declarations) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "float", + "raw": "float", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference int (argument) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "INT", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference int (argument) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference int (return type declarations) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "INT", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference int (return type declarations) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "int", + "raw": "int", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference iterable (argument) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "iterable", + "raw": "ITERABLE", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference iterable (argument) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "iterable", + "raw": "iterable", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference iterable (return type declarations) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "iterable", + "raw": "ITERABLE", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference iterable (return type declarations) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "iterable", + "raw": "iterable", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference object (argument) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "object", + "raw": "OBJECT", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference object (argument) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "object", + "raw": "object", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference object (return type declarations) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "object", + "raw": "OBJECT", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference object (return type declarations) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "object", + "raw": "object", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference string (argument) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "string", + "raw": "STRING", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference string (argument) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference string (return type declarations) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "string", + "raw": "STRING", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference string (return type declarations) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "string", + "raw": "string", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference void (argument) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "void", + "raw": "VOID", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference void (argument) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": TypeReference { + "kind": "typereference", + "name": "void", + "raw": "void", + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference void (return type declarations) (uppercase) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "void", + "raw": "VOID", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`typereference void (return type declarations) 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "arg", + }, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": TypeReference { + "kind": "typereference", + "name": "void", + "raw": "void", + }, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/unary.test.js.snap b/test/snapshot/__snapshots__/unary.test.js.snap new file mode 100644 index 000000000..8a029bc00 --- /dev/null +++ b/test/snapshot/__snapshots__/unary.test.js.snap @@ -0,0 +1,593 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Test unary boolean 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "!", + "what": Boolean { + "kind": "boolean", + "raw": "true", + "value": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary multiple (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Pre { + "kind": "pre", + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary multiple (3) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": Unary { + "kind": "unary", + "parenthesizedExpression": true, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary multiple (4) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Unary { + "kind": "unary", + "parenthesizedExpression": true, + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary multiple (5) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "!", + "what": Unary { + "kind": "unary", + "type": "!", + "what": Unary { + "kind": "unary", + "type": "!", + "what": Unary { + "kind": "unary", + "type": "!", + "what": Unary { + "kind": "unary", + "type": "!", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary multiple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "!", + "what": Unary { + "kind": "unary", + "type": "!", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary multiple 2`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "~", + "what": Unary { + "kind": "unary", + "type": "~", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary number (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": Number { + "kind": "number", + "value": "100", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary number (3) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "~", + "what": Number { + "kind": "number", + "value": "100", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary number (4) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "!", + "what": Number { + "kind": "number", + "value": "100", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary number 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Number { + "kind": "number", + "value": "100", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "!", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + "parenthesizedExpression": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens (3) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "parenthesizedExpression": true, + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens (4) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + "parenthesizedExpression": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens (5) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "parenthesizedExpression": true, + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens (6) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + "parenthesizedExpression": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens (7) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "~", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + "parenthesizedExpression": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens (8) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "parenthesizedExpression": true, + "type": "~", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens (9) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "parenthesizedExpression": true, + "type": "-", + "what": Number { + "kind": "number", + "value": "100", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens (10) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": Number { + "kind": "number", + "parenthesizedExpression": true, + "value": "100", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary parens 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "parenthesizedExpression": true, + "type": "!", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "!", + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary string (2) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "-", + "what": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary string (3) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "~", + "what": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary string (4) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "!", + "what": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unary string 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Unary { + "kind": "unary", + "type": "+", + "what": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""string"", + "unicode": false, + "value": "string", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/union.test.js.snap b/test/snapshot/__snapshots__/union.test.js.snap new file mode 100644 index 000000000..0b7b3e73a --- /dev/null +++ b/test/snapshot/__snapshots__/union.test.js.snap @@ -0,0 +1,597 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Test unions intersection mixed with union 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "baz", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [ + Error { + "expected": undefined, + "kind": "error", + "line": 1, + "message": "Unexpect token "|", "|" and "&" can not be mixed on line 1", + "token": undefined, + }, + ], + "kind": "program", +} +`; + +exports[`Test unions intersection with reference 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": true, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unions intersection with three types 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "baz", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unions intersection with variadic 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": true, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unions simple intersection 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": IntersectionType { + "kind": "intersectiontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unions simple union 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unions union mixed with intersection 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "baz", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [ + Error { + "expected": undefined, + "kind": "error", + "line": 1, + "message": "Unexpect token "&", "|" and "&" can not be mixed on line 1", + "token": undefined, + }, + ], + "kind": "program", +} +`; + +exports[`Test unions union with reference 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": true, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unions union with three types 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "baz", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test unions union with variadic 1`] = ` +Program { + "children": [ + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": Identifier { + "kind": "identifier", + "name": "test", + }, + "nullable": false, + "readonly": false, + "type": UnionType { + "kind": "uniontype", + "name": null, + "types": [ + Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, + Name { + "kind": "name", + "name": "bar", + "resolution": "uqn", + }, + ], + }, + "value": null, + "variadic": true, + }, + ], + "attrGroups": [], + "body": Block { + "children": [], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/unset.test.js.snap b/test/snapshot/__snapshots__/unset.test.js.snap new file mode 100644 index 000000000..6a4fb6d91 --- /dev/null +++ b/test/snapshot/__snapshots__/unset.test.js.snap @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`unset multiple 1`] = ` +Program { + "children": [ + Unset { + "kind": "unset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`unset simple 1`] = ` +Program { + "children": [ + Unset { + "kind": "unset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`unset trailing comma #2 1`] = ` +Program { + "children": [ + Unset { + "kind": "unset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + ], + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`unset trailing comma 1`] = ` +Program { + "children": [ + Unset { + "kind": "unset", + "variables": [ + Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + ], + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/usegroup.test.js.snap b/test/snapshot/__snapshots__/usegroup.test.js.snap new file mode 100644 index 000000000..c7d089fdb --- /dev/null +++ b/test/snapshot/__snapshots__/usegroup.test.js.snap @@ -0,0 +1,227 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`usegroup multiple 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": Identifier { + "kind": "identifier", + "name": "Another", + }, + "kind": "useitem", + "name": "My\\Full\\Classname", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "My\\Full\\NSname", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`usegroup multiple 2 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": Identifier { + "kind": "identifier", + "name": "Another", + }, + "kind": "useitem", + "name": "My\\Full\\Classname", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "My\\Full\\NSname", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "\\Full\\NSname\\With\\Leading\\Backslash", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`usegroup nested 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "ClassA", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "ClassB", + "type": null, + }, + UseItem { + "alias": Identifier { + "kind": "identifier", + "name": "C", + }, + "kind": "useitem", + "name": "ClassC", + "type": null, + }, + ], + "kind": "usegroup", + "name": "some\\my_namespace", + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`usegroup nested 2 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "fn_a", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "fn_b", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "fn_c", + "type": null, + }, + ], + "kind": "usegroup", + "name": "some\\my_namespace", + "type": "function", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`usegroup nested 3 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "ConstA", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "ConstB", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "ConstC", + "type": null, + }, + ], + "kind": "usegroup", + "name": "some\\my_namespace", + "type": "const", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`usegroup nested 4 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "SubnamespaceOne\\ClassA", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "SubnamespaceOne\\ClassB", + "type": null, + }, + ], + "kind": "usegroup", + "name": "Vendor\\Package\\SomeNamespace", + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`usegroup simple 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": Identifier { + "kind": "identifier", + "name": "Another", + }, + "kind": "useitem", + "name": "My\\Full\\Classname", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/useitem.test.js.snap b/test/snapshot/__snapshots__/useitem.test.js.snap new file mode 100644 index 000000000..7e6a5b3f8 --- /dev/null +++ b/test/snapshot/__snapshots__/useitem.test.js.snap @@ -0,0 +1,436 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`useitem importing a class 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "some\\my_namespace\\ClassC", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`useitem importing a class with type 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": Identifier { + "kind": "identifier", + "name": "C", + }, + "kind": "useitem", + "name": "some\\my_namespace\\ClassC", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`useitem importing a constant 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "My\\Full\\CONSTANT", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": "const", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`useitem importing a constant with type 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": Identifier { + "kind": "identifier", + "name": "MY_CONST", + }, + "kind": "useitem", + "name": "My\\Full\\CONSTANT", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": "const", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`useitem importing a function 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "My\\Full\\functionName", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": "function", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`useitem importing a function with type 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": Identifier { + "kind": "identifier", + "name": "func", + }, + "kind": "useitem", + "name": "My\\Full\\functionName", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": "function", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`useitem invalid use 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": "function", + }, + ExpressionStatement { + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + "kind": "expressionstatement", + }, + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "FOO", + "type": null, + }, + UseItem { + "alias": null, + "kind": "useitem", + "name": "BAR", + "type": null, + }, + ], + "kind": "usegroup", + "name": "", + "type": "const", + }, + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "foo", + "type": null, + }, + ], + "kind": "usegroup", + "name": "some", + "type": null, + }, + ExpressionStatement { + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "error", + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + _Function { + "arguments": [ + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": null, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + Parameter { + "attrGroups": [], + "byref": false, + "flags": 0, + "kind": "parameter", + "name": null, + "nullable": false, + "readonly": false, + "type": null, + "value": null, + "variadic": false, + }, + ], + "attrGroups": [], + "body": null, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": false, + }, + "nullable": false, + "type": null, + }, + ExpressionStatement { + "expression": undefined, + "kind": "expressionstatement", + }, + ], + "errors": [ + Error { + "expected": 105, + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '$foo' (T_VARIABLE), expecting T_STRING on line 1", + "token": "'$foo' (T_VARIABLE)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 1, + "message": "Parse Error : syntax error, unexpected '$foo' (T_VARIABLE), expecting ';' on line 1", + "token": "'$foo' (T_VARIABLE)", + }, + Error { + "expected": "}", + "kind": "error", + "line": 8, + "message": "Parse Error : syntax error, unexpected '$error' (T_VARIABLE), expecting '}' on line 8", + "token": "'$error' (T_VARIABLE)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 8, + "message": "Parse Error : syntax error, unexpected '$error' (T_VARIABLE), expecting ';' on line 8", + "token": "'$error' (T_VARIABLE)", + }, + Error { + "expected": ";", + "kind": "error", + "line": 8, + "message": "Parse Error : syntax error, unexpected ',', expecting ';' on line 8", + "token": "','", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 8, + "message": "Parse Error : syntax error, unexpected ',' on line 8", + "token": "','", + }, + Error { + "expected": ";", + "kind": "error", + "line": 9, + "message": "Parse Error : syntax error, unexpected 'function' (T_FUNCTION), expecting ';' on line 9", + "token": "'function' (T_FUNCTION)", + }, + Error { + "expected": "(", + "kind": "error", + "line": 9, + "message": "Parse Error : syntax error, unexpected '$bar' (T_VARIABLE), expecting '(' on line 9", + "token": "'$bar' (T_VARIABLE)", + }, + Error { + "expected": "(", + "kind": "error", + "line": 9, + "message": "Parse Error : syntax error, unexpected ',', expecting '(' on line 9", + "token": "','", + }, + Error { + "expected": 222, + "kind": "error", + "line": 9, + "message": "Parse Error : syntax error, unexpected ',', expecting T_VARIABLE on line 9", + "token": "','", + }, + Error { + "expected": 222, + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected '}', expecting T_VARIABLE on line 10", + "token": "'}'", + }, + Error { + "expected": [ + ",", + ")", + ], + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected '}' on line 10", + "token": "'}'", + }, + Error { + "expected": ")", + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected '}', expecting ')' on line 10", + "token": "'}'", + }, + Error { + "expected": "{", + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected '}', expecting '{' on line 10", + "token": "'}'", + }, + Error { + "expected": "EXPR", + "kind": "error", + "line": 10, + "message": "Parse Error : syntax error, unexpected '}' on line 10", + "token": "'}'", + }, + ], + "kind": "program", +} +`; + +exports[`useitem simple 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "My\\Full\\NSname", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`useitem simple 2 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": null, + "kind": "useitem", + "name": "ArrayObject", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`useitem with type 1`] = ` +Program { + "children": [ + UseGroup { + "items": [ + UseItem { + "alias": Identifier { + "kind": "identifier", + "name": "Another", + }, + "kind": "useitem", + "name": "My\\Full\\Classname", + "type": null, + }, + ], + "kind": "usegroup", + "name": null, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/variable.test.js.snap b/test/snapshot/__snapshots__/variable.test.js.snap index f3f1cee64..309f8dd3b 100644 --- a/test/snapshot/__snapshots__/variable.test.js.snap +++ b/test/snapshot/__snapshots__/variable.test.js.snap @@ -2,12 +2,11 @@ exports[`Test variables Chained encapsed vars 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -15,43 +14,45 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"{$a->foo()[$bar[$foo]]}\\"", + "raw": ""{$a->foo()[$bar[$foo]]}"", "type": "string", - "value": Array [ - OffsetLookup { - "kind": "offsetlookup", - "offset": OffsetLookup { + "value": [ + EncapsedPart { + "curly": false, + "expression": OffsetLookup { "kind": "offsetlookup", - "offset": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "foo", - }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "bar", - }, - }, - "what": Call { - "arguments": Array [], - "kind": "call", - "what": PropertyLookup { - "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", "name": "foo", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", - "name": "a", + "name": "bar", + }, + }, + "what": Call { + "arguments": [], + "kind": "call", + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, }, }, }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -59,19 +60,18 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test variables Check errors should be ? 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "?", @@ -86,9 +86,9 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { - "expected": Array [ + "expected": [ "{", "$", 222, @@ -105,22 +105,21 @@ Program { exports[`Test variables Check errors should fail $foo->bar::! 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "!", }, "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "bar", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", @@ -130,12 +129,17 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { - "expected": 105, + "expected": [ + 105, + 222, + "$", + "{", + ], "kind": "error", "line": 1, - "message": "Parse Error : syntax error, unexpected '!', expecting T_STRING on line 1", + "message": "Parse Error : syntax error, unexpected '!' on line 1", "token": "'!'", }, ], @@ -145,28 +149,31 @@ Program { exports[`Test variables Check errors should fail foo::bar::baz 1`] = ` Program { - "children": Array [ - StaticLookup { - "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "baz", - }, - "what": StaticLookup { + "children": [ + ExpressionStatement { + "expression": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "bar", - }, - "what": Identifier { + "offset": Identifier { "kind": "identifier", - "name": "foo", - "resolution": "uqn", + "name": "baz", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, }, }, + "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { "expected": undefined, "kind": "error", @@ -181,38 +188,38 @@ Program { exports[`Test variables Check errors should fail on double static lookup 1`] = ` Program { - "children": Array [ - StaticLookup { - "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "baz", - }, - "what": StaticLookup { + "children": [ + ExpressionStatement { + "expression": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "bar", + "offset": Identifier { + "kind": "identifier", + "name": "baz", }, - "what": PropertyLookup { - "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", - "name": "foo", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", }, - "what": ConstRef { - "kind": "constref", - "name": Identifier { + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { "kind": "identifier", + "name": "foo", + }, + "what": Name { + "kind": "name", "name": "this", "resolution": "uqn", }, }, }, }, + "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { "expected": undefined, "kind": "error", @@ -227,28 +234,27 @@ Program { exports[`Test variables Check errors should fail on property lookup on static lookup 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "baz", }, "what": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "bar", }, "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "foo", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "this", @@ -259,7 +265,7 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [ + "errors": [ Error { "expected": undefined, "kind": "error", @@ -274,78 +280,87 @@ Program { exports[`Test variables Class constants 1`] = ` Program { - "children": Array [ - Call { - "arguments": Array [], - "kind": "call", - "what": StaticLookup { - "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "foo", - }, - "what": ConstRef { - "kind": "constref", - "name": "static", + "children": [ + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": StaticReference { + "kind": "staticreference", + "raw": "static", + }, }, }, + "kind": "expressionstatement", }, - Call { - "arguments": Array [], - "kind": "call", - "what": StaticLookup { - "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "foo", + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": SelfReference { + "kind": "selfreference", + "raw": "self", + }, }, - "what": Identifier { - "kind": "identifier", - "name": "self", - "resolution": "uqn", + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": ParentReference { + "kind": "parentreference", + "raw": "parent", + }, }, }, + "kind": "expressionstatement", }, - Call { - "arguments": Array [], - "kind": "call", - "what": StaticLookup { + ExpressionStatement { + "expression": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "foo", - }, - "what": Identifier { + "offset": Identifier { "kind": "identifier", - "name": "parent", + "name": "class", + }, + "what": Name { + "kind": "name", + "name": "foo", "resolution": "uqn", }, }, - }, - StaticLookup { - "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", - "name": "class", - }, - "what": Identifier { - "kind": "identifier", - "name": "foo", - "resolution": "uqn", - }, + "kind": "expressionstatement", }, ExpressionStatement { "expression": Call { - "arguments": Array [], + "arguments": [], "kind": "call", "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "foo", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "this", @@ -354,28 +369,30 @@ Program { }, "kind": "expressionstatement", }, - StaticLookup { - "kind": "staticlookup", - "offset": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "bar", - }, - "what": Identifier { - "kind": "identifier", - "name": "foo", - "resolution": "uqn", + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, }, + "kind": "expressionstatement", }, ExpressionStatement { "expression": Call { - "arguments": Array [], + "arguments": [], "kind": "call", "what": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "qux", }, "what": OffsetLookup { @@ -383,24 +400,23 @@ Program { "offset": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"baz\\"", + "raw": ""baz"", "unicode": false, "value": "baz", }, "what": StaticLookup { "kind": "staticlookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "bar", }, "what": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "foo", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "this", @@ -413,23 +429,21 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test variables Dynamic variables 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -439,7 +453,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"bar\\"", + "raw": ""bar"", "unicode": false, "value": "bar", }, @@ -450,15 +464,12 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": Variable { - "byref": false, "curly": false, "kind": "variable", "name": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -469,7 +480,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"bar\\"", + "raw": ""bar"", "unicode": false, "value": "bar", }, @@ -480,13 +491,11 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": true, "kind": "variable", "name": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -494,7 +503,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"bar\\"", + "raw": ""bar"", "unicode": false, "value": "bar", }, @@ -505,7 +514,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"bar\\"", + "raw": ""bar"", "unicode": false, "value": "bar", }, @@ -520,7 +529,6 @@ Program { "offset": Bin { "kind": "bin", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -528,14 +536,13 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"bar\\"", + "raw": ""bar"", "unicode": false, "value": "bar", }, "type": ".", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "foo", @@ -545,7 +552,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"bar\\"", + "raw": ""bar"", "unicode": false, "value": "bar", }, @@ -553,19 +560,18 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test variables Encaps var offset 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -573,21 +579,25 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"{$a[1]}\\"", + "raw": ""{$a[1]}"", "type": "string", - "value": Array [ - OffsetLookup { - "kind": "offsetlookup", - "offset": Number { - "kind": "number", - "value": "1", - }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "a", + "value": [ + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -598,7 +608,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -606,24 +615,28 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"{$a[\\"a\\"]}\\"", + "raw": ""{$a["a"]}"", "type": "string", - "value": Array [ - OffsetLookup { - "kind": "offsetlookup", - "offset": String { - "isDoubleQuote": true, - "kind": "string", - "raw": "\\"a\\"", - "unicode": false, - "value": "a", - }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "a", + "value": [ + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": true, + "kind": "string", + "raw": ""a"", + "unicode": false, + "value": "a", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -634,7 +647,6 @@ Program { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -642,23 +654,26 @@ Program { "operator": "=", "right": Encapsed { "kind": "encapsed", - "raw": "\\"{$a[$b]}\\"", + "raw": ""{$a[$b]}"", "type": "string", - "value": Array [ - OffsetLookup { - "kind": "offsetlookup", - "offset": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "b", - }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "a", + "value": [ + EncapsedPart { + "curly": false, + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "b", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, }, + "kind": "encapsedpart", + "syntax": "complex", }, ], }, @@ -666,17 +681,16 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test variables Variable chains 1`] = ` Program { - "children": Array [ - StaticLookup { - "kind": "staticlookup", - "offset": OffsetLookup { + "children": [ + ExpressionStatement { + "expression": OffsetLookup { "kind": "offsetlookup", "offset": Number { "kind": "number", @@ -688,45 +702,58 @@ Program { "kind": "number", "value": "1", }, - "what": Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "a", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "a", + }, + "what": Name { + "kind": "name", + "name": "foo", + "resolution": "uqn", + }, }, }, }, - "what": Identifier { - "kind": "identifier", - "name": "foo", - "resolution": "uqn", - }, + "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test variables array destructuring 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": List { - "arguments": Array [ - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "id1", + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "id1", + }, }, - Variable { - "byref": false, - "curly": false, - "kind": "variable", - "name": "name1", + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "name1", + }, }, ], "kind": "list", @@ -740,7 +767,6 @@ Program { "value": "0", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "data", @@ -750,19 +776,18 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], "kind": "program", } `; exports[`Test variables default variables 1`] = ` Program { - "children": Array [ + "children": [ ExpressionStatement { "expression": Assign { "kind": "assign", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -771,7 +796,7 @@ Program { "right": String { "isDoubleQuote": true, "kind": "string", - "raw": "\\"foo\\"", + "raw": ""foo"", "unicode": false, "value": "foo", }, @@ -779,17 +804,14 @@ Program { "kind": "expressionstatement", }, ExpressionStatement { - "expression": Assign { - "kind": "assign", + "expression": AssignRef { + "kind": "assignref", "left": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "b", }, - "operator": "=", "right": Variable { - "byref": true, "curly": false, "kind": "variable", "name": "c", @@ -802,12 +824,11 @@ Program { "kind": "assign", "left": PropertyLookup { "kind": "propertylookup", - "offset": ConstRef { - "kind": "constref", + "offset": Identifier { + "kind": "identifier", "name": "b", }, "what": Variable { - "byref": false, "curly": false, "kind": "variable", "name": "a", @@ -823,7 +844,683 @@ Program { "kind": "expressionstatement", }, ], - "errors": Array [], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables fix #167 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Call { + "arguments": [], + "kind": "call", + "what": StaticLookup { + "kind": "staticlookup", + "offset": Literal { + "kind": "literal", + "value": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'baz'", + "unicode": false, + "value": "baz", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Call { + "arguments": [], + "kind": "call", + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'baz'", + "unicode": false, + "value": "baz", + }, + "what": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables fix #185 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "0", + }, + "parenthesizedExpression": true, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "parenthesizedExpression": true, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "0", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "0", + }, + "parenthesizedExpression": true, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "1", + }, + "parenthesizedExpression": true, + "what": OffsetLookup { + "kind": "offsetlookup", + "offset": Number { + "kind": "number", + "value": "0", + }, + "parenthesizedExpression": true, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": StaticLookup { + "kind": "staticlookup", + "offset": Identifier { + "kind": "identifier", + "name": "bar", + }, + "what": New { + "arguments": [], + "kind": "new", + "parenthesizedExpression": true, + "what": Name { + "kind": "name", + "name": "Foo", + "resolution": "uqn", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "wrap", + }, + "what": Call { + "arguments": [ + PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "resource", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "this", + }, + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables fix 248 - broken ast for \`$$$$$\` 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables fix 248 - test curly 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": EncapsedPart { + "curly": false, + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": PropertyLookup { + "kind": "propertylookup", + "offset": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + "kind": "expressionstatement", + }, + ExpressionStatement { + "expression": OffsetLookup { + "kind": "offsetlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + "what": PropertyLookup { + "kind": "propertylookup", + "offset": Identifier { + "kind": "identifier", + "name": "foo_", + }, + "what": Variable { + "curly": false, + "kind": "variable", + "name": "bar", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables fix 253 - can't be parsed \`global\` with multiple \`$\` 1`] = ` +Program { + "children": [ + Global { + "items": [ + Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "foo", + }, + }, + ], + "kind": "global", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables simple variable #2 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Variable { + "curly": true, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables simple variable #3 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Variable { + "curly": true, + "kind": "variable", + "name": Bin { + "kind": "bin", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "right": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "'foo'", + "unicode": false, + "value": "foo", + }, + "type": "+", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables simple variable #4 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables simple variable 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + "operator": "=", + "right": Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`Test variables valid offset lookup 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": StaticLookup { + "kind": "staticlookup", + "offset": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": Variable { + "curly": false, + "kind": "variable", + "name": "property", + }, + }, + }, + }, + }, + "what": Call { + "arguments": [ + Variable { + "curly": false, + "kind": "variable", + "name": "var", + }, + ], + "kind": "call", + "what": Name { + "kind": "name", + "name": "get_class", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], "kind": "program", } `; diff --git a/test/snapshot/__snapshots__/yield.test.js.snap b/test/snapshot/__snapshots__/yield.test.js.snap new file mode 100644 index 000000000..826653218 --- /dev/null +++ b/test/snapshot/__snapshots__/yield.test.js.snap @@ -0,0 +1,263 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`yield assign (key and value) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "data", + }, + "operator": "=", + "right": Yield { + "key": Variable { + "curly": false, + "kind": "variable", + "name": "key", + }, + "kind": "yield", + "parenthesizedExpression": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yield assign (parens) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "data", + }, + "operator": "=", + "right": Yield { + "key": null, + "kind": "yield", + "parenthesizedExpression": true, + "value": Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yield assign 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Assign { + "kind": "assign", + "left": Variable { + "curly": false, + "kind": "variable", + "name": "data", + }, + "operator": "=", + "right": Yield { + "key": null, + "kind": "yield", + "value": Variable { + "curly": false, + "kind": "variable", + "name": "value", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yield expression as generator key 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + ExpressionStatement { + "expression": Yield { + "key": Encapsed { + "kind": "encapsed", + "raw": ""bar {$test}" ", + "type": "string", + "value": [ + EncapsedPart { + "curly": false, + "expression": String { + "isDoubleQuote": false, + "kind": "string", + "raw": "bar ", + "unicode": false, + "value": "bar ", + }, + "kind": "encapsedpart", + "syntax": null, + }, + EncapsedPart { + "curly": false, + "expression": Variable { + "curly": false, + "kind": "variable", + "name": "test", + }, + "kind": "encapsedpart", + "syntax": "complex", + }, + ], + }, + "kind": "yield", + "value": Number { + "kind": "number", + "value": "123", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yield inside function 1`] = ` +Program { + "children": [ + _Function { + "arguments": [], + "attrGroups": [], + "body": Block { + "children": [ + ExpressionStatement { + "expression": Yield { + "key": null, + "kind": "yield", + "value": Variable { + "curly": false, + "kind": "variable", + "name": "i", + }, + }, + "kind": "expressionstatement", + }, + ], + "kind": "block", + }, + "byref": false, + "kind": "function", + "name": Identifier { + "kind": "identifier", + "name": "foo", + }, + "nullable": false, + "type": null, + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yield null 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Yield { + "key": null, + "kind": "yield", + "value": null, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yield simple (key and value) 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Yield { + "key": Variable { + "curly": false, + "kind": "variable", + "name": "id", + }, + "kind": "yield", + "value": Variable { + "curly": false, + "kind": "variable", + "name": "fields", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yield simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": Yield { + "key": null, + "kind": "yield", + "value": Variable { + "curly": false, + "kind": "variable", + "name": "i", + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/__snapshots__/yieldfrom.test.js.snap b/test/snapshot/__snapshots__/yieldfrom.test.js.snap new file mode 100644 index 000000000..b75e85d8b --- /dev/null +++ b/test/snapshot/__snapshots__/yieldfrom.test.js.snap @@ -0,0 +1,141 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`yieldfrom array 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": YieldFrom { + "kind": "yieldfrom", + "value": Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "3", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "4", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yieldfrom new 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": YieldFrom { + "kind": "yieldfrom", + "value": New { + "arguments": [ + Array { + "items": [ + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "5", + }, + }, + Entry { + "byRef": false, + "key": null, + "kind": "entry", + "unpack": false, + "value": Number { + "kind": "number", + "value": "6", + }, + }, + ], + "kind": "array", + "shortForm": true, + }, + ], + "kind": "new", + "what": Name { + "kind": "name", + "name": "ArrayIterator", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yieldfrom return 1`] = ` +Program { + "children": [ + Return { + "expr": YieldFrom { + "kind": "yieldfrom", + "value": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "nine_ten", + "resolution": "uqn", + }, + }, + }, + "kind": "return", + }, + ], + "errors": [], + "kind": "program", +} +`; + +exports[`yieldfrom simple 1`] = ` +Program { + "children": [ + ExpressionStatement { + "expression": YieldFrom { + "kind": "yieldfrom", + "value": Call { + "arguments": [], + "kind": "call", + "what": Name { + "kind": "name", + "name": "from", + "resolution": "uqn", + }, + }, + }, + "kind": "expressionstatement", + }, + ], + "errors": [], + "kind": "program", +} +`; diff --git a/test/snapshot/acid.test.js b/test/snapshot/acid.test.js index ec435a896..f3bde007b 100644 --- a/test/snapshot/acid.test.js +++ b/test/snapshot/acid.test.js @@ -1,8 +1,10 @@ -const parser = require('../main'); +const parser = require("../main"); -describe('Acid', () => { - it('level 1', () => { - expect(parser.parseCode(`#!/usr/bin/php +describe("Acid", () => { + it("level 1", () => { + expect( + parser.parseCode( + `#!/usr/bin/php { - it('deference array', () => { +describe("Array without keys", () => { + it("deference array", () => { expect( parser.parseEval( - ['$a = [', '"a", "b"', ']($foo)[$foo->bar()[1]]->foo()'].join('\r'), + ["$a = [", '"a", "b"', "]($foo)[$foo->bar()[1]]->foo()"].join("\r"), ), ).toMatchSnapshot(); }); - it('of strings', () => { + it("of strings", () => { expect( parser.parseEval('array("item1", "item2", "item3")'), ).toMatchSnapshot(); }); - it('of numbers', () => { - expect(parser.parseEval('array(1, 2.5, 0x1000)')).toMatchSnapshot(); + it("of numbers", () => { + expect(parser.parseEval("array(1, 2.5, 0x1000)")).toMatchSnapshot(); }); - it('of strings and numbers', () => { + it("of strings and numbers", () => { expect(parser.parseEval('array(1, "item2", 3, "item4")')).toMatchSnapshot(); }); - it('of variables', () => { - expect(parser.parseEval('array($obj1, $obj2, $obj3)')).toMatchSnapshot(); + it("of variables", () => { + expect(parser.parseEval("array($obj1, $obj2, $obj3)")).toMatchSnapshot(); }); - it('of objects', () => { + it("of objects", () => { expect( - parser.parseEval('[new foo(), new stdClass(), new bar()]'), + parser.parseEval("[new foo(), new stdClass(), new bar()]"), ).toMatchSnapshot(); }); - it('of arrays', () => { + it("of arrays", () => { expect( parser.parseEval(` array( @@ -44,14 +44,101 @@ describe('Array without keys', () => { ).toMatchSnapshot(); }); - describe('mixed tests / coverage', function() { - it('test empty array', function() { - expect(parser.parseEval('$a = []; $b = array();')).toMatchSnapshot(); + describe("mixed tests / coverage", function () { + it("test empty array", function () { + expect(parser.parseEval("$a = []; $b = array();")).toMatchSnapshot(); }); - it('test short form / keys', function() { + it("test short form / keys", function () { expect( parser.parseEval('[0 => &$foo, $bar => "foobar"];'), ).toMatchSnapshot(); }); }); + + it("single and empty", () => { + expect(parser.parseEval("array()")).toMatchSnapshot(); + }); + + it("single and empty (short form)", () => { + expect(parser.parseEval("[]")).toMatchSnapshot(); + }); + + it("array without trailing commas", () => { + expect(parser.parseEval("['foo', 'bar']")).toMatchSnapshot(); + }); + + it("array without trailing commas #2", () => { + expect(parser.parseEval("['foo', 'bar']")).toMatchSnapshot(); + }); + + it("array with trailing commas #3", () => { + expect(parser.parseEval("['foo', 'bar',]")).toMatchSnapshot(); + }); + + it("array with trailing commas #4", () => { + expect(parser.parseEval("['foo', 'bar' ,]")).toMatchSnapshot(); + }); + + it("array with trailing commas #5", () => { + expect(parser.parseEval("['foo', 'bar' , ]")).toMatchSnapshot(); + }); + + it("array with multiple trailing commas", () => { + expect(parser.parseEval("['foo', 'bar',,]")).toMatchSnapshot(); + }); + + it("array with multiple trailing commas #2", () => { + expect(parser.parseEval("['foo', 'bar',,,,,]")).toMatchSnapshot(); + }); + + it("array with empty values", () => { + expect(parser.parseEval("[,,,'foo',,, 'bar',,,'baz']")).toMatchSnapshot(); + }); + + it("array with empty values #2", () => { + expect(parser.parseEval("[,,,'foo',,, 'bar',,,'baz',]")).toMatchSnapshot(); + }); + + it("array with empty values #3", () => { + expect(parser.parseEval("[,,,'foo',,, 'bar',,,'baz',,]")).toMatchSnapshot(); + }); + + it("non empty array", () => { + expect( + parser.parseEval( + "$var = [true, 1, 1.1, 'test', \"test\", [1, 2, 3], new Foo(), call(), null];", + ), + ).toMatchSnapshot(); + }); + + it("spread operator", () => { + expect( + parser.parseEval(` +$var = ['banana', 'orange', ...$parts, 'watermelon']; +$var = [...$arr1]; +$var = [0, ...$arr1]; +$var = array(...$arr1, ...$arr2, 111); +$var = [...$arr1, ...$arr1]; +$var = [...getArr(), 'c']; +$var = [...new ArrayIterator(['a', 'b', 'c'])]; +`), + ).toMatchSnapshot(); + }); + + it("spread operator with reference", function () { + const astErr = parser.parseEval(`$var = [...&$arr];`, { + parser: { + suppressErrors: true, + }, + }); + expect(astErr).toMatchSnapshot(); + }); + + it("byRef", () => { + expect( + parser.parseEval(` +$var = [1, 'test', &$var, 'test' => &$var]; +`), + ).toMatchSnapshot(); + }); }); diff --git a/test/snapshot/arrowfunc.test.js b/test/snapshot/arrowfunc.test.js new file mode 100644 index 000000000..1031e0cda --- /dev/null +++ b/test/snapshot/arrowfunc.test.js @@ -0,0 +1,53 @@ +const parser = require("../main"); + +describe("arrow function", () => { + it.each([ + ["simple", '$var = fn() => "something";'], + ["argument", '$var = fn($arg) => "something";'], + ["argument by ref", '$var = fn(&$arg) => "something";'], + ["arguments", '$var = fn($arg, $arg, $arg) => "something";'], + ["return type", '$var = fn(): ?string => "something";'], + ["inside call", `call(fn($arg) => $arg);`], + ])("%s", function (_, code) { + expect(parser.parseEval(code)).toMatchSnapshot(); + }); + + it("error / fn passes on php7.3", () => { + expect( + parser.parseEval(`function fn($arg) { return $arg; }`, { + parser: { + version: "7.3", // disable the php 7.4 support + }, + }), + ).toMatchSnapshot(); + }); + it("error / fn fails on php7.4", () => { + expect( + parser.parseEval(`function fn($arg) { return $arg; }`, { + parser: { + version: "7.4", // enable the php 7.4 support + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); + }); + it("error / empty not allowed", () => { + expect( + parser.parseEval("$var = fn() => ;", { + parser: { + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); + }); + it("error / arrow functions before PHP 7.4", () => { + expect( + parser.parseEval(`$fn1 = fn($x) => $x + $y;`, { + parser: { + version: "7.3", + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/assign.test.js b/test/snapshot/assign.test.js new file mode 100644 index 000000000..696e532b3 --- /dev/null +++ b/test/snapshot/assign.test.js @@ -0,0 +1,67 @@ +const parser = require("../main"); + +describe("assign", () => { + it("simple", () => { + expect(parser.parseEval("$var = 1;")).toMatchSnapshot(); + }); + it("variable", () => { + expect(parser.parseEval("$var = $var;")).toMatchSnapshot(); + }); + it("multiple", () => { + expect(parser.parseEval("$var = $var = $var;")).toMatchSnapshot(); + }); + it("+=", () => { + expect(parser.parseEval("$var += $var;")).toMatchSnapshot(); + }); + it("-=", () => { + expect(parser.parseEval("$var -= $var;")).toMatchSnapshot(); + }); + it("*=", () => { + expect(parser.parseEval("$var *= $var;")).toMatchSnapshot(); + }); + it("**=", () => { + expect(parser.parseEval("$var **= $var;")).toMatchSnapshot(); + }); + it("/=", () => { + expect(parser.parseEval("$var /= $var;")).toMatchSnapshot(); + }); + it(".=", () => { + expect(parser.parseEval("$var .= $var;")).toMatchSnapshot(); + }); + it("%=", () => { + expect(parser.parseEval("$var %= $var;")).toMatchSnapshot(); + }); + it("&=", () => { + expect(parser.parseEval("$var &= $var;")).toMatchSnapshot(); + }); + it("|=", () => { + expect(parser.parseEval("$var |= $var;")).toMatchSnapshot(); + }); + it("^=", () => { + expect(parser.parseEval("$var ^= $var;")).toMatchSnapshot(); + }); + it("<<=", () => { + expect(parser.parseEval("$var <<= $var;")).toMatchSnapshot(); + }); + it(">>=", () => { + expect(parser.parseEval("$var >>= $var;")).toMatchSnapshot(); + }); + it("??=", () => { + expect(parser.parseEval("$var ??= $var;")).toMatchSnapshot(); + }); + it("??= with bin", () => { + expect(parser.parseEval("$var ??= $var + 10;")).toMatchSnapshot(); + }); + it("??= (php < 7)", function () { + const astErr = parser.parseEval(`$var ??= $var;`, { + parser: { + version: "5.6", + suppressErrors: true, + }, + }); + expect(astErr).toMatchSnapshot(); + }); + it("with ref", () => { + expect(parser.parseEval("$bar = &$foo;")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/ast.test.js b/test/snapshot/ast.test.js index a6a421ab6..812d6c3cc 100644 --- a/test/snapshot/ast.test.js +++ b/test/snapshot/ast.test.js @@ -1,30 +1,44 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test AST structure", function() { - it('fix #127 - echo statements', () => { +describe("Test AST structure", function () { + it("fix #127 - echo statements", () => { expect(parser.parseEval('echo "hello"; ?> world')).toMatchSnapshot(); }); - it('fix #127 - inline', function() { - expect(parser.parseEval('?>?>?>')).toMatchSnapshot(); + it("fix #127 - inline", function () { + expect(parser.parseEval("?>?>?>")).toMatchSnapshot(); }); - it("#176 - lost `?>` in program node", function() { - expect(parser.parseCode(`` in program node", function () { + expect( + parser.parseCode( + ``, null, { - ast: { - withPositions: true, - withSource: true - } - })).toMatchSnapshot(); - }) + ?>`, + null, + { + ast: { + withPositions: true, + withSource: true, + }, + }, + ), + ).toMatchSnapshot(); + }); - it('test program', function() { - expect(parser.parseEval('')).toMatchSnapshot(); + it("test program", function () { + expect(parser.parseEval("")).toMatchSnapshot(); }); - it("test syntax error", function() { - const parse = function() { + it("test syntax error", function () { + const parse = function () { parser.parseEval(` $a = 1 $b = 2 @@ -32,34 +46,34 @@ describe("Test AST structure", function() { }; expect(parse).toThrowErrorMatchingSnapshot(); }); - it("test inline", function() { + it("test inline", function () { expect( - parser.parseCode("Hello \n !") + parser.parseCode("Hello \n !"), ).toMatchSnapshot(); }); - it("fix #120", function() { - expect( - parser.parseCode("\r\n !") - ).toMatchSnapshot(); + it("fix #120", function () { + expect(parser.parseCode("\r\n !")).toMatchSnapshot(); }); - it("test magics", function() { + it("test invalid namespace separator", function () { expect( - parser.parseEval("echo __FILE__, __DIR__;") + parser.parseCode("\r\n !", { + parser: { suppressErrors: true }, + }), ).toMatchSnapshot(); }); - it("test shell", function() { - expect( - parser.parseEval("echo `ls -larth`;") - ).toMatchSnapshot(); + + it("test magics", function () { + expect(parser.parseEval("echo __FILE__, __DIR__;")).toMatchSnapshot(); }); - it("test clone", function() { - expect( - parser.parseEval("$a = clone $var;") - ).toMatchSnapshot(); + it("test shell", function () { + expect(parser.parseEval("echo `ls -larth`;")).toMatchSnapshot(); }); - it("test echo, isset, unset, empty", function() { + it("test clone", function () { + expect(parser.parseEval("$a = clone $var;")).toMatchSnapshot(); + }); + it("test echo, isset, unset, empty", function () { expect( parser.parseEval(` echo ($expr) ? "ok" : "ko"; @@ -67,44 +81,38 @@ describe("Test AST structure", function() { isset($foo, $bar); unset($var); empty($var); - `) + `), ).toMatchSnapshot(); }); - it("test constants", function() { - expect( - parser.parseEval("const FOO = 3.14;") - ).toMatchSnapshot(); + it("test constants", function () { + expect(parser.parseEval("const FOO = 3.14;")).toMatchSnapshot(); }); - it("test eval", function() { - expect( - parser.parseEval('eval("return true;");') - ).toMatchSnapshot(); + it("test eval", function () { + expect(parser.parseEval('eval("return true;");')).toMatchSnapshot(); }); - it("test die/exit", function() { + it("test die/exit", function () { expect( parser.parseEval(` die("bye"); exit(-1); - `) + `), ).toMatchSnapshot(); }); - it("test coalesce operator", function() { - expect( - parser.parseEval("$var = $a ?? true;") - ).toMatchSnapshot(); + it("test coalesce operator", function () { + expect(parser.parseEval("$var = $a ?? true;")).toMatchSnapshot(); }); - it("test include / require", function() { + it("test include / require", function () { expect( parser.parseEval(` include "file.php"; include_once (PATH . "/file.php"); require "req.php"; require_once "file.php"; - `) + `), ).toMatchSnapshot(); }); }); diff --git a/test/snapshot/attributes.test.js b/test/snapshot/attributes.test.js new file mode 100644 index 000000000..843001e80 --- /dev/null +++ b/test/snapshot/attributes.test.js @@ -0,0 +1,318 @@ +const parser = require("../main"); + +describe("Parse Attributes", () => { + it("can parse class attributes", () => { + expect( + parser.parseEval(` + #[Deprecated] + #[replace("use NewClass")] + class DepClass {} + `), + ).toMatchSnapshot(); + }); + it("can parse method attributes", () => { + expect( + parser.parseEval(` + class Test { + #[Pure] + function m() {} + } + `), + ).toMatchSnapshot(); + }); + it("can parse param attributes", () => { + expect( + parser.parseEval(` + function f( + #[Unsigned] + int $n) {} + `), + ).toMatchSnapshot(); + }); + it("can parse params with comments", () => { + expect( + parser.parseEval( + `// Line 1 + #[ Pure ( ) /* Pure */ ] + // Line 3 + #[ + // Try using b + Deprecated + ] + function a(#[ Unsigned ] $a) {} + `, + { + parser: { + extractDoc: true, + }, + }, + ), + ).toMatchSnapshot(); + }); + it("can parse parms with array values", () => { + expect( + parser.parseEval(` + #[List(["a"=>1, 'b' => Test::class, 'c'=>[]])] + function a() {} + `), + ).toMatchSnapshot(); + }); + it("can parse params with argument labels", () => { + expect( + parser.parseEval(` + #[MyAttribute(value: 1234)] + function a() {} + `), + ).toMatchSnapshot(); + }); + it("can parse params with mathematical expressions", () => { + expect( + parser.parseEval( + ` + #[Att1(-20 * (+10 / 5) % 2 + 8 ** 2 - +-2)] + class A {} + `, + { parser: { extractDoc: true } }, + ), + ).toMatchSnapshot(); + }); + it("can parse params with bitwise operations", () => { + expect( + parser.parseEval( + ` + #[Att1(Att1::FOO | Att1::BAR)] + #[Att2(Att2::FOO & Att2::BAR)] + #[Att3(Att3::FOO ^ Att3::BAR)] + #[Att4(~ Att4::BAR)] + #[Att5(Att5::BAR >> 1)] + #[Att6(Att6::BAR << 1)] + class A {} + `, + { parser: { extractDoc: true } }, + ), + ).toMatchSnapshot(); + }); + it("can parse params with logical operations", () => { + expect( + parser.parseEval( + ` + #[Att1(Att1::FOO || Att1::BAR)] + #[Att2(Att2::FOO && Att2::BAR)] + #[Att3(Att3::FOO or Att3::BAR)] + #[Att4(Att4::FOO and Att4::BAR)] + #[Att5(Att5::FOO xor Att5::BAR)] + #[Att6(!Att6::FOO)] + class A {} + `, + { parser: { extractDoc: true } }, + ), + ).toMatchSnapshot(); + }); + it("can parse params with string concatenation", () => { + expect( + parser.parseEval( + ` + #[Att1(Att1::FOO . Att1::BAR)] + #[Att1(Att1::FOO.Att1::BAR)] + #[Att2("a" . "b")] + #[Att2("a"."b")] + #[Att2('a' . "b")] + #[Att2('a'."b")] + #[Att2("a" . 'b')] + #[Att2("a".'b')] + #[Att2('a' . 'b')] + #[Att2('a'.'b')] + #[Att1(Att1::FOO . "b")] + #[Att1(Att1::FOO."b")] + #[Att1(Att1::FOO . 'b')] + #[Att1(Att1::FOO.'b')] + #[Att1("a" . Att1::BAR)] + #[Att1("a".Att1::BAR)] + #[Att1('a' . Att1::BAR)] + #[Att1('a'.Att1::BAR)] + #[Att1(Att1::FOO + .Att1::BAR + )] + #[Att1(Att1::FOO. + Att1::BAR + )] + class A {} + `, + { parser: { extractDoc: true } }, + ), + ).toMatchSnapshot(); + }); + it("can parse params with end characters", () => { + expect( + parser.parseEval(` + #[End(["])}>"])] + class End {} + `), + ).toMatchSnapshot(); + }); + it("can parse multi-line attributes", () => { + expect( + parser.parseEval(` + #[ + One(), + Two(), + Three() + ] + #[Four] + class Multi {} + `), + ).toMatchSnapshot(); + }); + it("can parse anonymous function attributes", () => { + expect( + parser.parseEval(` + $a = #[Pure] fn() => true; + $b = #[A] function() {}; + `), + ).toMatchSnapshot(); + }); + it("can't parse anonymous function attributes in PHP < 8", () => { + expect(() => + parser.parseEval( + ` + $a = #[Pure] fn() => true; + `, + { + parser: { + version: "7.4", + }, + }, + ), + ).toThrow(SyntaxError); + }); + it("can parse class property attributes", () => { + expect( + parser.parseEval(` + class A { + #[B] + public B $b; + #[C] + private C $c; + #[D] + protected $d; + } + `), + ).toMatchSnapshot(); + }); + it("can parse class const attributes", () => { + expect( + parser.parseEval(` + class A { + #[B] + const B = 1; + } + `), + ).toMatchSnapshot(); + }); + it("can parse anon-class attributes", () => { + expect(parser.parseEval(`$a = new #[T] class {};`)).toMatchSnapshot(); + }); + it("can't parse anon-class attributes in PHP < 8", () => { + expect(() => + parser.parseEval(`$a = new #[T] class {};`, { + parser: { + version: "7.4", + }, + }), + ).toThrow(SyntaxError); + }); + it("can parse interface attributes", () => { + expect( + parser.parseEval(` + #[A] + interface b { + #[C] + const D = 0; + #[E] + public function f(); + } + `), + ).toMatchSnapshot(); + }); + it("can parse attributes in inner statements", () => { + expect( + parser.parseEval(` + namespace A { + function b() { + return #[C] fn() => #[Pure] function() {}; + } + }`), + ).toMatchSnapshot(); + }); + it("can parse attributes with namespace", () => { + expect( + parser.parseEval(` + #[\\JetBrains\\PhpStorm\\Pure] + function b() {} + `), + ).toMatchSnapshot(); + }); + + it("doesnt repeat attributes from previous function", () => { + expect( + parser.parseEval(` + class a { + #[Att1] + function b(){} + function c(){} + function d(){} + } + `), + ).toMatchSnapshot(); + }); + + it("parses attributes as comments for PHP < 8", () => { + expect( + parser.parseEval( + ` + #[Att1] + class a { + #[Att2] + function b(){} + } + `, + { + parser: { + version: "7.4", + extractDoc: true, + }, + }, + ), + ).toMatchSnapshot(); + }); + + it("parses this complicated edge case", () => { + expect( + parser.parseEval( + ` + use Symfony\\Component\\Validator\\Constraints as Assert; + + class ValueModel + { + #[ + Assert\\NotBlank(allowNull: false, groups: ['foo']), + Assert\\Length(max: 255, groups: ['foo']), + ] + public ?string $value = null; + }`, + ), + ).toMatchSnapshot(); + }); + + it("doesnt parse attributes for assignments", () => { + expect( + parser.parseEval( + ` + #[Att1] + $a = 1; + `, + { parser: { extractDoc: true } }, + ), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/bin.test.js b/test/snapshot/bin.test.js new file mode 100644 index 000000000..b8c7e1df4 --- /dev/null +++ b/test/snapshot/bin.test.js @@ -0,0 +1,139 @@ +const parser = require("../main"); + +describe("bin", () => { + it("|", () => { + expect(parser.parseEval("$foo | $bar;")).toMatchSnapshot(); + }); + it("&", () => { + expect(parser.parseEval("$foo & $bar;")).toMatchSnapshot(); + }); + it("^", () => { + expect(parser.parseEval("$foo ^ $bar;")).toMatchSnapshot(); + }); + it(".", () => { + expect(parser.parseEval("$foo . $bar;")).toMatchSnapshot(); + }); + it("+", () => { + expect(parser.parseEval("$foo + $bar;")).toMatchSnapshot(); + }); + it("-", () => { + expect(parser.parseEval("$foo - $bar;")).toMatchSnapshot(); + }); + it("*", () => { + expect(parser.parseEval("$foo * $bar;")).toMatchSnapshot(); + }); + it("/", () => { + expect(parser.parseEval("$foo / $bar;")).toMatchSnapshot(); + }); + it("%", () => { + expect(parser.parseEval("$foo % $bar;")).toMatchSnapshot(); + }); + it("**", () => { + expect(parser.parseEval("$foo ** $bar;")).toMatchSnapshot(); + }); + it("<<", () => { + expect(parser.parseEval("$foo << $bar;")).toMatchSnapshot(); + }); + it(">>", () => { + expect(parser.parseEval("$foo >> $bar;")).toMatchSnapshot(); + }); + it("||", () => { + expect(parser.parseEval("$foo || $bar;")).toMatchSnapshot(); + }); + it("or", () => { + expect(parser.parseEval("$foo or $bar;")).toMatchSnapshot(); + }); + it("&&", () => { + expect(parser.parseEval("$foo && $bar;")).toMatchSnapshot(); + }); + it("and", () => { + expect(parser.parseEval("$foo and $bar;")).toMatchSnapshot(); + }); + it("xor", () => { + expect(parser.parseEval("$foo xor $bar;")).toMatchSnapshot(); + }); + it("===", () => { + expect(parser.parseEval("$foo === $bar;")).toMatchSnapshot(); + }); + it("!==", () => { + expect(parser.parseEval("$foo !== $bar;")).toMatchSnapshot(); + }); + it("==", () => { + expect(parser.parseEval("$foo == $bar;")).toMatchSnapshot(); + }); + it("!=", () => { + expect(parser.parseEval("$foo != $bar;")).toMatchSnapshot(); + }); + it("<", () => { + expect(parser.parseEval("$foo < $bar;")).toMatchSnapshot(); + }); + it(">", () => { + expect(parser.parseEval("$foo > $bar;")).toMatchSnapshot(); + }); + it("<=", () => { + expect(parser.parseEval("$foo <= $bar;")).toMatchSnapshot(); + }); + it(">=", () => { + expect(parser.parseEval("$foo >= $bar;")).toMatchSnapshot(); + }); + it("<=>", () => { + expect(parser.parseEval("$foo <=> $bar;")).toMatchSnapshot(); + }); + it("instanceof", () => { + expect(parser.parseEval("$foo instanceof MyClass;")).toMatchSnapshot(); + }); + it("instanceof variable", () => { + expect(parser.parseEval("$foo instanceof $var;")).toMatchSnapshot(); + }); + it("instanceof parent", () => { + expect(parser.parseEval("$foo instanceof parent;")).toMatchSnapshot(); + }); + it("instanceof self", () => { + expect(parser.parseEval("$foo instanceof self;")).toMatchSnapshot(); + }); + it("instanceof static", () => { + expect(parser.parseEval("$foo instanceof static;")).toMatchSnapshot(); + }); + it("multiple instanceof static", () => { + expect( + parser.parseEval("$foo instanceof static && $bar instanceof self;"), + ).toMatchSnapshot(); + }); + + it("??", () => { + expect(parser.parseEval("$foo ?? $bar;")).toMatchSnapshot(); + }); + it("** right-associative", () => { + expect(parser.parseEval("$a ** $b ** $c;")).toMatchSnapshot(); + }); + it("?? right-associative", () => { + expect(parser.parseEval("$a ?? $b ?? $c;")).toMatchSnapshot(); + }); + it("?? (php < 7)", function () { + const astErr = parser.parseEval(`$var ?? $var;`, { + parser: { + version: "5.6", + suppressErrors: true, + }, + }); + expect(astErr).toMatchSnapshot(); + }); + it("assign", () => { + expect(parser.parseEval("$var = $var + $var;")).toMatchSnapshot(); + }); + it("multiple", () => { + expect(parser.parseEval("$var = $var + $var + $var;")).toMatchSnapshot(); + }); + it("parens", () => { + expect(parser.parseEval("($var + $var);")).toMatchSnapshot(); + }); + it("parens around `and`", () => { + expect(parser.parseEval("$var = ($var and $var);")).toMatchSnapshot(); + }); + it("parens around `xor`", () => { + expect(parser.parseEval("$var = ($var xor $var);")).toMatchSnapshot(); + }); + it("parens around `or`", () => { + expect(parser.parseEval("$var = ($var or $var);")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/block.test.js b/test/snapshot/block.test.js new file mode 100644 index 000000000..43dbe72ef --- /dev/null +++ b/test/snapshot/block.test.js @@ -0,0 +1,83 @@ +const parser = require("../main"); + +describe("block", () => { + it.each([ + ["single", "{ $var = 1; }"], + ["empty function block", "function foo() { /* 1 */ }"], + ["empty class block", "class foo { /* 1 */ }"], + ["empty method block", "class foo { function bar() { /* 1 */ } }"], + ["empty namespace block", "namespace foo { /* 1 */ }"], + ["empty declare block", "declare(tick=1) { /* 1 */ }"], + ["empty declare short form", "declare(tick=1): /* 1 */ ENDDECLARE;"], + ["empty switch", "switch($foo) { /* foo */ }"], + ["empty for", "for(;;) { /* foo */ }"], + ["empty foreach", "foreach($foo as $bar) { /* foo */ }"], + ["empty switch short form", "switch($foo): /* foo */ endswitch;"], + [ + "empty switch case short form", + "switch($foo): case 1: /* foo */ endswitch;", + ], + ["empty for short form", "for(;;): /* foo */ endfor;"], + [ + "empty foreach short form", + "foreach($foo as $bar): /* foo */ endforeach;", + ], + ["empty if", "if($foo) { /* foo */ }"], + ["empty statement", "/* 1 */; /* 2 */; ; /* 3 */"], + ["empty if short form", "if($foo): /* foo */ endif;"], + [ + "empty if #2 short form", + "if($foo): /* pre */ $a; /* inner */ endif; /* out */", + ], + [ + "empty if #3 short form", + "if($foo): /* foo */ elseif($bar): /* baz */ else: /* bar */ endif;", + ], + ])("%s", function (_, code) { + expect( + parser.parseEval(code, { + parser: { + extractDoc: true, + }, + }), + ).toMatchSnapshot(); + }); + it("check empty php blocks", function () { + expect( + parser.parseCode( + ` +SOME HTML OUTPUT + { + it("assign", () => { + expect(parser.parseEval("$var = true;")).toMatchSnapshot(); + }); + it("assign (2)", () => { + expect(parser.parseEval("$var = false;")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/break.test.js b/test/snapshot/break.test.js new file mode 100644 index 000000000..d4db2ec99 --- /dev/null +++ b/test/snapshot/break.test.js @@ -0,0 +1,30 @@ +const parser = require("../main"); + +describe("break", () => { + it("simple", () => { + expect(parser.parseEval("break;")).toMatchSnapshot(); + }); + it("argument 0", () => { + expect(parser.parseEval("break 0;")).toMatchSnapshot(); + }); + it("argument 1", () => { + expect(parser.parseEval("break 1;")).toMatchSnapshot(); + }); + it("argument 2", () => { + expect(parser.parseEval("break 2;")).toMatchSnapshot(); + }); + it("with parens", () => { + expect(parser.parseEval("break (1);")).toMatchSnapshot(); + }); + // Deprecated since 5.4.0 + it("with expression", () => { + expect(parser.parseEval("break $var;")).toMatchSnapshot(); + }); + it("should fail when no ';' at end", function () { + expect( + parser.parseEval("break", { + parser: { suppressErrors: true }, + }), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/buffer.test.js b/test/snapshot/buffer.test.js index 3c26bcefc..be9200ab4 100644 --- a/test/snapshot/buffer.test.js +++ b/test/snapshot/buffer.test.js @@ -1,8 +1,8 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test buffers", function() { - it("handles buffers as input", function() { - var buffer = new Buffer('echo "test"'); +describe("Test buffers", function () { + it("handles buffers as input", function () { + const buffer = new Buffer('echo "test"'); expect(parser.parseEval(buffer)).toMatchSnapshot(); }); }); diff --git a/test/snapshot/byref.test.js b/test/snapshot/byref.test.js new file mode 100644 index 000000000..6a062130a --- /dev/null +++ b/test/snapshot/byref.test.js @@ -0,0 +1,119 @@ +const parser = require("../main"); + +describe("byref", () => { + it("variable", () => { + expect(parser.parseEval("$var = &$foo;")).toMatchSnapshot(); + }); + it("static lookup", () => { + expect(parser.parseEval("$var = &foo::$bar;")).toMatchSnapshot(); + }); + it("offset lookup", () => { + expect(parser.parseEval("$foo[&$bar];")).toMatchSnapshot(); + }); + it("new class", () => { + expect( + parser.parseEval("$a =& new foo();", { + parser: { + version: "5.6", + }, + }), + ).toMatchSnapshot(); + expect(() => { + parser.parseEval("$a =& new foo();"); + }).toThrow( + "Parse Error : syntax error, unexpected 'new' (T_NEW) on line 1", + ); + }); + it("call result", () => { + expect(parser.parseEval("$a =& foo( &$b );")).toMatchSnapshot(); + }); + it("return statement", () => { + expect(parser.parseEval("return &$foo;")).toMatchSnapshot(); + }); + it("function definition", () => { + expect(parser.parseEval("function &foo( &$bar ) { }")).toMatchSnapshot(); + }); + it("variadic", () => { + expect(parser.parseEval("function test(&...$var) { }")).toMatchSnapshot(); + }); + it("foreach", () => { + expect(parser.parseEval("foreach ($arr as &$value) { }")).toMatchSnapshot(); + }); + it("foreach (key/value)", () => { + expect( + parser.parseEval("foreach ($arr as $key => &$val) { }"), + ).toMatchSnapshot(); + }); + it("closure", () => { + expect( + parser.parseEval("$var = function () use (&$message) { };"), + ).toMatchSnapshot(); + }); + // https://github.com/php/php-src/blob/php-7.4.0beta4/Zend/zend_language_parser.y#L1165 + it("callable variable", () => { + expect(parser.parseEval("$var = &$var;")).toMatchSnapshot(); + }); + it("callable variable #2", () => { + expect(parser.parseEval("$var = &${$var};")).toMatchSnapshot(); + }); + it("callable variable #3", () => { + expect(parser.parseEval("$var = &$$$var;")).toMatchSnapshot(); + }); + it("callable variable #4", () => { + expect(parser.parseEval("$var = &$var[$var];")).toMatchSnapshot(); + }); + it("callable variable #5", () => { + expect(parser.parseEval("$var = &CONSTANT[$var];")).toMatchSnapshot(); + }); + it("callable variable #6", () => { + expect(parser.parseEval("$var = &$var{$var}[$var];")).toMatchSnapshot(); + }); + it("callable variable #7", () => { + expect(parser.parseEval("$var = &$var->test();")).toMatchSnapshot(); + }); + it("callable variable #8", () => { + expect(parser.parseEval("$var = &call();")).toMatchSnapshot(); + }); + // https://github.com/php/php-src/blob/php-7.4.0beta4/Zend/zend_language_parser.y#L1167 + it("staticlookup", () => { + expect(parser.parseEval("$var = &Foo::$test;")).toMatchSnapshot(); + }); + it("staticlookup #2", () => { + expect(parser.parseEval("$var = &Foo::${$test};")).toMatchSnapshot(); + }); + it("staticlookup #3", () => { + expect(parser.parseEval("$var = &Foo::$$$test;")).toMatchSnapshot(); + }); + it("staticlookup #4", () => { + expect(parser.parseEval("$var = &$var::$test;")).toMatchSnapshot(); + }); + it("staticlookup #5", () => { + expect(parser.parseEval("$var = &$var::${$test};")).toMatchSnapshot(); + }); + it("staticlookup #6", () => { + expect(parser.parseEval("$var = &$var::$$$test;")).toMatchSnapshot(); + }); + it("staticlookup #7", () => { + expect( + parser.parseEval("$var = &parent::getElementByPath();"), + ).toMatchSnapshot(); + }); + it("staticlookup #8", () => { + expect( + parser.parseEval(" $var = &self::getElementByPath();"), + ).toMatchSnapshot(); + }); + // https://github.com/php/php-src/blob/php-7.4.0beta4/Zend/zend_language_parser.y#L1169 + it("propertylookup", () => { + expect(parser.parseEval("$var = &$var->test;")).toMatchSnapshot(); + }); + it.skip("propertylookup #2", () => { + expect(parser.parseEval("$var = &($var)->test;")).toMatchSnapshot(); + }); + it("with bin", () => { + expect(parser.parseEval("$foo = &$bar || $bar;")).toMatchSnapshot(); + }); + it("with bin #2", () => { + expect(parser.parseEval("$foo = &$bar + 1;")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/call.test.js b/test/snapshot/call.test.js new file mode 100644 index 000000000..0ab555383 --- /dev/null +++ b/test/snapshot/call.test.js @@ -0,0 +1,315 @@ +const parser = require("../main"); + +describe("Test call", function () { + it("simple", function () { + const ast = parser.parseEval("call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("multiple", function () { + const ast = parser.parseEval("call()()();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("multiple (2)", function () { + const ast = parser.parseEval("$obj->call()->call()->call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("nested", function () { + const ast = parser.parseEval("call(call(call()));", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("single argument", function () { + const ast = parser.parseEval("call($a);", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("multiple arguments", function () { + const ast = parser.parseEval("call($a, $b, $c);", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("propertylookup", function () { + const ast = parser.parseEval("$obj->call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("propertylookup (2)", function () { + const ast = parser.parseEval("$obj->property->call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("nullsafepropertylookup", function () { + const ast = parser.parseEval("$obj?->call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("nullsafepropertylookup (2)", function () { + const ast = parser.parseEval("$obj?->property?->call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("staticlookup", function () { + const ast = parser.parseEval("$obj::call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("staticlookup (2)", function () { + const ast = parser.parseEval("Foo::call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("offsetlookup", function () { + const ast = parser.parseEval('$array["index"]();', { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("parent", function () { + const ast = parser.parseEval( + "class Foo { function foo() { parent::call(); } }", + { + parser: { debug: false }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + it("self", function () { + const ast = parser.parseEval( + "class Foo { function foo() { self::call(); } }", + { + parser: { debug: false }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + it("static", function () { + const ast = parser.parseEval( + "class Foo { function foo() { static::call(); } }", + { + parser: { debug: false }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + it("variable function", function () { + const ast = parser.parseEval("$func();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("variable function (2)", function () { + const ast = parser.parseEval("$obj->$func();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("variable function (3)", function () { + const ast = parser.parseEval("Foo::$func();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("string", function () { + const ast = parser.parseEval('("func")();', { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("array", function () { + const ast = parser.parseEval('array("Foo", "bar")();', { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("array parens", function () { + const ast = parser.parseEval('(array("Foo", "bar"))();', { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside offsetlookup", function () { + const ast = parser.parseEval('get_class($obj)["offset"];', { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside propertylookup", function () { + const ast = parser.parseEval("get_class($obj)->property;", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup", function () { + const ast = parser.parseEval("get_class($obj)::call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (2)", function () { + const ast = parser.parseEval("get_class($obj)::call()::call()::call();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (3)", function () { + const ast = parser.parseEval("get_class($obj)::$property;", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (4)", function () { + const ast = parser.parseEval( + "get_class($obj)::$property::$property::$property;", + { + parser: { debug: false }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (5)", function () { + const ast = parser.parseEval("get_class($obj)::CONSTANT;", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (6)", function () { + const ast = parser.parseEval("get_class($var)::${$property};", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (7)", function () { + const ast = parser.parseEval( + "get_class($var)::${$property}::${$property}::${$property};", + { + parser: { debug: false }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (8)", function () { + const ast = parser.parseEval('get_class($var)::${"property"};', { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (9)", function () { + const ast = parser.parseEval("get_class($var)::${$property};", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (10)", function () { + const ast = parser.parseEval("Order::call()();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("inside staticlookup (11)", function () { + const ast = parser.parseEval("Order::{call()}();", { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("trailing comma", function () { + const ast = parser.parseEval('foo("method", "bar",);', { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("trailing comma #2", function () { + const ast = parser.parseEval('$foo("method", "bar",);', { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("trailing comma #3", function () { + const ast = parser.parseEval('$foo->bar("method", "bar",);', { + parser: { debug: false }, + }); + expect(ast).toMatchSnapshot(); + }); + it("named arguments in php 8.0", function () { + const astErr = parser.parseEval(`foo(a: $a);`, { + parser: { + version: "8.0", + debug: false, + }, + }); + expect(astErr).toMatchSnapshot(); + }); + it("named arguments are not supported in php 7.2", function () { + expect(() => + parser.parseEval(`foo(a: $a);`, { + parser: { + version: "7.2", + debug: false, + }, + }), + ).toThrow("PHP 8+ is required to use named arguments"); + }); + it("doesnt confused static methods with named arguments", function () { + const astErr = parser.parseEval(`foo(a::bar());`, { + parser: { + version: "8.0", + debug: false, + }, + }); + expect(astErr).toMatchSnapshot(); + }); + it("keyword as named argument", function () { + const astErr = parser.parseEval(`foo(array: $a);`, { + parser: { + version: "8.0", + debug: false, + }, + }); + expect(astErr).toMatchSnapshot(); + }); + it("mix of unnamed and named arguments", function () { + const astErr = parser.parseEval(`foo(50, num: 100, start_index: 0);`, { + parser: { + version: "8.0", + debug: false, + }, + }); + expect(astErr).toMatchSnapshot(); + }); + it("comments", function () { + const astErr = parser.parseEval( + `foo(array // comment + (100, 0));`, + { + parser: { + extractDoc: true, + debug: false, + }, + }, + ); + expect(astErr).toMatchSnapshot(); + }); + it("handles spread operator at call site", function () { + expect( + parser.parseEval(` + foo(...$bar); + foo($bar, ...$baz); + foo(...$bar, ...$baz); + `), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/class.test.js b/test/snapshot/class.test.js index ee6fe13cf..ac0d31a0d 100644 --- a/test/snapshot/class.test.js +++ b/test/snapshot/class.test.js @@ -1,8 +1,53 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test classes", function() { - it("Validate usual declarations", function() { - expect(parser.parseEval(` +describe("Test classes", function () { + it("Implement #183 : static keyword as identifier", function () { + expect( + parser.parseEval(` + class A { + public static function test() { + parent::foo(); + self::bar(); + static::baz(); + A::fooBar(); + $this->fooBaz(); + } + } + `), + ).toMatchSnapshot(); + }); + + it("Implement typed_properties_v2 / php74", function () { + expect( + parser.parseEval(` + class Test { + public ?int $prop = null; + protected static float|string $y; + } + `), + ).toMatchSnapshot(); + }); + + it("Implement readonly property", function () { + expect( + parser.parseEval( + ` + class User { + public readonly int $uid; + } + `, + { + parser: { + version: "8.1", + }, + }, + ), + ).toMatchSnapshot(); + }); + + it("Validate usual declarations", function () { + expect( + parser.parseEval(` final class foo extends bar implements bim, bam, boum { const FOO = "azerty"; @@ -32,12 +77,14 @@ describe("Test classes", function() { * Some informations */ abstract protected function &foo() : bar; - }` - )).toMatchSnapshot(); + }`), + ).toMatchSnapshot(); }); - it("Advanced tests", function() { - expect(parser.parseEval(` + it("Advanced tests", function () { + expect( + parser.parseEval( + ` class foo implements boo { use A; use B { foo as bar; } @@ -57,30 +104,37 @@ describe("Test classes", function() { /** foo */ protected function foo(); } - trait line extends foo implements boo { + trait line { // some doc const A = 1.5; abstract protected function foo(); } - `, { - parser: { extractDoc: true } - })).toMatchSnapshot(); + `, + { + parser: { extractDoc: true }, + }, + ), + ).toMatchSnapshot(); }); - it("Test of silent mode", function() { - expect(parser.parseEval(` + it("Test of silent mode", function () { + expect( + parser.parseEval( + ` class foo { use A use B { foo }; }`, - { - parser: { suppressErrors: true } - } - )).toMatchSnapshot(); + { + parser: { suppressErrors: true }, + }, + ), + ).toMatchSnapshot(); }); - it("Test js properties", function() { - expect(parser.parseEval(` + it("Test js properties", function () { + expect( + parser.parseEval(` class __proto__ { static $constructor; public function constructor() {} @@ -88,7 +142,167 @@ describe("Test classes", function() { $this->constructor = null; self::$constructor = null; } - }` - )).toMatchSnapshot(); + }`), + ).toMatchSnapshot(); + }); + + it("Test promoted class properties php 8", function () { + const ast = parser.parseEval( + ` + class __proto__ { + public function constructor(public int $id, private $name, int $c, protected ServerRequestInterface $req) {} + }`, + { + parser: { + version: "8.0", + suppressErrors: true, + }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + + it("Test promoted readonly class properties", function () { + const ast = parser.parseEval( + ` + class Bob { + public function __construct(public readonly int $id) {} + } + class Bob2 { + public function __construct(readonly public int $id) {} + } +`, + { + parser: { + version: "8.1", + }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + + it("Test that readonly method parameters are throwing errors", function () { + const ast = parser.parseEval( + ` + class Bob { + public function foo(public readonly int $id) {} + }`, + { + parser: { + version: "8.1", + suppressErrors: true, + }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + + it("Test promoted nullable properties php 8", function () { + const ast = parser.parseEval( + ` + class __proto__ { + public function constructor(public ?string $maybe, private ?int $opt) {} + }`, + { + parser: { + version: "8.0", + suppressErrors: true, + }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + + describe("readonly class in PHP8.2", function () { + [ + "readonly", + "readonly abstract", + "abstract readonly", + "final readonly", + "readonly final", + ].forEach(function (token) { + it("should support " + token, function () { + expect( + parser.parseEval(` + ${token} class Foo { + } + `), + ).toMatchSnapshot(); + }); + }); + }); + + it("empty", function () { + expect(parser.parseEval("class Foo {}")).toMatchSnapshot(); + }); + + it("class name as identifier", function () { + expect(parser.parseEval("class A {}")).toMatchSnapshot(); + }); + + it("final and abstract", function () { + expect( + parser.parseEval(`final abstract class foo {}`, { + parser: { suppressErrors: true }, + }), + ).toMatchSnapshot(); + }); + + it("abstract and final", function () { + expect( + parser.parseEval(`abstract final class foo {}`, { + parser: { suppressErrors: true }, + }), + ).toMatchSnapshot(); + }); + + it("8.4 allow new without parenthesis", () => { + const code = `new People()->name();`; + const test_parser = parser.create({ + parser: { + version: "8.4", + }, + }); + expect(test_parser.parseEval(code)).toMatchSnapshot(); + }); + + it("new without parenthesis throw errors in PHP < 8.4", () => { + const code = `new People()->name();`; + expect(() => { + parser.parseEval(code); + }).toThrowErrorMatchingSnapshot(); + }); + + it("knows where a function definiton starts", function () { + const phpCode = ` +class b { + // prettier-ignore + public static function a() {} +} + `; + const ast = parser.parseEval(phpCode, { + ast: { + withPositions: true, + withSource: true, + }, + }); + const funcStart = ast.children[0].body[0].loc.start.offset; + const funcEnd = ast.children[0].body[0].loc.end.offset; + expect(phpCode.substr(funcStart, funcEnd - funcStart)).toEqual( + "public static function a() {}", + ); + expect(ast.children[0].body[0].loc.source).toEqual( + "public static function a()", + ); + }); + + it("handles property types with a leading \\", function () { + expect( + parser.parseEval(` + class Foo { + public \\Bar $baz; + } + `), + ).toMatchSnapshot(); }); }); diff --git a/test/snapshot/classconstant.test.js b/test/snapshot/classconstant.test.js new file mode 100644 index 000000000..287845a7d --- /dev/null +++ b/test/snapshot/classconstant.test.js @@ -0,0 +1,78 @@ +const parser = require("../main"); + +describe("classconstant", () => { + it("simple", () => { + expect( + parser.parseEval('class Foo { const CONSTANT = "Hello world!"; }'), + ).toMatchSnapshot(); + }); + it("simple using 8.3", () => { + expect( + parser.parseEval(`class Foo { const CONSTANT = "Hello world!"; }`, { + parser: { version: 803 }, + }), + ).toMatchSnapshot(); + }); + + it("multiple", () => { + expect( + parser.parseEval( + 'class Foo { const CONSTANT = "Hello world!", OTHER_CONSTANT = "Other hello world!"; }', + ), + ).toMatchSnapshot(); + }); + + it("multiple 8.3", () => { + expect( + parser.parseEval( + 'class Foo { const NAME_1 = "Hello world!", NAME_2 = "Other hello world!"; }', + { + parser: { version: 803 }, + }, + ), + ).toMatchSnapshot(); + }); + + it("public", () => { + expect( + parser.parseEval('class Foo { public const CONSTANT = "Hello world!"; }'), + ).toMatchSnapshot(); + }); + it("protected", () => { + expect( + parser.parseEval( + 'class Foo { protected const CONSTANT = "Hello world!"; }', + ), + ).toMatchSnapshot(); + }); + it("private", () => { + expect( + parser.parseEval( + 'class Foo { private const CONSTANT = "Hello world!"; }', + ), + ).toMatchSnapshot(); + }); + it("final", () => { + expect( + parser.parseEval( + 'class Foo { final public const CONSTANT = "Hello world!"; }', + ), + ).toMatchSnapshot(); + }); + it("type hinted (supported)", () => { + expect( + parser.parseEval( + 'class Foo { public const string CONSTANT = "Hello world!"; }', + { parser: { version: 803 } }, + ), + ).toMatchSnapshot(); + }); + it("type hinted (unsupported)", () => { + expect(() => + parser.parseEval( + 'class Foo { public const string CONSTANT = "Hello world!"; }', + { parser: { version: 802 } }, + ), + ).toThrowErrorMatchingSnapshot(); + }); +}); diff --git a/test/snapshot/classreference.test.js b/test/snapshot/classreference.test.js new file mode 100644 index 000000000..c4687e687 --- /dev/null +++ b/test/snapshot/classreference.test.js @@ -0,0 +1,21 @@ +const parser = require("../main"); + +describe("classreference", function () { + it("variable", function () { + expect(parser.parseEval("Foo::$var;")).toMatchSnapshot(); + }); + it("constant", function () { + expect(parser.parseEval("Foo::CONSTANT;")).toMatchSnapshot(); + }); + it("call", function () { + expect(parser.parseEval("Foo::call();")).toMatchSnapshot(); + }); + it("argument type", function () { + expect(parser.parseEval("function foo(Foo $arg) {}")).toMatchSnapshot(); + }); + it("argument type (2)", function () { + expect( + parser.parseEval("function foo(Foo\\Foo $arg) {}"), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/clone.test.js b/test/snapshot/clone.test.js new file mode 100644 index 000000000..90ad67d49 --- /dev/null +++ b/test/snapshot/clone.test.js @@ -0,0 +1,10 @@ +const parser = require("../main"); + +describe("clone", function () { + it("simple", function () { + expect(parser.parseEval("clone $obj;")).toMatchSnapshot(); + }); + it("assign", function () { + expect(parser.parseEval("$var = clone $obj;")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/closure.test.js b/test/snapshot/closure.test.js new file mode 100644 index 000000000..5dfa6395f --- /dev/null +++ b/test/snapshot/closure.test.js @@ -0,0 +1,69 @@ +const parser = require("../main"); + +describe("closure", () => { + it("simple", () => { + expect( + parser.parseEval('$var = function() { echo "something"; };'), + ).toMatchSnapshot(); + }); + it("empty", () => { + expect(parser.parseEval("$var = function() {};")).toMatchSnapshot(); + }); + it("argument", () => { + expect( + parser.parseEval('$var = function($arg) { echo "something"; };'), + ).toMatchSnapshot(); + }); + it("argument by ref", () => { + expect( + parser.parseEval('$var = function(&$arg) { echo "something"; };'), + ).toMatchSnapshot(); + }); + it("arguments", () => { + expect( + parser.parseEval( + '$var = function($arg, $arg, $arg) { echo "something"; };', + ), + ).toMatchSnapshot(); + }); + it("use", () => { + expect( + parser.parseEval( + '$var = function() use ($message) { echo "something"; };', + ), + ).toMatchSnapshot(); + }); + it("use multiple", () => { + expect( + parser.parseEval( + '$var = function() use ($message, $message1, $message2) { echo "something"; };', + ), + ).toMatchSnapshot(); + }); + it("use by ref", () => { + expect( + parser.parseEval( + '$var = function() use (&$message) { echo "something"; };', + ), + ).toMatchSnapshot(); + }); + it("argument and use", () => { + expect( + parser.parseEval( + '$var = function($arg) use ($use) { echo "something"; };', + ), + ).toMatchSnapshot(); + }); + it("arguments and uses", () => { + expect( + parser.parseEval( + '$var = function($arg, $arg, $arg) use ($use, $use, $use) { echo "something"; };', + ), + ).toMatchSnapshot(); + }); + it("inside call", () => { + expect( + parser.parseEval(`call(function ($arg) { return $arg; });`), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/comment.test.js b/test/snapshot/comment.test.js index 82c8bd533..a20ddf4d6 100644 --- a/test/snapshot/comment.test.js +++ b/test/snapshot/comment.test.js @@ -1,8 +1,53 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test comments", function() { - describe("issues", function() { - it("fix #126 : new option", function() { +describe("Test comments", function () { + describe("issues", function () { + it("fix #250 : Leading comments are treated as trailing comments", function () { + expect( + parser.parseEval( + ` +// leading +foo(); +// bar +bar() /* inner */ ; +// trailing + `, + { + parser: { + extractDoc: true, + // debug: true + }, + ast: { + withPositions: true, + withSource: true, + }, + }, + ), + ).toMatchSnapshot(); + }); + + it("fix call comments", function () { + expect( + parser.parseEval( + ` +call(array // comment +()); + `, + { + parser: { + extractDoc: true, + // debug: true + }, + ast: { + withPositions: true, + withSource: true, + }, + }, + ), + ).toMatchSnapshot(); + }); + + it("fix #126 : new option", function () { const ast = parser.parseEval( ` if (true) { @@ -17,13 +62,13 @@ describe("Test comments", function() { `, { parser: { - extractDoc: true - } - } + extractDoc: true, + }, + }, ); expect(ast).toMatchSnapshot(); }); - it("fix #55", function() { + it("fix #55", function () { const ast = parser.parseEval( ` if (true): @@ -34,15 +79,15 @@ describe("Test comments", function() { `, { parser: { - extractDoc: true + extractDoc: true, // debug: true - } - } + }, + }, ); expect(ast).toMatchSnapshot(); }); - it("fix #189", function() { + it("fix #189", function () { const ast = parser.parseEval( ` $var = 'string1' @@ -55,13 +100,13 @@ describe("Test comments", function() { parser: { extractDoc: true, // debug: true - } - } + }, + }, ); expect(ast).toMatchSnapshot(); }); - - it("fix #193", function() { + + it("fix #193", function () { const ast = parser.parseEval( ` $a = $var @@ -74,13 +119,57 @@ describe("Test comments", function() { parser: { extractDoc: true, // debug: true - } - } + }, + }, ); expect(ast).toMatchSnapshot(); }); - it("impl #194", function() { + it("fix #278", function () { + const ast = parser.parseEval( + ` +/** + * Class description + */ +class FooClass +{ + /** + * Description + */ + public static function bar() + { + return $array; + } + + /** + * Description + */ + public static function baz() + { + return $array; + } + + /** + * Description + */ + public static function woo() + { + return $array; + } + // true trailing comment +} + `, + { + parser: { + extractDoc: true, + // debug: true + }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + + it("impl #194", function () { const ast = parser.parseEval( ` // lead assign @@ -92,15 +181,15 @@ describe("Test comments", function() { { parser: { extractDoc: true, - debug: true - } - } + // debug: true + }, + }, ); expect(ast).toMatchSnapshot(); }); }); - it("test single line comments", function() { + it("test single line comments", function () { const ast = parser.parseEval( ` # some information @@ -110,15 +199,15 @@ describe("Test comments", function() { `, { parser: { - extractDoc: true - } - } + extractDoc: true, + }, + }, ); expect(ast).toMatchSnapshot(); }); - describe("multi line comments", function() { - it("test function", function() { + describe("multi line comments", function () { + it("test function", function () { const ast = parser.parseEval( ` /** @@ -131,13 +220,13 @@ describe("Test comments", function() { `, { parser: { - extractDoc: true - } - } + extractDoc: true, + }, + }, ); expect(ast).toMatchSnapshot(); }); - it("test if statements", function() { + it("test if statements", function () { const ast = parser.parseEval( ` if /* ignore */ (/* */ true) /* ignore */ { @@ -153,13 +242,13 @@ describe("Test comments", function() { `, { parser: { - extractDoc: true - } - } + extractDoc: true, + }, + }, ); expect(ast).toMatchSnapshot(); }); - it("test try statements", function() { + it("test try statements", function () { const ast = parser.parseEval( ` try /* ignore */ { @@ -172,15 +261,15 @@ describe("Test comments", function() { `, { parser: { - extractDoc: true - } - } + extractDoc: true, + }, + }, ); expect(ast).toMatchSnapshot(); }); }); - it("test classes", function() { + it("test classes", function () { const ast = parser.parseEval( ` /** @@ -201,9 +290,9 @@ describe("Test comments", function() { `, { parser: { - extractDoc: true - } - } + extractDoc: true, + }, + }, ); expect(ast).toMatchSnapshot(); }); diff --git a/test/snapshot/constantstatement.test.js b/test/snapshot/constantstatement.test.js new file mode 100644 index 000000000..f7d9718ec --- /dev/null +++ b/test/snapshot/constantstatement.test.js @@ -0,0 +1,16 @@ +const parser = require("../main"); + +describe("constantstatement", () => { + it("simple", () => { + expect( + parser.parseEval('const CONSTANT = "Hello world!";'), + ).toMatchSnapshot(); + }); + it("multiple", () => { + expect( + parser.parseEval( + 'const CONSTANT = "Hello world!", OTHER_CONSTANT = "Other hello world!";', + ), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/continue.test.js b/test/snapshot/continue.test.js new file mode 100644 index 000000000..39ea5e648 --- /dev/null +++ b/test/snapshot/continue.test.js @@ -0,0 +1,30 @@ +const parser = require("../main"); + +describe("continue", () => { + it("simple", () => { + expect(parser.parseEval("continue;")).toMatchSnapshot(); + }); + it("argument 0", () => { + expect(parser.parseEval("continue 0;")).toMatchSnapshot(); + }); + it("argument 1", () => { + expect(parser.parseEval("continue 1;")).toMatchSnapshot(); + }); + it("argument 2", () => { + expect(parser.parseEval("continue 2;")).toMatchSnapshot(); + }); + it("with parens", () => { + expect(parser.parseEval("continue (1);")).toMatchSnapshot(); + }); + // Deprecated since 5.4.0 + it("with expression", () => { + expect(parser.parseEval("continue $var;")).toMatchSnapshot(); + }); + it("should fail when no ';' at end", function () { + expect( + parser.parseEval("continue", { + parser: { suppressErrors: true }, + }), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/declare.test.js b/test/snapshot/declare.test.js new file mode 100644 index 000000000..5c4808532 --- /dev/null +++ b/test/snapshot/declare.test.js @@ -0,0 +1,26 @@ +const parser = require("../main"); + +describe("declare", function () { + it("strict_types", function () { + expect(parser.parseEval("declare (strict_types=1);")).toMatchSnapshot(); + }); + it("ticks", function () { + expect(parser.parseEval("declare(ticks=1);")).toMatchSnapshot(); + }); + it("encoding", function () { + expect( + parser.parseEval("declare(encoding='ISO-8859-1');"), + ).toMatchSnapshot(); + }); + it("nested", function () { + expect(parser.parseEval("declare(ticks=1) { }")).toMatchSnapshot(); + }); + it("mode short", function () { + expect( + parser.parseEval('declare(ticks=1): echo "something"; enddeclare;'), + ).toMatchSnapshot(); + }); + it("multiple", function () { + expect(parser.parseEval("declare (A='B', C='D') { }")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/echo.test.js b/test/snapshot/echo.test.js new file mode 100644 index 000000000..0de2397e0 --- /dev/null +++ b/test/snapshot/echo.test.js @@ -0,0 +1,10 @@ +const parser = require("../main"); + +describe("echo", function () { + it("simple", function () { + expect(parser.parseEval('echo "string";')).toMatchSnapshot(); + }); + it("multiple", function () { + expect(parser.parseEval('echo "string", "string";')).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/empty.test.js b/test/snapshot/empty.test.js new file mode 100644 index 000000000..8d1d67f8b --- /dev/null +++ b/test/snapshot/empty.test.js @@ -0,0 +1,10 @@ +const parser = require("../main"); + +describe("empty", function () { + it("simple", function () { + expect(parser.parseEval("empty($var);")).toMatchSnapshot(); + }); + it("assign", function () { + expect(parser.parseEval("$var = empty($var);")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/encapsed.test.js b/test/snapshot/encapsed.test.js new file mode 100644 index 000000000..3e95f60e4 --- /dev/null +++ b/test/snapshot/encapsed.test.js @@ -0,0 +1,132 @@ +const parser = require("../main"); + +describe("encapsed", function () { + it.each([ + ["variable (simple syntax)", '"string $var string";'], + ["two variable (simple syntax)", '"string $var->$var string";'], + ["variable curly (simple syntax)", '"string ${var} string";'], + ["offsetlookup (simple syntax)", '"string $array[0] string";'], + ["offsetlookup (2) (simple syntax)", '"string $array[koolaid1] string";'], + ["offsetlookup (3) (simple syntax)", '"string $array[0][0] string";'], + ["propertylookup (simple syntax)", '"string $obj->property string";'], + [ + "nullsafepropertylookup (simple syntax)", + '"string $obj?->property string";', + ], + ["variable with space opening before curly", '"string { $var} string";'], + ["variable with before closing curly", '"string {$var } string";'], + ["variable (complex syntax)", '"string {$var} string";'], + ["propertylookup (complex syntax)", '"string {$obj->property} string";'], + [ + "nullsafepropertylookup (complex syntax)", + '"string {$obj?->property} string";', + ], + ["offsetlookup (complex syntax)", '"string {$array["key"]} string";'], + ["offsetlookup 2 (complex syntax)", '"string {$array[4][3]} string";'], + ["offsetlookup 3 (complex syntax)", '"string {$arr[foo][3]} string";'], + ["offsetlookup 4 (complex syntax)", '"string {$arr["foo"][3]} string";'], + [ + "nullsafepropertylookup and offsetlookup (complex syntax)", + '"string {$obj?->values[3]?->name} string";', + ], + ["value of the var (complex syntax)", '"string {${$name}} string";'], + [ + "value of the var named by the return value (complex syntax)", + '"string {${call()}} string";', + ], + [ + "value of the var named by the return value (2) (complex syntax)", + '"string {${call()}} string";', + ], + [ + "value of the var named by the return value (3) (complex syntax)", + '"string {${$obj->property}} string";', + ], + [ + "value of the var named by the return value (4) (complex syntax)", + '"string {${$obj->call()}} string";', + ], + [ + "value of the var named by the return value (5) (complex syntax)", + '"string {${$obj::$var}} string";', + ], + [ + "value of the var named by the return value (6) (complex syntax)", + '"string {${$obj::call()}} string";', + ], + [ + "propertylookup by variable (complex syntax)", + '"string {$obj->$var} string";', + ], + [ + "nullsafepropertylookup by variable (complex syntax)", + '"string {$obj?->$var} string";', + ], + [ + "propertylookup by variable (2) (complex syntax)", + '"string {$obj->{$array[1]}} string";', + ], + [ + "nullsafepropertylookup by variable (2) (complex syntax)", + '"string {$obj?->{$array[1]}} string";', + ], + [ + "propertylookup with multiple call (complex syntax)", + '"string {$obj->call()->call()} string";', + ], + [ + "nullsafepropertylookup with multiple call (complex syntax)", + '"string {$obj?->call()?->call()} string";', + ], + [ + "multiple propertylookup (complex syntax)", + '"string {$obj->property->property} string";', + ], + [ + "multiple nullsafepropertylookup (complex syntax)", + '"string {$obj?->property?->property} string";', + ], + [ + "propertylookup with comments (complex syntax)", + '"string {$var->foo->bar /* Comment */ } string";', + ], + [ + "nullsafepropertylookup with comments (complex syntax)", + '"string {$var?->foo?->bar /* Comment */ } string";', + ], + [ + "newline before closing curly (complex syntax)", + '"string {$var\n} string";', + ], + ["staticlookup (complex syntax)", '"string {$obj::$var} string";'], + ["staticlookup (2) (complex syntax)", '"string {$obj::call()} string";'], + [ + "staticlookup (3) (complex syntax)", + '"string {$obj::$var::$var} string";', + ], + [ + "staticlookup (4) (complex syntax)", + '"string {$var::$target::$resource::$binary::$foo::$bar::$foobar::$bar::$foo::$foobar::$bar::$foo} string";', + ], + ["string offset in encapsed var offset", `"$var[var]";`], + ["positive offset in encapsed var offset", `"$var[1]";`], + ["negative offset in encapsed var offset", `"$var[-1]";`], + ["string offset in encapsed var offset", `"$var[$var]";`], + ["dollar open curly braces", '"string ${juice} string";'], + ["dollar open curly braces #2", '"string ${$juice} string";'], + ["dollar open curly braces #3", '"string ${${$juice}} string";'], + ["dollar open curly braces #4", '"string ${call()} string";'], + ["dollar open curly braces #5", '"string ${test[test]} string";'], + ["dollar open curly braces #6", '"string ${test[1]} string";'], + ["dollar open curly braces #7", '"string ${test[-1]} string";'], + ["dollar open curly braces #8", '"string ${test[$var]} string";'], + ["curly", '"string {$juice} string";'], + ["curly #2", '"string {$$juice} string";'], + ["curly #3", '"string {$call()} string";'], + ["no curly", '"string $$juice string";'], + ["propertylookup", '$this->{"set{$type}"};'], + ["nullsafepropertylookup", '$this?->{"set{$type}"};'], + ])("%s", function (_, code) { + expect(parser.parseEval(code)).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/enum.test.js b/test/snapshot/enum.test.js new file mode 100644 index 000000000..8b3c1a8e8 --- /dev/null +++ b/test/snapshot/enum.test.js @@ -0,0 +1,114 @@ +const parser = require("../main"); + +describe("Test enums", function () { + it("empty", function () { + expect(parser.parseEval("enum Foo {}")).toMatchSnapshot(); + }); + + it("non-empty", function () { + expect( + parser.parseEval(` + enum Suit { + case Hearts; + case Diamonds; + case Clubs; + case Spades; + } + `), + ).toMatchSnapshot(); + }); + + it("may have a backing type", function () { + expect( + parser.parseEval(` + enum Suit: string { + case Hearts = 'H'; + case Diamonds = 'D'; + case Clubs = 'C'; + case Spades = 'S'; + } + `), + ).toMatchSnapshot(); + }); + + it("can alias cases", function () { + expect( + parser.parseEval(` + enum Foo { + case Bar; + public const Baz = self::Bar; + } + `), + ).toMatchSnapshot(); + }); + + it("can implement interfaces", function () { + expect( + parser.parseEval(` + enum Foo implements Bar, Baz {} + `), + ).toMatchSnapshot(); + }); + + it("can use traits", function () { + expect( + parser.parseEval(` + enum Foo { + use Bar, Baz { + Baz::hello insteadof Bar; + Baz::world as earth; + } + use Bax; + } + `), + ).toMatchSnapshot(); + }); + + it("can have functions", function () { + expect( + parser.parseEval(` + enum Foo: int { + case MyCase = 1; + + public function bar(): void {} + + protected static function baz() { + echo self::MyCase->value; + } + } + `), + ).toMatchSnapshot(); + }); + + it("cannot have properties", function () { + expect(() => { + parser.parseEval(` + enum Foo { + public int $bar; + protected $baz; + } + `); + }).toThrowErrorMatchingSnapshot(); + }); + + it("doesn't confuse enums with identifiers", function () { + expect( + parser.parseEval(` + class Enum { function enum () {} } + interface Enum {} + trait Enum {} + function enum() {} + class Enum extends Foo {} + class Enum implements Foo {} + class Enum exTends Foo {} + enum extendsFoo {} + `), + ).toMatchSnapshot(); + }); + + it("can't be parsed with PHP < 8", function () { + expect(() => { + parser.parseEval("enum Foo {}", { parser: { version: "8.0" } }); + }).toThrowErrorMatchingSnapshot(); + }); +}); diff --git a/test/snapshot/eval.test.js b/test/snapshot/eval.test.js new file mode 100644 index 000000000..0dfe526df --- /dev/null +++ b/test/snapshot/eval.test.js @@ -0,0 +1,7 @@ +const parser = require("../main"); + +describe("eval", function () { + it("simple", function () { + expect(parser.parseEval('eval("command");')).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/exit.test.js b/test/snapshot/exit.test.js new file mode 100644 index 000000000..deb8a21d1 --- /dev/null +++ b/test/snapshot/exit.test.js @@ -0,0 +1,31 @@ +const parser = require("../main"); + +describe("exit", function () { + it("simple", function () { + expect(parser.parseEval("exit();")).toMatchSnapshot(); + }); + it("argument", function () { + expect(parser.parseEval("exit($var);")).toMatchSnapshot(); + }); + it("die", function () { + expect(parser.parseEval("die();")).toMatchSnapshot(); + }); + it("exit without expression", function () { + expect(parser.parseEval("exit;")).toMatchSnapshot(); + }); + it("exit with empty expression", function () { + expect(parser.parseEval("exit();")).toMatchSnapshot(); + }); + it("exit with expression", function () { + expect(parser.parseEval("exit(10 + $var);")).toMatchSnapshot(); + }); + it("die without expression", function () { + expect(parser.parseEval("die;")).toMatchSnapshot(); + }); + it("die with empty expression", function () { + expect(parser.parseEval("die();")).toMatchSnapshot(); + }); + it("die with expression", function () { + expect(parser.parseEval("die(10 + $var);")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/expr.test.js b/test/snapshot/expr.test.js index cdc09e6cb..89dcb2b41 100644 --- a/test/snapshot/expr.test.js +++ b/test/snapshot/expr.test.js @@ -1,7 +1,7 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test expressions", function() { - it("test binary", function() { +describe("Test expressions", function () { + it("test binary", function () { const ast = parser.parseEval( ` 1 | 3; @@ -16,12 +16,12 @@ describe("Test expressions", function() { 1 ** 3; 1 << 3; 1 >> 3; - ` + `, ); expect(ast).toMatchSnapshot(); }); - it("test more binary ops (formerly bool)", function() { + it("test more binary ops (formerly bool)", function () { const ast = parser.parseEval( ` $a && $b; @@ -39,12 +39,12 @@ describe("Test expressions", function() { $a <= $b; $a <=> $b; $a instanceof $b; - ` + `, ); expect(ast).toMatchSnapshot(); }); - it("test assignements", function() { + it("test assignements", function () { const ast = parser.parseEval( ` $a = $b; @@ -60,28 +60,28 @@ describe("Test expressions", function() { $a ^= $b; $a <<= $b; $a >>= $b; - ` + `, ); expect(ast).toMatchSnapshot(); }); - it("test if based returns", function() { + it("test if based returns", function () { const ast = parser.parseEval( ` $a ?? false; $a > 5 ? true : false; $a ?: false; - ` + `, ); expect(ast).toMatchSnapshot(); }); - it("test silent", function() { + it("test silent", function () { const ast = parser.parseEval("@trigger_error();"); expect(ast).toMatchSnapshot(); }); - it("test generators", function() { + it("test generators", function () { const ast = parser.parseEval( ` function gen() { @@ -89,24 +89,24 @@ describe("Test expressions", function() { yield from foo(); // keys 0-2 yield 1 => $a; // key 1 } - ` + `, ); expect(ast).toMatchSnapshot(); }); - it("test unary", function() { + it("test unary", function () { const ast = parser.parseEval( ` +$var; ~$var; !$var; -$var; - ` + `, ); expect(ast).toMatchSnapshot(); }); - it("test cast", function() { + it("test cast", function () { const ast = parser.parseEval( ` (int)$var; @@ -121,13 +121,12 @@ describe("Test expressions", function() { (array)$var; (object)$var; (unset)$var; - ` + `, ); expect(ast).toMatchSnapshot(); }); - - it("test cast extension - #171", function() { + it("test cast extension - #171", function () { const ast = parser.parseEval( ` (int)$var; @@ -142,33 +141,34 @@ describe("Test expressions", function() { (array)$var; (object)$var; (unset)$var; - `, { + `, + { parser: { - read_expr_cast: function(cast) { + read_expr_cast: function (cast) { const rawCast = this.text(); const expr = this.next().read_expr(); expr.cast = cast; expr.rawCast = rawCast; return expr; - } - } - } + }, + }, + }, ); expect(ast).toMatchSnapshot(); }); - it("test exit", function() { + it("test exit", function () { const ast = parser.parseEval( ` exit(1); die(); exit; - ` + `, ); expect(ast).toMatchSnapshot(); }); - it("test incr/decr", function() { + it("test incr/decr", function () { const ast = parser.parseEval( ` $i++; @@ -178,35 +178,35 @@ describe("Test expressions", function() { `, { ast: { - withPositions: true - } - } + withPositions: true, + }, + }, ); expect(ast).toMatchSnapshot(); }); - it("should fail to assign constants", function() { + it("should fail to assign constants", function () { const ast = parser.parseEval("a = 1;", { - parser: { debug: false, suppressErrors: true } + parser: { debug: false, suppressErrors: true }, }); expect(ast).toMatchSnapshot(); }); - it("should fail to assign class constants", function() { + it("should fail to assign class constants", function () { const ast = parser.parseEval("foo::b = 1;", { - parser: { debug: false, suppressErrors: true } + parser: { debug: false, suppressErrors: true }, }); expect(ast).toMatchSnapshot(); }); - it("should assign class static", function() { + it("should assign class static", function () { const ast = parser.parseEval("a::$b = 1;", { - parser: { debug: false, suppressErrors: true } + parser: { debug: false, suppressErrors: true }, }); expect(ast).toMatchSnapshot(); }); - it("test new", function() { + it("test new", function () { const ast = parser.parseEval( ` $a = new \\foo(); @@ -215,13 +215,68 @@ describe("Test expressions", function() { $a = new class extends foo implements bar { }; `, { - parser: { debug: false } - } + parser: { debug: false }, + }, ); expect(ast).toMatchSnapshot(); }); - it("test nested expressions precedence", function() { + it("fix #234", function () { + expect( + parser.parseEval( + ` + new foo; + $a = (new foo)[0]; + `, + { parser: { debug: false } }, + ), + ).toMatchSnapshot(); + }); + + it("fix #235", function () { + expect( + parser.parseEval( + ` + self(); + sElF(); + parent(); + pArEnT(); + parent::foo(); + new self(); + new static(); + new parent(); + `, + { parser: { debug: false } }, + ), + ).toMatchSnapshot(); + }); + + it("test node references", function () { + expect( + parser.parseEval( + ` + parent::foo(); + new self(); + new static(); + new parent(); + `, + { parser: { debug: false } }, + ), + ).toMatchSnapshot(); + }); + + it("test fail new", function () { + expect( + parser.parseEval( + ` + $a = new foo[0]; + `, + { parser: { suppressErrors: true } }, + ), + ).toMatchSnapshot(); + }); + + it("test nested expressions precedence", function () { const ast = parser.parseEval( ` $a = 5 * 2 + 1; // same as ((5 * 2) + 1) @@ -230,23 +285,28 @@ describe("Test expressions", function() { $d = 1 !== 2 && 3; // same as (1 !== 2) && 3 `, { - parser: { debug: false } - } + parser: { debug: false }, + }, ); expect(ast).toMatchSnapshot(); }); - - it("chaining calls (derefenceable)", function() { - expect(parser.parseEval(`($a->b)::call()->foo[10]->bar;`)).toMatchSnapshot(); + it("chaining calls (derefenceable)", function () { + expect( + parser.parseEval(`($a->b)::call()->foo[10]->bar;`), + ).toMatchSnapshot(); expect(parser.parseEval(`array(1, 2, 3)[0]->foo;`)).toMatchSnapshot(); - expect(parser.parseEval(`($a++)($foo)->bar{$baz}::foo();`)).toMatchSnapshot(); + expect( + parser.parseEval(`($a++)($foo)->bar{$baz}::foo();`), + ).toMatchSnapshot(); // expect error : - expect(parser.parseEval(`($a++)bar::foo::baz;`, { - parser: { - suppressErrors: true - } - })).toMatchSnapshot(); + expect( + parser.parseEval(`($a++)bar::foo::baz;`, { + parser: { + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); // should pass expect(parser.parseEval(`bar()::foo()::baz();`)).toMatchSnapshot(); }); diff --git a/test/snapshot/foreach.test.js b/test/snapshot/foreach.test.js new file mode 100644 index 000000000..939f3bfe5 --- /dev/null +++ b/test/snapshot/foreach.test.js @@ -0,0 +1,103 @@ +const parser = require("../main"); + +describe("foreach", function () { + it("as variable", function () { + expect( + parser.parseEval(` +foreach ($array as $var) { + echo $a; +} + `), + ).toMatchSnapshot(); + }); + + it("as variable by ref", function () { + expect( + parser.parseEval(` +foreach ($array as &$var) { + echo $a; +} + `), + ).toMatchSnapshot(); + }); + + it("as list", function () { + expect( + parser.parseEval(` +foreach ($array as list($a, $b)) { + echo $a; +} + `), + ).toMatchSnapshot(); + }); + + it("as short list", function () { + expect( + parser.parseEval(` +foreach ($array as [$a, $b]) { + echo $a; +} + `), + ).toMatchSnapshot(); + }); + + it("as list with key", function () { + expect( + parser.parseEval(` +foreach ($array as $v => list($a, $b)) { + echo $v; +} + `), + ).toMatchSnapshot(); + }); + + it("as short list with key", function () { + expect( + parser.parseEval(` +foreach ($array as $v => [$a, $b]) { + echo $v; +} + `), + ).toMatchSnapshot(); + }); + + it("unpacking", function () { + expect( + parser.parseEval(` +foreach ([...$var, 2, 3, 4] as $value) { + print_r($value); +} + `), + ).toMatchSnapshot(); + }); + + it("unpacking #2", function () { + expect( + parser.parseEval(` +foreach (array(...$var, 2, 3, 4) as $value) { + print_r($value); +} + `), + ).toMatchSnapshot(); + }); + + it("unpacking #3", function () { + expect( + parser.parseEval(` +foreach ([[...$var], 2, 3, 4] as $value) { + print_r($value); +} + `), + ).toMatchSnapshot(); + }); + + it("unpacking #4", function () { + expect( + parser.parseEval(` +foreach (array(array(...$var), 2, 3, 4) as $value) { + print_r($value); +} + `), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/function.test.js b/test/snapshot/function.test.js index f7ff9030c..77d58e1df 100644 --- a/test/snapshot/function.test.js +++ b/test/snapshot/function.test.js @@ -1,7 +1,7 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Function tests", function() { - it("test function parsing", function() { +describe("Function tests", function () { + it("test function parsing", function () { const ast = parser.parseEval( ` function &foo($a = 1, callable $b, ?array &...$params) : ?boolean {} @@ -9,45 +9,269 @@ describe("Function tests", function() { return true; }; $b = foo(...[1, null, 1, 2, 3]); + `, + ); + expect(ast).toMatchSnapshot(); + }); + + it("test function union types", function () { + const ast = parser.parseEval( + ` + function foo(int|float $a = 1, Foo|Bar $b) : string|int {} + `, + ); + expect(ast).toMatchSnapshot(); + }); + + it("test short function union types", function () { + const ast = parser.parseEval( + ` + fn (int|float $a = 1, Foo|Bar $b) : string|int => ""; + `, + ); + expect(ast).toMatchSnapshot(); + }); + + it("test function intersection types", function () { + const ast = parser.parseEval( ` + function foo(int&float $a = 1, Foo&Bar $b) : string&int {} + `, ); expect(ast).toMatchSnapshot(); }); - it("implement #196 : set function name as identifier", function() { + it("test short function intersection types", function () { + const ast = parser.parseEval( + ` + fn (int&float $a = 1, Foo&Bar $b) : string&int => ""; + `, + ); + expect(ast).toMatchSnapshot(); + }); + + it("array pass by reference are not confused with intersection", function () { + expect( + parser.parseEval( + ` + function foo(array &$params) { + // inner comment + } + `, + ), + ).toMatchSnapshot(); + }); + + it("spread array pass by reference are not intersection", function () { + expect( + parser.parseEval( + ` + function &foo(array &$params) { + // inner comment + } + `, + ), + ).toMatchSnapshot(); + }); + + it("implement #113 : typehint nodes", function () { + expect( + parser.parseEval( + ` + function &foo(int $a = 1, float $b = 1, bool $c = 1, string $d, callable $e, int\\bar $f, ?array &...$params) : ?object { + // inner comment + } + `, + ), + ).toMatchSnapshot(); + }); + + it("implement #196 : set function name as identifier", function () { const ast = parser.parseEval( ` function f /* f */($a) {} `, { parser: { - extractDoc: true - } - } + extractDoc: true, + }, + }, ); expect(ast).toMatchSnapshot(); }); - it("test variadic error", function() { - const astErr = parser.parseEval(`$b = foo(...[1, 2, 3], $a);`, { + it("test variadic call error", function () { + expect(() => + parser.parseEval(`$b = foo(...[1, 2, 3], $a);`), + ).toThrowErrorMatchingSnapshot(); + }); + + it("test variadic function error 1", function () { + expect(() => + parser.parseEval(`function foo(...$bar, $baz) {}`), + ).toThrowErrorMatchingSnapshot(); + }); + + it("test variadic function error 2", function () { + expect(() => + parser.parseEval(`function foo(...$bar, ...$baz) {}`), + ).toThrowErrorMatchingSnapshot(); + }); + + it("test reserved word for function name error", function () { + const astErr = parser.parseEval(`function list() {}`, { parser: { - suppressErrors: true - } + version: "5.6", + suppressErrors: true, + }, }); expect(astErr).toMatchSnapshot(); }); - it("test reserved word for function name error", function() { - const astErr = parser.parseEval(`function list() {}`, { + it("test static closure", function () { + const ast = parser.parseEval("$a = static function() {};"); + expect(ast).toMatchSnapshot(); + }); + + it("test arrow function php 7.4", function () { + const astErr = parser.parseEval(`function () {}`, { parser: { - suppressErrors: true - } + version: "7.4", + suppressErrors: true, + }, }); expect(astErr).toMatchSnapshot(); }); - it("test static closure", function() { - const ast = parser.parseEval("$a = static function() {};"); + it("test danging comma in function php 8.0", function () { + const astErr = parser.parseEval( + `function ( + $a, + $b, + $c, + ) {}`, + { + parser: { + version: "8.0", + }, + }, + ); + expect(astErr).toMatchSnapshot(); + }); + + it("test without danging comma in closure use-block php 8.0", function () { + const ast = parser.parseEval("$test = function () use ($one) {}", { + parser: { + version: "8.0", + }, + }); + expect(ast).toMatchSnapshot(); + }); + + it("test danging comma in closure use-block php 8.0", function () { + const ast = parser.parseEval("$test = function () use ($one,) {}", { + parser: { + version: "8.0", + }, + }); + expect(ast).toMatchSnapshot(); + }); + + it("test without danging comma in closure use-block with refs php 8.0", function () { + const ast = parser.parseEval("$test = function () use (&$one) {}", { + parser: { + version: "8.0", + }, + }); + expect(ast).toMatchSnapshot(); + }); + + it("test danging comma in closure use-block with refs php 8.0", function () { + const ast = parser.parseEval("$test = function () use (&$one) {}", { + parser: { + version: "8.0", + }, + }); + expect(ast).toMatchSnapshot(); + }); + + it("test danging comma in closure use-block with multiple php 8.0", function () { + const ast = parser.parseEval("$test = function () use ($one, $two,) {}", { + parser: { + version: "8.0", + }, + }); + expect(ast).toMatchSnapshot(); + }); + + it("test danging comma in closure use-block with multiple/refs php 8.0", function () { + const ast = parser.parseEval( + "$test = function ($one, $two) use ($three, &$four,) {}", + { + parser: { + version: "8.0", + }, + }, + ); expect(ast).toMatchSnapshot(); }); + + it("test double danging comma in closure use-block php 8.0", function () { + const astErr = parser.parseEval("$test = function () use ($one, ,) {}", { + parser: { + version: "8.0", + suppressErrors: true, + }, + }); + expect(astErr).toMatchSnapshot(); + }); + + it("Test readonly function properties are only for class constructor", function () { + const ast = parser.parseEval( + ` + function fun(public readonly int $id) {} + `, + { + parser: { + version: "8.1", + suppressErrors: true, + }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + + test("first class callable support", function () { + expect( + parser.parseEval( + ` + $callable = strlen(...); + $callable = $item->doSomething(...); + $callable = $item::doSomething(...); + $callable = Foo::doSomething(...); + `, + { + parser: { + version: "8.1", + }, + }, + ), + ).toMatchSnapshot(); + }); + + test("first class callable support requires PHP 8.1+", function () { + expect( + parser.parseEval( + ` + $callable = strlen(...); + `, + { + parser: { + suppressErrors: true, + version: "8.0", + }, + }, + ), + ).toMatchSnapshot(); + }); }); diff --git a/test/snapshot/global.test.js b/test/snapshot/global.test.js new file mode 100644 index 000000000..8fa85b1ce --- /dev/null +++ b/test/snapshot/global.test.js @@ -0,0 +1,10 @@ +const parser = require("../main"); + +describe("global", function () { + it("simple", function () { + expect(parser.parseEval("global $var;")).toMatchSnapshot(); + }); + it("mutliple", function () { + expect(parser.parseEval("global $var, $foo;")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/goto.test.js b/test/snapshot/goto.test.js new file mode 100644 index 000000000..5ca726523 --- /dev/null +++ b/test/snapshot/goto.test.js @@ -0,0 +1,8 @@ +const parser = require("../main"); + +describe("goto", function () { + it("simple", function () { + expect(parser.parseEval('goto a; echo "Foo";')).toMatchSnapshot(); + expect(parser.parseEval('goto longName; echo "Foo";')).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/graceful.test.js b/test/snapshot/graceful.test.js index 0d42e7c38..a55d2cca9 100644 --- a/test/snapshot/graceful.test.js +++ b/test/snapshot/graceful.test.js @@ -1,50 +1,106 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test graceful mode", function() { - describe("to suppress errors", function() { - var test = parser.create({ +describe("Test graceful mode", function () { + describe("to suppress errors", function () { + const test = parser.create({ parser: { - suppressErrors: true - } + suppressErrors: true, + }, }); - it("should contain 2 errors", function() { - expect(test.parseEval([ - "$var = ", // 1. - "function() {", // 2. - "$foo = ", // 3. <-- missing expr - "}", // 4. - "}" // 5. <-- extra '}' token here - ].join("\n"))).toMatchSnapshot(); + it("should contain 2 errors", function () { + expect( + test.parseEval( + [ + "$var = ", // 1. + "function() {", // 2. + "$foo = ", // 3. <-- missing expr + "}", // 4. + "}", // 5. <-- extra '}' token here + ].join("\n"), + ), + ).toMatchSnapshot(); }); - it("test expr", function() { + it("test expr", function () { expect(test.parseEval("$a = $b -; $foo = $a;")).toMatchSnapshot(); }); - it("test class", function() { + it("test class", function () { expect(test.parseEval("class foo { foo const A = 1 ")).toMatchSnapshot(); }); - it("test flags", function() { - expect(test.parseEval(` + it("test flags", function () { + expect( + test.parseEval(` final final interface foo { abstract function func() - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - it("test function arguments", function() { - expect(test.parseEval(` + it("test flags (2)", function () { + expect( + test.parseEval(` + final final class foo { + abstract function func() + `), + ).toMatchSnapshot(); + }); + + it("test flags (3)", function () { + expect( + test.parseEval(` + final final trait foo { + abstract function func() + `), + ).toMatchSnapshot(); + }); + + it("interface", function () { + expect( + test.parseEval("interface foo implement baz {}"), + ).toMatchSnapshot(); + }); + + it("trait", function () { + expect( + test.parseEval("trait foo extends bar implement baz {}"), + ).toMatchSnapshot(); + }); + + it("test function arguments", function () { + expect( + test.parseEval(` $foo->bar($arg, ); $foo = new bar($baz, ,$foo); - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - it("test method chains", function() { - expect(test.parseEval(` + it("test method chains", function () { + expect( + test.parseEval(` $controller->expects($this->once()) -> - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); + }); + + it("staticlookup", function () { + expect(test.parseEval("Order::{call()};")).toMatchSnapshot(); + }); + + it("should fail !", function () { + expect(test.parseEval("new Foo::{call()}();")).toMatchSnapshot(); + }); + + it("should fail with '{' and ']'", function () { + expect(test.parseEval("$obj{$foo];")).toMatchSnapshot(); + }); + + it("should fail with '[' and '}'", function () { + expect(test.parseEval("$obj[$bar};")).toMatchSnapshot(); }); }); }); diff --git a/test/snapshot/heredoc.test.js b/test/snapshot/heredoc.test.js new file mode 100644 index 000000000..801949d37 --- /dev/null +++ b/test/snapshot/heredoc.test.js @@ -0,0 +1,508 @@ +const parser = require("../main"); + +describe("heredoc", function () { + it("simple", function () { + expect( + parser.parseEval(` +echo <<foo. +Now, I am printing some {$foo->bar[1]}. +This should print a capital 'A': \x41 +EOT; + `), + ).toMatchSnapshot(); + }); + + it("inside call", function () { + expect( + parser.parseEval(` +var_dump(array(<<bar[1]} + b + c + END; + `), + ).toMatchSnapshot(); + }); + + it("Flexible heredoc syntax: If the closing marker is indented further than any lines of the body", () => { + expect( + parser.parseEval( + ` + echo << { + expect( + parser.parseEval( + ` + echo << { + expect( + parser.parseEval( + ` + echo << { + expect( + parser.parseEval( + ` +echo << { + expect( + parser.parseEval( + ` +stringManipulator(<< { + expect( + parser.parseEval( + ` +$values = [<< { + expect( + parser.parseEval( + ` +$values = [<< { + expect( + parser.parseEval( + ` +$values = << { + expect( + parser.parseEval( + ` +$a = << { + expect( + parser.parseEval( + ` +$a = <<<'EOT' + a + + EOT; + +$b = <<<'EOT' + b + EOT; +`, + ), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/if.test.js b/test/snapshot/if.test.js index 719caab60..478ebc3f5 100644 --- a/test/snapshot/if.test.js +++ b/test/snapshot/if.test.js @@ -1,7 +1,7 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test IF statements", function() { - it("test common cases", function() { +describe("Test IF statements", function () { + it("test common cases", function () { const ast = parser.parseEval( ` if (true) { @@ -15,13 +15,13 @@ describe("Test IF statements", function() { } `, { - parser: { debug: false } - } + parser: { debug: false }, + }, ); expect(ast).toMatchSnapshot(); }); - it("test short form", function() { + it("test short form", function () { const ast = parser.parseEval( ` if (true): @@ -33,13 +33,13 @@ describe("Test IF statements", function() { endif; `, { - parser: { debug: false } - } + parser: { debug: false }, + }, ); expect(ast).toMatchSnapshot(); }); - it("test various cases", function() { + it("test various cases", function () { const ast = parser.parseEval( ` if (true): @@ -56,13 +56,13 @@ describe("Test IF statements", function() { endif; `, { - parser: { debug: false } - } + parser: { debug: false }, + }, ); expect(ast).toMatchSnapshot(); }); - it("test issue #84", function() { + it("test issue #84", function () { const ast = parser.parseCode( ` @@ -70,13 +70,12 @@ describe("Test IF statements", function() { `, { - parser: { debug: false } - } + parser: { debug: false }, + }, ); expect(ast).toMatchSnapshot(); }); it("test issue #168", () => { - // should be ok let ast = parser.parseCode( ` @@ -84,9 +83,9 @@ describe("Test IF statements", function() { { ast: { withPositions: true, - withSource: true - } - } + withSource: true, + }, + }, ); expect(ast).toMatchSnapshot(); @@ -97,9 +96,9 @@ describe("Test IF statements", function() { { ast: { withPositions: true, - withSource: true - } - } + withSource: true, + }, + }, ); expect(ast).toMatchSnapshot(); @@ -110,11 +109,10 @@ describe("Test IF statements", function() { { ast: { withPositions: true, - withSource: true - } - } + withSource: true, + }, + }, ); expect(ast).toMatchSnapshot(); - }); }); diff --git a/test/snapshot/include.test.js b/test/snapshot/include.test.js new file mode 100644 index 000000000..c1590f8ab --- /dev/null +++ b/test/snapshot/include.test.js @@ -0,0 +1,16 @@ +const parser = require("../main"); + +describe("include", function () { + it("include", function () { + expect(parser.parseEval('include "string";')).toMatchSnapshot(); + }); + it("include once", function () { + expect(parser.parseEval('include_once "string";')).toMatchSnapshot(); + }); + it("require", function () { + expect(parser.parseEval('require "string";')).toMatchSnapshot(); + }); + it("require_once", function () { + expect(parser.parseEval('require_once "string";')).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/interface.test.js b/test/snapshot/interface.test.js new file mode 100644 index 000000000..0c52595b4 --- /dev/null +++ b/test/snapshot/interface.test.js @@ -0,0 +1,20 @@ +const parser = require("../main"); + +describe("interface", function () { + it("interface name as identifier", function () { + expect(parser.parseEval("interface A {}")).toMatchSnapshot(); + }); + it("extends", function () { + expect(parser.parseEval("interface A extends B {}")).toMatchSnapshot(); + }); + it("multiple extends", function () { + expect(parser.parseEval("interface A extends B, C {}")).toMatchSnapshot(); + }); + it("invalid private flag", function () { + expect( + parser.parseEval("interface A { private const B = 1; }", { + parser: { suppressErrors: true }, + }), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/isset.test.js b/test/snapshot/isset.test.js new file mode 100644 index 000000000..1218313f6 --- /dev/null +++ b/test/snapshot/isset.test.js @@ -0,0 +1,26 @@ +const parser = require("../main"); + +describe("isset", function () { + it("simple", function () { + expect(parser.parseEval("isset($var);")).toMatchSnapshot(); + }); + it("multiple", function () { + expect(parser.parseEval("isset($var, $var, $var);")).toMatchSnapshot(); + }); + it("assign", function () { + expect(parser.parseEval("$var = isset($var);")).toMatchSnapshot(); + }); + it("trailing comma", function () { + expect(parser.parseEval("isset($foo,);")).toMatchSnapshot(); + }); + it("trailing comma #2", function () { + expect(parser.parseEval("isset($foo, $bar,);")).toMatchSnapshot(); + }); + it("test errors", function () { + const errAst = parser.parseEval("$var = isset();", { + parser: { suppressErrors: true }, + }); + expect(errAst).toMatchSnapshot(); + expect(errAst.errors.length).not.toBe(0); + }); +}); diff --git a/test/snapshot/label.test.js b/test/snapshot/label.test.js new file mode 100644 index 000000000..35a5a93ed --- /dev/null +++ b/test/snapshot/label.test.js @@ -0,0 +1,8 @@ +const parser = require("../main"); + +describe("label", function () { + it("simple", function () { + expect(parser.parseEval('a: echo "Foo";')).toMatchSnapshot(); + expect(parser.parseEval('longName: echo "Foo";')).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/lexer.test.js b/test/snapshot/lexer.test.js index e04830e71..44da77238 100644 --- a/test/snapshot/lexer.test.js +++ b/test/snapshot/lexer.test.js @@ -1,44 +1,52 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test lexer", function() { - describe("initial state", function() { - it("parse short tag", function() { - expect(parser.parseCode("", { - lexer: { - short_tags: true - } - })).toMatchSnapshot(); +describe("Test lexer", function () { + describe("initial state", function () { + it("parse short tag", function () { + expect( + parser.parseCode("", { + lexer: { + short_tags: true, + }, + }), + ).toMatchSnapshot(); }); - it("parse short echo", function() { - expect(parser.parseCode("", { - lexer: { - short_tags: true - } - })).toMatchSnapshot(); + it("parse short echo", function () { + expect(parser.parseCode("")).toMatchSnapshot(); }); - it("parse asp tag", function() { - expect(parser.parseCode("<% echo $b; %>", { - lexer: { - short_tags: true, - asp_tags: true - } - })).toMatchSnapshot(); + it("#263 - expect inline", function () { + expect(parser.parseCode("")).toMatchSnapshot(); }); - it("parse asp echo tag", function() { - expect(parser.parseCode("<%= $b %>", { - lexer: { - short_tags: true, - asp_tags: true - } - })).toMatchSnapshot(); + it("parse asp tag", function () { + expect( + parser.parseCode("<% echo $b; %>", { + lexer: { + short_tags: true, + asp_tags: true, + }, + }), + ).toMatchSnapshot(); + }); + + it("parse asp echo tag", function () { + expect( + parser.parseCode("<%= $b %>", { + lexer: { + short_tags: true, + asp_tags: true, + }, + }), + ).toMatchSnapshot(); }); }); - it("test comments", function() { - expect(parser.parseCode(` + it("test comments", function () { + expect( + parser.parseCode( + ` <% @@ -46,28 +54,35 @@ describe("Test lexer", function() { list;")).toMatchSnapshot(); }); - it('test #148 - sensitive lexer', function() { - expect(parser.tokenGetAll(' list;')).toMatchSnapshot(); + it("test #1003 - null-safe operator with reserved keyword", function () { + expect(parser.parseCode("class;")).toMatchSnapshot(); }); }); diff --git a/test/snapshot/list.test.js b/test/snapshot/list.test.js index c7ab7d3b8..44289c621 100644 --- a/test/snapshot/list.test.js +++ b/test/snapshot/list.test.js @@ -1,34 +1,100 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test list expressions", function() { - it("test list statements", function() { +describe("Test list expressions", function () { + it("test list statements", function () { const ast = parser.parseEval(`list($a => list($c,$d,,$e,), $b) = [1, 2];`, { ast: { - withPositions: true - } + withPositions: true, + }, }); expect(ast).toMatchSnapshot(); }); - it("test short list", function() { - expect(parser.parseEval(`[$a => [$c,$d,,$e,], $b] = [1 => [5, 6, 7, 8, 9,], 2];`, { - ast: { - withPositions: true - } - })).toMatchSnapshot(); + it("test short list", function () { + expect( + parser.parseEval( + `[$a => [$c,$d,,$e,], $b] = [1 => [5, 6, 7, 8, 9,], 2];`, + { + ast: { + withPositions: true, + }, + }, + ), + ).toMatchSnapshot(); }); - it("fix #150", function() { + it("fix #150", function () { const ast = parser.parseEval("list('foo' => $bar) = ['foo' => 'bar'];"); expect(ast).toMatchSnapshot(); }); - it("fix #137", function() { + it("fix #137", function () { const ast = parser.parseEval("list(,,$a,,$b) = [null, 1, null, 2];", { ast: { - withPositions: true - } + withPositions: true, + }, }); expect(ast).toMatchSnapshot(); }); -}); \ No newline at end of file + + it("handles nested shorthand lists (fix #512)", () => { + expect(parser.parseEval("[$a, [$b, $c]] = [1,[2,3]]")).toMatchSnapshot(); + }); + + it("handles comments in nested shorthand lists", () => { + expect( + parser.parseEval( + "[/*a*/$a/*b*/, /*c*/ [/*d*/$b/*e*/, /*f*/$c/*g*/]/*h*/]/*i*/ = [1,[2,3]] /*j*/", + { + parser: { extractDoc: true }, + }, + ), + ).toMatchSnapshot(); + }); + + it("list without trailing commas", () => { + expect(parser.parseEval("['foo', 'bar'] = $a")).toMatchSnapshot(); + }); + + it("array without trailing commas", () => { + expect(parser.parseEval("['foo', 'bar'] = $a")).toMatchSnapshot(); + }); + + it("array with trailing commas", () => { + expect(parser.parseEval("['foo', 'bar',] = $a")).toMatchSnapshot(); + }); + + it("array with trailing commas #2", () => { + expect(parser.parseEval("['foo', 'bar' ,] = $a")).toMatchSnapshot(); + }); + + it("array with trailing commas #3", () => { + expect(parser.parseEval("['foo', 'bar' , ] = $a")).toMatchSnapshot(); + }); + + it("array with multiple trailing commas", () => { + expect(parser.parseEval("['foo', 'bar',,] = $a")).toMatchSnapshot(); + }); + + it("array with multiple trailing commas #2", () => { + expect(parser.parseEval("['foo', 'bar',,,,,] = $a")).toMatchSnapshot(); + }); + + it("array with empty values", () => { + expect( + parser.parseEval("[,,,'foo',,, 'bar',,,'baz'] = $a"), + ).toMatchSnapshot(); + }); + + it("array with empty values #2", () => { + expect( + parser.parseEval("[,,,'foo',,, 'bar',,,'baz',] = $a"), + ).toMatchSnapshot(); + }); + + it("array with empty values #3", () => { + expect( + parser.parseEval("[,,,'foo',,, 'bar',,,'baz',,] = $a"), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/location.test.js b/test/snapshot/location.test.js index 6db3e4621..8759f01cf 100644 --- a/test/snapshot/location.test.js +++ b/test/snapshot/location.test.js @@ -1,28 +1,232 @@ -const parser = require('../main'); +const parser = require("../main"); -describe('Test locations', function() { - it('#164 : expr must include ;', function() { +describe("Test locations", function () { + it.each([ + ["#230 : check location", "$var1 + $var2 + $var3;"], + [ + "#230 : check location on retif", + "$var1 + $var2 ? true : $false ? $innerTrue : $innerFalse;", + ], + ["#230 : check location on cast", "(string)$var1 + $var2;"], + ["#202 : include calling argument", "$foo->bar->baz($arg);"], + ["#164 : expr must include ;", "$a = $b + 1;"], + [ + "if/elseif/else", + 'if ($a > $b) echo "something"; elseif ($a < $b) echo "something"; else echo "something";', + ], + [ + "if/elseif/else block", + 'if ($a > $b) { echo "something"; } elseif ($a < $b) { echo "something"; } else { echo "something"; }', + ], + ["switch", "switch ($i) {}"], + ["switch case", 'switch ($i) { case 0: echo "something"; break; }'], + ["switch default", 'switch ($i) { default: echo "something"; }'], + ["for", 'for ($i = 1; $i <= 10; $i++) echo "something";'], + ["for block", 'for ($i = 1; $i <= 10; $i++) { echo "something"; }'], + ["foreach", 'foreach ($arr as $value) echo "something";'], + ["foreach block", 'foreach ($arr as $value) { echo "something"; }'], + ["while", 'while(true) echo "something";'], + ["while block", 'while(true) { echo "something"; }'], + ["do", "do { echo $i; } while(true);"], + ["return", "return 1;"], + ["break", "break;"], + + ["continue", "continue;"], + ["global", "global $a;"], + ["static", "static $a = 1;"], + ["static multiple", "static $a = 1, $b = 2, $c = 3;"], + ["echo", 'echo "something";'], + ["unset", "unset($foo);"], + ["declare", "declare(ticks=1);"], + ["declare block", 'declare(ticks=1) { echo "something"; }'], + ["try", "try new Exception();"], + ["goto", "goto a;"], + ["goto #2", "goto longName;"], + ["label", 'a: echo "something";'], + ["label #2", 'longName: echo "something";'], + ["function", 'function foo() { echo "something"; }'], + ["class", "class Foo {}"], + ["abstract class", "abstract class Foo {}"], + ["final class", "final class Foo {}"], + ["class (inner statement)", "function foo() { class Foo {} }"], + [ + "abstract class (inner statement)", + "function foo() { abstract class Foo {} }", + ], + ["final class (inner statement)", "function foo() { final class Foo {} }"], + ["interface", "interface Foo {}"], + ["trait", "trait Foo {}"], + ["namespace", "namespace my\\name;"], + ["namespace backets", 'namespace my\\name { echo "something"; }'], + ["string double quotes", '"string";'], + ["string single quotes", "'string';"], + ["number", "2112;"], + ["negative number", "-2112;"], + ["magic", "__DIR__;"], + ["ternary", '$valid ? "yes" : "no";'], + ["ternary no true expression", '$valid ?: "no";'], + ["variable", "$var;"], + ["assign", "$var = true;"], + ["assign by ref", "$var = &$var;"], + ["assign mutliple", "$var = $other = true;"], + ["unary", "!$var;"], + ["pre", "++$var;"], + ["post", "$var++;"], + ["yield", "yield $var;"], + ["yield from", "yield from from();"], + ["bin", "$var = $var + 100;"], + ["array", "array(1, 2, 3);"], + ["array nested", "array(array(1, 2, 3));"], + ["array short form", "[1, 2, 3];"], + ["array short form nested", "[[1, 2, 3]];"], + [ + "array with keys, byRef and unpack", + `$var = [1, 'foo', 'test' => $foo, 'test' => &$foo, ...$var];`, + ], + ["clone", "clone $var;"], + ["new", "new Foo();"], + ["new anonymous class", "$var = new class {};"], + ["eval", 'eval("code");'], + ["exit", "exit(1);"], + ["print", 'print "something";'], + ["include", 'include "something";'], + ["isset", "$var = isset($var);"], + ["empty", "$var = empty($var);"], + ["silent", "$var = @call();"], + ["variadic", "call(...$var);"], + ["try/catch/finally", "try {} catch (Exception $e) {} finally {}"], + [ + "nowdoc", + `<<<'EOD' +Text +EOD;`, + ], + [ + "nowdoc assign", + `$var = <<<'EOD' +Text +EOD;`, + ], + [ + "encapsed heredoc", + `<<each() // Comment + // Comment + ->map() // Comment + // Comment + ->first() // Comment + // Comment + ->dump(); + `, + ], + [ + "staticlookup", + ` + $var = $var + // Comment + ::each() // Comment + // Comment + ::map() // Comment + // Comment + ::first() // Comment + // Comment + ::dump(); + `, + ], + [ + "offsetlookup", + ` + $var = $var + // Comment + [ 'foo' ] // Comment + // Comment + ['bar'] // Comment + // Comment + ['baz'] // Comment + // Comment + ['qqq']; + `, + ], + ["assign []", `$var[] = $var`], + ["single call", `call();`], + ])("test %s", (_, code) => { expect( - parser.parseEval( - '$a = $b + 1;', { - ast: { - withPositions: true, - withSource: true - } - } - ) + parser.parseEval(code, { + ast: { + withPositions: true, + withSource: true, + }, + }), ).toMatchSnapshot(); }); - it('#164 : expr should avoid ?>', function() { + + it("#164 : expr should avoid ?>", function () { expect( - parser.parseCode( - '', { - ast: { - withPositions: true, - withSource: true - } - } - ) + parser.parseCode("", { + ast: { + withPositions: true, + withSource: true, + }, + }), ).toMatchSnapshot(); }); -}); \ No newline at end of file +}); diff --git a/test/snapshot/loop.test.js b/test/snapshot/loop.test.js index 701c282bf..dd9601ecc 100644 --- a/test/snapshot/loop.test.js +++ b/test/snapshot/loop.test.js @@ -1,36 +1,47 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test loops statements (for, while)", function() { - describe("test while", function() { - it("test default form", function() { - expect(parser.parseEval(` +describe("Test loops statements (for, while)", function () { + describe("test while", function () { + it("test default form", function () { + expect( + parser.parseEval(` while(true) { echo "go"; } - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - it("test short form", function() { - expect(parser.parseEval(` + it("test short form", function () { + expect( + parser.parseEval(` while(true): echo "short"; endwhile; - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); }); - it("test do", function() { - expect(parser.parseEval(` + it("test do", function () { + expect( + parser.parseEval( + ` do { echo "something"; } while(true); - `, { - parser: { debug: false } - })).toMatchSnapshot(); + `, + { + parser: { debug: false }, + }, + ), + ).toMatchSnapshot(); }); - it("test for", function() { - expect(parser.parseEval(` + it("test for", function () { + expect( + parser.parseEval( + ` for($i = 0, $b = 0; $i < 10, $ok; $i++) echo $i; for(;;): @@ -38,13 +49,18 @@ describe("Test loops statements (for, while)", function() { continue 5; continue(5); endfor; - `, { - parser: { debug: false } - })).toMatchSnapshot(); + `, + { + parser: { debug: false }, + }, + ), + ).toMatchSnapshot(); }); - it("test foreach", function() { - expect(parser.parseEval(` + it("test foreach", function () { + expect( + parser.parseEval( + ` foreach(&$foo as $v) echo "$k -> $v\n"; foreach( @@ -54,23 +70,36 @@ describe("Test loops statements (for, while)", function() { ): echo "$a -> $b\n"; endforeach; - `, { - parser: { debug: false } - })).toMatchSnapshot(); + `, + { + parser: { debug: false }, + }, + ), + ).toMatchSnapshot(); }); - it("fix #122", function() { + it("fix #122", function () { // https://github.com/glayzzle/php-parser/issues/122 - expect(parser.parseEval(` + expect( + parser.parseEval( + ` foreach($foo as $bar => array($foo)) echo "$k -> $v\n"; - `, { - parser: { suppressErrors: true } - })).toMatchSnapshot(); - expect(parser.parseEval(` + `, + { + parser: { suppressErrors: true }, + }, + ), + ).toMatchSnapshot(); + expect( + parser.parseEval( + ` foreach($foo as [$bar] => $foo) echo "$k -> $v\n"; - `, { - parser: { suppressErrors: true } - })).toMatchSnapshot(); - }) + `, + { + parser: { suppressErrors: true }, + }, + ), + ).toMatchSnapshot(); + }); }); diff --git a/test/snapshot/magic.test.js b/test/snapshot/magic.test.js new file mode 100644 index 000000000..d92eec895 --- /dev/null +++ b/test/snapshot/magic.test.js @@ -0,0 +1,31 @@ +const parser = require("../main"); + +describe("magic", function () { + it("__LINE__", function () { + expect(parser.parseEval("__LINE__;")).toMatchSnapshot(); + }); + it("__LINE__ lowercase", function () { + expect(parser.parseEval("__line__;")).toMatchSnapshot(); + }); + it("__FILE__", function () { + expect(parser.parseEval("__FILE__;")).toMatchSnapshot(); + }); + it("__DIR__", function () { + expect(parser.parseEval("__DIR__;")).toMatchSnapshot(); + }); + it("__FUNCTION__", function () { + expect(parser.parseEval("__FUNCTION__;")).toMatchSnapshot(); + }); + it("__CLASS__", function () { + expect(parser.parseEval("__CLASS__;")).toMatchSnapshot(); + }); + it("__TRAIT__", function () { + expect(parser.parseEval("__TRAIT__;")).toMatchSnapshot(); + }); + it("__METHOD__", function () { + expect(parser.parseEval("__METHOD__;")).toMatchSnapshot(); + }); + it("__NAMESPACE__", function () { + expect(parser.parseEval("__NAMESPACE__;")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/match.test.js b/test/snapshot/match.test.js new file mode 100644 index 000000000..4ccd0bbbc --- /dev/null +++ b/test/snapshot/match.test.js @@ -0,0 +1,62 @@ +const parser = require("../main"); + +describe("match", () => { + it("can be parsed", () => { + const ast = parser.parseEval(` + $test = match($a) { + true => 'yes', + false => 'no', + default => null + }; + `); + expect(ast).toMatchSnapshot(); + }); + + it("can have lhs, functions", () => { + const ast = parser.parseEval(` + $test = match(true) { + test($a), abc($b) => 'yes', + default => null + }; + `); + expect(ast).toMatchSnapshot(); + }); + + it("can have multiple values", () => { + const ast = parser.parseEval(` + $test = match(trye) { + 0,1,2,3 => run(), + default => null + }; + `); + expect(ast).toMatchSnapshot(); + }); + it("can have hanging comma", () => { + const ast = parser.parseEval(` + $test = match($test) { + true, => 'ok', + false => throw new Exception('Nope'), + }; + `); + expect(ast).toMatchSnapshot(); + }); + it("does not support older php than 8", () => { + expect(() => { + new parser({ parser: { version: 704 } }).parseEval(` + $test = match($test) { + true => 'ok', + false => 'Nope!', + }; + `); + }).toThrow(SyntaxError); + }); + it("can be nested", () => { + const ast = parser.parseEval(` + $v = match(callMe(1,2,3)) { + null => match($err) { 1 => 'Connect', 2 => 'Auth'}, + match($a) {true => 0, false => -1} => 'Ok' + }; + `); + expect(ast).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/namespace.test.js b/test/snapshot/namespace.test.js index ddde2e7d2..b39f1602d 100644 --- a/test/snapshot/namespace.test.js +++ b/test/snapshot/namespace.test.js @@ -1,16 +1,27 @@ -const parser = require('../main'); - -describe("Test namespace statements", function() { - it("allow trailing comma for grouped namespaces #177", function() { - expect(parser.parseEval(` +const parser = require("../main"); + +describe("Test namespace statements", function () { + it("fix #246 - doesn't work properly for `FULL_QUALIFIED_NAME`", function () { + expect( + parser.parseEval(` + $obj = new \\Foo(); + `), + ).toMatchSnapshot(); + }); + it("allow trailing comma for grouped namespaces #177", function () { + expect( + parser.parseEval(` use Foo\\Bar\\ { Foo, Bar, Baz, - };`)).toMatchSnapshot(); + };`), + ).toMatchSnapshot(); }); - it("test single namespace", function() { - expect(parser.parseEval(` + it("test single namespace", function () { + expect( + parser.parseEval( + ` namespace foo; use bar\\baz as barBaz; use const bar\\baz as barBaz, baz\\boo as bazBoo; @@ -27,82 +38,135 @@ describe("Test namespace statements", function() { $b = \\barBaz; $c = barBaz\\foo; $d = barBaz; - `, { - parser: { - debug: false - } - })).toMatchSnapshot(); + `, + { + parser: { + debug: false, + }, + }, + ), + ).toMatchSnapshot(); }); - it("test multiple namespace", function() { - expect(parser.parseEval(` + it("test multiple namespace", function () { + expect( + parser.parseEval( + ` namespace \\foo { $i++; } namespace { $b++; } - `, { - parser: { - debug: false - } - })).toMatchSnapshot(); + `, + { + parser: { + debug: false, + }, + }, + ), + ).toMatchSnapshot(); }); - it("test namespace keyword", function() { - expect(parser.parseEval(` + it("test namespace keyword", function () { + expect( + parser.parseEval( + ` namespace\\foo(); $var = namespace\\bar; - `, { - parser: { - debug: false - } - })).toMatchSnapshot(); + `, + { + parser: { + debug: false, + }, + }, + ), + ).toMatchSnapshot(); + }); + + it("test keywords", function () { + expect( + parser.parseEval( + ` + namespace\\enum(); + \\foo\\trait\\class(); + use \\foo\\bar\\{ a, b }; + $var = namespace\\bar; + `, + { + parser: { + debug: false, + }, + }, + ), + ).toMatchSnapshot(); }); - it("test namespace error", function() { - expect(parser.parseEval(` + it("test bare namespace separator", function () { + expect( + parser.parseEval(`\\`, { + parser: { + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); + }); + + it("test namespace error", function () { + expect( + parser.parseEval( + ` namespace $var = true; - `, { - parser: { - debug: false, - suppressErrors: true - } - })).toMatchSnapshot(); + `, + { + parser: { + debug: false, + suppressErrors: true, + }, + }, + ), + ).toMatchSnapshot(); }); - it("check namespace", function() { + it("check namespace", function () { // @todo }); - it("check use", function() { + it("check use", function () { // @todo }); - it("check resolution", function() { + it("check resolution", function () { // @todo }); - it("check silent mode", function() { - expect(parser.parseEval(` + it("check silent mode", function () { + expect( + parser.parseEval( + ` namespace $var = true; - `, { - parser: { - debug: false, - suppressErrors: true - } - })).toMatchSnapshot(); + `, + { + parser: { + debug: false, + suppressErrors: true, + }, + }, + ), + ).toMatchSnapshot(); }); - it("work with declare statement", function() { - expect(parser.parseEval(` + it("work with declare statement", function () { + expect( + parser.parseEval(` declare(strict_types=1); namespace foo; class bar {} - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - describe("read usegroup location correctly", function() { + describe("read usegroup location correctly", function () { const testString = ` namespace Test\\test\\test; @@ -125,23 +189,27 @@ describe("Test namespace statements", function() { } `; - it("without docs", function() { - expect(parser.parseEval(testString, { - ast: { - withPositions: true - } - })).toMatchSnapshot() + it("without docs", function () { + expect( + parser.parseEval(testString, { + ast: { + withPositions: true, + }, + }), + ).toMatchSnapshot(); }); - it("with docs", function() { - expect(parser.parseEval(testString, { - ast: { - withPositions: true - }, - parser: { - extractDoc: true - } - })).toMatchSnapshot() + it("with docs", function () { + expect( + parser.parseEval(testString, { + ast: { + withPositions: true, + }, + parser: { + extractDoc: true, + }, + }), + ).toMatchSnapshot(); }); }); }); diff --git a/test/snapshot/new.test.js b/test/snapshot/new.test.js new file mode 100644 index 000000000..db340d959 --- /dev/null +++ b/test/snapshot/new.test.js @@ -0,0 +1,88 @@ +const parser = require("../main"); + +describe("new", function () { + it("#348 - byref usage deprecated", function () { + expect( + parser.parseEval("$a =& new Foo();", { + parser: { + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); + }); + it("simple", function () { + expect(parser.parseEval("new Foo();")).toMatchSnapshot(); + }); + it("variable", function () { + expect(parser.parseEval("new $var;")).toMatchSnapshot(); + }); + it("simple (2)", function () { + expect(parser.parseEval("new \\Foo();")).toMatchSnapshot(); + }); + it("simple (3)", function () { + expect(parser.parseEval("new Foo\\Foo();")).toMatchSnapshot(); + }); + it("simple (4)", function () { + expect(parser.parseEval("new \\Foo\\Foo();")).toMatchSnapshot(); + }); + it("no parens", function () { + expect(parser.parseEval("new Foo;")).toMatchSnapshot(); + }); + it("anonymous", function () { + expect(parser.parseEval("new class() {};")).toMatchSnapshot(); + }); + it("anonymous no parens", function () { + expect(parser.parseEval("new class {};")).toMatchSnapshot(); + }); + it("anonymous with argument", function () { + expect(parser.parseEval("new class($var) {};")).toMatchSnapshot(); + }); + it("anonymous with multiple argument", function () { + expect( + parser.parseEval("new class($one, $two, $three) {};"), + ).toMatchSnapshot(); + }); + it("static array", () => { + expect( + parser.parseEval("return new self::$mapping[$map]();"), + ).toMatchSnapshot(); + }); + it("parent", function () { + expect(parser.parseEval("new parent();")).toMatchSnapshot(); + }); + it("self", function () { + expect(parser.parseEval("new self();")).toMatchSnapshot(); + }); + it("static", function () { + expect(parser.parseEval("new static();")).toMatchSnapshot(); + }); + it("with arguments", function () { + expect( + parser.parseEval('new Foo("constructor", "bar");'), + ).toMatchSnapshot(); + }); + it("trailing comma", function () { + expect( + parser.parseEval('new Foo("constructor", "bar",);'), + ).toMatchSnapshot(); + }); + it("anonymous class", function () { + expect(parser.parseEval("$var = new class {};")).toMatchSnapshot(); + }); + it("anonymous class #2", function () { + expect(parser.parseEval("$var = new class($var) {};")).toMatchSnapshot(); + }); + it("anonymous class #3", function () { + expect( + parser.parseEval( + "$var = new class($var) extends SomeClass implements SomeInterface {};", + ), + ).toMatchSnapshot(); + }); + it("result from function", function () { + expect(parser.parseEval("$a = new (b('c')('d'));")).toMatchSnapshot(); + }); + it("result from function with arguments", function () { + expect(parser.parseEval("$a = new (b('c')('d'))('e');")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/nowdoc.test.js b/test/snapshot/nowdoc.test.js new file mode 100644 index 000000000..4690d23fc --- /dev/null +++ b/test/snapshot/nowdoc.test.js @@ -0,0 +1,159 @@ +const parser = require("../main"); + +describe("nowdoc", function () { + it("simple", function () { + expect( + parser.parseEval(` +echo <<<'EOD' +Example of string +spanning multiple lines +using heredoc syntax. +EOD; + `), + ).toMatchSnapshot(); + }); + + it("with space between <<< and label", function () { + expect( + parser.parseEval(` +echo <<< 'EOD' +Example of string +spanning multiple lines +using heredoc syntax. +EOD; + `), + ).toMatchSnapshot(); + }); + + it("with variables", function () { + expect( + parser.parseEval(` +echo <<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should print a capital 'A': \x41 +EOT; + `), + ).toMatchSnapshot(); + }); + + it("inside call", function () { + expect( + parser.parseEval(` +var_dump(array(<<<'EOD' +foobar! +EOD +)); + `), + ).toMatchSnapshot(); + }); + + it("inside function", function () { + expect( + parser.parseEval(` +function foo() +{ + static $bar = <<<'LABEL' +Nothing in here... +LABEL; +} + `), + ).toMatchSnapshot(); + }); + + it("inside class", function () { + expect( + parser.parseEval(` +class foo { + const BAR = <<<'FOOBAR' +Constant example +FOOBAR; + + public $baz = <<<'FOOBAR' +Property example +FOOBAR; +} + `), + ).toMatchSnapshot(); + }); + + it("empty", function () { + expect( + parser.parseEval(` +echo <<<'TEST' +TEST; + `), + ).toMatchSnapshot(); + }); + + it("only newline", function () { + expect( + parser.parseEval(` +echo <<<'TEST' + +TEST; + `), + ).toMatchSnapshot(); + }); + + it("space between <<< and label", function () { + expect( + parser.parseEval(` +echo <<< 'TEST' + a + b +c +TEST; + `), + ).toMatchSnapshot(); + }); + + it("tab between <<< and label", function () { + expect( + parser.parseEval(` +echo <<<\t'TEST' + a + b +c +TEST; + `), + ).toMatchSnapshot(); + }); + + it("Flexible nowdoc syntax: 4 spaces of indentation", function () { + expect( + parser.parseEval(` + echo <<<'END' + a + b + c + END; + `), + ).toMatchSnapshot(); + }); + + it("Flexible nowdoc syntax: with variables", function () { + expect( + parser.parseEval(` + echo <<<'END' + a + {$foo->bar[1]} + b + c + END; + `), + ).toMatchSnapshot(); + }); + + it("Followed by string interpolation", function () { + expect( + parser.parseEval(` + $x = <<<'NOWDOC' + ... + NOWDOC; + + $y = "_$z"; + `), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/nullsavepropertylookup.test.js b/test/snapshot/nullsavepropertylookup.test.js new file mode 100644 index 000000000..50e82ac32 --- /dev/null +++ b/test/snapshot/nullsavepropertylookup.test.js @@ -0,0 +1,18 @@ +const parser = require("../main"); + +describe("nullsavepropertylookup", function () { + it("simple", function () { + expect(parser.parseEval("$obj?->property;")).toMatchSnapshot(); + }); + it("variable", function () { + expect(parser.parseEval("$obj?->$property;")).toMatchSnapshot(); + }); + it("call", function () { + expect(parser.parseEval("$obj?->call();")).toMatchSnapshot(); + }); + it("multiple", function () { + expect( + parser.parseEval("$obj?->property_1?->property_2;"), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/number.test.js b/test/snapshot/number.test.js index 56601fe35..84b6960b0 100644 --- a/test/snapshot/number.test.js +++ b/test/snapshot/number.test.js @@ -1,8 +1,10 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test numbers", function() { - it("test common cases", function() { - expect(parser.parseEval(` +describe("Test numbers", function () { + it("test common cases", function () { + expect( + parser.parseEval(` + 1234; $a = -1.5; $b = 1234; $c = 9223372036854775807; @@ -13,20 +15,33 @@ describe("Test numbers", function() { $f = 0123; $g = 1.2e3; $h = 7E-10; - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - it("test edge cases", function() { - expect(parser.parseEval(` - $a = 0xx; - $b = 0b2; - $c = 01239; - $d = 7E-a; - $e = 7EX; - `, { + it.each([ + ["hexa without hex", "$a = 0xx;"], + ["binary with 2", "$b = 0b2;"], + ["multiple points", "$b = 1.0.5;"], + // @fixme : PHP Parse error: Invalid numeric literal in %s + // ["octal with 9", "$c = 01239;"], + ["exponent with letter", "$d = 7E-a;"], + ["variant (for coverage)", "$d = 7e+a;"], + ["exponent empty", "$e = 7EX;"], + ["underscore #1", "$e = 7__0;"], + ["underscore #2", "$e = 7._0;"], + ["underscore #3", "$e = 7_.0;"], + ["underscore #4", "$e = 7e_0;"], + ["underscore #5", "$e = 7_e0;"], + ])("%s", function (_, code) { + const ast = parser.parseEval(code, { parser: { - suppressErrors: true - } - })).toMatchSnapshot(); + suppressErrors: true, + }, + }); + // expect to fail + expect(ast.errors.length).toBeGreaterThan(0); + // check structure + expect(ast).toMatchSnapshot(); }); }); diff --git a/test/snapshot/offsetlookup.test.js b/test/snapshot/offsetlookup.test.js new file mode 100644 index 000000000..6e65f832c --- /dev/null +++ b/test/snapshot/offsetlookup.test.js @@ -0,0 +1,50 @@ +const parser = require("../main"); + +describe("offsetlookup", function () { + it("simple", function () { + expect(parser.parseEval('$obj["index"];')).toMatchSnapshot(); + }); + it("variable", function () { + expect(parser.parseEval("$obj[$var];")).toMatchSnapshot(); + }); + it("call", function () { + expect(parser.parseEval("$obj[$var]();")).toMatchSnapshot(); + }); + it("multiple", function () { + expect(parser.parseEval('$obj["first"]["second"];')).toMatchSnapshot(); + }); + it("simple (curly)", function () { + expect(parser.parseEval('$obj{"index"};')).toMatchSnapshot(); + }); + it("variable (curly)", function () { + expect(parser.parseEval("$obj{$var};")).toMatchSnapshot(); + }); + it("call (curly)", function () { + expect(parser.parseEval("$obj{$var}();")).toMatchSnapshot(); + }); + it("multiple (curly)", function () { + expect(parser.parseEval('$obj{"first"}{"second"};')).toMatchSnapshot(); + }); + it("inside propertylookup", function () { + expect( + parser.parseEval(` +$foo->bzr_[1]; +$foo->bzr_['string']; +$foo->bzr_[$baz]; +$foo->bzr_[$baz->foo]; +$foo->bzr_[$var ? 'one' : 'two']; + `), + ).toMatchSnapshot(); + }); + it("inside propertylookup (curly)", function () { + expect( + parser.parseEval(` +$foo->bzr_{1}; +$foo->bzr_{'string'}; +$foo->bzr_{$baz}; +$foo->bzr_{$baz->foo}; +$foo->bzr_{$var ? 'one' : 'two'}; + `), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/parentreference.test.js b/test/snapshot/parentreference.test.js new file mode 100644 index 000000000..98e6bc5c7 --- /dev/null +++ b/test/snapshot/parentreference.test.js @@ -0,0 +1,28 @@ +const parser = require("../main"); + +describe("parentreference", function () { + it("variable", function () { + expect(parser.parseEval("parent::$var;")).toMatchSnapshot(); + }); + it("constant", function () { + expect(parser.parseEval("parent::CONSTANT;")).toMatchSnapshot(); + }); + it("call", function () { + expect(parser.parseEval("parent::call();")).toMatchSnapshot(); + }); + it("uppercase", function () { + expect(parser.parseEval("PARENT::call();")).toMatchSnapshot(); + }); + it("argument", function () { + expect(parser.parseEval("function foo(parent $arg) {}")).toMatchSnapshot(); + }); + it("argument (uppercase)", function () { + expect(parser.parseEval("function foo(PARENT $arg) {}")).toMatchSnapshot(); + }); + it("return type declarations", function () { + expect(parser.parseEval("function foo($arg): parent {}")).toMatchSnapshot(); + }); + it("return type declarations (uppercase)", function () { + expect(parser.parseEval("function foo($arg): PARENT {}")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/php5.test.js b/test/snapshot/php5.test.js index 8c9fafb6b..f1dc07ba0 100644 --- a/test/snapshot/php5.test.js +++ b/test/snapshot/php5.test.js @@ -1,13 +1,12 @@ -const parser = require('../main'); +const parser = require("../main"); -describe('Test syntax parsing without PHP7 support', function() { - - it('special keywords should fail', function() { - var ast = parser.parseEval('class foo { function list() { } }', { +describe("Test syntax parsing without PHP7 support", function () { + it("special keywords should fail", function () { + const ast = parser.parseEval("class foo { function list() { } }", { parser: { - php7: false, - suppressErrors: true - } + version: "5.6", + suppressErrors: true, + }, }); expect(ast).toMatchSnapshot(); }); diff --git a/test/snapshot/php73.test.js b/test/snapshot/php73.test.js new file mode 100644 index 000000000..8bc4d9d54 --- /dev/null +++ b/test/snapshot/php73.test.js @@ -0,0 +1,76 @@ +const parser = require("../main"); + +describe("Test syntax parsing with PHP 73 support", function () { + it("https://wiki.php.net/rfc/list_reference_assignment", function () { + const ast = parser.parseEval( + "[$a, &$b] = $array; list($a, &$b) = $array;", + { + parser: { + version: "7.3", + }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + + it("https://wiki.php.net/rfc/trailing-comma-function-calls", function () { + const ast = parser.parseEval( + ` + $newArray = array_merge( + $arrayOne, + $arrayTwo, + ['foo', 'bar'], + ); + + $foo = new Foo( + 'constructor', + 'bar', + ); + + $foo->bar( + 'method', + 'bar', + ); + + $foo( + 'invoke', + 'bar', + ); + + unset($foo, $bar,); + var_dump(isset($foo, $bar,)); + `, + { + parser: { + version: "7.3", + }, + }, + ); + expect(ast).toMatchSnapshot(); + }); + + it("https://wiki.php.net/rfc/trailing-comma-function-calls#errors", function () { + const ast = parser.parseEval( + ` + # Parse error + function bar($a, $b,) { + // + } + # Parse error + foo(,); + + # Parse error + foo('function', 'bar',,); + # Also parse error + foo(, 'function', 'bar'); + `, + { + parser: { + version: "7.3", + suppressErrors: true, + }, + }, + ); + expect(ast).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/post.test.js b/test/snapshot/post.test.js new file mode 100644 index 000000000..016565309 --- /dev/null +++ b/test/snapshot/post.test.js @@ -0,0 +1,34 @@ +const parser = require("../main"); + +describe("post", function () { + it("++", function () { + expect(parser.parseEval("$var++;")).toMatchSnapshot(); + }); + it("--", function () { + expect(parser.parseEval("$var--;")).toMatchSnapshot(); + }); + it("++ and parens", function () { + expect(parser.parseEval("($var++);")).toMatchSnapshot(); + }); + it("-- and parens", function () { + expect(parser.parseEval("($var--);")).toMatchSnapshot(); + }); + it("++ and + unary", function () { + expect(parser.parseEval("+($var++);")).toMatchSnapshot(); + }); + it("++ and - unary", function () { + expect(parser.parseEval("-$var++;")).toMatchSnapshot(); + }); + it("++ and - unary (with parens)", function () { + expect(parser.parseEval("-($var++);")).toMatchSnapshot(); + }); + it("-- and + unary", function () { + expect(parser.parseEval("+$var--;")).toMatchSnapshot(); + }); + it("-- and + unary (with parens)", function () { + expect(parser.parseEval("+($var--);")).toMatchSnapshot(); + }); + it("-- and unary -", function () { + expect(parser.parseEval("-($var--);")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/pre.test.js b/test/snapshot/pre.test.js new file mode 100644 index 000000000..5276ef10f --- /dev/null +++ b/test/snapshot/pre.test.js @@ -0,0 +1,34 @@ +const parser = require("../main"); + +describe("pre", function () { + it("++", function () { + expect(parser.parseEval("++$var;")).toMatchSnapshot(); + }); + it("--", function () { + expect(parser.parseEval("--$var;")).toMatchSnapshot(); + }); + it("++ and parens", function () { + expect(parser.parseEval("(++$var);")).toMatchSnapshot(); + }); + it("-- and parens", function () { + expect(parser.parseEval("(--$var);")).toMatchSnapshot(); + }); + it("++ and + unary", function () { + expect(parser.parseEval("+(++$var);")).toMatchSnapshot(); + }); + it("++ and - unary", function () { + expect(parser.parseEval("-++$var;")).toMatchSnapshot(); + }); + it("++ and - unary (with parens)", function () { + expect(parser.parseEval("-(++$var);")).toMatchSnapshot(); + }); + it("-- and + unary", function () { + expect(parser.parseEval("+--$var;")).toMatchSnapshot(); + }); + it("-- and + unary (with parens)", function () { + expect(parser.parseEval("+(--$var);")).toMatchSnapshot(); + }); + it("-- and unary -", function () { + expect(parser.parseEval("-(--$var);")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/print.test.js b/test/snapshot/print.test.js new file mode 100644 index 000000000..9e3858aa3 --- /dev/null +++ b/test/snapshot/print.test.js @@ -0,0 +1,7 @@ +const parser = require("../main"); + +describe("print", function () { + it("simple", function () { + expect(parser.parseEval('print "string";')).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/property.test.js b/test/snapshot/property.test.js new file mode 100644 index 000000000..0761a087a --- /dev/null +++ b/test/snapshot/property.test.js @@ -0,0 +1,124 @@ +const parser = require("../main"); + +describe("property", () => { + it("var", () => { + expect(parser.parseEval("class Foo { var $property; }")).toMatchSnapshot(); + }); + it("var with value", () => { + expect( + parser.parseEval("class Foo { var $property = 10; }"), + ).toMatchSnapshot(); + }); + it("public", () => { + expect( + parser.parseEval("class Foo { public $property; }"), + ).toMatchSnapshot(); + }); + it("public with value", () => { + expect( + parser.parseEval("class Foo { public $property = 10; }"), + ).toMatchSnapshot(); + }); + it("protected", () => { + expect( + parser.parseEval("class Foo { protected $property; }"), + ).toMatchSnapshot(); + }); + it("protected with value", () => { + expect( + parser.parseEval("class Foo { protected $property = 10; }"), + ).toMatchSnapshot(); + }); + it("private", () => { + expect( + parser.parseEval("class Foo { private $property; }"), + ).toMatchSnapshot(); + }); + it("private with value", () => { + expect( + parser.parseEval("class Foo { private $property = 10; }"), + ).toMatchSnapshot(); + }); + it("public static", () => { + expect( + parser.parseEval("class Foo { public static $property; }"), + ).toMatchSnapshot(); + }); + it("public static with value", () => { + expect( + parser.parseEval("class Foo { public static $property = 10; }"), + ).toMatchSnapshot(); + }); + it("without value", () => { + expect( + parser.parseEval("class Foo { public $property; }"), + ).toMatchSnapshot(); + }); + it("with string number value", () => { + expect( + parser.parseEval("class Foo { public $property = 10; }"), + ).toMatchSnapshot(); + }); + it("with single quotes string value", () => { + expect( + parser.parseEval("class Foo { public $property = 'string'; }"), + ).toMatchSnapshot(); + }); + it("with double quotes string value", () => { + expect( + parser.parseEval('class Foo { public $property = "string"; }'), + ).toMatchSnapshot(); + }); + it("with boolean value", () => { + expect( + parser.parseEval("class Foo { public $property = true; }"), + ).toMatchSnapshot(); + }); + it("with bin value", () => { + expect( + parser.parseEval("class Foo { public $property = 'hello ' . 'world'; }"), + ).toMatchSnapshot(); + }); + it("with bin value 2", () => { + expect( + parser.parseEval("class Foo { public $property = 1 + 2; }"), + ).toMatchSnapshot(); + }); + it("with heredoc value", () => { + expect( + parser.parseEval(` +class Foo { + public $property = << { + expect( + parser.parseEval(` +class Foo { + public $property = <<<'EOD' +hello world +EOD; +} + `), + ).toMatchSnapshot(); + }); + it("with constant value", () => { + expect( + parser.parseEval("class Foo { public $property = CONSTANT; }"), + ).toMatchSnapshot(); + }); + it("with array value", () => { + expect( + parser.parseEval("class Foo { public $property = array(true, false); }"), + ).toMatchSnapshot(); + }); + it("with short array value", () => { + expect( + parser.parseEval("class Foo { public $property = [true, false]; }"), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/propertylookup.test.js b/test/snapshot/propertylookup.test.js new file mode 100644 index 000000000..2b3f7347b --- /dev/null +++ b/test/snapshot/propertylookup.test.js @@ -0,0 +1,19 @@ +const parser = require("../main"); + +describe("propertylookup", function () { + it("fix 128 - Don't have curly for propertylookup", function () { + expect(parser.parseEval("$this->{foo};$this->bar;")).toMatchSnapshot(); + }); + it("simple", function () { + expect(parser.parseEval("$obj->property;")).toMatchSnapshot(); + }); + it("variable", function () { + expect(parser.parseEval("$obj->$property;")).toMatchSnapshot(); + }); + it("call", function () { + expect(parser.parseEval("$obj->call();")).toMatchSnapshot(); + }); + it("multiple", function () { + expect(parser.parseEval("$obj->property_1->property_2;")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/propertystatement.test.js b/test/snapshot/propertystatement.test.js new file mode 100644 index 000000000..6c9707a51 --- /dev/null +++ b/test/snapshot/propertystatement.test.js @@ -0,0 +1,20 @@ +const parser = require("../main"); + +describe("propertystatement", () => { + it("simple", () => { + expect(parser.parseEval("class Foo { public $dsn; }")).toMatchSnapshot(); + }); + it("simple (var)", () => { + expect(parser.parseEval("class Foo { var $dsn; }")).toMatchSnapshot(); + }); + it("multiple", () => { + expect( + parser.parseEval("class Foo { public $dsn, $username, $password; }"), + ).toMatchSnapshot(); + }); + it("multiple (var)", () => { + expect( + parser.parseEval("class Foo { var $dsn, $username, $password; }"), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/return.test.js b/test/snapshot/return.test.js new file mode 100644 index 000000000..031888e2f --- /dev/null +++ b/test/snapshot/return.test.js @@ -0,0 +1,17 @@ +const parser = require("../main"); + +describe("return", function () { + it("simple", function () { + expect(parser.parseEval('return "string";')).toMatchSnapshot(); + }); + it("no expression", function () { + expect(parser.parseEval("return;")).toMatchSnapshot(); + }); + it("should fail when no ';' at end", function () { + expect( + parser.parseEval("return", { + parser: { suppressErrors: true }, + }), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/scalar.test.js b/test/snapshot/scalar.test.js index 0fc6830fb..edda34a3e 100644 --- a/test/snapshot/scalar.test.js +++ b/test/snapshot/scalar.test.js @@ -1,16 +1,25 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test scalar statements", function() { - it("test constants", function() { - expect(parser.parseEval('$a = foo::ref[-5];')).toMatchSnapshot(); - }); - - it("test dereferencable", function() { - expect(parser.parseEval(` +describe("Test scalar statements", function () { + it.each([ + ["test constants", "$a = foo::ref[-5];"], + ["test constants #2", "$a = Foo;"], + ["test constants #3", "$a = $var::foo;"], + [ + "test dereferencable", + ` $a = foo::bar()[5]->test; $b = (new test())->foo(); $c = (foo())[5]; $d = (function($a) { return $a * 2; })(5); - `)).toMatchSnapshot(); + `, + ], + ["test dereferencable_scalar", "$var = array(1);"], + ["test dereferencable_scalar #2", "$var = [1];"], + ["test dereferencable_scalar #3", '$var = "test";'], + ["php 8.1 explicit octal", "$var = 0o123 + 0o001_234;"], + ["implicit octal", "$var = 0123;"], + ])("%s", function (_, code) { + expect(parser.parseEval(code)).toMatchSnapshot(); }); }); diff --git a/test/snapshot/selfreference.test.js b/test/snapshot/selfreference.test.js new file mode 100644 index 000000000..cf501c841 --- /dev/null +++ b/test/snapshot/selfreference.test.js @@ -0,0 +1,31 @@ +const parser = require("../main"); + +describe("selfreference", function () { + it("variable", function () { + expect(parser.parseEval("self::$var;")).toMatchSnapshot(); + }); + it("constant", function () { + expect(parser.parseEval("self::CONSTANT;")).toMatchSnapshot(); + }); + it("call", function () { + expect(parser.parseEval("self::call();")).toMatchSnapshot(); + }); + it("uppercase", function () { + expect(parser.parseEval("SELF::call();")).toMatchSnapshot(); + }); + it("argument", function () { + expect(parser.parseEval("function foo(self $arg) {}")).toMatchSnapshot(); + }); + it("argument (uppercase)", function () { + expect(parser.parseEval("function foo(SELF $arg) {}")).toMatchSnapshot(); + }); + it("return type declarations", function () { + expect(parser.parseEval("function foo($arg): self {}")).toMatchSnapshot(); + }); + it("return type declarations (uppercase)", function () { + expect(parser.parseEval("function foo($arg): SELF {}")).toMatchSnapshot(); + }); + it("return static type declarations", function () { + expect(parser.parseEval("function foo($arg): static {}")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/silent.test.js b/test/snapshot/silent.test.js new file mode 100644 index 000000000..3386b4388 --- /dev/null +++ b/test/snapshot/silent.test.js @@ -0,0 +1,7 @@ +const parser = require("../main"); + +describe("silent", function () { + it("simple", function () { + expect(parser.parseEval("@call();")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/statement.test.js b/test/snapshot/statement.test.js index f63d50625..6f4128d90 100644 --- a/test/snapshot/statement.test.js +++ b/test/snapshot/statement.test.js @@ -1,68 +1,89 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test statements", function() { - it("test goto label", function() { - expect(parser.parseEval(` +describe("Test statements", function () { + it("test goto label", function () { + expect( + parser.parseEval(` start: $i++; goto start; - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - it("test global", function() { - expect(parser.parseEval(` + it("test global", function () { + expect( + parser.parseEval(` function foo() { global $a, $b; } - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - describe('halt statements', function() { - it("test halt statement", function() { - expect(parser.parseEval(` + describe("halt statements", function () { + it("test halt statement", function () { + expect( + parser.parseEval( + ` $a = 1; __halt_compiler(); $b = 1; - `, { - parser: { debug: false } - })).toMatchSnapshot(); + `, + { + parser: { debug: false }, + }, + ), + ).toMatchSnapshot(); }); - it("test inner error", function() { + it("test inner error", function () { expect(() => { parser.parseEval(` if (true) { __halt_compiler(); } - `) + `); }).toThrow(); }); - it("test fallback", function() { - expect(parser.parseEval(` + it("test fallback", function () { + expect( + parser.parseEval( + ` if (true) { __halt_compiler(); } $b = 1; - `, { - parser: { suppressErrors: true } - })).toMatchSnapshot(); + `, + { + parser: { suppressErrors: true }, + }, + ), + ).toMatchSnapshot(); }); }); - it("test static", function() { - expect(parser.parseEval(` + it("test static", function () { + expect( + parser.parseEval( + ` function foo() { static $a, $b = 5; } static $sVar1 = 11; - `, { - parser: { debug: false } - })).toMatchSnapshot(); + `, + { + parser: { debug: false }, + }, + ), + ).toMatchSnapshot(); }); - it("test declare", function() { - expect(parser.parseEval(` + it("test declare", function () { + expect( + parser.parseEval( + ` if (true) { declare(ticks=1); } $a = 1; declare(ticks=2,encoding=ISO-8859-1); @@ -74,13 +95,18 @@ describe("Test statements", function() { $d = 3; enddeclare; $e = 4; - `, { - parser: { debug: false } - })).toMatchSnapshot(); + `, + { + parser: { debug: false }, + }, + ), + ).toMatchSnapshot(); }); - it("test try", function() { - expect(parser.parseEval(` + it("test try", function () { + expect( + parser.parseEval( + ` try { foo(); } catch(FooError|BarError $err) { @@ -89,13 +115,18 @@ describe("Test statements", function() { } finally { clean(); } - `, { - parser: { debug: false } - })).toMatchSnapshot(); + `, + { + parser: { debug: false }, + }, + ), + ).toMatchSnapshot(); }); - it("test inner statements", function() { - expect(parser.parseEval(` + it("test inner statements", function () { + expect( + parser.parseEval( + ` if (true) { function foo() {} abstract class foo {} @@ -104,8 +135,11 @@ describe("Test statements", function() { trait foo {} interface foo {} } - `, { - parser: { debug: false } - })).toMatchSnapshot(); + `, + { + parser: { debug: false }, + }, + ), + ).toMatchSnapshot(); }); }); diff --git a/test/snapshot/static.test.js b/test/snapshot/static.test.js new file mode 100644 index 000000000..553954444 --- /dev/null +++ b/test/snapshot/static.test.js @@ -0,0 +1,15 @@ +const parser = require("../main"); + +describe("static", function () { + it("simple", function () { + expect(parser.parseEval("static $foo;")).toMatchSnapshot(); + }); + it("assign", function () { + expect(parser.parseEval("static $foo = 1;")).toMatchSnapshot(); + }); + it("multiple", function () { + expect( + parser.parseEval("static $foo = 1, $bar = 2, $baz = 3;"), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/staticlookup.test.js b/test/snapshot/staticlookup.test.js new file mode 100644 index 000000000..b43af8a32 --- /dev/null +++ b/test/snapshot/staticlookup.test.js @@ -0,0 +1,22 @@ +const parser = require("../main"); + +describe("staticlookup", function () { + it("simple", function () { + expect(parser.parseEval("Foo::$var;")).toMatchSnapshot(); + }); + it("simple (2)", function () { + expect(parser.parseEval("$var::$var;")).toMatchSnapshot(); + }); + it("call", function () { + expect(parser.parseEval("Foo::call();")).toMatchSnapshot(); + }); + it("call (2)", function () { + expect(parser.parseEval("$var::call();")).toMatchSnapshot(); + }); + it("multiple", function () { + expect(parser.parseEval("$var::$var_1::$var_2;")).toMatchSnapshot(); + }); + it("multiple (2)", function () { + expect(parser.parseEval("Foo::$var_1::$var_2;")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/staticreference.test.js b/test/snapshot/staticreference.test.js new file mode 100644 index 000000000..8c720e893 --- /dev/null +++ b/test/snapshot/staticreference.test.js @@ -0,0 +1,16 @@ +const parser = require("../main"); + +describe("staticreference", function () { + it("variable", function () { + expect(parser.parseEval("static::$var;")).toMatchSnapshot(); + }); + it("constant", function () { + expect(parser.parseEval("static::CONSTANT;")).toMatchSnapshot(); + }); + it("call", function () { + expect(parser.parseEval("static::call();")).toMatchSnapshot(); + }); + it("uppercase", function () { + expect(parser.parseEval("STATIC::call();")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/string.test.js b/test/snapshot/string.test.js index 0f256b6f8..20d876177 100644 --- a/test/snapshot/string.test.js +++ b/test/snapshot/string.test.js @@ -1,317 +1,402 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test strings", function() { - it("fix #144", function() { - expect(parser.parseEval('"encapsed \\\" {$var}";')).toMatchSnapshot(); +describe("Test strings", function () { + it("fix #251", function () { + expect( + parser.parseEval("$var = \"string ${juices['FOO']} string\";"), + ).toMatchSnapshot(); }); - describe("fix #101", function() { - it("case 1", function() { + it("fix #144", function () { + expect(parser.parseEval('"encapsed \\" {$var}";')).toMatchSnapshot(); + }); + + describe("fix #101", function () { + it("case 1", function () { expect(parser.parseEval('"encapsed {$var}";')).toMatchSnapshot(); }); - it("case 2", function() { + it("case 2", function () { expect(parser.parseEval('"encapsed {$arr[0]}";')).toMatchSnapshot(); }); - it("case 3", function() { + it("case 3", function () { expect(parser.parseEval('"encapsed ${var}";')).toMatchSnapshot(); }); }); - it("fix #124", function() { - expect(parser.parseEval('$string = "He drank some $juices[koolaid1] juice.";')).toMatchSnapshot(); + it("fix #124", function () { + expect( + parser.parseEval('$string = "He drank some $juices[koolaid1] juice.";'), + ).toMatchSnapshot(); }); - it("fix #123", function() { - expect(parser.parseEval("$string = 'Avoid converting \n chars, but \\' or \\\\ is ok.';")).toMatchSnapshot(); + it("fix #123", function () { + expect( + parser.parseEval( + "$string = 'Avoid converting \n chars, but \\' or \\\\ is ok.';", + ), + ).toMatchSnapshot(); }); - it("implement #116", function() { + it("implement #116", function () { expect(parser.parseEval(`$a = "foo\\nbar";`)).toMatchSnapshot(); }); - it("fix #149", function() { + it("fix #149", function () { expect(parser.parseEval(`$a = b"foo\\nbar";`)).toMatchSnapshot(); }); - it("test binary with double quotes", function() { - expect(parser.parseEval(`echo b"\\colors contains >$colors<\\n";`)).toMatchSnapshot(); + it("test binary with double quotes", function () { + expect( + parser.parseEval(`echo b"\\colors contains >$colors<\\n";`), + ).toMatchSnapshot(); }); - describe("check infinite on $", function() { - it("using doublequotes", function() { - expect(parser.parseEval(`echo "$`, { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + describe("check infinite on $", function () { + it("using doublequotes", function () { + expect( + parser.parseEval(`echo "$`, { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); - it("using backquotes", function() { - expect(parser.parseEval("echo `$", { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + it("using backquotes", function () { + expect( + parser.parseEval("echo `$", { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); - it("with arrow", function() { - expect(parser.parseEval("echo ` -> $", { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + it("with arrow", function () { + expect( + parser.parseEval("echo ` -> $", { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); }); - describe("check infinite on {", function() { - it("using doublequotes", function() { - expect(parser.parseEval(`echo "{`, { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + describe("check infinite on {", function () { + it("using doublequotes", function () { + expect( + parser.parseEval(`echo "{`, { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); - it("using backquotes", function() { - expect(parser.parseEval("echo `{", { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + it("using backquotes", function () { + expect( + parser.parseEval("echo `{", { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); - it("with arrow", function() { - expect(parser.parseEval("echo ` -> {", { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + it("with arrow", function () { + expect( + parser.parseEval("echo ` -> {", { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); }); - describe("check infinite on ${", function() { - it("using doublequotes", function() { - expect(parser.parseEval('echo "${', { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + describe("check infinite on ${", function () { + it("using doublequotes", function () { + expect( + parser.parseEval('echo "${', { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); - it("using backquotes", function() { - expect(parser.parseEval("echo `${", { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + it("using backquotes", function () { + expect( + parser.parseEval("echo `${", { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); - it("with arrow", function() { - expect(parser.parseEval("echo ` -> ${", { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + it("with arrow", function () { + expect( + parser.parseEval("echo ` -> ${", { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); }); - describe("check infinite on {$", function() { - it("using doublequotes", function() { - expect(parser.parseEval('echo "{$', { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + describe("check infinite on {$", function () { + it("using doublequotes", function () { + expect( + parser.parseEval('echo "{$', { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); - it("using backquotes", function() { - expect(parser.parseEval("echo `{$", { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + it("using backquotes", function () { + expect( + parser.parseEval("echo `{$", { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); - it("with arrow", function() { - expect(parser.parseEval("echo ` -> {$", { - parser: { suppressErrors: true, debug: false }, - lexer: { debug: false } - })).toMatchSnapshot(); + it("with arrow", function () { + expect( + parser.parseEval("echo ` -> {$", { + parser: { suppressErrors: true, debug: false }, + lexer: { debug: false }, + }), + ).toMatchSnapshot(); }); }); - it.skip("binary cast", function() { - expect(parser.parseEval(`echo (binary)"\\colors[1] contains >$colors[1]<\\n";`)).toMatchSnapshot(); + it.skip("binary cast", function () { + expect( + parser.parseEval(`echo (binary)"\\colors[1] contains >$colors[1]<\\n";`), + ).toMatchSnapshot(); }); - it("test encapsed variable", function() { - expect(parser.parseEval(` + it("test encapsed variable", function () { + expect( + parser.parseEval(` echo "Hello $obj->name !"; echo "Hello $obj->foo->bar !"; echo "Hello $obj[1]->foo !"; - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - it("encapsed variable / curly varname", function() { + it("encapsed variable / curly varname", function () { expect(parser.parseEval('echo "Hello ${obj}->name !";')).toMatchSnapshot(); }); - it("encapsed variable / curly constant", function() { + it("encapsed variable / curly constant", function () { expect(parser.parseEval('echo "Hello ${ obj }";')).toMatchSnapshot(); }); - it("encapsed variable / offsetlookup", function() { + it("encapsed variable / offsetlookup", function () { expect(parser.parseEval('echo "${$parts[$i]}\\n";')).toMatchSnapshot(); }); - it("test double quotes", function() { - expect(parser.parseEval([ - '$a = "$";', - '$a = "{";', - '$a = "-$-";', - '$a = "-{";', - '$a = "$b";', - '$a = "{$b}";', - '$a = "${$b}";', - '$a = "-$b?";', - '$a = "-{$b}";', - '$a = "-${$b}";', - '$a = "";', - '$a = "\\"";' - ].join("\r\n"), { - lexer: { - debug: false - }, - parser: { - debug: false - } - })).toMatchSnapshot(); - }); - - it("...", function() { - var ast = parser.parseEval('echo B"\\colors[1] contains >$colors[1]<\\n";'); - }); - - it("...", function() { - var ast = parser.parseEval('echo "\\colors[1] contains >$colors [1]<\\n";'); - }); - - it("...", function() { - var ast = parser.parseEval("echo \"~'.{{$expectedLength}}'\\$~s\";"); - }); - - it("...", function() { - var ast = parser.parseEval("$a = b'\\t\\ra';"); - }); - - it("...", function() { - var ast = parser.parseEval('$foo = array("v1.09azAZ-._~!$", true);'); - }); - - it("...", function() { - var ast = parser.parseEval('$v = strtolower("$i.$j.$k-$rel");'); - }); - - it("...", function() { - var ast = parser.parseEval('$text = "$text at line $line";'); - }); - - it("...", function() { - var ast = parser.parseEval( - "return \"Class.create('$package$className',{\";" - ); - }); - - it("...", function() { - var ast = parser.parseEval("echo \"yo : {$feeds[0]['title[0][value]']}\";"); - }); - - it("...", function() { - var ast = parser.parseEval('return "\\x1B[{$color}m{$str}\\x1B[0m";'); - }); - - it("...", function() { - var ast = parser.parseEval('echo "\\"$parts[0]\\"\\n";'); - }); - - it("...", function() { - var ast = parser.parseEval('echo "Hello {".$obj->name."} !";'); - }); - - it("...", function() { - var ast = parser.parseEval('echo "Hello {$obj->name} !";'); - }); - - it("test encapsed elements", function() { - expect(parser.parseEval([ - "$code = <<<\t EOFX", - "{$this->docStar}", - "${$foo}", - "${targetDirs[1]}", - "$test[1]", - "$test->foo", - "EOFX;" - ].join("\r"), { - parser: { - debug: false - } - })).toMatchSnapshot(); - }); - - it("test nowdoc label and contents", function() { - expect(parser.parseEval(["$code .= <<<'EOF'", " }", "EOF;"].join("\r\n"), { - parser: { - debug: false - } - })).toMatchSnapshot(); - }); - - it.skip("heredoc ...", function() { - expect(parser.parseEval(` + it("test double quotes", function () { + expect( + parser.parseEval( + [ + '$a = "$";', + '$a = "{";', + '$a = "-$-";', + '$a = "-{";', + '$a = "$b";', + '$a = "{$b}";', + '$a = "${$b}";', + '$a = "-$b?";', + '$a = "-{$b}";', + '$a = "-${$b}";', + '$a = "";', + '$a = "\\"";', + ].join("\r\n"), + { + lexer: { + debug: false, + }, + parser: { + debug: false, + }, + }, + ), + ).toMatchSnapshot(); + }); + + it.each([ + 'echo B"\\colors[1] contains >$colors[1]<\\n";', + 'echo "\\colors[1] contains >$colors [1]<\\n";', + "echo \"~'.{{$expectedLength}}'\\$~s\";", + "$a = b'\\t\\ra';", + '$foo = array("v1.09azAZ-._~!$", true);', + '$v = strtolower("$i.$j.$k-$rel");', + '$text = "$text at line $line";', + "return \"Class.create('$package$className',{\";", + "echo \"yo : {$feeds[0]['title[0][value]']}\";", + 'return "\\x1B[{$color}m{$str}\\x1B[0m";', + 'echo "\\"$parts[0]\\"\\n";', + 'echo "Hello {".$obj->name."} !";', + 'echo "Hello {$obj->name} !";', + ])("string test: %s", function (code) { + parser.parseEval(code); + }); + + it("test encapsed elements", function () { + expect( + parser.parseEval( + [ + "$code = <<<\t EOFX", + "{$this->docStar}", + "${$foo}", + "${targetDirs[1]}", + "$test[1]", + "$test->foo", + "EOFX;", + ].join("\r"), + { + parser: { + debug: false, + }, + }, + ), + ).toMatchSnapshot(); + }); + + it("test nowdoc label and contents", function () { + expect( + parser.parseEval(["$code .= <<<'EOF'", " }", "EOF;"].join("\r\n"), { + parser: { + debug: false, + }, + }), + ).toMatchSnapshot(); + }); + + it.skip("heredoc ...", function () { + expect( + parser.parseEval(` $fallbackContent .= sprintf(<<addFallbackCatalogue(\\$catalogue%s); EOF2 ) - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - it("test empty nowdoc & heredoc contents", function() { - expect(parser.parseEval(` + it("test empty nowdoc & heredoc contents", function () { + expect( + parser.parseEval( + ` echo << throw new Exception("oops");'), + ).toMatchSnapshot(); + }); + it("arrow function in PHP < 8", function () { + expect(() => + parser.parseEval('$fn = fn() => throw new Exception("oops");', { + parser: { version: "7.4" }, + }), + ).toThrow(); + }); +}); diff --git a/test/snapshot/token.test.js b/test/snapshot/token.test.js index 7ba50d9ae..7b9e47538 100644 --- a/test/snapshot/token.test.js +++ b/test/snapshot/token.test.js @@ -1,12 +1,12 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test tokens statements", function() { - it("hello world", function() { +describe("Test tokens statements", function () { + it("hello world", function () { const ast = parser.parseCode("Hello ", { parser: { debug: false, - extractTokens: true - } + extractTokens: true, + }, }); expect(ast).toMatchSnapshot(); }); diff --git a/test/snapshot/trait.test.js b/test/snapshot/trait.test.js new file mode 100644 index 000000000..a377232f9 --- /dev/null +++ b/test/snapshot/trait.test.js @@ -0,0 +1,7 @@ +const parser = require("../main"); + +describe("trait", function () { + it("trait name as identifier", function () { + expect(parser.parseEval("trait A {}")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/traitprecedence.test.js b/test/snapshot/traitprecedence.test.js new file mode 100644 index 000000000..c2e33a906 --- /dev/null +++ b/test/snapshot/traitprecedence.test.js @@ -0,0 +1,18 @@ +const parser = require("../main"); + +describe("traitprecedence", () => { + it("simple", () => { + expect( + parser.parseEval( + ` +class MyHelloWorld extends Base { + use A, B { + B::smallTalk insteadof A; + A::bigTalk insteadof B; + } +} + `, + ), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/try.test.js b/test/snapshot/try.test.js new file mode 100644 index 000000000..7f6c70371 --- /dev/null +++ b/test/snapshot/try.test.js @@ -0,0 +1,81 @@ +const parser = require("../main"); + +describe("boolean", () => { + it("simple", () => { + expect( + parser.parseEval( + "try { call(); } catch (Exception $e) { do_something(); }", + ), + ).toMatchSnapshot(); + }); + it("without variable", () => { + expect( + parser.parseEval("try { call(); } catch (Exception) { do_something(); }"), + ).toMatchSnapshot(); + }); + it("without variable in PHP < 8", () => { + expect(() => + parser.parseEval( + "try { call(); } catch (Exception) { do_something(); }", + { parser: { version: "7.4" } }, + ), + ).toThrow(SyntaxError); + }); + it("qualified name", () => { + expect( + parser.parseEval( + "try { call(); } catch (Foo\\Exception $e) { do_something(); }", + ), + ).toMatchSnapshot(); + }); + + it("fully qualified name", () => { + expect( + parser.parseEval( + "try { call(); } catch (\\Exception $e) { do_something(); }", + ), + ).toMatchSnapshot(); + }); + it("fully qualified name #2", () => { + expect( + parser.parseEval( + "try { call(); } catch (\\Exception\\Foo $e) { do_something(); }", + ), + ).toMatchSnapshot(); + }); + it("relative name", () => { + expect( + parser.parseEval( + "try { call(); } catch (namespace\\Exception $e) { do_something(); }", + ), + ).toMatchSnapshot(); + }); + it("finally", () => { + expect( + parser.parseEval( + "try { call(); } catch (Exception $e) { do_something(); } finally { do_something_other(); }", + ), + ).toMatchSnapshot(); + }); + it("multiple catch", () => { + expect( + parser.parseEval( + "try { call(); } catch (MyException | MyOtherException $e) { do_something(); }", + ), + ).toMatchSnapshot(); + }); + it("multiple catch without variable", () => { + expect( + parser.parseEval( + "try { call(); } catch (MyException | MyOtherException) { do_something(); }", + ), + ).toMatchSnapshot(); + }); + it("multiple catch #2", () => { + expect( + parser.parseEval( + "try { call(); } catch (MyException | Foo\\Exception | \\Exception | \\Exception\\Foo | namespace\\Exception $e) { do_something(); }", + ), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/typereference.test.js b/test/snapshot/typereference.test.js new file mode 100644 index 000000000..1c7777db9 --- /dev/null +++ b/test/snapshot/typereference.test.js @@ -0,0 +1,144 @@ +const parser = require("../main"); + +describe("typereference", function () { + it("int (argument)", function () { + expect(parser.parseEval("function foo(int $arg) {}")).toMatchSnapshot(); + }); + it("int (argument) (uppercase)", function () { + expect(parser.parseEval("function foo(INT $arg) {}")).toMatchSnapshot(); + }); + it("int (return type declarations)", function () { + expect(parser.parseEval("function foo($arg): int {}")).toMatchSnapshot(); + }); + it("int (return type declarations) (uppercase)", function () { + expect(parser.parseEval("function foo($arg): INT {}")).toMatchSnapshot(); + }); + it("float (argument)", function () { + expect(parser.parseEval("function foo(float $arg) {}")).toMatchSnapshot(); + }); + it("float (argument) (uppercase)", function () { + expect(parser.parseEval("function foo(FLOAT $arg) {}")).toMatchSnapshot(); + }); + it("float (return type declarations)", function () { + expect(parser.parseEval("function foo($arg): float {}")).toMatchSnapshot(); + }); + it("float (return type declarations) (uppercase)", function () { + expect(parser.parseEval("function foo($arg): FLOAT {}")).toMatchSnapshot(); + }); + it("bool (argument)", function () { + expect(parser.parseEval("function foo(bool $arg) {}")).toMatchSnapshot(); + }); + it("bool (argument) (uppercase)", function () { + expect(parser.parseEval("function foo(BOOL $arg) {}")).toMatchSnapshot(); + }); + it("bool (return type declarations)", function () { + expect(parser.parseEval("function foo($arg): bool {}")).toMatchSnapshot(); + }); + it("bool (return type declarations) (uppercase)", function () { + expect(parser.parseEval("function foo($arg): BOOL {}")).toMatchSnapshot(); + }); + it("string (argument)", function () { + expect(parser.parseEval("function foo(string $arg) {}")).toMatchSnapshot(); + }); + it("string (argument) (uppercase)", function () { + expect(parser.parseEval("function foo(STRING $arg) {}")).toMatchSnapshot(); + }); + it("string (return type declarations)", function () { + expect(parser.parseEval("function foo($arg): string {}")).toMatchSnapshot(); + }); + it("string (return type declarations) (uppercase)", function () { + expect(parser.parseEval("function foo($arg): STRING {}")).toMatchSnapshot(); + }); + it("array (argument)", function () { + expect(parser.parseEval("function foo(array $arg) {}")).toMatchSnapshot(); + }); + it("array (argument) (uppercase)", function () { + expect(parser.parseEval("function foo(ARRAY $arg) {}")).toMatchSnapshot(); + }); + it("array (return type declarations)", function () { + expect(parser.parseEval("function foo($arg): array {}")).toMatchSnapshot(); + }); + it("array (return type declarations) (uppercase)", function () { + expect(parser.parseEval("function foo($arg): ARRAY {}")).toMatchSnapshot(); + }); + it("callable (argument)", function () { + expect( + parser.parseEval("function foo(callable $arg) {}"), + ).toMatchSnapshot(); + }); + it("callable (argument) (uppercase)", function () { + expect( + parser.parseEval("function foo(CALLABLE $arg) {}"), + ).toMatchSnapshot(); + }); + it("callable (return type declarations)", function () { + expect( + parser.parseEval("function foo($arg): callable {}"), + ).toMatchSnapshot(); + }); + it("callable (return type declarations) (uppercase)", function () { + expect( + parser.parseEval("function foo($arg): CALLABLE {}"), + ).toMatchSnapshot(); + }); + it("object (argument)", function () { + expect(parser.parseEval("function foo(object $arg) {}")).toMatchSnapshot(); + }); + it("object (argument) (uppercase)", function () { + expect(parser.parseEval("function foo(OBJECT $arg) {}")).toMatchSnapshot(); + }); + it("object (return type declarations)", function () { + expect(parser.parseEval("function foo($arg): object {}")).toMatchSnapshot(); + }); + it("object (return type declarations) (uppercase)", function () { + expect(parser.parseEval("function foo($arg): OBJECT {}")).toMatchSnapshot(); + }); + it("iterable (argument)", function () { + expect( + parser.parseEval("function foo(iterable $arg) {}"), + ).toMatchSnapshot(); + }); + it("iterable (argument) (uppercase)", function () { + expect( + parser.parseEval("function foo(ITERABLE $arg) {}"), + ).toMatchSnapshot(); + }); + it("iterable (return type declarations)", function () { + expect( + parser.parseEval("function foo($arg): iterable {}"), + ).toMatchSnapshot(); + }); + it("iterable (return type declarations) (uppercase)", function () { + expect( + parser.parseEval("function foo($arg): ITERABLE {}"), + ).toMatchSnapshot(); + }); + it("void (argument)", function () { + expect(parser.parseEval("function foo(void $arg) {}")).toMatchSnapshot(); + }); + it("void (argument) (uppercase)", function () { + expect(parser.parseEval("function foo(VOID $arg) {}")).toMatchSnapshot(); + }); + it("void (return type declarations)", function () { + expect(parser.parseEval("function foo($arg): void {}")).toMatchSnapshot(); + }); + it("void (return type declarations) (uppercase)", function () { + expect(parser.parseEval("function foo($arg): VOID {}")).toMatchSnapshot(); + }); + it("class", function () { + expect(parser.parseEval("function foo(Foo $arg) {}")).toMatchSnapshot(); + }); + it("class (2)", function () { + expect( + parser.parseEval("function foo(Foo\\Foo $arg) {}"), + ).toMatchSnapshot(); + }); + it("class (3)", function () { + expect(parser.parseEval("function foo($arg): Foo {}")).toMatchSnapshot(); + }); + it("class (4)", function () { + expect( + parser.parseEval("function foo($arg): Foo\\Foo {}"), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/unary.test.js b/test/snapshot/unary.test.js new file mode 100644 index 000000000..d1d992851 --- /dev/null +++ b/test/snapshot/unary.test.js @@ -0,0 +1,34 @@ +const parser = require("../main"); + +describe("Test unary", function () { + it.each([ + ["simple", "!$var;"], + ["number", "-100;"], + ["number (2)", "+100;"], + ["number (3)", "~100;"], + ["number (4)", "!100;"], + ["string", '+"string";'], + ["string (2)", '-"string";'], + ["string (3)", '~"string";'], + ["string (4)", '!"string";'], + ["boolean", "!true;"], + ["multiple", "!!$var;"], + ["multiple", "~~$var;"], + ["multiple (2)", "--$var;"], + ["multiple (3)", "+(+$var);"], + ["multiple (4)", "-(-$var);"], + ["multiple (5)", "!!!!!$var;"], + ["parens", "(!$var);"], + ["parens (2)", "!($var);"], + ["parens (3)", "(-$var);"], + ["parens (4)", "-($var);"], + ["parens (5)", "(+$var);"], + ["parens (6)", "+($var);"], + ["parens (7)", "~($var);"], + ["parens (8)", "(~$var);"], + ["parens (9)", "(-100);"], + ["parens (10)", "-(100);"], + ])("%s", function (_, code) { + expect(parser.parseEval(code)).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/union.test.js b/test/snapshot/union.test.js new file mode 100644 index 000000000..8e54971d0 --- /dev/null +++ b/test/snapshot/union.test.js @@ -0,0 +1,61 @@ +const parser = require("../main"); + +describe("Test unions", function () { + it("simple union", function () { + expect(parser.parseEval("function(foo|bar $test) {}")).toMatchSnapshot(); + }); + + it("simple intersection", function () { + expect(parser.parseEval("function(foo&bar $test) {}")).toMatchSnapshot(); + }); + + it("union with reference", function () { + expect(parser.parseEval("function(foo|bar &$test) {}")).toMatchSnapshot(); + }); + + it("intersection with reference", function () { + expect(parser.parseEval("function(foo&bar &$test) {}")).toMatchSnapshot(); + }); + + it("union with variadic", function () { + expect(parser.parseEval("function(foo|bar ...$test) {}")).toMatchSnapshot(); + }); + + it("intersection with variadic", function () { + expect(parser.parseEval("function(foo&bar ...$test) {}")).toMatchSnapshot(); + }); + + it("union with three types", function () { + expect( + parser.parseEval("function(foo|bar|baz $test) {}"), + ).toMatchSnapshot(); + }); + + it("intersection with three types", function () { + expect( + parser.parseEval("function(foo&bar&baz $test) {}"), + ).toMatchSnapshot(); + }); + + it("union mixed with intersection", function () { + const astErr = parser.parseEval("function(foo|bar&baz $test) {}", { + parser: { + version: "8.1", + suppressErrors: true, + }, + }); + + expect(astErr).toMatchSnapshot(); + }); + + it("intersection mixed with union", function () { + const astErr = parser.parseEval("function(foo&bar|baz $test) {}", { + parser: { + version: "8.1", + suppressErrors: true, + }, + }); + + expect(astErr).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/unset.test.js b/test/snapshot/unset.test.js new file mode 100644 index 000000000..a3e002cee --- /dev/null +++ b/test/snapshot/unset.test.js @@ -0,0 +1,16 @@ +const parser = require("../main"); + +describe("unset", function () { + it("simple", function () { + expect(parser.parseEval("unset($var);")).toMatchSnapshot(); + }); + it("multiple", function () { + expect(parser.parseEval("unset($var, $var, $var);")).toMatchSnapshot(); + }); + it("trailing comma", function () { + expect(parser.parseEval("unset($foo,);")).toMatchSnapshot(); + }); + it("trailing comma #2", function () { + expect(parser.parseEval("unset($foo, $bar,);")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/usegroup.test.js b/test/snapshot/usegroup.test.js new file mode 100644 index 000000000..5cedc5096 --- /dev/null +++ b/test/snapshot/usegroup.test.js @@ -0,0 +1,50 @@ +const parser = require("../main"); + +describe("usegroup", () => { + it("simple", () => { + expect( + parser.parseEval("use My\\Full\\Classname as Another;"), + ).toMatchSnapshot(); + }); + it("multiple", () => { + expect( + parser.parseEval("use My\\Full\\Classname as Another, My\\Full\\NSname;"), + ).toMatchSnapshot(); + }); + it("multiple 2", () => { + expect( + parser.parseEval( + "use My\\Full\\Classname as Another, My\\Full\\NSname, \\Full\\NSname\\With\\Leading\\Backslash;", + ), + ).toMatchSnapshot(); + }); + it("nested", () => { + expect( + parser.parseEval( + "use some\\my_namespace\\{ClassA, ClassB, ClassC as C};", + ), + ).toMatchSnapshot(); + }); + it("nested 2", () => { + expect( + parser.parseEval("use function some\\my_namespace\\{fn_a, fn_b, fn_c};"), + ).toMatchSnapshot(); + }); + it("nested 3", () => { + expect( + parser.parseEval( + "use const some\\my_namespace\\{ConstA, ConstB, ConstC};", + ), + ).toMatchSnapshot(); + }); + it("nested 4", () => { + expect( + parser.parseEval( + `use Vendor\\Package\\SomeNamespace\\{ + SubnamespaceOne\\ClassA, + SubnamespaceOne\\ClassB + };`, + ), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/useitem.test.js b/test/snapshot/useitem.test.js new file mode 100644 index 000000000..bdb931da8 --- /dev/null +++ b/test/snapshot/useitem.test.js @@ -0,0 +1,62 @@ +const parser = require("../main"); + +describe("useitem", () => { + it("simple", () => { + expect(parser.parseEval("use My\\Full\\NSname;")).toMatchSnapshot(); + }); + it("simple 2", () => { + expect(parser.parseEval("use ArrayObject;")).toMatchSnapshot(); + }); + it("with type", () => { + expect( + parser.parseEval("use My\\Full\\Classname as Another;"), + ).toMatchSnapshot(); + }); + it("importing a function", () => { + expect( + parser.parseEval("use function My\\Full\\functionName;"), + ).toMatchSnapshot(); + }); + it("importing a function with type", () => { + expect( + parser.parseEval("use function My\\Full\\functionName as func;"), + ).toMatchSnapshot(); + }); + it("importing a class", () => { + expect( + parser.parseEval("use some\\my_namespace\\ClassC;"), + ).toMatchSnapshot(); + }); + it("importing a class with type", () => { + expect( + parser.parseEval("use some\\my_namespace\\ClassC as C;"), + ).toMatchSnapshot(); + }); + it("importing a constant", () => { + expect(parser.parseEval("use const My\\Full\\CONSTANT;")).toMatchSnapshot(); + }); + it("importing a constant with type", () => { + expect( + parser.parseEval("use const My\\Full\\CONSTANT as MY_CONST;"), + ).toMatchSnapshot(); + }); + it("invalid use", () => { + expect( + parser.parseEval( + `use function $foo; + use const namespace\\{ + FOO, + BAR, + }; + use some\\{ + namespace\\foo, + $error, + function $bar, + };`, + { + parser: { suppressErrors: true }, + }, + ), + ).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/variable.test.js b/test/snapshot/variable.test.js index 6c932254d..dff819c9b 100644 --- a/test/snapshot/variable.test.js +++ b/test/snapshot/variable.test.js @@ -1,98 +1,182 @@ -const parser = require('../main'); +const parser = require("../main"); -describe("Test variables", function() { - it("array destructuring", function() { +describe("Test variables", function () { + it("fix 253 - can't be parsed `global` with multiple `$`", function () { + expect( + parser.parseEval(` + global $$foo; + `), + ).toMatchSnapshot(); + }); + + it("fix 248 - broken ast for `$$$$$`", function () { + expect( + parser.parseEval(` + $foo::$$property; + $foo::\${$property}; + $bar->$$property; + $bar->\${$property}; + `), + ).toMatchSnapshot(); + }); + + it("fix 248 - test curly", function () { + expect( + parser.parseEval(` + $bar->{$property->foo}; + $bar->\${$property}; + $bar->foo_{$property}; + `), + ).toMatchSnapshot(); + }); + + it("array destructuring", function () { expect(parser.parseEval("[$id1, $name1] = $data[0];")).toMatchSnapshot(); }); - it("default variables", function() { - expect(parser.parseEval(` + it("default variables", function () { + expect( + parser.parseEval(` $a = "foo"; $b = &$c; - $a->b = true;` - )).toMatchSnapshot(); + $a->b = true;`), + ).toMatchSnapshot(); }); - it("Variable chains", function() { + it("Variable chains", function () { expect(parser.parseEval("foo::$a[1][2];")).toMatchSnapshot(); }); - it("Class constants", function() { - expect(parser.parseEval(` + it("fix #167", function () { + expect( + parser.parseEval("$var = Foo::{$bar['baz']}();Foo::$bar['baz']();"), + ).toMatchSnapshot(); + }); + + it("valid offset lookup", function () { + expect( + parser.parseEval("get_class($var)::$$$$$property;"), + ).toMatchSnapshot(); + }); + + it("fix #185", function () { + expect( + parser.parseEval(` + $var = ($var[0])::foo; + $var = ($var[0][1])::foo; + $var = ($var[0])[1]::foo; + $var = (($var[0])[1])::foo; + $var = (new Foo())::bar; + get_class($this->resource)::$wrap; + `), + ).toMatchSnapshot(); + }); + + it("Class constants", function () { + expect( + parser.parseEval(` static::foo(); self::foo(); parent::foo(); foo::class; $this->foo(); foo::$bar; - $this->foo::bar["baz"]::qux();` - )).toMatchSnapshot(); + $this->foo::bar["baz"]::qux();`), + ).toMatchSnapshot(); }); - it("Encaps var offset", function() { - expect(parser.parseEval(` + it("Encaps var offset", function () { + expect( + parser.parseEval(` $a = "{$a[1]}"; $a = "{$a["a"]}"; - $a = "{$a[$b]}";` - )).toMatchSnapshot(); + $a = "{$a[$b]}";`), + ).toMatchSnapshot(); }); - it("Chained encapsed vars", function() { - expect(parser.parseEval( - ` + it("Chained encapsed vars", function () { + expect( + parser.parseEval( + ` $a = "{$a->foo()[$bar[$foo]]}"; - ` - )).toMatchSnapshot(); + `, + ), + ).toMatchSnapshot(); }); - it("Dynamic variables", function() { - expect(parser.parseEval(` + it("Dynamic variables", function () { + expect( + parser.parseEval(` $$a = "bar"; $$$a = "bar"; \${$a."bar"} = "bar"; $foo{$a."bar"} = "bar"; - `)).toMatchSnapshot(); + `), + ).toMatchSnapshot(); }); - describe("Check errors", function() { - it("should be ?", function() { - expect(parser.parseEval("$? = true;", { - parser: { - suppressErrors: true - } - })).toMatchSnapshot(); + describe("Check errors", function () { + it("should be ?", function () { + expect( + parser.parseEval("$? = true;", { + parser: { + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); }); - it("should fail on double static lookup", function() { - expect(parser.parseEval(["this->foo::bar::baz;"].join("\n"), { - parser: { - suppressErrors: true - } - })).toMatchSnapshot(); + it("should fail on double static lookup", function () { + expect( + parser.parseEval(["this->foo::bar::baz;"].join("\n"), { + parser: { + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); }); - it("should fail on property lookup on static lookup", function() { - expect(parser.parseEval(["$this->foo::bar->baz;"].join("\n"), { - parser: { - suppressErrors: true - } - })).toMatchSnapshot(); + it("should fail on property lookup on static lookup", function () { + expect( + parser.parseEval(["$this->foo::bar->baz;"].join("\n"), { + parser: { + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); }); - it("should fail $foo->bar::!", function() { - expect(parser.parseEval("$foo->bar::!", { - parser: { - suppressErrors: true - } - })).toMatchSnapshot(); + it("should fail $foo->bar::!", function () { + expect( + parser.parseEval("$foo->bar::!", { + parser: { + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); }); - it("should fail foo::bar::baz", function() { - expect(parser.parseEval("foo::bar::baz", { - parser: { - suppressErrors: true - } - })).toMatchSnapshot(); + it("should fail foo::bar::baz", function () { + expect( + parser.parseEval("foo::bar::baz", { + parser: { + suppressErrors: true, + }, + }), + ).toMatchSnapshot(); }); }); + + it("simple variable", function () { + expect(parser.parseEval("$var = $var;")).toMatchSnapshot(); + }); + it("simple variable #2", function () { + expect(parser.parseEval("$var = ${$var};")).toMatchSnapshot(); + }); + it("simple variable #3", function () { + expect(parser.parseEval("$var = ${$var + 'foo'};")).toMatchSnapshot(); + }); + it("simple variable #4", function () { + expect(parser.parseEval("$var = $$$var;")).toMatchSnapshot(); + }); }); diff --git a/test/snapshot/yield.test.js b/test/snapshot/yield.test.js new file mode 100644 index 000000000..4b82a19e5 --- /dev/null +++ b/test/snapshot/yield.test.js @@ -0,0 +1,32 @@ +const parser = require("../main"); + +describe("yield", function () { + it("simple", function () { + expect(parser.parseEval("yield $i;")).toMatchSnapshot(); + }); + it("assign", function () { + expect(parser.parseEval("$data = yield $value;")).toMatchSnapshot(); + }); + it("assign (parens)", function () { + expect(parser.parseEval("$data = (yield $value);")).toMatchSnapshot(); + }); + it("simple (key and value)", function () { + expect(parser.parseEval("yield $id => $fields;")).toMatchSnapshot(); + }); + it("assign (key and value)", function () { + expect( + parser.parseEval("$data = (yield $key => $value);"), + ).toMatchSnapshot(); + }); + it("inside function", function () { + expect(parser.parseEval("function foo() { yield $i; }")).toMatchSnapshot(); + }); + it("expression as generator key", function () { + expect( + parser.parseEval('function foo() { yield "bar {$test}" => 123; }'), + ).toMatchSnapshot(); + }); + it("null", function () { + expect(parser.parseEval("yield;")).toMatchSnapshot(); + }); +}); diff --git a/test/snapshot/yieldfrom.test.js b/test/snapshot/yieldfrom.test.js new file mode 100644 index 000000000..f7480feb9 --- /dev/null +++ b/test/snapshot/yieldfrom.test.js @@ -0,0 +1,18 @@ +const parser = require("../main"); + +describe("yieldfrom", function () { + it("simple", function () { + expect(parser.parseEval("yield from from();")).toMatchSnapshot(); + }); + it("array", function () { + expect(parser.parseEval("yield from [3, 4];")).toMatchSnapshot(); + }); + it("new", function () { + expect( + parser.parseEval("yield from new ArrayIterator([5, 6]);"), + ).toMatchSnapshot(); + }); + it("return", function () { + expect(parser.parseEval("return yield from nine_ten();")).toMatchSnapshot(); + }); +}); diff --git a/test/version.test.js b/test/version.test.js new file mode 100644 index 000000000..9d82d1e45 --- /dev/null +++ b/test/version.test.js @@ -0,0 +1,54 @@ +const parser = require("./main"); + +describe("Test versions", function () { + it("unserialize a version string", function () { + const test = parser.create({ + parser: { + version: "7.3", + }, + }); + expect(test.parser.version).toEqual(703); + }); + it("unserialize a version string - with bugfix ignored", function () { + const test = parser.create({ + parser: { + version: "7.3.5", + }, + }); + expect(test.parser.version).toEqual(703); + }); + it("fail to parse array", function () { + expect( + parser.create.bind(null, { + parser: { + version: [701], + }, + }), + ).toThrow(new Error("Expecting a number for version")); + }); + it("fail to parse bad version numbers", function () { + expect( + parser.create.bind(null, { + parser: { + version: "x.y.z", + }, + }), + ).toThrow(new Error("Bad version number : x.y.z")); + }); + it("unhandled version", function () { + expect( + parser.create.bind(null, { + parser: { + version: "4.9", + }, + }), + ).toThrow(new Error("Can only handle versions between 5.x to 8.x")); + expect( + parser.create.bind(null, { + parser: { + version: "9.9", + }, + }), + ).toThrow(new Error("Can only handle versions between 5.x to 8.x")); + }); +}); diff --git a/types.d.ts b/types.d.ts new file mode 100644 index 000000000..a5ad9c93f --- /dev/null +++ b/types.d.ts @@ -0,0 +1,1447 @@ +declare module "php-parser" { + /** + * Defines an array structure + * @example + * // PHP code : + * [1, 'foo' => 'bar', 3] + * + * // AST structure : + * { + * "kind": "array", + * "shortForm": true + * "items": [ + * {"kind": "number", "value": "1"}, + * { + * "kind": "entry", + * "key": {"kind": "string", "value": "foo", "isDoubleQuote": false}, + * "value": {"kind": "string", "value": "bar", "isDoubleQuote": false} + * }, + * {"kind": "number", "value": "3"} + * ] + * } + * @property items - List of array items + * @property shortForm - Indicate if the short array syntax is used, ex `[]` instead `array()` + */ + class Array extends Expression { + /** + * List of array items + */ + items: (Entry | Expression | Variable)[]; + /** + * Indicate if the short array syntax is used, ex `[]` instead `array()` + */ + shortForm: boolean; + } + /** + * Defines an arrow function (it's like a closure) + */ + class ArrowFunc extends Expression { + arguments: Parameter[]; + type: Identifier; + body: Expression; + byref: boolean; + nullable: boolean; + isStatic: boolean; + } + /** + * Assigns a value to the specified target + */ + class Assign extends Expression { + left: Expression; + right: Expression; + operator: string; + } + /** + * Assigns a value to the specified target + */ + class AssignRef extends Expression { + left: Expression; + right: Expression; + operator: string; + } + /** + * Attribute group + */ + class AttrGroup extends Node { + attrs: Attribute[]; + } + /** + * Attribute Value + */ + class Attribute extends Node { + name: string; + args: Parameter[]; + } + /** + * Binary operations + */ + class Bin extends Operation { + type: string; + left: Expression; + right: Expression; + } + /** + * A block statement, i.e., a sequence of statements surrounded by braces. + */ + class Block extends Statement { + children: Node[]; + } + /** + * Defines a boolean value (true/false) + */ + class Boolean extends Literal { + value: boolean; + } + /** + * A break statement + */ + class Break extends Statement { + level: number | null; + } + /** + * Passing by Reference - so the function can modify the variable + */ + class ByRef extends Expression { + what: ExpressionStatement; + } + /** + * Executes a call statement + */ + class Call extends Expression { + what: Identifier | Variable; + arguments: Expression[]; + } + /** + * A switch case statement + * @property test - if null, means that the default case + */ + class Case extends Statement { + /** + * if null, means that the default case + */ + test: Expression | null; + body: Block | null; + } + /** + * Binary operations + */ + class Cast extends Operation { + type: string; + raw: string; + expr: Expression; + } + /** + * Defines a catch statement + */ + class Catch extends Statement { + what: Name[]; + variable: Variable; + body: Block; + } + /** + * A class definition + */ + class Class extends Declaration { + extends: Identifier | null; + implements: Identifier[] | null; + body: Declaration[]; + isAnonymous: boolean; + isAbstract: boolean; + isFinal: boolean; + isReadonly: boolean; + attrGroups: AttrGroup[]; + } + /** + * Defines a class/interface/trait constant + */ + class ClassConstant extends ConstantStatement { + /** + * Generic flags parser + */ + parseFlags(flags: (number | null)[]): void; + visibility: string; + final: boolean; + nullable: boolean; + type: TypeReference | IntersectionType | UnionType | null; + attrGroups: AttrGroup[]; + } + /** + * Defines a clone call + */ + class Clone extends Expression { + what: Expression; + } + /** + * Defines a closure + */ + class Closure extends Expression { + arguments: Parameter[]; + uses: Variable[]; + type: Identifier; + byref: boolean; + nullable: boolean; + body: Block | null; + isStatic: boolean; + attrGroups: AttrGroup[]; + } + /** + * Abstract documentation node (ComentLine or CommentBlock) + */ + class Comment extends Node { + value: string; + } + /** + * A comment block (multiline) + */ + class CommentBlock extends Comment {} + /** + * A single line comment + */ + class CommentLine extends Comment {} + /** + * Defines a constant + */ + class Constant extends Node { + name: string; + value: Node | string | number | boolean | null; + } + /** + * Declares a constants into the current scope + */ + class ConstantStatement extends Statement { + constants: Constant[]; + } + /** + * A continue statement + */ + class Continue extends Statement { + level: number | null; + } + /** + * A declaration statement (function, class, interface...) + */ + class Declaration extends Statement { + /** + * Generic flags parser + */ + parseFlags(flags: (number | null)[]): void; + name: Identifier | string; + } + /** + * The declare construct is used to set execution directives for a block of code + */ + class Declare extends Block { + /** + * The node is declared as a short tag syntax : + * ```php + * bar_$baz; + * ``` + */ + readonly TYPE_OFFSET: string; + /** + * Defines the type of encapsed string (shell, heredoc, string) + */ + type: string; + /** + * The heredoc label, defined only when the type is heredoc + */ + label: string | null; + value: EncapsedPart[]; + } + /** + * Part of `Encapsed` node + */ + class EncapsedPart extends Expression { + expression: Expression; + syntax: string; + curly: boolean; + } + /** + * An array entry - see [Array](#array) + * @property key - The entry key/offset + * @property value - The entry value + * @property byRef - By reference + * @property unpack - Argument unpacking + */ + class Entry extends Expression { + /** + * The entry key/offset + */ + key: Node | null; + /** + * The entry value + */ + value: Node; + /** + * By reference + */ + byRef: boolean; + /** + * Argument unpacking + */ + unpack: boolean; + } + /** + * A enum definition + */ + class Enum extends Declaration { + valueType: Identifier | null; + implements: Identifier[]; + body: Declaration[]; + attrGroups: AttrGroup[]; + } + /** + * Declares a cases into the current scope + */ + class EnumCase extends Node { + name: string; + value: string | number | null; + } + /** + * Defines an error node (used only on silentMode) + */ + class Error extends Node { + message: string; + line: number; + token: number | string; + expected: string | any[]; + } + /** + * Defines an eval statement + */ + class Eval extends Expression { + source: Node; + } + /** + * Defines an exit / die call + */ + class Exit extends Expression { + expression: Node | null; + useDie: boolean; + } + /** + * Any expression node. Since the left-hand side of an assignment may + * be any expression in general, an expression can also be a pattern. + */ + class Expression extends Node {} + /** + * Defines an expression based statement + */ + class ExpressionStatement extends Statement { + expression: Expression; + } + /** + * Defines a for iterator + */ + class For extends Statement { + init: Expression[]; + test: Expression[]; + increment: Expression[]; + body: Block | null; + shortForm: boolean; + } + /** + * Defines a foreach iterator + */ + class Foreach extends Statement { + source: Expression; + key: Expression | null; + value: Expression; + body: Block | null; + shortForm: boolean; + } + /** + * Defines a classic function + */ + class Function extends Declaration { + arguments: Parameter[]; + type: Identifier; + byref: boolean; + nullable: boolean; + body: Block | null; + attrGroups: AttrGroup[]; + } + /** + * Imports a variable from the global scope + */ + class Global extends Statement { + items: Variable[]; + } + /** + * Defines goto statement + */ + class Goto extends Statement { + label: string; + } + /** + * Halts the compiler execution + * @property after - String after the halt statement + */ + class Halt extends Statement { + /** + * String after the halt statement + */ + after: string; + } + /** + * Defines an identifier node + */ + class Identifier extends Node { + name: string; + } + /** + * Defines a if statement + */ + class If extends Statement { + test: Expression; + body: Block; + alternate: Block | If | null; + shortForm: boolean; + } + /** + * Defines system include call + */ + class Include extends Expression { + target: Node; + once: boolean; + require: boolean; + } + /** + * Defines inline html output (treated as echo output) + */ + class Inline extends Literal { + value: string; + } + /** + * An interface definition + */ + class Interface extends Declaration { + extends: Identifier[]; + body: Declaration[]; + attrGroups: AttrGroup[]; + } + /** + * A union of types + */ + class IntersectionType extends Declaration { + types: TypeReference[]; + } + /** + * Defines an isset call + */ + class Isset extends Expression {} + /** + * A label statement (referenced by goto) + */ + class Label extends Statement { + name: string; + } + /** + * Defines list assignment + */ + class List extends Expression { + shortForm: boolean; + items: Entry[]; + } + /** + * Defines an array structure + */ + class Literal extends Expression { + raw: string; + value: EncapsedPart[] | Node | string | number | boolean | null; + } + /** + * Defines the location of the node (with it's source contents as string) + */ + class Location { + source: string | null; + start: Position; + end: Position; + } + /** + * Lookup on an offset in the specified object + */ + class Lookup extends Expression { + what: Expression; + offset: Expression; + } + /** + * Defines magic constant + */ + class Magic extends Literal {} + /** + * Defines a match expression + * @property cond - Condition expression to match against + * @property arms - Arms for comparison + */ + class Match extends Expression { + /** + * Condition expression to match against + */ + cond: Expression; + /** + * Arms for comparison + */ + arms: MatchArm[]; + } + /** + * An array entry - see [Array](#array) + * @property conds - The match condition expression list - null indicates default arm + * @property body - The return value expression + */ + class MatchArm extends Expression { + /** + * The match condition expression list - null indicates default arm + */ + conds: Expression[] | null; + /** + * The return value expression + */ + body: Expression; + } + /** + * Defines a class/interface/trait method + */ + class Method extends Function { + isAbstract: boolean; + isFinal: boolean; + isStatic: boolean; + visibility: string; + } + /** + * Defines a class reference node + */ + class Name extends Reference { + /** + * This is an identifier without a namespace separator, such as Foo + */ + readonly UNQUALIFIED_NAME: string; + /** + * This is an identifier with a namespace separator, such as Foo\Bar + */ + readonly QUALIFIED_NAME: string; + /** + * This is an identifier with a namespace separator that begins with + * a namespace separator, such as \Foo\Bar. The namespace \Foo is also + * a fully qualified name. + */ + readonly FULL_QUALIFIED_NAME: string; + /** + * This is an identifier starting with namespace, such as namespace\Foo\Bar. + */ + readonly RELATIVE_NAME: string; + name: string; + resolution: string; + } + /** + * Named arguments. + */ + class namedargument extends Expression { + name: string; + value: Expression; + } + /** + * The main program node + */ + class Namespace extends Block { + name: string; + withBrackets: boolean; + } + /** + * Creates a new instance of the specified class + */ + class New extends Expression { + what: Identifier | Variable | Class; + arguments: Variable[]; + } + /** + * A generic AST node + */ + class Node { + /** + * Attach comments to current node + */ + setTrailingComments(docs: any): void; + /** + * Destroying an unused node + */ + destroy(): void; + /** + * Includes current token position of the parser + */ + includeToken(parser: any): void; + /** + * Helper for extending the Node class + */ + static extends( + type: string, + constructor: (...params: any[]) => any, + ): (...params: any[]) => any; + loc: Location | null; + leadingComments: CommentBlock[] | Comment[] | null; + trailingComments: CommentBlock[] | Comment[] | null; + kind: string; + } + /** + * Ignore this node, it implies a no operation block, for example : + * [$foo, $bar, /* here a noop node * /] + */ + class Noop extends Node {} + /** + * Defines a nowdoc string + */ + class NowDoc extends Literal { + label: string; + raw: string; + value: string; + } + /** + * Represents the null keyword + */ + class NullKeyword extends Node {} + /** + * Lookup to an object property + */ + class NullSafePropertyLookup extends Lookup {} + /** + * Defines a numeric value + */ + class Number extends Literal { + value: number; + } + /** + * Lookup on an offset in an array + */ + class OffsetLookup extends Lookup {} + /** + * Defines binary operations + */ + class Operation extends Expression {} + type MODIFIER_PUBLIC = 1; + type MODIFIER_PROTECTED = 2; + type MODIFIER_PRIVATE = 4; + /** + * Defines a function parameter + */ + class Parameter extends Declaration { + type: Identifier | null; + value: Node | null; + byref: boolean; + variadic: boolean; + readonly: boolean; + nullable: boolean; + attrGroups: AttrGroup[]; + flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED | MODIFIER_PRIVATE; + } + /** + * Defines a class reference node + */ + class ParentReference extends Reference {} + /** + * Each Position object consists of a line number (1-indexed) and a column number (0-indexed): + */ + class Position { + line: number; + column: number; + offset: number; + } + /** + * Defines a post operation `$i++` or `$i--` + */ + class Post extends Operation { + type: string; + what: Variable; + } + /** + * Defines a pre operation `++$i` or `--$i` + */ + class Pre extends Operation { + type: string; + what: Variable; + } + /** + * Outputs + */ + class Print extends Expression {} + /** + * The main program node + */ + class Program extends Block { + errors: Error[]; + comments: Comment[] | null; + tokens: String[] | null; + } + /** + * Defines a class property + */ + class Property extends Statement { + name: string; + value: Node | null; + readonly: boolean; + nullable: boolean; + type: Identifier | Identifier[] | null; + attrGroups: AttrGroup[]; + } + /** + * Lookup to an object property + */ + class PropertyLookup extends Lookup {} + /** + * Declares a properties into the current scope + */ + class PropertyStatement extends Statement { + /** + * Generic flags parser + */ + parseFlags(flags: (number | null)[]): void; + properties: Property[]; + visibility: string | null; + isStatic: boolean; + } + /** + * Defines a reference node + */ + class Reference extends Node {} + /** + * Defines a short if statement that returns a value + */ + class RetIf extends Expression { + test: Expression; + trueExpr: Expression; + falseExpr: Expression; + } + /** + * A continue statement + */ + class Return extends Statement { + expr: Expression | null; + } + /** + * Defines a class reference node + */ + class SelfReference extends Reference {} + /** + * Avoids to show/log warnings & notices from the inner expression + */ + class Silent extends Expression { + expr: Expression; + } + /** + * Any statement. + */ + class Statement extends Node {} + /** + * Declares a static variable into the current scope + */ + class Static extends Statement { + variables: StaticVariable[]; + } + /** + * Lookup to a static property + */ + class StaticLookup extends Lookup {} + /** + * Defines a class reference node + */ + class StaticReference extends Reference {} + /** + * Defines a constant + */ + class StaticVariable extends Node { + variable: Variable; + defaultValue: Node | string | number | boolean | null; + } + /** + * Defines a string (simple or double quoted) - chars are already escaped + */ + class String extends Literal { + unicode: boolean; + isDoubleQuote: boolean; + value: string; + } + /** + * Defines a switch statement + */ + class Switch extends Statement { + test: Expression; + body: Block; + shortForm: boolean; + } + /** + * Defines a throw statement + */ + class Throw extends Statement { + what: Expression; + } + /** + * A trait definition + */ + class Trait extends Declaration { + body: Declaration[]; + } + /** + * Defines a trait alias + */ + class TraitAlias extends Node { + trait: Identifier | null; + method: Identifier; + as: Identifier | null; + visibility: string | null; + } + /** + * Defines a trait alias + */ + class TraitPrecedence extends Node { + trait: Identifier | null; + method: Identifier; + instead: Identifier[]; + } + /** + * Defines a trait usage + */ + class TraitUse extends Node { + traits: Identifier[]; + adaptations: Node[] | null; + } + /** + * Defines a try statement + */ + class Try extends Statement { + body: Block; + catches: Catch[]; + always: Block; + } + /** + * Defines a class reference node + */ + class TypeReference extends Reference { + name: string; + } + /** + * Unary operations + */ + class Unary extends Operation { + type: string; + what: Expression; + } + /** + * A union of types + */ + class UnionType extends Declaration { + types: TypeReference[]; + } + /** + * Deletes references to a list of variables + */ + class Unset extends Statement {} + /** + * Defines a use statement (with a list of use items) + * @property type - Possible value : function, const + */ + class UseGroup extends Statement { + name: string | null; + /** + * Possible value : function, const + */ + type: string | null; + item: UseItem[]; + } + /** + * Defines a use statement (from namespace) + * @property type - Possible value : function, const + */ + class UseItem extends Statement { + /** + * Importing a constant + */ + readonly TYPE_CONST: string; + /** + * Importing a function + */ + readonly TYPE_FUNC: string; + name: string; + /** + * Possible value : function, const + */ + type: string | null; + alias: Identifier | null; + } + /** + * Any expression node. Since the left-hand side of an assignment may + * be any expression in general, an expression can also be a pattern. + * @example + * // PHP code : + * $foo + * // AST output + * { + * "kind": "variable", + * "name": "foo", + * "curly": false + * } + * @property name - The variable name (can be a complex expression when the name is resolved dynamically) + * @property curly - Indicate if the name is defined between curlies, ex `${foo}` + */ + class Variable extends Expression { + /** + * The variable name (can be a complex expression when the name is resolved dynamically) + */ + name: string | Node; + /** + * Indicate if the name is defined between curlies, ex `${foo}` + */ + curly: boolean; + } + /** + * Introduce a list of items into the arguments of the call + */ + class Variadic extends Expression { + what: any[] | Expression; + } + /** + * Defines a variadic placeholder (the ellipsis in PHP 8.1+'s first-class callable syntax) + */ + class VariadicPlaceholder extends Node {} + /** + * Defines a while statement + */ + class While extends Statement { + test: Expression; + body: Block | null; + shortForm: boolean; + } + /** + * Defines a yield generator statement + */ + class Yield extends Expression { + value: Expression | null; + key: Expression | null; + } + /** + * Defines a yield from generator statement + */ + class YieldFrom extends Expression { + value: Expression; + } + /** + * The AST builder class + * @property withPositions - Should locate any node (by default false) + * @property withSource - Should extract the node original code (by default false) + */ + class AST { + /** + * Should locate any node (by default false) + */ + withPositions: boolean; + /** + * Should extract the node original code (by default false) + */ + withSource: boolean; + } + /** + * Initialise a new parser instance with the specified options + * @example + * var parser = require('php-parser'); + * var instance = new parser({ + * parser: { + * extractDoc: true, + * suppressErrors: true, + * version: 704 // or '7.4' + * }, + * ast: { + * withPositions: true + * }, + * lexer: { + * short_tags: true, + * asp_tags: true + * } + * }); + * + * var evalAST = instance.parseEval('some php code'); + * var codeAST = instance.parseCode(' Note that the output tokens are *STRICLY* similar to PHP function `token_get_all` + * @returns - Each item can be a string or an array with following informations [token_name, text, line_number] + */ + tokenGetAll(buffer: string): (string | string[])[]; + lexer: Lexer; + parser: Parser; + ast: AST; + tokens: any; + } + /** + * This is the php lexer. It will tokenize the string for helping the + * parser to build the AST from its grammar. + * @property all_tokens - defines if all tokens must be retrieved (used by token_get_all only) + * @property comment_tokens - extracts comments tokens + * @property mode_eval - enables the evald mode (ignore opening tags) + * @property asp_tags - disables by default asp tags mode + * @property short_tags - enables by default short tags mode + * @property keywords - List of php keyword + * @property castKeywords - List of php keywords for type casting + */ + class Lexer { + /** + * Initialize the lexer with the specified input + */ + setInput(): void; + /** + * consumes and returns one char from the input + */ + input(): void; + /** + * revert eating specified size + */ + unput(): void; + /** + * check if the text matches + */ + tryMatch(text: string): boolean; + /** + * check if the text matches + */ + tryMatchCaseless(text: string): boolean; + /** + * look ahead + */ + ahead(size: number): string; + /** + * consume the specified size + */ + consume(size: number): Lexer; + /** + * Gets the current state + */ + getState(): void; + /** + * Sets the current lexer state + */ + setState(): void; + /** + * prepend next token + */ + appendToken(value: any, ahead: any): Lexer; + /** + * return next match that has a token + */ + lex(): number | string; + /** + * activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + */ + begin(condition: any): Lexer; + /** + * pop the previously active lexer condition state off the condition stack + */ + popState(): string | any; + /** + * return next match in input + */ + next(): number | any; + EOF: number; + /** + * defines if all tokens must be retrieved (used by token_get_all only) + */ + all_tokens: boolean; + /** + * extracts comments tokens + */ + comment_tokens: boolean; + /** + * enables the evald mode (ignore opening tags) + */ + mode_eval: boolean; + /** + * disables by default asp tags mode + */ + asp_tags: boolean; + /** + * enables by default short tags mode + */ + short_tags: boolean; + /** + * List of php keyword + */ + keywords: any; + /** + * List of php keywords for type casting + */ + castKeywords: any; + } + /** + * The PHP Parser class that build the AST tree from the lexer + * @property lexer - current lexer instance + * @property ast - the AST factory instance + * @property token - current token + * @property extractDoc - should extract documentation as AST node + * @property extractTokens - should extract each token + * @property suppressErrors - should ignore parsing errors and continue + * @property debug - should output debug informations + */ + class Parser { + /** + * helper : gets a token name + */ + getTokenName(): void; + /** + * main entry point : converts a source code to AST + */ + parse(): void; + /** + * Raise an error + */ + raiseError(): void; + /** + * handling errors + */ + error(): void; + /** + * Create a position node from the lexers position + */ + position(): Position; + /** + * Creates a new AST node + */ + node(): void; + /** + * expects an end of statement or end of file + */ + expectEndOfStatement(): boolean; + /** + * Force the parser to check the current token. + * + * If the current token does not match to expected token, + * the an error will be raised. + * + * If the suppressError mode is activated, then the error will + * be added to the program error stack and this function will return `false`. + */ + expect(token: string | number): boolean; + /** + * Returns the current token contents + */ + text(): string; + /** + * consume the next token + */ + next(): void; + /** + * Peek at the next token. + * @returns Next Token + */ + peek(): string | number; + /** + * Eating a token + */ + lex(): void; + /** + * Check if token is of specified type + */ + is(): void; + /** + * current lexer instance + */ + lexer: Lexer; + /** + * the AST factory instance + */ + ast: AST; + /** + * current token + */ + token: number | string; + /** + * should extract documentation as AST node + */ + extractDoc: boolean; + /** + * should extract each token + */ + extractTokens: boolean; + /** + * should ignore parsing errors and continue + */ + suppressErrors: boolean; + /** + * should output debug informations + */ + debug: boolean; + } + const enum TokenNames { + T_HALT_COMPILER = 101, + T_USE = 102, + T_ENCAPSED_AND_WHITESPACE = 103, + T_OBJECT_OPERATOR = 104, + T_STRING = 105, + T_DOLLAR_OPEN_CURLY_BRACES = 106, + T_STRING_VARNAME = 107, + T_CURLY_OPEN = 108, + T_NUM_STRING = 109, + T_ISSET = 110, + T_EMPTY = 111, + T_INCLUDE = 112, + T_INCLUDE_ONCE = 113, + T_EVAL = 114, + T_REQUIRE = 115, + T_REQUIRE_ONCE = 116, + T_NAMESPACE = 117, + T_NS_SEPARATOR = 118, + T_AS = 119, + T_IF = 120, + T_ENDIF = 121, + T_WHILE = 122, + T_DO = 123, + T_FOR = 124, + T_SWITCH = 125, + T_BREAK = 126, + T_CONTINUE = 127, + T_RETURN = 128, + T_GLOBAL = 129, + T_STATIC = 130, + T_ECHO = 131, + T_INLINE_HTML = 132, + T_UNSET = 133, + T_FOREACH = 134, + T_DECLARE = 135, + T_TRY = 136, + T_THROW = 137, + T_GOTO = 138, + T_FINALLY = 139, + T_CATCH = 140, + T_ENDDECLARE = 141, + T_LIST = 142, + T_CLONE = 143, + T_PLUS_EQUAL = 144, + T_MINUS_EQUAL = 145, + T_MUL_EQUAL = 146, + T_DIV_EQUAL = 147, + T_CONCAT_EQUAL = 148, + T_MOD_EQUAL = 149, + T_AND_EQUAL = 150, + T_OR_EQUAL = 151, + T_XOR_EQUAL = 152, + T_SL_EQUAL = 153, + T_SR_EQUAL = 154, + T_INC = 155, + T_DEC = 156, + T_BOOLEAN_OR = 157, + T_BOOLEAN_AND = 158, + T_LOGICAL_OR = 159, + T_LOGICAL_AND = 160, + T_LOGICAL_XOR = 161, + T_SL = 162, + T_SR = 163, + T_IS_IDENTICAL = 164, + T_IS_NOT_IDENTICAL = 165, + T_IS_EQUAL = 166, + T_IS_NOT_EQUAL = 167, + T_IS_SMALLER_OR_EQUAL = 168, + T_IS_GREATER_OR_EQUAL = 169, + T_INSTANCEOF = 170, + T_INT_CAST = 171, + T_DOUBLE_CAST = 172, + T_STRING_CAST = 173, + T_ARRAY_CAST = 174, + T_OBJECT_CAST = 175, + T_BOOL_CAST = 176, + T_UNSET_CAST = 177, + T_EXIT = 178, + T_PRINT = 179, + T_YIELD = 180, + T_YIELD_FROM = 181, + T_FUNCTION = 182, + T_DOUBLE_ARROW = 183, + T_DOUBLE_COLON = 184, + T_ARRAY = 185, + T_CALLABLE = 186, + T_CLASS = 187, + T_ABSTRACT = 188, + T_TRAIT = 189, + T_FINAL = 190, + T_EXTENDS = 191, + T_INTERFACE = 192, + T_IMPLEMENTS = 193, + T_VAR = 194, + T_PUBLIC = 195, + T_PROTECTED = 196, + T_PRIVATE = 197, + T_CONST = 198, + T_NEW = 199, + T_INSTEADOF = 200, + T_ELSEIF = 201, + T_ELSE = 202, + T_ENDSWITCH = 203, + T_CASE = 204, + T_DEFAULT = 205, + T_ENDFOR = 206, + T_ENDFOREACH = 207, + T_ENDWHILE = 208, + T_CONSTANT_ENCAPSED_STRING = 209, + T_LNUMBER = 210, + T_DNUMBER = 211, + T_LINE = 212, + T_FILE = 213, + T_DIR = 214, + T_TRAIT_C = 215, + T_METHOD_C = 216, + T_FUNC_C = 217, + T_NS_C = 218, + T_START_HEREDOC = 219, + T_END_HEREDOC = 220, + T_CLASS_C = 221, + T_VARIABLE = 222, + T_OPEN_TAG = 223, + T_OPEN_TAG_WITH_ECHO = 224, + T_CLOSE_TAG = 225, + T_WHITESPACE = 226, + T_COMMENT = 227, + T_DOC_COMMENT = 228, + T_ELLIPSIS = 229, + T_COALESCE = 230, + T_POW = 231, + T_POW_EQUAL = 232, + T_SPACESHIP = 233, + T_COALESCE_EQUAL = 234, + T_FN = 235, + T_NULLSAFE_OBJECT_OPERATOR = 236, + T_MATCH = 237, + T_ATTRIBUTE = 238, + T_ENUM = 239, + T_READ_ONLY = 240, + T_NAME_RELATIVE = 241, + T_NAME_QUALIFIED = 242, + T_NAME_FULLY_QUALIFIED = 243, + } + /** + * PHP AST Tokens + */ + const tokens: { + values: { + [key: number]: string; + }; + names: TokenNames; + }; +} diff --git a/webpack.config.js b/webpack.config.js index 38f699a7d..40b783e10 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,13 +1,13 @@ const path = require("path"); const webpack = require("webpack"); -const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); -const { name, description, license, author } = require("./package.json"); +const TerserPlugin = require("terser-webpack-plugin"); +const { name, description, license } = require("./package.json"); const entry = "./src/index.js"; const entries = { [`${name}`]: entry, - [`${name}.min`]: entry + [`${name}.min`]: entry, }; const today = `${new Date(Date.now()).toLocaleDateString()}`; @@ -21,7 +21,7 @@ module.exports = { path: path.resolve(__dirname, "dist"), library: "PhpParser", libraryExport: "default", - libraryTarget: "umd" + libraryTarget: "umd", }, module: { rules: [ @@ -29,38 +29,33 @@ module.exports = { test: /\.js$/, exclude: /(node_modules|bower_components)/, use: { - loader: "babel-loader?cacheDirectory=true" - } - } - ] + loader: "babel-loader?cacheDirectory=true", + }, + }, + ], }, optimization: { minimize: true, minimizer: [ - new UglifyJsPlugin({ + new TerserPlugin({ include: /\.min\.js$/, - sourceMap: true, - uglifyOptions: { - compress: { - keep_fnames: false - }, - sourceMap: true, - mangle: false, - maxLineLen: 1024 - } - }) - ] + terserOptions: { + mangle: true, + }, + }), + ], }, plugins: [ new webpack.BannerPlugin({ entryOnly: true, banner: ` - Package: ${name} - ${description} - Build: [hash] - ${today} - License: ${license} - Author: ${author} - ` - }) - ] + Package: ${name} + ${description} + Build: [fullhash] - ${today} + Copyright (C) 2021 Glayzzle (${license}) + @authors https://github.com/glayzzle/php-parser/graphs/contributors + @url http://glayzzle.com + `, + }), + ], }; diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 000000000..12e87ad70 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,5427 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@ampproject/remapping@^2.1.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" + integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w== + dependencies: + "@jridgewell/gen-mapping" "^0.1.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@ampproject/remapping@^2.2.0": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" + integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.21.4": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39" + integrity sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g== + dependencies: + "@babel/highlight" "^7.18.6" + +"@babel/code-frame@^7.12.13": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" + integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== + dependencies: + "@babel/highlight" "^7.18.6" + +"@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.0": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" + integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== + dependencies: + "@babel/helper-validator-identifier" "^7.25.9" + js-tokens "^4.0.0" + picocolors "^1.0.0" + +"@babel/compat-data@^7.22.0": + version "7.22.3" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.3.tgz#cd502a6a0b6e37d7ad72ce7e71a7160a3ae36f7e" + integrity sha512-aNtko9OPOwVESUFp3MZfD8Uzxl7JzSeJpd7npIoxCasU37PFbAQRpKglkaKwlHOyeJdrREpo8TW8ldrkYWwvIQ== + +"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.25.9", "@babel/compat-data@^7.26.0": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.2.tgz#278b6b13664557de95b8f35b90d96785850bb56e" + integrity sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg== + +"@babel/core@^7.11.6", "@babel/core@^7.12.3": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.7.tgz#37072f951bd4d28315445f66e0ec9f6ae0c8c35f" + integrity sha512-t1ZjCluspe5DW24bn2Rr1CDb2v9rn/hROtg9a2tmd0+QYf4bsloYfLQzjG4qHPNMhWtKdGC33R5AxGR2Af2cBw== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.20.7" + "@babel/helper-compilation-targets" "^7.20.7" + "@babel/helper-module-transforms" "^7.20.7" + "@babel/helpers" "^7.20.7" + "@babel/parser" "^7.20.7" + "@babel/template" "^7.20.7" + "@babel/traverse" "^7.20.7" + "@babel/types" "^7.20.7" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.1" + semver "^6.3.0" + +"@babel/core@^7.23.9", "@babel/core@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.0.tgz#d78b6023cc8f3114ccf049eb219613f74a747b40" + integrity sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.26.0" + "@babel/generator" "^7.26.0" + "@babel/helper-compilation-targets" "^7.25.9" + "@babel/helper-module-transforms" "^7.26.0" + "@babel/helpers" "^7.26.0" + "@babel/parser" "^7.26.0" + "@babel/template" "^7.25.9" + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.26.0" + convert-source-map "^2.0.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + +"@babel/generator@^7.20.7", "@babel/generator@^7.22.3": + version "7.22.3" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.3.tgz#0ff675d2edb93d7596c5f6728b52615cfc0df01e" + integrity sha512-C17MW4wlk//ES/CJDL51kPNwl+qiBQyN7b9SKyVp11BLGFeSPoVaHrv+MNt8jwQFhQWowW88z1eeBx3pFz9v8A== + dependencies: + "@babel/types" "^7.22.3" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + +"@babel/generator@^7.25.9", "@babel/generator@^7.26.0": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.2.tgz#87b75813bec87916210e5e01939a4c823d6bb74f" + integrity sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw== + dependencies: + "@babel/parser" "^7.26.2" + "@babel/types" "^7.26.0" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^3.0.2" + +"@babel/generator@^7.7.2": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.7.tgz#f8ef57c8242665c5929fe2e8d82ba75460187b4a" + integrity sha512-7wqMOJq8doJMZmP4ApXTzLxSr7+oO2jroJURrVEp6XShrQUObV8Tq/D0NCcoYg2uHqUrjzO0zwBjoYzelxK+sw== + dependencies: + "@babel/types" "^7.20.7" + "@jridgewell/gen-mapping" "^0.3.2" + jsesc "^2.5.1" + +"@babel/helper-annotate-as-pure@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" + integrity sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-annotate-as-pure@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz#d8eac4d2dc0d7b6e11fa6e535332e0d3184f06b4" + integrity sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g== + dependencies: + "@babel/types" "^7.25.9" + +"@babel/helper-builder-binary-assignment-operator-visitor@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.25.9.tgz#f41752fe772a578e67286e6779a68a5a92de1ee9" + integrity sha512-C47lC7LIDCnz0h4vai/tpNOI95tCd5ZT3iBt/DBH5lXKHZsyNQv18yf1wIIg2ntiQNgmAvA+DgZ82iW8Qdym8g== + dependencies: + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helper-compilation-targets@^7.20.7": + version "7.22.1" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.1.tgz#bfcd6b7321ffebe33290d68550e2c9d7eb7c7a58" + integrity sha512-Rqx13UM3yVB5q0D/KwQ8+SPfX/+Rnsy1Lw1k/UwOC4KC6qrzIQoY3lYnBu5EHKBlEHHcj0M0W8ltPSkD8rqfsQ== + dependencies: + "@babel/compat-data" "^7.22.0" + "@babel/helper-validator-option" "^7.21.0" + browserslist "^4.21.3" + lru-cache "^5.1.1" + semver "^6.3.0" + +"@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz#55af025ce365be3cdc0c1c1e56c6af617ce88875" + integrity sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ== + dependencies: + "@babel/compat-data" "^7.25.9" + "@babel/helper-validator-option" "^7.25.9" + browserslist "^4.24.0" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-create-class-features-plugin@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.9.tgz#7644147706bb90ff613297d49ed5266bde729f83" + integrity sha512-UTZQMvt0d/rSz6KI+qdu7GQze5TIajwTS++GUozlw8VBJDEOAqSXwm1WvmYEZwqdqSGQshRocPDqrt4HBZB3fQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.25.9" + "@babel/helper-member-expression-to-functions" "^7.25.9" + "@babel/helper-optimise-call-expression" "^7.25.9" + "@babel/helper-replace-supers" "^7.25.9" + "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" + "@babel/traverse" "^7.25.9" + semver "^6.3.1" + +"@babel/helper-create-regexp-features-plugin@^7.18.6": + version "7.22.1" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.1.tgz#a7ed9a8488b45b467fca353cd1a44dc5f0cf5c70" + integrity sha512-WWjdnfR3LPIe+0EY8td7WmjhytxXtjKAEpnAxun/hkNiyOaPlvGK+NZaBFIdi9ndYV3Gav7BpFvtUwnaJlwi1w== + dependencies: + "@babel/helper-annotate-as-pure" "^7.18.6" + regexpu-core "^5.3.1" + semver "^6.3.0" + +"@babel/helper-create-regexp-features-plugin@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.25.9.tgz#3e8999db94728ad2b2458d7a470e7770b7764e26" + integrity sha512-ORPNZ3h6ZRkOyAa/SaHU+XsLZr0UQzRwuDQ0cczIA17nAzZ+85G5cVkOJIj7QavLZGSe8QXUmNFxSZzjcZF9bw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.25.9" + regexpu-core "^6.1.1" + semver "^6.3.1" + +"@babel/helper-define-polyfill-provider@^0.6.2": + version "0.6.2" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.2.tgz#18594f789c3594acb24cfdb4a7f7b7d2e8bd912d" + integrity sha512-LV76g+C502biUK6AyZ3LK10vDpDyCzZnhZFXkH1L75zHPj68+qc8Zfpx2th+gzwA2MzyK+1g/3EPl62yFnVttQ== + dependencies: + "@babel/helper-compilation-targets" "^7.22.6" + "@babel/helper-plugin-utils" "^7.22.5" + debug "^4.1.1" + lodash.debounce "^4.0.8" + resolve "^1.14.2" + +"@babel/helper-environment-visitor@^7.18.9", "@babel/helper-environment-visitor@^7.22.1": + version "7.22.1" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.1.tgz#ac3a56dbada59ed969d712cf527bd8271fe3eba8" + integrity sha512-Z2tgopurB/kTbidvzeBrc2To3PUP/9i5MUe+fU6QJCQDyPwSH2oRapkLw3KGECDYSjhQZCNxEvNvZlLw8JjGwA== + +"@babel/helper-function-name@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz#d552829b10ea9f120969304023cd0645fa00b1b4" + integrity sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg== + dependencies: + "@babel/template" "^7.20.7" + "@babel/types" "^7.21.0" + +"@babel/helper-hoist-variables@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" + integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-member-expression-to-functions@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz#9dfffe46f727005a5ea29051ac835fb735e4c1a3" + integrity sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ== + dependencies: + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helper-module-imports@^7.18.6": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz#ac88b2f76093637489e718a90cec6cf8a9b029af" + integrity sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg== + dependencies: + "@babel/types" "^7.21.4" + +"@babel/helper-module-imports@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz#e7f8d20602ebdbf9ebbea0a0751fb0f2a4141715" + integrity sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw== + dependencies: + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helper-module-transforms@^7.20.7": + version "7.20.11" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz#df4c7af713c557938c50ea3ad0117a7944b2f1b0" + integrity sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg== + dependencies: + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-simple-access" "^7.20.2" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/helper-validator-identifier" "^7.19.1" + "@babel/template" "^7.20.7" + "@babel/traverse" "^7.20.10" + "@babel/types" "^7.20.7" + +"@babel/helper-module-transforms@^7.25.9", "@babel/helper-module-transforms@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz#8ce54ec9d592695e58d84cd884b7b5c6a2fdeeae" + integrity sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw== + dependencies: + "@babel/helper-module-imports" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/helper-optimise-call-expression@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.25.9.tgz#3324ae50bae7e2ab3c33f60c9a877b6a0146b54e" + integrity sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ== + dependencies: + "@babel/types" "^7.25.9" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.8.0": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz#345f2377d05a720a4e5ecfa39cbf4474a4daed56" + integrity sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg== + +"@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz#9cbdd63a9443a2c92a725cca7ebca12cc8dd9f46" + integrity sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw== + +"@babel/helper-remap-async-to-generator@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.9.tgz#e53956ab3d5b9fb88be04b3e2f31b523afd34b92" + integrity sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.25.9" + "@babel/helper-wrap-function" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/helper-replace-supers@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.25.9.tgz#ba447224798c3da3f8713fc272b145e33da6a5c5" + integrity sha512-IiDqTOTBQy0sWyeXyGSC5TBJpGFXBkRynjBeXsvbhQFKj2viwJC76Epz35YLU1fpe/Am6Vppb7W7zM4fPQzLsQ== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.25.9" + "@babel/helper-optimise-call-expression" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/helper-simple-access@^7.20.2": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.21.5.tgz#d697a7971a5c39eac32c7e63c0921c06c8a249ee" + integrity sha512-ENPDAMC1wAjR0uaCUwliBdiSl1KBJAVnMTzXqi64c2MG8MPR6ii4qf7bSXDqSFbr4W6W028/rf5ivoHop5/mkg== + dependencies: + "@babel/types" "^7.21.5" + +"@babel/helper-simple-access@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.25.9.tgz#6d51783299884a2c74618d6ef0f86820ec2e7739" + integrity sha512-c6WHXuiaRsJTyHYLJV75t9IqsmTbItYfdj99PnzYGQZkYKvan5/2jKJ7gu31J3/BJ/A18grImSPModuyG/Eo0Q== + dependencies: + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helper-skip-transparent-expression-wrappers@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.25.9.tgz#0b2e1b62d560d6b1954893fd2b705dc17c91f0c9" + integrity sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA== + dependencies: + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helper-split-export-declaration@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075" + integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-string-parser@^7.19.4", "@babel/helper-string-parser@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz#2b3eea65443c6bdc31c22d037c65f6d323b6b2bd" + integrity sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w== + +"@babel/helper-string-parser@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" + integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== + +"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" + integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== + +"@babel/helper-validator-identifier@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" + integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== + +"@babel/helper-validator-option@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180" + integrity sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ== + +"@babel/helper-validator-option@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz#86e45bd8a49ab7e03f276577f96179653d41da72" + integrity sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw== + +"@babel/helper-wrap-function@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.25.9.tgz#d99dfd595312e6c894bd7d237470025c85eea9d0" + integrity sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g== + dependencies: + "@babel/template" "^7.25.9" + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helpers@^7.20.7": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.7.tgz#04502ff0feecc9f20ecfaad120a18f011a8e6dce" + integrity sha512-PBPjs5BppzsGaxHQCDKnZ6Gd9s6xl8bBCluz3vEInLGRJmnZan4F6BYCeqtyXqkk4W5IlPmjK4JlOuZkpJ3xZA== + dependencies: + "@babel/template" "^7.20.7" + "@babel/traverse" "^7.20.7" + "@babel/types" "^7.20.7" + +"@babel/helpers@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.26.0.tgz#30e621f1eba5aa45fe6f4868d2e9154d884119a4" + integrity sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw== + dependencies: + "@babel/template" "^7.25.9" + "@babel/types" "^7.26.0" + +"@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.9.4": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.7.tgz#66fe23b3c8569220817d5feb8b9dcdc95bb4f71b" + integrity sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg== + +"@babel/parser@^7.20.7", "@babel/parser@^7.21.9", "@babel/parser@^7.22.4": + version "7.22.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.4.tgz#a770e98fd785c231af9d93f6459d36770993fb32" + integrity sha512-VLLsx06XkEYqBtE5YGPwfSGwfrjnyPP5oiGty3S8pQLFDFLaS8VwWSIxkTXpcvr5zeYLE6+MBNl2npl/YnfofA== + +"@babel/parser@^7.23.9", "@babel/parser@^7.25.9", "@babel/parser@^7.26.0", "@babel/parser@^7.26.2": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.2.tgz#fd7b6f487cfea09889557ef5d4eeb9ff9a5abd11" + integrity sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ== + dependencies: + "@babel/types" "^7.26.0" + +"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.9.tgz#cc2e53ebf0a0340777fff5ed521943e253b4d8fe" + integrity sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/plugin-bugfix-safari-class-field-initializer-scope@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.9.tgz#af9e4fb63ccb8abcb92375b2fcfe36b60c774d30" + integrity sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.9.tgz#e8dc26fcd616e6c5bf2bd0d5a2c151d4f92a9137" + integrity sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.25.9.tgz#807a667f9158acac6f6164b4beb85ad9ebc9e1d1" + integrity sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" + "@babel/plugin-transform-optional-chaining" "^7.25.9" + +"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.9.tgz#de7093f1e7deaf68eadd7cc6b07f2ab82543269e" + integrity sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2": + version "7.21.0-placeholder-for-preset-env.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz#7844f9289546efa9febac2de4cfe358a050bd703" + integrity sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w== + +"@babel/plugin-syntax-async-generators@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-bigint@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-class-properties@^7.8.3": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-import-assertions@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.26.0.tgz#620412405058efa56e4a564903b79355020f445f" + integrity sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-syntax-import-attributes@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz#3b1412847699eea739b4f2602c74ce36f6b0b0f7" + integrity sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-syntax-import-meta@^7.8.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-jsx@^7.7.2": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz#a8feef63b010150abd97f1649ec296e849943ca0" + integrity sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q== + dependencies: + "@babel/helper-plugin-utils" "^7.18.6" + +"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-numeric-separator@^7.8.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-top-level-await@^7.8.3": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-typescript@^7.7.2": + version "7.20.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz#4e9a0cfc769c85689b77a2e642d24e9f697fc8c7" + integrity sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.19.0" + +"@babel/plugin-syntax-unicode-sets-regex@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz#d49a3b3e6b52e5be6740022317580234a6a47357" + integrity sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + +"@babel/plugin-transform-arrow-functions@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.25.9.tgz#7821d4410bee5daaadbb4cdd9a6649704e176845" + integrity sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-async-generator-functions@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.9.tgz#1b18530b077d18a407c494eb3d1d72da505283a2" + integrity sha512-RXV6QAzTBbhDMO9fWwOmwwTuYaiPbggWQ9INdZqAYeSHyG7FzQ+nOZaUUjNwKv9pV3aE4WFqFm1Hnbci5tBCAw== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-remap-async-to-generator" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/plugin-transform-async-to-generator@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.25.9.tgz#c80008dacae51482793e5a9c08b39a5be7e12d71" + integrity sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ== + dependencies: + "@babel/helper-module-imports" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-remap-async-to-generator" "^7.25.9" + +"@babel/plugin-transform-block-scoped-functions@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.25.9.tgz#5700691dbd7abb93de300ca7be94203764fce458" + integrity sha512-toHc9fzab0ZfenFpsyYinOX0J/5dgJVA2fm64xPewu7CoYHWEivIWKxkK2rMi4r3yQqLnVmheMXRdG+k239CgA== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-block-scoping@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.9.tgz#c33665e46b06759c93687ca0f84395b80c0473a1" + integrity sha512-1F05O7AYjymAtqbsFETboN1NvBdcnzMerO+zlMyJBEz6WkMdejvGWw9p05iTSjC85RLlBseHHQpYaM4gzJkBGg== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-class-properties@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.9.tgz#a8ce84fedb9ad512549984101fa84080a9f5f51f" + integrity sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-class-static-block@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.26.0.tgz#6c8da219f4eb15cae9834ec4348ff8e9e09664a0" + integrity sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-classes@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.9.tgz#7152457f7880b593a63ade8a861e6e26a4469f52" + integrity sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.25.9" + "@babel/helper-compilation-targets" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-replace-supers" "^7.25.9" + "@babel/traverse" "^7.25.9" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.25.9.tgz#db36492c78460e534b8852b1d5befe3c923ef10b" + integrity sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/template" "^7.25.9" + +"@babel/plugin-transform-destructuring@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.25.9.tgz#966ea2595c498224340883602d3cfd7a0c79cea1" + integrity sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-dotall-regex@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.25.9.tgz#bad7945dd07734ca52fe3ad4e872b40ed09bb09a" + integrity sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-duplicate-keys@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.25.9.tgz#8850ddf57dce2aebb4394bb434a7598031059e6d" + integrity sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-duplicate-named-capturing-groups-regex@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.9.tgz#6f7259b4de127721a08f1e5165b852fcaa696d31" + integrity sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-dynamic-import@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.25.9.tgz#23e917de63ed23c6600c5dd06d94669dce79f7b8" + integrity sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-exponentiation-operator@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.25.9.tgz#ece47b70d236c1d99c263a1e22b62dc20a4c8b0f" + integrity sha512-KRhdhlVk2nObA5AYa7QMgTMTVJdfHprfpAk4DjZVtllqRg9qarilstTKEhpVjyt+Npi8ThRyiV8176Am3CodPA== + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-export-namespace-from@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.25.9.tgz#90745fe55053394f554e40584cda81f2c8a402a2" + integrity sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-for-of@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.25.9.tgz#4bdc7d42a213397905d89f02350c5267866d5755" + integrity sha512-LqHxduHoaGELJl2uhImHwRQudhCM50pT46rIBNvtT/Oql3nqiS3wOwP+5ten7NpYSXrrVLgtZU3DZmPtWZo16A== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" + +"@babel/plugin-transform-function-name@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.9.tgz#939d956e68a606661005bfd550c4fc2ef95f7b97" + integrity sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA== + dependencies: + "@babel/helper-compilation-targets" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/plugin-transform-json-strings@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.25.9.tgz#c86db407cb827cded902a90c707d2781aaa89660" + integrity sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-literals@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.9.tgz#1a1c6b4d4aa59bc4cad5b6b3a223a0abd685c9de" + integrity sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-logical-assignment-operators@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.25.9.tgz#b19441a8c39a2fda0902900b306ea05ae1055db7" + integrity sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-member-expression-literals@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.25.9.tgz#63dff19763ea64a31f5e6c20957e6a25e41ed5de" + integrity sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-modules-amd@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.25.9.tgz#49ba478f2295101544abd794486cd3088dddb6c5" + integrity sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw== + dependencies: + "@babel/helper-module-transforms" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-modules-commonjs@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.25.9.tgz#d165c8c569a080baf5467bda88df6425fc060686" + integrity sha512-dwh2Ol1jWwL2MgkCzUSOvfmKElqQcuswAZypBSUsScMXvgdT8Ekq5YA6TtqpTVWH+4903NmboMuH1o9i8Rxlyg== + dependencies: + "@babel/helper-module-transforms" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-simple-access" "^7.25.9" + +"@babel/plugin-transform-modules-systemjs@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.9.tgz#8bd1b43836269e3d33307151a114bcf3ba6793f8" + integrity sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA== + dependencies: + "@babel/helper-module-transforms" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/plugin-transform-modules-umd@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.25.9.tgz#6710079cdd7c694db36529a1e8411e49fcbf14c9" + integrity sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw== + dependencies: + "@babel/helper-module-transforms" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-named-capturing-groups-regex@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.25.9.tgz#454990ae6cc22fd2a0fa60b3a2c6f63a38064e6a" + integrity sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-new-target@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.25.9.tgz#42e61711294b105c248336dcb04b77054ea8becd" + integrity sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-nullish-coalescing-operator@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.25.9.tgz#bcb1b0d9e948168102d5f7104375ca21c3266949" + integrity sha512-ENfftpLZw5EItALAD4WsY/KUWvhUlZndm5GC7G3evUsVeSJB6p0pBeLQUnRnBCBx7zV0RKQjR9kCuwrsIrjWog== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-numeric-separator@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.25.9.tgz#bfed75866261a8b643468b0ccfd275f2033214a1" + integrity sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-object-rest-spread@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.25.9.tgz#0203725025074164808bcf1a2cfa90c652c99f18" + integrity sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg== + dependencies: + "@babel/helper-compilation-targets" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/plugin-transform-parameters" "^7.25.9" + +"@babel/plugin-transform-object-super@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.25.9.tgz#385d5de135162933beb4a3d227a2b7e52bb4cf03" + integrity sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-replace-supers" "^7.25.9" + +"@babel/plugin-transform-optional-catch-binding@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.25.9.tgz#10e70d96d52bb1f10c5caaac59ac545ea2ba7ff3" + integrity sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-optional-chaining@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.25.9.tgz#e142eb899d26ef715435f201ab6e139541eee7dd" + integrity sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" + +"@babel/plugin-transform-parameters@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.25.9.tgz#b856842205b3e77e18b7a7a1b94958069c7ba257" + integrity sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-private-methods@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.25.9.tgz#847f4139263577526455d7d3223cd8bda51e3b57" + integrity sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-private-property-in-object@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.25.9.tgz#9c8b73e64e6cc3cbb2743633885a7dd2c385fe33" + integrity sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.25.9" + "@babel/helper-create-class-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-property-literals@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.25.9.tgz#d72d588bd88b0dec8b62e36f6fda91cedfe28e3f" + integrity sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-regenerator@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.25.9.tgz#03a8a4670d6cebae95305ac6defac81ece77740b" + integrity sha512-vwDcDNsgMPDGP0nMqzahDWE5/MLcX8sv96+wfX7as7LoF/kr97Bo/7fI00lXY4wUXYfVmwIIyG80fGZ1uvt2qg== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + regenerator-transform "^0.15.2" + +"@babel/plugin-transform-regexp-modifiers@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.26.0.tgz#2f5837a5b5cd3842a919d8147e9903cc7455b850" + integrity sha512-vN6saax7lrA2yA/Pak3sCxuD6F5InBjn9IcrIKQPjpsLvuHYLVroTxjdlVRHjjBWxKOqIwpTXDkOssYT4BFdRw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-reserved-words@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.25.9.tgz#0398aed2f1f10ba3f78a93db219b27ef417fb9ce" + integrity sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-shorthand-properties@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.25.9.tgz#bb785e6091f99f826a95f9894fc16fde61c163f2" + integrity sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-spread@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.25.9.tgz#24a35153931b4ba3d13cec4a7748c21ab5514ef9" + integrity sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" + +"@babel/plugin-transform-sticky-regex@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.25.9.tgz#c7f02b944e986a417817b20ba2c504dfc1453d32" + integrity sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-template-literals@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.25.9.tgz#6dbd4a24e8fad024df76d1fac6a03cf413f60fe1" + integrity sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-typeof-symbol@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.25.9.tgz#224ba48a92869ddbf81f9b4a5f1204bbf5a2bc4b" + integrity sha512-v61XqUMiueJROUv66BVIOi0Fv/CUuZuZMl5NkRoCVxLAnMexZ0A3kMe7vvZ0nulxMuMp0Mk6S5hNh48yki08ZA== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-unicode-escapes@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.25.9.tgz#a75ef3947ce15363fccaa38e2dd9bc70b2788b82" + integrity sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-unicode-property-regex@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.25.9.tgz#a901e96f2c1d071b0d1bb5dc0d3c880ce8f53dd3" + integrity sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-unicode-regex@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.25.9.tgz#5eae747fe39eacf13a8bd006a4fb0b5d1fa5e9b1" + integrity sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-transform-unicode-sets-regex@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.25.9.tgz#65114c17b4ffc20fa5b163c63c70c0d25621fabe" + integrity sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/preset-env@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.26.0.tgz#30e5c6bc1bcc54865bff0c5a30f6d4ccdc7fa8b1" + integrity sha512-H84Fxq0CQJNdPFT2DrfnylZ3cf5K43rGfWK4LJGPpjKHiZlk0/RzwEus3PDDZZg+/Er7lCA03MVacueUuXdzfw== + dependencies: + "@babel/compat-data" "^7.26.0" + "@babel/helper-compilation-targets" "^7.25.9" + "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-validator-option" "^7.25.9" + "@babel/plugin-bugfix-firefox-class-in-computed-class-key" "^7.25.9" + "@babel/plugin-bugfix-safari-class-field-initializer-scope" "^7.25.9" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.25.9" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.25.9" + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.25.9" + "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" + "@babel/plugin-syntax-import-assertions" "^7.26.0" + "@babel/plugin-syntax-import-attributes" "^7.26.0" + "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" + "@babel/plugin-transform-arrow-functions" "^7.25.9" + "@babel/plugin-transform-async-generator-functions" "^7.25.9" + "@babel/plugin-transform-async-to-generator" "^7.25.9" + "@babel/plugin-transform-block-scoped-functions" "^7.25.9" + "@babel/plugin-transform-block-scoping" "^7.25.9" + "@babel/plugin-transform-class-properties" "^7.25.9" + "@babel/plugin-transform-class-static-block" "^7.26.0" + "@babel/plugin-transform-classes" "^7.25.9" + "@babel/plugin-transform-computed-properties" "^7.25.9" + "@babel/plugin-transform-destructuring" "^7.25.9" + "@babel/plugin-transform-dotall-regex" "^7.25.9" + "@babel/plugin-transform-duplicate-keys" "^7.25.9" + "@babel/plugin-transform-duplicate-named-capturing-groups-regex" "^7.25.9" + "@babel/plugin-transform-dynamic-import" "^7.25.9" + "@babel/plugin-transform-exponentiation-operator" "^7.25.9" + "@babel/plugin-transform-export-namespace-from" "^7.25.9" + "@babel/plugin-transform-for-of" "^7.25.9" + "@babel/plugin-transform-function-name" "^7.25.9" + "@babel/plugin-transform-json-strings" "^7.25.9" + "@babel/plugin-transform-literals" "^7.25.9" + "@babel/plugin-transform-logical-assignment-operators" "^7.25.9" + "@babel/plugin-transform-member-expression-literals" "^7.25.9" + "@babel/plugin-transform-modules-amd" "^7.25.9" + "@babel/plugin-transform-modules-commonjs" "^7.25.9" + "@babel/plugin-transform-modules-systemjs" "^7.25.9" + "@babel/plugin-transform-modules-umd" "^7.25.9" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.25.9" + "@babel/plugin-transform-new-target" "^7.25.9" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.25.9" + "@babel/plugin-transform-numeric-separator" "^7.25.9" + "@babel/plugin-transform-object-rest-spread" "^7.25.9" + "@babel/plugin-transform-object-super" "^7.25.9" + "@babel/plugin-transform-optional-catch-binding" "^7.25.9" + "@babel/plugin-transform-optional-chaining" "^7.25.9" + "@babel/plugin-transform-parameters" "^7.25.9" + "@babel/plugin-transform-private-methods" "^7.25.9" + "@babel/plugin-transform-private-property-in-object" "^7.25.9" + "@babel/plugin-transform-property-literals" "^7.25.9" + "@babel/plugin-transform-regenerator" "^7.25.9" + "@babel/plugin-transform-regexp-modifiers" "^7.26.0" + "@babel/plugin-transform-reserved-words" "^7.25.9" + "@babel/plugin-transform-shorthand-properties" "^7.25.9" + "@babel/plugin-transform-spread" "^7.25.9" + "@babel/plugin-transform-sticky-regex" "^7.25.9" + "@babel/plugin-transform-template-literals" "^7.25.9" + "@babel/plugin-transform-typeof-symbol" "^7.25.9" + "@babel/plugin-transform-unicode-escapes" "^7.25.9" + "@babel/plugin-transform-unicode-property-regex" "^7.25.9" + "@babel/plugin-transform-unicode-regex" "^7.25.9" + "@babel/plugin-transform-unicode-sets-regex" "^7.25.9" + "@babel/preset-modules" "0.1.6-no-external-plugins" + babel-plugin-polyfill-corejs2 "^0.4.10" + babel-plugin-polyfill-corejs3 "^0.10.6" + babel-plugin-polyfill-regenerator "^0.6.1" + core-js-compat "^3.38.1" + semver "^6.3.1" + +"@babel/preset-modules@0.1.6-no-external-plugins": + version "0.1.6-no-external-plugins" + resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz#ccb88a2c49c817236861fee7826080573b8a923a" + integrity sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/types" "^7.4.4" + esutils "^2.0.2" + +"@babel/regjsgen@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" + integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== + +"@babel/runtime@^7.8.4": + version "7.22.3" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.3.tgz#0a7fce51d43adbf0f7b517a71f4c3aaca92ebcbb" + integrity sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ== + dependencies: + regenerator-runtime "^0.13.11" + +"@babel/template@^7.20.7": + version "7.21.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.21.9.tgz#bf8dad2859130ae46088a99c1f265394877446fb" + integrity sha512-MK0X5k8NKOuWRamiEfc3KEJiHMTkGZNUjzMipqCGDDc6ijRl/B7RGSKVGncu4Ro/HdyzzY6cmoXuKI2Gffk7vQ== + dependencies: + "@babel/code-frame" "^7.21.4" + "@babel/parser" "^7.21.9" + "@babel/types" "^7.21.5" + +"@babel/template@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016" + integrity sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/template@^7.3.3": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8" + integrity sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/parser" "^7.20.7" + "@babel/types" "^7.20.7" + +"@babel/traverse@^7.20.10", "@babel/traverse@^7.20.7": + version "7.22.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.4.tgz#c3cf96c5c290bd13b55e29d025274057727664c0" + integrity sha512-Tn1pDsjIcI+JcLKq1AVlZEr4226gpuAQTsLMorsYg9tuS/kG7nuwwJ4AB8jfQuEgb/COBwR/DqJxmoiYFu5/rQ== + dependencies: + "@babel/code-frame" "^7.21.4" + "@babel/generator" "^7.22.3" + "@babel/helper-environment-visitor" "^7.22.1" + "@babel/helper-function-name" "^7.21.0" + "@babel/helper-hoist-variables" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/parser" "^7.22.4" + "@babel/types" "^7.22.4" + debug "^4.1.0" + globals "^11.1.0" + +"@babel/traverse@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.9.tgz#a50f8fe49e7f69f53de5bea7e413cd35c5e13c84" + integrity sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/generator" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/template" "^7.25.9" + "@babel/types" "^7.25.9" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.7.tgz#54ec75e252318423fc07fb644dc6a58a64c09b7f" + integrity sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg== + dependencies: + "@babel/helper-string-parser" "^7.19.4" + "@babel/helper-validator-identifier" "^7.19.1" + to-fast-properties "^2.0.0" + +"@babel/types@^7.18.6", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.4", "@babel/types@^7.21.5", "@babel/types@^7.22.3", "@babel/types@^7.22.4", "@babel/types@^7.4.4": + version "7.22.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.4.tgz#56a2653ae7e7591365dabf20b76295410684c071" + integrity sha512-Tx9x3UBHTTsMSW85WB2kphxYQVvrZ/t1FxD88IpSgIjiUJlCm9z+xWIDwyo1vffTwSqteqyznB8ZE9vYYk16zA== + dependencies: + "@babel/helper-string-parser" "^7.21.5" + "@babel/helper-validator-identifier" "^7.19.1" + to-fast-properties "^2.0.0" + +"@babel/types@^7.25.9", "@babel/types@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.0.tgz#deabd08d6b753bc8e0f198f8709fb575e31774ff" + integrity sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA== + dependencies: + "@babel/helper-string-parser" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + +"@discoveryjs/json-ext@^0.5.0": + version "0.5.7" + resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" + integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== + +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/eslint-utils@^4.4.0": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz#d1145bf2c20132d6400495d6df4bf59362fd9d56" + integrity sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA== + dependencies: + eslint-visitor-keys "^3.4.3" + +"@eslint-community/regexpp@^4.12.1": + version "4.12.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0" + integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ== + +"@eslint/config-array@^0.18.0": + version "0.18.0" + resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.18.0.tgz#37d8fe656e0d5e3dbaea7758ea56540867fd074d" + integrity sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw== + dependencies: + "@eslint/object-schema" "^2.1.4" + debug "^4.3.1" + minimatch "^3.1.2" + +"@eslint/core@^0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.7.0.tgz#a1bb4b6a4e742a5ff1894b7ee76fbf884ec72bd3" + integrity sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw== + +"@eslint/eslintrc@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.1.0.tgz#dbd3482bfd91efa663cbe7aa1f506839868207b6" + integrity sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^10.0.1" + globals "^14.0.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@9.14.0", "@eslint/js@^9.14.0": + version "9.14.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.14.0.tgz#2347a871042ebd11a00fd8c2d3d56a265ee6857e" + integrity sha512-pFoEtFWCPyDOl+C6Ift+wC7Ro89otjigCf5vcuWqWgqNSQbRrpjSvdeE6ofLz4dHmyxD5f7gIdGT4+p36L6Twg== + +"@eslint/object-schema@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.4.tgz#9e69f8bb4031e11df79e03db09f9dbbae1740843" + integrity sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ== + +"@eslint/plugin-kit@^0.2.0": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@eslint/plugin-kit/-/plugin-kit-0.2.2.tgz#5eff371953bc13e3f4d88150e2c53959f64f74f6" + integrity sha512-CXtq5nR4Su+2I47WPOlWud98Y5Lv8Kyxp2ukhgFx/eW6Blm18VXJO5WuQylPugRo8nbluoi6GvvxBLqHcvqUUw== + dependencies: + levn "^0.4.1" + +"@humanfs/core@^0.19.1": + version "0.19.1" + resolved "https://registry.yarnpkg.com/@humanfs/core/-/core-0.19.1.tgz#17c55ca7d426733fe3c561906b8173c336b40a77" + integrity sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA== + +"@humanfs/node@^0.16.6": + version "0.16.6" + resolved "https://registry.yarnpkg.com/@humanfs/node/-/node-0.16.6.tgz#ee2a10eaabd1131987bf0488fd9b820174cd765e" + integrity sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw== + dependencies: + "@humanfs/core" "^0.19.1" + "@humanwhocodes/retry" "^0.3.0" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/retry@^0.3.0": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.3.1.tgz#c72a5c76a9fbaf3488e231b13dc52c0da7bab42a" + integrity sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA== + +"@humanwhocodes/retry@^0.4.0": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.4.1.tgz#9a96ce501bc62df46c4031fbd970e3cc6b10f07b" + integrity sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA== + +"@istanbuljs/load-nyc-config@^1.0.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== + dependencies: + camelcase "^5.3.1" + find-up "^4.1.0" + get-package-type "^0.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" + +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== + +"@jest/console@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" + integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + slash "^3.0.0" + +"@jest/core@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" + integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== + dependencies: + "@jest/console" "^29.7.0" + "@jest/reporters" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + ci-info "^3.2.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-changed-files "^29.7.0" + jest-config "^29.7.0" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-resolve-dependencies "^29.7.0" + jest-runner "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + jest-watcher "^29.7.0" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + strip-ansi "^6.0.0" + +"@jest/environment@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" + integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== + dependencies: + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== + dependencies: + jest-get-type "^29.6.3" + +"@jest/expect@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" + integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== + dependencies: + expect "^29.7.0" + jest-snapshot "^29.7.0" + +"@jest/fake-timers@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" + integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== + dependencies: + "@jest/types" "^29.6.3" + "@sinonjs/fake-timers" "^10.0.2" + "@types/node" "*" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-util "^29.7.0" + +"@jest/globals@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" + integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/types" "^29.6.3" + jest-mock "^29.7.0" + +"@jest/reporters@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" + integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" + "@types/node" "*" + chalk "^4.0.0" + collect-v8-coverage "^1.0.0" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^6.0.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.1.3" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + jest-worker "^29.7.0" + slash "^3.0.0" + string-length "^4.0.1" + strip-ansi "^6.0.0" + v8-to-istanbul "^9.0.1" + +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" + +"@jest/source-map@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" + integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== + dependencies: + "@jridgewell/trace-mapping" "^0.3.18" + callsites "^3.0.0" + graceful-fs "^4.2.9" + +"@jest/test-result@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" + integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== + dependencies: + "@jest/console" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" + +"@jest/test-sequencer@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" + integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== + dependencies: + "@jest/test-result" "^29.7.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + slash "^3.0.0" + +"@jest/transform@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" + integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== + dependencies: + "@babel/core" "^7.11.6" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" + babel-plugin-istanbul "^6.1.1" + chalk "^4.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + micromatch "^4.0.4" + pirates "^4.0.4" + slash "^3.0.0" + write-file-atomic "^4.0.2" + +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== + dependencies: + "@jest/schemas" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + +"@jridgewell/gen-mapping@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" + integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w== + dependencies: + "@jridgewell/set-array" "^1.0.0" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" + integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/gen-mapping@^0.3.5": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" + integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + +"@jridgewell/source-map@^0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.3.tgz#8108265659d4c33e72ffe14e33d6cc5eb59f2fda" + integrity sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/sourcemap-codec@1.4.14": + version "1.4.14" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" + integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/sourcemap-codec@^1.4.14": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@jridgewell/trace-mapping@^0.3.12": + version "0.3.17" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" + integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== + dependencies: + "@jridgewell/resolve-uri" "3.1.0" + "@jridgewell/sourcemap-codec" "1.4.14" + +"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": + version "0.3.18" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" + integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== + dependencies: + "@jridgewell/resolve-uri" "3.1.0" + "@jridgewell/sourcemap-codec" "1.4.14" + +"@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== + +"@sinclair/typebox@^0.27.8": + version "0.27.8" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" + integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== + +"@sinonjs/commons@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-2.0.0.tgz#fd4ca5b063554307e8327b4564bd56d3b73924a3" + integrity sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg== + dependencies: + type-detect "4.0.8" + +"@sinonjs/fake-timers@^10.0.2": + version "10.0.2" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz#d10549ed1f423d80639c528b6c7f5a1017747d0c" + integrity sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw== + dependencies: + "@sinonjs/commons" "^2.0.0" + +"@types/babel__core@^7.1.14": + version "7.1.20" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.20.tgz#e168cdd612c92a2d335029ed62ac94c95b362359" + integrity sha512-PVb6Bg2QuscZ30FvOU7z4guG6c926D9YRvOxEaelzndpMsvP+YM74Q/dAFASpg2l6+XLalxSGxcq/lrgYWZtyQ== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" + integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.4.1" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" + integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.18.3" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.3.tgz#dfc508a85781e5698d5b33443416b6268c4b3e8d" + integrity sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w== + dependencies: + "@babel/types" "^7.3.0" + +"@types/estree@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" + integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== + +"@types/graceful-fs@^4.1.3": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" + integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw== + dependencies: + "@types/node" "*" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" + integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== + +"@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/json-schema@^7.0.15": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + +"@types/json-schema@^7.0.8": + version "7.0.12" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" + integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== + +"@types/json-schema@^7.0.9": + version "7.0.11" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== + +"@types/linkify-it@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.2.tgz#fd2cd2edbaa7eaac7e7f3c1748b52a19143846c9" + integrity sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA== + +"@types/markdown-it@^12.2.3": + version "12.2.3" + resolved "https://registry.yarnpkg.com/@types/markdown-it/-/markdown-it-12.2.3.tgz#0d6f6e5e413f8daaa26522904597be3d6cd93b51" + integrity sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ== + dependencies: + "@types/linkify-it" "*" + "@types/mdurl" "*" + +"@types/mdurl@*": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-1.0.2.tgz#e2ce9d83a613bacf284c7be7d491945e39e1f8e9" + integrity sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA== + +"@types/node@*": + version "20.2.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.2.5.tgz#26d295f3570323b2837d322180dfbf1ba156fefb" + integrity sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ== + +"@types/node@^22.9.0": + version "22.9.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.9.0.tgz#b7f16e5c3384788542c72dc3d561a7ceae2c0365" + integrity sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ== + dependencies: + undici-types "~6.19.8" + +"@types/parse-json@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" + integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== + +"@types/stack-utils@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" + integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== + +"@types/yargs-parser@*": + version "21.0.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" + integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + +"@types/yargs@^17.0.8": + version "17.0.18" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.18.tgz#466225ab4fbabb9aa711f5b406796daf1374a5b7" + integrity sha512-eIJR1UER6ur3EpKM3d+2Pgd+ET+k6Kn9B4ZItX0oPjjVI5PrfaRjKyLT5UYendDpLuoiJMNJvovLQbEXqhsPaw== + dependencies: + "@types/yargs-parser" "*" + +"@typescript-eslint/scope-manager@8.13.0": + version "8.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.13.0.tgz#2f4aed0b87d72360e64e4ea194b1fde14a59082e" + integrity sha512-XsGWww0odcUT0gJoBZ1DeulY1+jkaHUciUq4jKNv4cpInbvvrtDoyBH9rE/n2V29wQJPk8iCH1wipra9BhmiMA== + dependencies: + "@typescript-eslint/types" "8.13.0" + "@typescript-eslint/visitor-keys" "8.13.0" + +"@typescript-eslint/types@8.13.0": + version "8.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.13.0.tgz#3f35dead2b2491a04339370dcbcd17bbdfc204d8" + integrity sha512-4cyFErJetFLckcThRUFdReWJjVsPCqyBlJTi6IDEpc1GWCIIZRFxVppjWLIMcQhNGhdWJJRYFHpHoDWvMlDzng== + +"@typescript-eslint/typescript-estree@8.13.0": + version "8.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.13.0.tgz#db8c93dd5437ca3ce417a255fb35ddc3c12c3e95" + integrity sha512-v7SCIGmVsRK2Cy/LTLGN22uea6SaUIlpBcO/gnMGT/7zPtxp90bphcGf4fyrCQl3ZtiBKqVTG32hb668oIYy1g== + dependencies: + "@typescript-eslint/types" "8.13.0" + "@typescript-eslint/visitor-keys" "8.13.0" + debug "^4.3.4" + fast-glob "^3.3.2" + is-glob "^4.0.3" + minimatch "^9.0.4" + semver "^7.6.0" + ts-api-utils "^1.3.0" + +"@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0": + version "8.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.13.0.tgz#f6d40e8b5053dcaeabbd2e26463857abf27d62c0" + integrity sha512-A1EeYOND6Uv250nybnLZapeXpYMl8tkzYUxqmoKAWnI4sei3ihf2XdZVd+vVOmHGcp3t+P7yRrNsyyiXTvShFQ== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@typescript-eslint/scope-manager" "8.13.0" + "@typescript-eslint/types" "8.13.0" + "@typescript-eslint/typescript-estree" "8.13.0" + +"@typescript-eslint/visitor-keys@8.13.0": + version "8.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.13.0.tgz#e97b0d92b266ef38a1faf40a74da289b66683a5b" + integrity sha512-7N/+lztJqH4Mrf0lb10R/CbI1EaAMMGyF5y0oJvFoAhafwgiRA7TXyd8TFn8FC8k5y2dTsYogg238qavRGNnlw== + dependencies: + "@typescript-eslint/types" "8.13.0" + eslint-visitor-keys "^3.4.3" + +"@webassemblyjs/ast@1.13.1", "@webassemblyjs/ast@^1.12.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.13.1.tgz#4bf991409845051ce9fd3d36ebcd49bb75faae4c" + integrity sha512-+Zp/YJMBws+tg2Nuy5jiFhwvPiSeIB0gPp1Ie/TyqFg69qJ/vRrOKQ7AsFLn3solq5/9ubkBjrGd0UcvFjFsYA== + dependencies: + "@webassemblyjs/helper-numbers" "1.12.1" + "@webassemblyjs/helper-wasm-bytecode" "1.12.1" + +"@webassemblyjs/floating-point-hex-parser@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.12.1.tgz#e92ce6f1d663d5a44127b751ee6cee335b8e3e20" + integrity sha512-0vqwjuCO3Sa6pO3nfplawORkL1GUgza/H1A62SdXHSFCmAHoRcrtX/yVG3f1LuMYW951cvYRcRt6hThhz4FnCQ== + +"@webassemblyjs/helper-api-error@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.12.1.tgz#e310b66234838b0c77d38741346b2b575dc4c047" + integrity sha512-czovmKZdRk4rYauCOuMV/EImC3qyfcqyJuOYyDRYR6PZSOW37VWe26fAZQznbvKjlwJdyxLl6mIfx47Cfz8ykw== + +"@webassemblyjs/helper-buffer@1.13.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.13.1.tgz#65f9d5d0d42ff9c2bdf9768d9368fd2fdab36185" + integrity sha512-J0gf97+D3CavG7aO5XmtwxRWMiMEuxQ6t8Aov8areSnyI5P5fM0HV0m8bE3iLfDQZBhxLCc15tRsFVOGyAJ0ng== + +"@webassemblyjs/helper-numbers@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.12.1.tgz#3b7239d8c5b4bab237b9138b231f3a0837a3ca27" + integrity sha512-Vp6k5nXOMvI9dWJqDGCMvwAc8+G6tI2YziuYWqxk7XYnWHdxEJo19CGpqm/kRh86rJxwYANLGuyreARhM+C9lQ== + dependencies: + "@webassemblyjs/floating-point-hex-parser" "1.12.1" + "@webassemblyjs/helper-api-error" "1.12.1" + "@xtuc/long" "4.2.2" + +"@webassemblyjs/helper-wasm-bytecode@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.12.1.tgz#2008ce69b4129a6e66c435498557eaa7957b3eae" + integrity sha512-flsRYmCqN2ZJmvAyNxZXPPFkwKoezeTUczytfBovql8cOjYTr6OTcZvku4UzyKFW0Kj+PgD+UaG8/IdX31EYWg== + +"@webassemblyjs/helper-wasm-section@1.13.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.13.1.tgz#3f7b438d4226f12fba60bf8e11e871343756f072" + integrity sha512-lcVNbrM5Wm7867lmbU61l+R4dU7emD2X70f9V0PuicvsdVUS5vvXODAxRYGVGBAJ6rWmXMuZKjM0PoeBjAcm2A== + dependencies: + "@webassemblyjs/ast" "1.13.1" + "@webassemblyjs/helper-buffer" "1.13.1" + "@webassemblyjs/helper-wasm-bytecode" "1.12.1" + "@webassemblyjs/wasm-gen" "1.13.1" + +"@webassemblyjs/ieee754@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.12.1.tgz#6c27377183eb6b0b9f6dacbd37bc143ba56e97ff" + integrity sha512-fcrUCqE2dVldeVAHTWFiTiKMS9ivc5jOgB2c30zYOZnm3O54SWeMJWS/HXYK862we2AYHtf6GYuP9xG9J+5zyQ== + dependencies: + "@xtuc/ieee754" "^1.2.0" + +"@webassemblyjs/leb128@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.12.1.tgz#cc30f0ea19e5f8efdf8b247c2bc5627d64dcb621" + integrity sha512-jOU6pTFNf7aGm46NCrEU7Gj6cVuP55T7+kyo5TU/rCduZ5EdwMPBZwSwwzjPZ3eFXYFCmC5wZdPZN0ZWio6n4Q== + dependencies: + "@xtuc/long" "4.2.2" + +"@webassemblyjs/utf8@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.12.1.tgz#f7f9eaaf1fd0835007672b628907cf5ccf916ee7" + integrity sha512-zcZvnAY3/M28Of012dksIfC26qZQJlj2PQCCvxqlsRJHOYtasp+OvK8nRcg11TKzAAv3ja7Y0NEBMKAjH6ljnw== + +"@webassemblyjs/wasm-edit@^1.12.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.13.1.tgz#84a7c07469bf03589c82afd23c0b26b75a3443c9" + integrity sha512-YHnh/f4P4ggjPB+pcri8Pb2HHwCGK+B8qBE+NeEp/WTMQ7dAjgWTnLhXxUqb6WLOT25TK5m0VTCAKTYw8AKxcg== + dependencies: + "@webassemblyjs/ast" "1.13.1" + "@webassemblyjs/helper-buffer" "1.13.1" + "@webassemblyjs/helper-wasm-bytecode" "1.12.1" + "@webassemblyjs/helper-wasm-section" "1.13.1" + "@webassemblyjs/wasm-gen" "1.13.1" + "@webassemblyjs/wasm-opt" "1.13.1" + "@webassemblyjs/wasm-parser" "1.13.1" + "@webassemblyjs/wast-printer" "1.13.1" + +"@webassemblyjs/wasm-gen@1.13.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.13.1.tgz#a821f9a139b72da9614238ecddd3d7ae2a366f64" + integrity sha512-AxWiaqIeLh3c1H+8d1gPgVNXHyKP7jDu2G828Of9/E0/ovVEsh6LjX1QZ6g1tFBHocCwuUHK9O4w35kgojZRqA== + dependencies: + "@webassemblyjs/ast" "1.13.1" + "@webassemblyjs/helper-wasm-bytecode" "1.12.1" + "@webassemblyjs/ieee754" "1.12.1" + "@webassemblyjs/leb128" "1.12.1" + "@webassemblyjs/utf8" "1.12.1" + +"@webassemblyjs/wasm-opt@1.13.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.13.1.tgz#eaa4e9946c46427fb025e837dbfc235a400c7581" + integrity sha512-SUMlvCrfykC7dtWX5g4TSuMmWi9w9tK5kGIdvQMnLuvJfnFLsnAaF86FNbSBSAL33VhM/hOhx4t9o66N37IqSg== + dependencies: + "@webassemblyjs/ast" "1.13.1" + "@webassemblyjs/helper-buffer" "1.13.1" + "@webassemblyjs/wasm-gen" "1.13.1" + "@webassemblyjs/wasm-parser" "1.13.1" + +"@webassemblyjs/wasm-parser@1.13.1", "@webassemblyjs/wasm-parser@^1.12.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.13.1.tgz#42c20ec9a340865c3ba4fea8a19566afda90283e" + integrity sha512-8SPOcbqSb7vXHG+B0PTsJrvT/HilwV3WkJgxw34lmhWvO+7qM9xBTd9u4dn1Lb86WHpKswT5XwF277uBTHFikg== + dependencies: + "@webassemblyjs/ast" "1.13.1" + "@webassemblyjs/helper-api-error" "1.12.1" + "@webassemblyjs/helper-wasm-bytecode" "1.12.1" + "@webassemblyjs/ieee754" "1.12.1" + "@webassemblyjs/leb128" "1.12.1" + "@webassemblyjs/utf8" "1.12.1" + +"@webassemblyjs/wast-printer@1.13.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.13.1.tgz#a82ff5e16eb6411fe10a8a06925bfa1b35230d74" + integrity sha512-q0zIfwpbFvaNkgbSzkZFzLsOs8ixZ5MSdTTMESilSAk1C3P8BKEWfbLEvIqyI/PjNpP9+ZU+/KwgfXx3T7ApKw== + dependencies: + "@webassemblyjs/ast" "1.13.1" + "@xtuc/long" "4.2.2" + +"@webpack-cli/configtest@^2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-2.1.1.tgz#3b2f852e91dac6e3b85fb2a314fb8bef46d94646" + integrity sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw== + +"@webpack-cli/info@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-2.0.2.tgz#cc3fbf22efeb88ff62310cf885c5b09f44ae0fdd" + integrity sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A== + +"@webpack-cli/serve@^2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e" + integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ== + +"@xtuc/ieee754@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" + integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== + +"@xtuc/long@4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" + integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== + +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + +acorn@^8.14.0: + version "8.14.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" + integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== + +acorn@^8.8.2: + version "8.8.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" + integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== + +ajv-formats@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" + integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA== + dependencies: + ajv "^8.0.0" + +ajv-keywords@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" + integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== + +ajv-keywords@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz#69d4d385a4733cdbeab44964a1170a88f87f0e16" + integrity sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw== + dependencies: + fast-deep-equal "^3.1.3" + +ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ajv@^8.0.0, ajv@^8.8.0: + version "8.11.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.11.2.tgz#aecb20b50607acf2569b6382167b65a96008bb78" + integrity sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + +ansi-escapes@^4.2.1: + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== + dependencies: + type-fest "^0.21.3" + +ansi-gray@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" + integrity sha512-HrgGIZUl8h2EHuZaU9hTR/cU5nhKxpVE1V6kdGsQ8e4zirElJ5fvtfc8N7Q1oq1aatO275i8pUFUCpNWCAnVWw== + dependencies: + ansi-wrap "0.1.0" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA== + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + +ansi-wrap@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" + integrity sha512-ZyznvL8k/FZeQHr2T6LzcJ/+vBApDnMNZvfVFy3At0knswWd6rJ3/0Hhmpu8oqa6C92npmozs890sX9Dl6q+Qw== + +anymatch@^3.0.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +array-differ@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-1.0.0.tgz#eff52e3758249d33be402b8bb8e564bb2b5d4031" + integrity sha512-LeZY+DZDRnvP7eMuQ6LHfCzUGxAAIViUBliK24P3hWXL6y4SortgR6Nim6xrkfSLlmH0+k+9NYNwVC2s53ZrYQ== + +array-uniq@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + integrity sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q== + +asn1@~0.2.3: + version "0.2.6" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" + integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== + +async@^1.5.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + integrity sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w== + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== + +aws4@^1.8.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" + integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== + +babel-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" + integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== + dependencies: + "@jest/transform" "^29.7.0" + "@types/babel__core" "^7.1.14" + babel-plugin-istanbul "^6.1.1" + babel-preset-jest "^29.6.3" + chalk "^4.0.0" + graceful-fs "^4.2.9" + slash "^3.0.0" + +babel-loader@^9.2.1: + version "9.2.1" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-9.2.1.tgz#04c7835db16c246dd19ba0914418f3937797587b" + integrity sha512-fqe8naHt46e0yIdkjUZYqddSXfej3AHajX+CSO5X7oy0EmPc6o5Xh+RClNoHjnieWz9AW4kZxW9yyFMhVB1QLA== + dependencies: + find-cache-dir "^4.0.0" + schema-utils "^4.0.0" + +babel-plugin-istanbul@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" + integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-instrument "^5.0.4" + test-exclude "^6.0.0" + +babel-plugin-jest-hoist@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" + integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== + dependencies: + "@babel/template" "^7.3.3" + "@babel/types" "^7.3.3" + "@types/babel__core" "^7.1.14" + "@types/babel__traverse" "^7.0.6" + +babel-plugin-polyfill-corejs2@^0.4.10: + version "0.4.11" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz#30320dfe3ffe1a336c15afdcdafd6fd615b25e33" + integrity sha512-sMEJ27L0gRHShOh5G54uAAPaiCOygY/5ratXuiyb2G46FmlSpc9eFCzYVyDiPxfNbwzA7mYahmjQc5q+CZQ09Q== + dependencies: + "@babel/compat-data" "^7.22.6" + "@babel/helper-define-polyfill-provider" "^0.6.2" + semver "^6.3.1" + +babel-plugin-polyfill-corejs3@^0.10.6: + version "0.10.6" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz#2deda57caef50f59c525aeb4964d3b2f867710c7" + integrity sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.6.2" + core-js-compat "^3.38.0" + +babel-plugin-polyfill-regenerator@^0.6.1: + version "0.6.2" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.2.tgz#addc47e240edd1da1058ebda03021f382bba785e" + integrity sha512-2R25rQZWP63nGwaAswvDazbPXfrM3HwVoBXK6HcqeKrSrL/JqcC/rDcf95l4r7LXLyxDXc8uQDa064GubtCABg== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.6.2" + +babel-preset-current-node-syntax@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" + integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== + dependencies: + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-bigint" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.8.3" + "@babel/plugin-syntax-import-meta" "^7.8.3" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.8.3" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-top-level-await" "^7.8.3" + +babel-preset-jest@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" + integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== + dependencies: + babel-plugin-jest-hoist "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== + dependencies: + tweetnacl "^0.14.3" + +beeper@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/beeper/-/beeper-1.1.1.tgz#e6d5ea8c5dad001304a70b22638447f69cb2f809" + integrity sha512-3vqtKL1N45I5dV0RdssXZG7X6pCqQrWPNOlBPZPrd+QkE2HEhR57Z04m0KtpbsZH73j+a3F8UD1TQnn+ExTvIA== + +benchmark@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/benchmark/-/benchmark-2.1.4.tgz#09f3de31c916425d498cc2ee565a0ebf3c2a5629" + integrity sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ== + dependencies: + lodash "^4.17.4" + platform "^1.3.3" + +bluebird@^3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +braces@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +browserslist@^4.21.3: + version "4.21.7" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.7.tgz#e2b420947e5fb0a58e8f4668ae6e23488127e551" + integrity sha512-BauCXrQ7I2ftSqd2mvKHGo85XR0u7Ru3C/Hxsy/0TkfCtjrmAbPdzLGasmoiBxplpDXlPvdjX9u7srIMfgasNA== + dependencies: + caniuse-lite "^1.0.30001489" + electron-to-chromium "^1.4.411" + node-releases "^2.0.12" + update-browserslist-db "^1.0.11" + +browserslist@^4.24.0, browserslist@^4.24.2: + version "4.24.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.2.tgz#f5845bc91069dbd55ee89faf9822e1d885d16580" + integrity sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg== + dependencies: + caniuse-lite "^1.0.30001669" + electron-to-chromium "^1.5.41" + node-releases "^2.0.18" + update-browserslist-db "^1.1.1" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + +buffer-from@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== + +buffers@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb" + integrity sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ== + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelcase@^6.2.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-lite@^1.0.30001489: + version "1.0.30001495" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001495.tgz#64a0ccef1911a9dcff647115b4430f8eff1ef2d9" + integrity sha512-F6x5IEuigtUfU5ZMQK2jsy5JqUUlEFRVZq8bO2a+ysq5K7jD6PPc9YXZj78xDNS3uNchesp1Jw47YXEqr+Viyg== + +caniuse-lite@^1.0.30001669: + version "1.0.30001677" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001677.tgz#27c2e2c637e007cfa864a16f7dfe7cde66b38b5f" + integrity sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog== + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== + +catharsis@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/catharsis/-/catharsis-0.9.0.tgz#40382a168be0e6da308c277d3a2b3eb40c7d2121" + integrity sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A== + dependencies: + lodash "^4.17.15" + +chalk@^1.0.0, chalk@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A== + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.0.0, chalk@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +char-regex@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" + integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== + +chrome-trace-event@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" + integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== + +ci-info@^3.2.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.7.0.tgz#6d01b3696c59915b6ce057e4aa4adfc2fa25f5ef" + integrity sha512-2CpRNYmImPx+RXKLq6jko/L07phmS9I02TyqkcNU20GCF/GgaWvc58hPtjxDX8lPpkdwc9sNh72V9k00S7ezog== + +cjs-module-lexer@^1.0.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" + integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== + +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + +clone-deep@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" + +clone-stats@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" + integrity sha512-dhUqc57gSMCo6TX85FLfe51eC/s+Im2MLkAgJwfaRRexR2tA4dd3eLEW4L6efzHc2iNorrRRXITifnDLlRrhaA== + +clone@^1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== + +collect-v8-coverage@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" + integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg== + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +color-support@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" + integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== + +colorette@^2.0.14: + version "2.0.20" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +command-exists@^1.2.9: + version "1.2.9" + resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" + integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== + +commander@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" + integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== + +commander@^2.20.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +common-path-prefix@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/common-path-prefix/-/common-path-prefix-3.0.0.tgz#7d007a7e07c58c4b4d5f433131a19141b29f11e0" + integrity sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +convert-source-map@^1.6.0, convert-source-map@^1.7.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" + integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== + +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + +core-js-compat@^3.38.0, core-js-compat@^3.38.1: + version "3.39.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.39.0.tgz#b12dccb495f2601dc860bdbe7b4e3ffa8ba63f61" + integrity sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw== + dependencies: + browserslist "^4.24.2" + +core-util-is@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== + +core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + +cosmiconfig@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6" + integrity sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.2.1" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.10.0" + +coveralls@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.1.1.tgz#f5d4431d8b5ae69c5079c8f8ca00d64ac77cf081" + integrity sha512-+dxnG2NHncSD1NrqbSM3dn/lE57O6Qf/koe9+I7c+wzkqRmEvcp0kgJdxKInzYzkICKkFMZsX3Vct3++tsF9ww== + dependencies: + js-yaml "^3.13.1" + lcov-parse "^1.0.0" + log-driver "^1.2.7" + minimist "^1.2.5" + request "^2.88.2" + +create-jest-runner@^0.11.2: + version "0.11.2" + resolved "https://registry.yarnpkg.com/create-jest-runner/-/create-jest-runner-0.11.2.tgz#4b4f62ccef1e4de12e80f81c2cf8211fa392a962" + integrity sha512-6lwspphs4M1PLKV9baBNxHQtWVBPZuDU8kAP4MyrVWa6aEpEcpi2HZeeA6WncwaqgsGNXpP0N2STS7XNM/nHKQ== + dependencies: + chalk "^4.1.0" + jest-worker "^28.0.2" + throat "^6.0.1" + +create-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" + integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-config "^29.7.0" + jest-util "^29.7.0" + prompts "^2.0.1" + +cross-spawn@^7.0.2, cross-spawn@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== + dependencies: + assert-plus "^1.0.0" + +dateformat@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.2.0.tgz#4065e2013cf9fb916ddfd82efb506ad4c6769062" + integrity sha512-GODcnWq3YGoTnygPfi02ygEiRxqUxpJwuRHjdhJYuxpcZmDq4rjBiXYmbCCzStxo176ixfLT6i4NPwQooRySnw== + +debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +debug@^4.3.1: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + +dedent@^1.0.0: + version "1.5.3" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" + integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== + +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + +deepmerge@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" + integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +detect-newline@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== + +diff-sequences@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" + integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== + +dot-prop@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083" + integrity sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA== + dependencies: + is-obj "^2.0.0" + +duplexer2@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db" + integrity sha512-+AWBwjGadtksxjOQSFDhPNQbed7icNXApT4+2BNpsXzcCBiInq2H9XW0O8sfHFaPmnQRs7cg/P0fAr2IWQSW0g== + dependencies: + readable-stream "~1.1.9" + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +electron-to-chromium@^1.4.411: + version "1.4.423" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.423.tgz#99567f3a0563fe0d1d0931e9ce851bca239f6658" + integrity sha512-y4A7YfQcDGPAeSWM1IuoWzXpg9RY1nwHzHSwRtCSQFp9FgAVDgdWlFf0RbdWfLWQ2WUI+bddUgk5RgTjqRE6FQ== + +electron-to-chromium@^1.5.41: + version "1.5.52" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.52.tgz#2bed832c95a56a195504f918150e548474687da8" + integrity sha512-xtoijJTZ+qeucLBDNztDOuQBE1ksqjvNjvqFoST3nGC7fSpqJ+X6BdTBaY5BHG+IhWWmpc6b/KfpeuEDupEPOQ== + +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +enhanced-resolve@^5.17.1: + version "5.17.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" + integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + +entities@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" + integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w== + +envinfo@^7.7.3: + version "7.8.1" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475" + integrity sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw== + +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-module-lexer@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.2.1.tgz#ba303831f63e6a394983fde2f97ad77b22324527" + integrity sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg== + +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + +escalade@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== + +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-config-prettier@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" + integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== + +eslint-plugin-jest@^28.9.0: + version "28.9.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-28.9.0.tgz#19168dfaed124339cd2252c4c4d1ac3688aeb243" + integrity sha512-rLu1s1Wf96TgUUxSw6loVIkNtUjq1Re7A9QdCCHSohnvXEBAjuL420h0T/fMmkQlNsQP2GhQzEUpYHPfxBkvYQ== + dependencies: + "@typescript-eslint/utils" "^6.0.0 || ^7.0.0 || ^8.0.0" + +eslint-plugin-prettier@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz#d1c8f972d8f60e414c25465c163d16f209411f95" + integrity sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw== + dependencies: + prettier-linter-helpers "^1.0.0" + synckit "^0.9.1" + +eslint-scope@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +eslint-scope@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.2.0.tgz#377aa6f1cb5dc7592cfd0b7f892fd0cf352ce442" + integrity sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-visitor-keys@^3.3.0: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== + +eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint-visitor-keys@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz#687bacb2af884fcdda8a6e7d65c606f46a14cd45" + integrity sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw== + +eslint@^9.14.0: + version "9.14.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.14.0.tgz#534180a97c00af08bcf2b60b0ebf0c4d6c1b2c95" + integrity sha512-c2FHsVBr87lnUtjP4Yhvk4yEhKrQavGafRA/Se1ouse8PfbfC/Qh9Mxa00yWsZRlqeUB9raXip0aiiUZkgnr9g== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.12.1" + "@eslint/config-array" "^0.18.0" + "@eslint/core" "^0.7.0" + "@eslint/eslintrc" "^3.1.0" + "@eslint/js" "9.14.0" + "@eslint/plugin-kit" "^0.2.0" + "@humanfs/node" "^0.16.6" + "@humanwhocodes/module-importer" "^1.0.1" + "@humanwhocodes/retry" "^0.4.0" + "@types/estree" "^1.0.6" + "@types/json-schema" "^7.0.15" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + escape-string-regexp "^4.0.0" + eslint-scope "^8.2.0" + eslint-visitor-keys "^4.2.0" + espree "^10.3.0" + esquery "^1.5.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^8.0.0" + find-up "^5.0.0" + glob-parent "^6.0.2" + ignore "^5.2.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + json-stable-stringify-without-jsonify "^1.0.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + text-table "^0.2.0" + +espree@^10.0.1, espree@^10.3.0: + version "10.3.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-10.3.0.tgz#29267cf5b0cb98735b65e64ba07e0ed49d1eed8a" + integrity sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg== + dependencies: + acorn "^8.14.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^4.2.0" + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" + integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +events@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== + +expect@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== + dependencies: + "@jest/expect-utils" "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== + +extsprintf@^1.2.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" + integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== + +fancy-log@^1.1.0: + version "1.3.3" + resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7" + integrity sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw== + dependencies: + ansi-gray "^0.1.1" + color-support "^1.1.3" + parse-node-version "^1.0.0" + time-stamp "^1.0.0" + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + +fast-glob@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== + +fastest-levenshtein@^1.0.12: + version "1.0.16" + resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz#210e61b6ff181de91ea9b3d1b84fdedd47e034e5" + integrity sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg== + +fastq@^1.6.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" + integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + dependencies: + reusify "^1.0.4" + +fb-watchman@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" + integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== + dependencies: + bser "2.1.1" + +file-entry-cache@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-8.0.0.tgz#7787bddcf1131bffb92636c69457bbc0edd6d81f" + integrity sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ== + dependencies: + flat-cache "^4.0.0" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +find-cache-dir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-4.0.0.tgz#a30ee0448f81a3990708f6453633c733e2f6eec2" + integrity sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg== + dependencies: + common-path-prefix "^3.0.0" + pkg-dir "^7.0.0" + +find-up@^4.0.0, find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +find-up@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-6.3.0.tgz#2abab3d3280b2dc7ac10199ef324c4e002c8c790" + integrity sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw== + dependencies: + locate-path "^7.1.0" + path-exists "^5.0.0" + +flat-cache@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-4.0.1.tgz#0ece39fcb14ee012f4b0410bd33dd9c1f011127c" + integrity sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw== + dependencies: + flatted "^3.2.9" + keyv "^4.5.4" + +flatted@^3.2.9: + version "3.3.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" + integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +fsevents@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-package-type@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== + +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== + dependencies: + assert-plus "^1.0.0" + +glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +glob-to-regexp@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== + +glob@^7.1.3, glob@^7.1.4: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^14.0.0: + version "14.0.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e" + integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ== + +globals@^15.12.0: + version "15.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-15.12.0.tgz#1811872883ad8f41055b61457a130221297de5b5" + integrity sha512-1+gLErljJFhbOVyaetcwJiJ4+eLe45S2E7P5UiZ9xGfeq3ATQf5DOv9G7MH3gGbKQLkzmNh2DxfZwLdw+j6oTQ== + +glogg@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.2.tgz#2d7dd702beda22eb3bffadf880696da6d846313f" + integrity sha512-5mwUoSuBk44Y4EshyiqcH95ZntbDdTQqA3QYSrxmzj28Ai0vXBGMH1ApSANH14j2sIRtqCEyg6PfsuP7ElOEDA== + dependencies: + sparkles "^1.0.0" + +graceful-fs@^4.1.2, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +graceful-fs@^4.1.9: + version "4.2.10" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + +gulp-css-base64@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/gulp-css-base64/-/gulp-css-base64-1.3.4.tgz#afca45e83401045f472c67b776d1b1514e11489f" + integrity sha512-4bdGQW0PFA6Z9zfeYlsGod9IeSPP6u6wobzixZd0w5f36aqP6Oecrb6fJCEQ4xinthH4f4OLs+8+b+Az2hOYwQ== + dependencies: + async "^1.5.0" + buffers "^0.1.1" + chalk "^1.1.1" + gulp-util "^3.0.3" + mime "^1.3.4" + request "^2.67.0" + through2 "^2.0.0" + +gulp-util@^3.0.3: + version "3.0.8" + resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" + integrity sha512-q5oWPc12lwSFS9h/4VIjG+1NuNDlJ48ywV2JKItY4Ycc/n1fXJeYPVQsfu5ZrhQi7FGSDBalwUCLar/GyHXKGw== + dependencies: + array-differ "^1.0.0" + array-uniq "^1.0.2" + beeper "^1.0.0" + chalk "^1.0.0" + dateformat "^2.0.0" + fancy-log "^1.1.0" + gulplog "^1.0.0" + has-gulplog "^0.1.0" + lodash._reescape "^3.0.0" + lodash._reevaluate "^3.0.0" + lodash._reinterpolate "^3.0.0" + lodash.template "^3.0.0" + minimist "^1.1.0" + multipipe "^0.1.2" + object-assign "^3.0.0" + replace-ext "0.0.1" + through2 "^2.0.0" + vinyl "^0.5.0" + +gulplog@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/gulplog/-/gulplog-1.0.0.tgz#e28c4d45d05ecbbed818363ce8f9c5926229ffe5" + integrity sha512-hm6N8nrm3Y08jXie48jsC55eCZz9mnb4OirAStEk2deqeyhXU3C1otDVh+ccttMuc1sBi6RX6ZJ720hs9RCvgw== + dependencies: + glogg "^1.0.0" + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q== + +har-validator@~5.1.3: + version "5.1.5" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" + integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== + dependencies: + ajv "^6.12.3" + har-schema "^2.0.0" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg== + dependencies: + ansi-regex "^2.0.0" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-gulplog@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" + integrity sha512-+F4GzLjwHNNDEAJW2DC1xXfEoPkRDmUdJ7CBYw4MpqtDwOnqdImJl7GWlpqx+Wko6//J8uKTnIe4wZSv7yCqmw== + dependencies: + sparkles "^1.0.0" + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ== + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + +husky@^9.1.6: + version "9.1.6" + resolved "https://registry.yarnpkg.com/husky/-/husky-9.1.6.tgz#e23aa996b6203ab33534bdc82306b0cf2cb07d6c" + integrity sha512-sqbjZKK7kf44hfdE94EoX8MZNk0n7HeW37O4YrVGCF4wzgQjp+akPAkfUK5LZ6KuR/6sqeAVuXHji+RzQgOn5A== + +ignore@^5.2.0: + version "5.2.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" + integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== + +import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +import-local@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" + integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== + dependencies: + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@~2.0.1, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +interpret@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" + integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ== + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== + +is-core-module@^2.11.0: + version "2.12.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" + integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== + dependencies: + has "^1.0.3" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-obj@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" + integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== + +is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== + +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== + +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" + integrity sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw== + +istanbul-lib-instrument@^5.0.4: + version "5.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" + integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== + dependencies: + "@babel/core" "^7.12.3" + "@babel/parser" "^7.14.7" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-coverage "^3.2.0" + semver "^6.3.0" + +istanbul-lib-instrument@^6.0.0: + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== + dependencies: + "@babel/core" "^7.23.9" + "@babel/parser" "^7.23.9" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + +istanbul-lib-report@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" + integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== + dependencies: + istanbul-lib-coverage "^3.0.0" + make-dir "^3.0.0" + supports-color "^7.1.0" + +istanbul-lib-source-maps@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + source-map "^0.6.1" + +istanbul-reports@^3.1.3: + version "3.1.5" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.5.tgz#cc9a6ab25cb25659810e4785ed9d9fb742578bae" + integrity sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w== + dependencies: + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" + +jest-changed-files@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" + integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== + dependencies: + execa "^5.0.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + +jest-circus@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" + integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + dedent "^1.0.0" + is-generator-fn "^2.0.0" + jest-each "^29.7.0" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + pretty-format "^29.7.0" + pure-rand "^6.0.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-cli@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" + integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== + dependencies: + "@jest/core" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + chalk "^4.0.0" + create-jest "^29.7.0" + exit "^0.1.2" + import-local "^3.0.2" + jest-config "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + yargs "^17.3.1" + +jest-config@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" + integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== + dependencies: + "@babel/core" "^7.11.6" + "@jest/test-sequencer" "^29.7.0" + "@jest/types" "^29.6.3" + babel-jest "^29.7.0" + chalk "^4.0.0" + ci-info "^3.2.0" + deepmerge "^4.2.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-circus "^29.7.0" + jest-environment-node "^29.7.0" + jest-get-type "^29.6.3" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-runner "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + micromatch "^4.0.4" + parse-json "^5.2.0" + pretty-format "^29.7.0" + slash "^3.0.0" + strip-json-comments "^3.1.1" + +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-docblock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" + integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== + dependencies: + detect-newline "^3.0.0" + +jest-each@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" + integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + jest-get-type "^29.6.3" + jest-util "^29.7.0" + pretty-format "^29.7.0" + +jest-environment-node@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" + integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + jest-util "^29.7.0" + +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== + +jest-haste-map@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" + integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== + dependencies: + "@jest/types" "^29.6.3" + "@types/graceful-fs" "^4.1.3" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.9" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + jest-worker "^29.7.0" + micromatch "^4.0.4" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.2" + +jest-leak-detector@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" + integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== + dependencies: + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== + dependencies: + chalk "^4.0.0" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.6.3" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-mock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" + integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-util "^29.7.0" + +jest-pnp-resolver@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== + +jest-regex-util@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" + integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== + +jest-resolve-dependencies@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" + integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== + dependencies: + jest-regex-util "^29.6.3" + jest-snapshot "^29.7.0" + +jest-resolve@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" + integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== + dependencies: + chalk "^4.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-pnp-resolver "^1.2.2" + jest-util "^29.7.0" + jest-validate "^29.7.0" + resolve "^1.20.0" + resolve.exports "^2.0.0" + slash "^3.0.0" + +jest-runner-eslint@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jest-runner-eslint/-/jest-runner-eslint-2.2.1.tgz#3cb214f84eeab3848af81c5842359e82073a3aef" + integrity sha512-BSAB65hGhtr/Kmb7tSkfqFmK9LYwCMK8L1xcp+XaSToPFqr7sY1jleMZUeDhV0ITA33pW+JUCx5a02veVD2Q2w== + dependencies: + chalk "^4.0.0" + cosmiconfig "^7.0.0" + create-jest-runner "^0.11.2" + dot-prop "^6.0.1" + +jest-runner@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" + integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== + dependencies: + "@jest/console" "^29.7.0" + "@jest/environment" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + emittery "^0.13.1" + graceful-fs "^4.2.9" + jest-docblock "^29.7.0" + jest-environment-node "^29.7.0" + jest-haste-map "^29.7.0" + jest-leak-detector "^29.7.0" + jest-message-util "^29.7.0" + jest-resolve "^29.7.0" + jest-runtime "^29.7.0" + jest-util "^29.7.0" + jest-watcher "^29.7.0" + jest-worker "^29.7.0" + p-limit "^3.1.0" + source-map-support "0.5.13" + +jest-runtime@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" + integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/globals" "^29.7.0" + "@jest/source-map" "^29.6.3" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + cjs-module-lexer "^1.0.0" + collect-v8-coverage "^1.0.0" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + slash "^3.0.0" + strip-bom "^4.0.0" + +jest-snapshot@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" + integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== + dependencies: + "@babel/core" "^7.11.6" + "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + chalk "^4.0.0" + expect "^29.7.0" + graceful-fs "^4.2.9" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + natural-compare "^1.4.0" + pretty-format "^29.7.0" + semver "^7.5.3" + +jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + +jest-validate@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" + integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== + dependencies: + "@jest/types" "^29.6.3" + camelcase "^6.2.0" + chalk "^4.0.0" + jest-get-type "^29.6.3" + leven "^3.1.0" + pretty-format "^29.7.0" + +jest-watcher@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" + integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== + dependencies: + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + emittery "^0.13.1" + jest-util "^29.7.0" + string-length "^4.0.1" + +jest-worker@^27.4.5: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" + integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest-worker@^28.0.2: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-28.1.3.tgz#7e3c4ce3fa23d1bb6accb169e7f396f98ed4bb98" + integrity sha512-CqRA220YV/6jCo8VWvAt1KKx6eek1VIHMPeLEbpcfSfkEeWyBNppynM/o6q+Wmw+sOhos2ml34wZbSX3G13//g== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest-worker@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== + dependencies: + "@types/node" "*" + jest-util "^29.7.0" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" + integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== + dependencies: + "@jest/core" "^29.7.0" + "@jest/types" "^29.6.3" + import-local "^3.0.2" + jest-cli "^29.7.0" + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.13.1: + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +js2xmlparser@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-4.0.2.tgz#2a1fdf01e90585ef2ae872a01bc169c6a8d5e60a" + integrity sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA== + dependencies: + xmlcreate "^2.0.4" + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== + +jsdoc-template@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/jsdoc-template/-/jsdoc-template-1.2.0.tgz#5ad0c85ed509a5de9b51537835c1762d90e75564" + integrity sha512-Njl5ROuIDCcNfdDjIFHw5URlziXwZXgcUkch9GhSlf7U/q0Et7kwDxlapZsgJ8dzSboCq9xx6MSFlkAm1WhGEw== + dependencies: + gulp-css-base64 "^1.3.4" + +jsdoc@^3.6.11: + version "3.6.11" + resolved "https://registry.yarnpkg.com/jsdoc/-/jsdoc-3.6.11.tgz#8bbb5747e6f579f141a5238cbad4e95e004458ce" + integrity sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg== + dependencies: + "@babel/parser" "^7.9.4" + "@types/markdown-it" "^12.2.3" + bluebird "^3.7.2" + catharsis "^0.9.0" + escape-string-regexp "^2.0.0" + js2xmlparser "^4.0.2" + klaw "^3.0.0" + markdown-it "^12.3.2" + markdown-it-anchor "^8.4.1" + marked "^4.0.10" + mkdirp "^1.0.4" + requizzle "^0.2.3" + strip-json-comments "^3.1.0" + taffydb "2.6.2" + underscore "~1.13.2" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +jsesc@^3.0.2, jsesc@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" + integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g== + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA== + +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + +json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +json-schema@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" + integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== + +json5@^2.2.1, json5@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + +jsprim@^1.2.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz#712c65533a15c878ba59e9ed5f0e26d5b77c5feb" + integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.4.0" + verror "1.10.0" + +keyv@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + +kind-of@^6.0.2: + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + +klaw@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/klaw/-/klaw-3.0.0.tgz#b11bec9cf2492f06756d6e809ab73a2910259146" + integrity sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g== + dependencies: + graceful-fs "^4.1.9" + +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + +lcov-parse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-1.0.0.tgz#eb0d46b54111ebc561acb4c408ef9363bdc8f7e0" + integrity sha512-aprLII/vPzuQvYZnDRU78Fns9I2Ag3gi4Ipga/hxnVMCZC8DnR2nI7XBqrPoywGfxqIx/DgarGvDJZAD3YBTgQ== + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +linkify-it@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.3.tgz#a98baf44ce45a550efb4d49c769d07524cc2fa2e" + integrity sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ== + dependencies: + uc.micro "^1.0.1" + +loader-runner@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" + integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +locate-path@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-7.2.0.tgz#69cb1779bd90b35ab1e771e1f2f89a202c2a8a8a" + integrity sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA== + dependencies: + p-locate "^6.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + integrity sha512-rFR6Vpm4HeCK1WPGvjZSJ+7yik8d8PVUdCJx5rT2pogG4Ve/2ZS7kfmO5l5T2o5V2mqlNIfSF5MZlr1+xOoYQQ== + +lodash._basetostring@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz#d1861d877f824a52f669832dcaf3ee15566a07d5" + integrity sha512-mTzAr1aNAv/i7W43vOR/uD/aJ4ngbtsRaCubp2BfZhlGU/eORUjg/7F6X0orNMdv33JOrdgGybtvMN/po3EWrA== + +lodash._basevalues@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz#5b775762802bde3d3297503e26300820fdf661b7" + integrity sha512-H94wl5P13uEqlCg7OcNNhMQ8KvWSIyqXzOPusRgHC9DK3o54P6P3xtbXlVbRABG4q5gSmp7EDdJ0MSuW9HX6Mg== + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + integrity sha512-RrL9VxMEPyDMHOd9uFbvMe8X55X16/cGM5IgOKgRElQZutpX89iS6vwl64duTV1/16w5JY7tuFNXqoekmh1EmA== + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + integrity sha512-De+ZbrMu6eThFti/CSzhRvTKMgQToLxbij58LMfM8JnYDNSOjkjTCIaa8ixglOeGh2nyPlakbt5bJWJ7gvpYlQ== + +lodash._reescape@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reescape/-/lodash._reescape-3.0.0.tgz#2b1d6f5dfe07c8a355753e5f27fac7f1cde1616a" + integrity sha512-Sjlavm5y+FUVIF3vF3B75GyXrzsfYV8Dlv3L4mEpuB9leg8N6yf/7rU06iLPx9fY0Mv3khVp9p7Dx0mGV6V5OQ== + +lodash._reevaluate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz#58bc74c40664953ae0b124d806996daca431e2ed" + integrity sha512-OrPwdDc65iJiBeUe5n/LIjd7Viy99bKwDdk7Z5ljfZg0uFRFlfQaCy9tZ4YMAag9WAZmlVpe1iZrkIMMSMHD3w== + +lodash._reinterpolate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" + integrity sha512-xYHt68QRoYGjeeM/XOE1uJtvXQAgvszfBhjV4yvsQH0u2i9I6cI6c6/eG4Hh3UAOVn0y/xAXwmTzEay49Q//HA== + +lodash._root@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" + integrity sha512-O0pWuFSK6x4EXhM1dhZ8gchNtG7JMqBtrHdoUFUWXD7dJnNSUze1GuyQr5sOs0aCvgGeI3o/OJW8f4ca7FDxmQ== + +lodash.debounce@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" + integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== + +lodash.escape@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-3.2.0.tgz#995ee0dc18c1b48cc92effae71a10aab5b487698" + integrity sha512-n1PZMXgaaDWZDSvuNZ/8XOcYO2hOKDqZel5adtR30VKQAtoWs/5AOeFA0vPV8moiPzlqe7F4cP2tzpFewQyelQ== + dependencies: + lodash._root "^3.0.0" + +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + integrity sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg== + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + integrity sha512-JwObCrNJuT0Nnbuecmqr5DgtuBppuCvGD9lxjFpAzwnVtdGoDQ1zig+5W8k5/6Gcn0gZ3936HDAlGd28i7sOGQ== + +lodash.keys@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" + integrity sha512-CuBsapFjcubOGMn3VD+24HOAPxM79tH+V6ivJL3CHYjtrawauDJHUk//Yew9Hvc6e9rbCrURGk8z6PC+8WJBfQ== + dependencies: + lodash._getnative "^3.0.0" + lodash.isarguments "^3.0.0" + lodash.isarray "^3.0.0" + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash.restparam@^3.0.0: + version "3.6.1" + resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" + integrity sha512-L4/arjjuq4noiUJpt3yS6KIKDtJwNe2fIYgMqyYYKoeIfV1iEqvPwhCx23o+R9dzouGihDAPN1dTIRWa7zk8tw== + +lodash.template@>=4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" + integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== + dependencies: + lodash._reinterpolate "^3.0.0" + lodash.templatesettings "^4.0.0" + +lodash.template@^3.0.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-3.6.2.tgz#f8cdecc6169a255be9098ae8b0c53d378931d14f" + integrity sha512-0B4Y53I0OgHUJkt+7RmlDFWKjVAI/YUpWNiL9GQz5ORDr4ttgfQGo+phBWKFLJbBdtOwgMuUkdOHOnPg45jKmQ== + dependencies: + lodash._basecopy "^3.0.0" + lodash._basetostring "^3.0.0" + lodash._basevalues "^3.0.0" + lodash._isiterateecall "^3.0.0" + lodash._reinterpolate "^3.0.0" + lodash.escape "^3.0.0" + lodash.keys "^3.0.0" + lodash.restparam "^3.0.0" + lodash.templatesettings "^3.0.0" + +lodash.templatesettings@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz#fb307844753b66b9f1afa54e262c745307dba8e5" + integrity sha512-TcrlEr31tDYnWkHFWDCV3dHYroKEXpJZ2YJYvJdhN+y4AkWMDZ5I4I8XDtUKqSAyG81N7w+I1mFEJtcED+tGqQ== + dependencies: + lodash._reinterpolate "^3.0.0" + lodash.escape "^3.0.0" + +lodash.templatesettings@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33" + integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ== + dependencies: + lodash._reinterpolate "^3.0.0" + +lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +log-driver@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" + integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== + +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + +make-dir@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== + dependencies: + semver "^6.0.0" + +makeerror@1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" + integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== + dependencies: + tmpl "1.0.5" + +markdown-it-anchor@^8.4.1: + version "8.6.6" + resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-8.6.6.tgz#4a12e358c9c2167ee28cb7a5f10e29d6f1ffd7ca" + integrity sha512-jRW30YGywD2ESXDc+l17AiritL0uVaSnWsb26f+68qaW9zgbIIr1f4v2Nsvc0+s0Z2N3uX6t/yAw7BwCQ1wMsA== + +markdown-it@^12.3.2: + version "12.3.2" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-12.3.2.tgz#bf92ac92283fe983fe4de8ff8abfb5ad72cd0c90" + integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg== + dependencies: + argparse "^2.0.1" + entities "~2.1.0" + linkify-it "^3.0.1" + mdurl "^1.0.1" + uc.micro "^1.0.5" + +marked@^4.0.10: + version "4.2.5" + resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.5.tgz#979813dfc1252cc123a79b71b095759a32f42a5d" + integrity sha512-jPueVhumq7idETHkb203WDD4fMA3yV9emQ5vLwop58lu8bTclMghBWcYAavlDqIEMaisADinV1TooIFCfqOsYQ== + +mdurl@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" + integrity sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g== + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge2@^1.3.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12, mime-types@^2.1.27, mime-types@~2.1.19: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mime@^1.3.4: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + +minimist@^1.1.0, minimist@^1.2.5: + version "1.2.7" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" + integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== + +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +multipipe@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/multipipe/-/multipipe-0.1.2.tgz#2a8f2ddf70eed564dff2d57f1e1a137d9f05078b" + integrity sha512-7ZxrUybYv9NonoXgwoOqtStIu18D1c3eFZj27hqgf5kBrBF8Q+tE8V0MW8dKM5QLkQPh1JhhbKgHLY9kifov4Q== + dependencies: + duplexer2 "0.0.2" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + +neo-async@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== + +node-releases@^2.0.12: + version "2.0.12" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.12.tgz#35627cc224a23bfb06fb3380f2b3afaaa7eb1039" + integrity sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ== + +node-releases@^2.0.18: + version "2.0.18" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" + integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== + +normalize-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + +object-assign@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2" + integrity sha512-jHP15vXVGeVh1HuaA2wY6lxk+whK/x4KBG88VXeRma7CCun7iGD5qPc4eYykQ9sdQvg8jkwFKsSxHln2ybW3xQ== + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +optionator@^0.9.3: + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.5" + +p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^3.0.2, p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-limit@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644" + integrity sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ== + dependencies: + yocto-queue "^1.0.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +p-locate@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-6.0.0.tgz#3da9a49d4934b901089dca3302fa65dc5a05c04f" + integrity sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw== + dependencies: + p-limit "^4.0.0" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-json@^5.0.0, parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +parse-node-version@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b" + integrity sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA== + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-exists@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7" + integrity sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== + +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +picocolors@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== + +picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +pirates@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" + integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== + +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + dependencies: + find-up "^4.0.0" + +pkg-dir@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-7.0.0.tgz#8f0c08d6df4476756c5ff29b3282d0bab7517d11" + integrity sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA== + dependencies: + find-up "^6.3.0" + +platform@^1.3.3: + version "1.3.6" + resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7" + integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg== + +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== + +pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== + dependencies: + "@jest/schemas" "^29.6.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +prompts@^2.0.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.5" + +psl@^1.1.28: + version "1.9.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" + integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== + +punycode@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" + integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== + +punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +pure-rand@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.1.tgz#31207dddd15d43f299fdcdb2f572df65030c19af" + integrity sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg== + +qs@~6.5.2: + version "6.5.3" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" + integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +react-is@^18.0.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + +readable-stream@~1.1.9: + version "1.1.14" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" + integrity sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +readable-stream@~2.3.6: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +rechoir@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22" + integrity sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ== + dependencies: + resolve "^1.20.0" + +regenerate-unicode-properties@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz#7c3192cab6dd24e21cb4461e5ddd7dd24fa8374c" + integrity sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ== + dependencies: + regenerate "^1.4.2" + +regenerate-unicode-properties@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz#626e39df8c372338ea9b8028d1f99dc3fd9c3db0" + integrity sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA== + dependencies: + regenerate "^1.4.2" + +regenerate@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" + integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== + +regenerator-runtime@^0.13.11: + version "0.13.11" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" + integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== + +regenerator-transform@^0.15.2: + version "0.15.2" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.2.tgz#5bbae58b522098ebdf09bca2f83838929001c7a4" + integrity sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg== + dependencies: + "@babel/runtime" "^7.8.4" + +regexpu-core@^5.3.1: + version "5.3.2" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.2.tgz#11a2b06884f3527aec3e93dbbf4a3b958a95546b" + integrity sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ== + dependencies: + "@babel/regjsgen" "^0.8.0" + regenerate "^1.4.2" + regenerate-unicode-properties "^10.1.0" + regjsparser "^0.9.1" + unicode-match-property-ecmascript "^2.0.0" + unicode-match-property-value-ecmascript "^2.1.0" + +regexpu-core@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-6.1.1.tgz#b469b245594cb2d088ceebc6369dceb8c00becac" + integrity sha512-k67Nb9jvwJcJmVpw0jPttR1/zVfnKf8Km0IPatrU/zJ5XeG3+Slx0xLXs9HByJSzXzrlz5EDvN6yLNMDc2qdnw== + dependencies: + regenerate "^1.4.2" + regenerate-unicode-properties "^10.2.0" + regjsgen "^0.8.0" + regjsparser "^0.11.0" + unicode-match-property-ecmascript "^2.0.0" + unicode-match-property-value-ecmascript "^2.1.0" + +regjsgen@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.8.0.tgz#df23ff26e0c5b300a6470cad160a9d090c3a37ab" + integrity sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q== + +regjsparser@^0.11.0: + version "0.11.2" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.11.2.tgz#7404ad42be00226d72bcf1f003f1f441861913d8" + integrity sha512-3OGZZ4HoLJkkAZx/48mTXJNlmqTGOzc0o9OWQPuWpkOlXXPbyN6OafCcoXUnBqE2D3f/T5L+pWc1kdEmnfnRsA== + dependencies: + jsesc "~3.0.2" + +regjsparser@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.9.1.tgz#272d05aa10c7c1f67095b1ff0addae8442fc5709" + integrity sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ== + dependencies: + jsesc "~0.5.0" + +replace-ext@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" + integrity sha512-AFBWBy9EVRTa/LhEcG8QDP3FvpwZqmvN2QFDuJswFeaVhWnZMp8q3E6Zd90SR04PlIwfGdyVjNyLPyen/ek5CQ== + +request@^2.67.0, request@^2.88.2: + version "2.88.2" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.5.0" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + +requizzle@^0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/requizzle/-/requizzle-0.2.4.tgz#319eb658b28c370f0c20f968fa8ceab98c13d27c" + integrity sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw== + dependencies: + lodash "^4.17.21" + +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== + dependencies: + resolve-from "^5.0.0" + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + +resolve.exports@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.1.tgz#cee884cd4e3f355660e501fa3276b27d7ffe5a20" + integrity sha512-OEJWVeimw8mgQuj3HfkNl4KqRevH7lzeQNaWRPfx0PPse7Jk6ozcsG4FKVgtzDsC1KUF+YlTHh17NcgHOPykLw== + +resolve@^1.14.2, resolve@^1.20.0: + version "1.22.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" + integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== + dependencies: + is-core-module "^2.11.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +schema-utils@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.1.2.tgz#36c10abca6f7577aeae136c804b0c741edeadc99" + integrity sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg== + dependencies: + "@types/json-schema" "^7.0.8" + ajv "^6.12.5" + ajv-keywords "^3.5.2" + +schema-utils@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" + integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== + dependencies: + "@types/json-schema" "^7.0.8" + ajv "^6.12.5" + ajv-keywords "^3.5.2" + +schema-utils@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.0.0.tgz#60331e9e3ae78ec5d16353c467c34b3a0a1d3df7" + integrity sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg== + dependencies: + "@types/json-schema" "^7.0.9" + ajv "^8.8.0" + ajv-formats "^2.1.1" + ajv-keywords "^5.0.0" + +semver@^6.0.0, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + +semver@^7.5.3, semver@^7.5.4, semver@^7.6.0: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + +serialize-javascript@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.1.tgz#b206efb27c3da0b0ab6b52f48d170b7996458e5c" + integrity sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w== + dependencies: + randombytes "^2.1.0" + +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +signal-exit@^3.0.3, signal-exit@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +sisteransi@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +source-map-support@0.5.13: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0, source-map@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +sparkles@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.1.tgz#008db65edce6c50eec0c5e228e1945061dd0437c" + integrity sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw== + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== + +sshpk@^1.7.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.17.0.tgz#578082d92d4fe612b13007496e543fa0fbcbe4c5" + integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +stack-utils@^2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + +string-length@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== + dependencies: + char-regex "^1.0.2" + strip-ansi "^6.0.0" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + integrity sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ== + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg== + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-bom@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g== + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +synckit@^0.9.1: + version "0.9.2" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.2.tgz#a3a935eca7922d48b9e7d6c61822ee6c3ae4ec62" + integrity sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw== + dependencies: + "@pkgr/core" "^0.1.0" + tslib "^2.6.2" + +taffydb@2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/taffydb/-/taffydb-2.6.2.tgz#7cbcb64b5a141b6a2efc2c5d2c67b4e150b2a268" + integrity sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA== + +tapable@^2.1.1, tapable@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" + integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== + +terser-webpack-plugin@^5.3.10: + version "5.3.10" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz#904f4c9193c6fd2a03f693a2150c62a92f40d199" + integrity sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w== + dependencies: + "@jridgewell/trace-mapping" "^0.3.20" + jest-worker "^27.4.5" + schema-utils "^3.1.1" + serialize-javascript "^6.0.1" + terser "^5.26.0" + +terser@^5.26.0: + version "5.36.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.36.0.tgz#8b0dbed459ac40ff7b4c9fd5a3a2029de105180e" + integrity sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w== + dependencies: + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" + commander "^2.20.0" + source-map-support "~0.5.20" + +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== + dependencies: + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + +throat@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.2.tgz#51a3fbb5e11ae72e2cf74861ed5c8020f89f29fe" + integrity sha512-WKexMoJj3vEuK0yFEapj8y64V0A6xcuPuK9Gt1d0R+dzCSJc0lHqQytAbSB4cDAK0dWh4T0E2ETkoLE2WZ41OQ== + +through2@^2.0.0: + version "2.0.5" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== + dependencies: + readable-stream "~2.3.6" + xtend "~4.0.1" + +time-stamp@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" + integrity sha512-gLCeArryy2yNTRzTGKbZbloctj64jkZ57hj5zdraXue6aFgd6PmvVtEyiUU+hvU0v7q08oVv8r8ev0tRo6bvgw== + +tmpl@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +ts-api-utils@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.4.0.tgz#709c6f2076e511a81557f3d07a0cbd566ae8195c" + integrity sha512-032cPxaEKwM+GT3vA5JXNzIaizx388rhsSW79vGRNGXfRRAdEAn2mvk36PvK5HnOchyWZ7afLEXqYCvPCrzuzQ== + +tsd-jsdoc@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tsd-jsdoc/-/tsd-jsdoc-2.5.0.tgz#0677aa952e1a8e3ebbb5bcf7d6e2f0301d71e151" + integrity sha512-80fcJLAiUeerg4xPftp+iEEKWUjJjHk9AvcHwJqA8Zw0R4oASdu3kT/plE/Zj19QUTz8KupyOX25zStlNJjS9g== + dependencies: + typescript "^3.2.1" + +tslib@^2.6.2: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + +type-detect@4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== + +typescript@^3.2.1: + version "3.9.10" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8" + integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q== + +typescript@^5.6.3: + version "5.6.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b" + integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw== + +uc.micro@^1.0.1, uc.micro@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" + integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== + +underscore@~1.13.2: + version "1.13.6" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441" + integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A== + +undici-types@~6.19.8: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +unicode-canonical-property-names-ecmascript@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc" + integrity sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ== + +unicode-match-property-ecmascript@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz#54fd16e0ecb167cf04cf1f756bdcc92eba7976c3" + integrity sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q== + dependencies: + unicode-canonical-property-names-ecmascript "^2.0.0" + unicode-property-aliases-ecmascript "^2.0.0" + +unicode-match-property-value-ecmascript@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz#cb5fffdcd16a05124f5a4b0bf7c3770208acbbe0" + integrity sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA== + +unicode-property-aliases-ecmascript@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz#43d41e3be698bd493ef911077c9b131f827e8ccd" + integrity sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w== + +update-browserslist-db@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz#9a2a641ad2907ae7b3616506f4b977851db5b940" + integrity sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + +update-browserslist-db@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz#80846fba1d79e82547fb661f8d141e0945755fe5" + integrity sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A== + dependencies: + escalade "^3.2.0" + picocolors "^1.1.0" + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + +uuid@^3.3.2: + version "3.4.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + +v8-to-istanbul@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4" + integrity sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w== + dependencies: + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^1.6.0" + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +vinyl@^0.5.0: + version "0.5.3" + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.5.3.tgz#b0455b38fc5e0cf30d4325132e461970c2091cde" + integrity sha512-P5zdf3WB9uzr7IFoVQ2wZTmUwHL8cMZWJGzLBNCHNZ3NB6HTMsYABtt7z8tAGIINLXyAob9B9a1yzVGMFOYKEA== + dependencies: + clone "^1.0.0" + clone-stats "^0.0.1" + replace-ext "0.0.1" + +walker@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" + integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== + dependencies: + makeerror "1.0.12" + +watchpack@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" + integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== + dependencies: + glob-to-regexp "^0.4.1" + graceful-fs "^4.1.2" + +webpack-cli@^5.1.4: + version "5.1.4" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-5.1.4.tgz#c8e046ba7eaae4911d7e71e2b25b776fcc35759b" + integrity sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg== + dependencies: + "@discoveryjs/json-ext" "^0.5.0" + "@webpack-cli/configtest" "^2.1.1" + "@webpack-cli/info" "^2.0.2" + "@webpack-cli/serve" "^2.0.5" + colorette "^2.0.14" + commander "^10.0.1" + cross-spawn "^7.0.3" + envinfo "^7.7.3" + fastest-levenshtein "^1.0.12" + import-local "^3.0.2" + interpret "^3.1.1" + rechoir "^0.8.0" + webpack-merge "^5.7.3" + +webpack-merge@^5.7.3: + version "5.9.0" + resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.9.0.tgz#dc160a1c4cf512ceca515cc231669e9ddb133826" + integrity sha512-6NbRQw4+Sy50vYNTw7EyOn41OZItPiXB8GNv3INSoe3PSFaHJEz3SHTrYVaRm2LilNGnFUzh0FAwqPEmU/CwDg== + dependencies: + clone-deep "^4.0.1" + wildcard "^2.0.0" + +webpack-sources@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" + integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== + +webpack@5.96.0: + version "5.96.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.96.0.tgz#1e4dc9d1d819ff1b1f89d53e45a299ffe9231a8a" + integrity sha512-gvn84AfQ4f6vUeNWmFuRp3vGERyxK4epADKTaAo60K0EQbY/YBNQbXH3Ji/ZRK5M25O/XneAOuChF4xQZjQ4xA== + dependencies: + "@types/estree" "^1.0.6" + "@webassemblyjs/ast" "^1.12.1" + "@webassemblyjs/wasm-edit" "^1.12.1" + "@webassemblyjs/wasm-parser" "^1.12.1" + acorn "^8.14.0" + browserslist "^4.24.0" + chrome-trace-event "^1.0.2" + enhanced-resolve "^5.17.1" + es-module-lexer "^1.2.1" + eslint-scope "5.1.1" + events "^3.2.0" + glob-to-regexp "^0.4.1" + graceful-fs "^4.2.11" + json-parse-even-better-errors "^2.3.1" + loader-runner "^4.2.0" + mime-types "^2.1.27" + neo-async "^2.6.2" + schema-utils "^3.2.0" + tapable "^2.1.1" + terser-webpack-plugin "^5.3.10" + watchpack "^2.4.1" + webpack-sources "^3.2.3" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wildcard@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67" + integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ== + +word-wrap@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +write-file-atomic@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== + dependencies: + imurmurhash "^0.1.4" + signal-exit "^3.0.7" + +xmlcreate@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-2.0.4.tgz#0c5ab0f99cdd02a81065fa9cd8f8ae87624889be" + integrity sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg== + +xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + +yaml@^1.10.0: + version "1.10.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" + integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== + +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yargs@^17.3.1: + version "17.6.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541" + integrity sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + +yarpm@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/yarpm/-/yarpm-1.2.0.tgz#5baaf5589f6237426cf76f812296dcf9b4254f55" + integrity sha512-gxN4Ali09uey8EpLfbYG+bTXf1hF6TA5oAXFPpKi5Nt5aztXU9AIEksXE0lpuvC50vL4De/KIeP8JXgYOZ8KbQ== + dependencies: + command-exists "^1.2.9" + cross-spawn "^7.0.3" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +yocto-queue@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.1.1.tgz#fef65ce3ac9f8a32ceac5a634f74e17e5b232110" + integrity sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==