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
-
-
-
-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.
-
-[](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 === "=" || text === "<%=";
- var args = this.next().read_list(this.read_expr, ",");
- this.expectEndOfStatement();
- return result(args, shortForm);
- }
-
- case this.tok.T_INLINE_HTML:
- {
- var value = this.text();
- var prevChar = this.lexer.yylloc.first_offset > 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="="===text||"<%="===text,args=this.next().read_list(this.read_expr,",");return this.expectEndOfStatement(),result(args,shortForm);case this.tok.T_INLINE_HTML:var value=this.text(),prevChar=this.lexer.yylloc.first_offset>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
Global
+
+
+ Classes
Global
@@ -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 @@
});
-
+