diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 8928b42..0000000 --- a/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -# Composer -composer.phar -/vendor/ - -# IDE Stuff -.idea -.vscode -.antlr -# Allow grammar generator settings -!extra/grammar/.vscode/settings.json - -# Custom stuff -out -.local - -# PHPUnit -.phpunit.result.cache diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index b968743..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 ElandaOfficial - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 59fa281..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -![Banner-rounded](https://github.com/user-attachments/assets/895eeb10-e35d-457e-8b60-21fdcc0c1285) - -# JsonScout-php -A fully fledged JSON utility suite for PHP, coming with support for JSONPath, JSONPatch, JSONPointer and so much more. diff --git a/composer.json b/composer.json deleted file mode 100644 index b8ef2cd..0000000 --- a/composer.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "elandasunshine/jsonscout", - "version": "1.0.0", - - "authors": [ - { - "email": "elendaofficial@gmail.com", - "role": "lead", - "name": "Elanda", - "homepage": "https://github.com/ElandaOfficial" - } - ], - - "description": "Implements the full JSONPath draft (RFC 9535) for querying JSON documents.", - "homepage": "https://github.com/ElandaSunshine/JSONScout-PHP", - "keywords": [ "json", "jsonpath", "xpath", "query", "php", "parser" ], - "license": "MIT", - "type": "library", - - "require": { - "php": "^8.3", - "antlr/antlr4-php-runtime": "^0.9", - "technically/callable-reflection": "^0.4", - "ext-mbstring": "*", - "ext-ctype": "*" - }, - "require-dev": { - "phpstan/phpstan": "^1.12", - "phpstan/extension-installer":"^1.4", - "phpstan/phpstan-deprecation-rules":"^1.2", - "phpstan/phpstan-strict-rules":"^1.6", - "phpunit/phpunit": "^11" - }, - "autoload": { - "psr-4": { - "JsonScout\\": "src/" - } - }, - "config": { - "allow-plugins": { - "phpstan/extension-installer": true, - "dealerdirect/phpcodesniffer-composer-installer": false - }, - "platform": { - "php": "8.3" - } - }, - "scripts": { - "test": "phpunit" - } -} diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 6c39666..0000000 --- a/composer.lock +++ /dev/null @@ -1,2009 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "d040ab5f83ef166ad0590ed5be4b9903", - "packages": [ - { - "name": "antlr/antlr4-php-runtime", - "version": "0.9.1", - "source": { - "type": "git", - "url": "https://github.com/antlr/antlr-php-runtime.git", - "reference": "3afe41b19f8ea3d6b10400397712cb8181da5e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/antlr/antlr-php-runtime/zipball/3afe41b19f8ea3d6b10400397712cb8181da5e25", - "reference": "3afe41b19f8ea3d6b10400397712cb8181da5e25", - "shasum": "" - }, - "require": { - "ext-mbstring": "^8.0", - "php": "^8.0", - "psr/log": "^2.0 || ^3.0" - }, - "require-dev": { - "ergebnis/composer-normalize": "^2.15", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-strict-rules": "^1.1", - "slevomat/coding-standard": "^7.0", - "squizlabs/php_codesniffer": "^3.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.2-dev" - } - }, - "autoload": { - "psr-4": { - "Antlr\\Antlr4\\Runtime\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "PHP 8.0+ runtime for ANTLR 4", - "keywords": [ - "antlr4", - "php", - "runtime" - ], - "support": { - "issues": "https://github.com/antlr/antlr-php-runtime/issues", - "source": "https://github.com/antlr/antlr-php-runtime/tree/0.9.1" - }, - "time": "2023-09-04T20:27:34+00:00" - }, - { - "name": "psr/log", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", - "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", - "shasum": "" - }, - "require": { - "php": ">=8.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/3.0.2" - }, - "time": "2024-09-11T13:17:53+00:00" - }, - { - "name": "technically/callable-reflection", - "version": "0.4.1", - "source": { - "type": "git", - "url": "https://github.com/technically-php/callable-reflection.git", - "reference": "0634449080e030438f68127f84281fdbb85f9778" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/technically-php/callable-reflection/zipball/0634449080e030438f68127f84281fdbb85f9778", - "reference": "0634449080e030438f68127f84281fdbb85f9778", - "shasum": "" - }, - "require": { - "php": "^7.1|^8.0" - }, - "require-dev": { - "peridot-php/peridot": "^1.19" - }, - "type": "library", - "autoload": { - "psr-4": { - "Technically\\CallableReflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ivan Voskoboinyk", - "email": "ivan@voskoboinyk.com" - } - ], - "description": "A handy library to simplify reflecting any callable or constructor. PHP8-ready!", - "support": { - "issues": "https://github.com/technically-php/callable-reflection/issues", - "source": "https://github.com/technically-php/callable-reflection/tree/0.4.1" - }, - "time": "2023-03-14T16:42:34+00:00" - } - ], - "packages-dev": [ - { - "name": "myclabs/deep-copy", - "version": "1.12.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3 <3.2.2" - }, - "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpspec/prophecy": "^1.10", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" - }, - "type": "library", - "autoload": { - "files": [ - "src/DeepCopy/deep_copy.php" - ], - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2024-06-12T14:39:25+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v5.3.1", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-json": "*", - "ext-tokenizer": "*", - "php": ">=7.4" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" - }, - "time": "2024-10-08T18:51:32+00:00" - }, - { - "name": "phar-io/manifest", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "54750ef60c58e43759730615a392c31c80e23176" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", - "reference": "54750ef60c58e43759730615a392c31c80e23176", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2024-03-03T12:33:53+00:00" - }, - { - "name": "phar-io/version", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.2.1" - }, - "time": "2022-02-21T01:04:05+00:00" - }, - { - "name": "phpstan/extension-installer", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/phpstan/extension-installer.git", - "reference": "85e90b3942d06b2326fba0403ec24fe912372936" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", - "reference": "85e90b3942d06b2326fba0403ec24fe912372936", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^2.0", - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.0 || ^2.0" - }, - "require-dev": { - "composer/composer": "^2.0", - "php-parallel-lint/php-parallel-lint": "^1.2.0", - "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" - }, - "type": "composer-plugin", - "extra": { - "class": "PHPStan\\ExtensionInstaller\\Plugin" - }, - "autoload": { - "psr-4": { - "PHPStan\\ExtensionInstaller\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Composer plugin for automatic installation of PHPStan extensions", - "keywords": [ - "dev", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" - }, - "time": "2024-09-04T20:21:43+00:00" - }, - { - "name": "phpstan/phpstan", - "version": "1.12.7", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", - "shasum": "" - }, - "require": { - "php": "^7.2|^8.0" - }, - "conflict": { - "phpstan/phpstan-shim": "*" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "keywords": [ - "dev", - "static analysis" - ], - "support": { - "docs": "https://phpstan.org/user-guide/getting-started", - "forum": "https://github.com/phpstan/phpstan/discussions", - "issues": "https://github.com/phpstan/phpstan/issues", - "security": "https://github.com/phpstan/phpstan/security/policy", - "source": "https://github.com/phpstan/phpstan-src" - }, - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://github.com/phpstan", - "type": "github" - } - ], - "time": "2024-10-18T11:12:07+00:00" - }, - { - "name": "phpstan/phpstan-deprecation-rules", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", - "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/f94d246cc143ec5a23da868f8f7e1393b50eaa82", - "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.12" - }, - "require-dev": { - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5" - }, - "type": "phpstan-extension", - "extra": { - "phpstan": { - "includes": [ - "rules.neon" - ] - } - }, - "autoload": { - "psr-4": { - "PHPStan\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", - "support": { - "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", - "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.1" - }, - "time": "2024-09-11T15:52:35+00:00" - }, - { - "name": "phpstan/phpstan-strict-rules", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "daeec748b53de80a97498462513066834ec28f8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/daeec748b53de80a97498462513066834ec28f8b", - "reference": "daeec748b53de80a97498462513066834ec28f8b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.12.4" - }, - "require-dev": { - "nikic/php-parser": "^4.13.0", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-deprecation-rules": "^1.1", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5" - }, - "type": "phpstan-extension", - "extra": { - "phpstan": { - "includes": [ - "rules.neon" - ] - } - }, - "autoload": { - "psr-4": { - "PHPStan\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Extra strict and opinionated rules for PHPStan", - "support": { - "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.6.1" - }, - "time": "2024-09-20T14:04:44+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "11.0.7", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7f08030e8811582cc459871d28d6f5a1a4d35ca", - "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^5.3.1", - "php": ">=8.2", - "phpunit/php-file-iterator": "^5.1.0", - "phpunit/php-text-template": "^4.0.1", - "sebastian/code-unit-reverse-lookup": "^4.0.1", - "sebastian/complexity": "^4.0.1", - "sebastian/environment": "^7.2.0", - "sebastian/lines-of-code": "^3.0.1", - "sebastian/version": "^5.0.2", - "theseer/tokenizer": "^1.2.3" - }, - "require-dev": { - "phpunit/phpunit": "^11.4.1" - }, - "suggest": { - "ext-pcov": "PHP extension that provides line coverage", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "11.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.7" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-10-09T06:21:38+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "5.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-08-27T05:02:59+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "5.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", - "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^11.0" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T05:07:44+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", - "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T05:08:43+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "7.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", - "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "7.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "security": "https://github.com/sebastianbergmann/php-timer/security/policy", - "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T05:09:35+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "11.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e8e8ed1854de5d36c088ec1833beae40d2dedd76", - "reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.12.0", - "phar-io/manifest": "^2.0.4", - "phar-io/version": "^3.2.1", - "php": ">=8.2", - "phpunit/php-code-coverage": "^11.0.7", - "phpunit/php-file-iterator": "^5.1.0", - "phpunit/php-invoker": "^5.0.1", - "phpunit/php-text-template": "^4.0.1", - "phpunit/php-timer": "^7.0.1", - "sebastian/cli-parser": "^3.0.2", - "sebastian/code-unit": "^3.0.1", - "sebastian/comparator": "^6.1.1", - "sebastian/diff": "^6.0.2", - "sebastian/environment": "^7.2.0", - "sebastian/exporter": "^6.1.3", - "sebastian/global-state": "^7.0.2", - "sebastian/object-enumerator": "^6.0.1", - "sebastian/type": "^5.1.0", - "sebastian/version": "^5.0.2" - }, - "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "11.4-dev" - } - }, - "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.3" - }, - "funding": [ - { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", - "type": "tidelift" - } - ], - "time": "2024-10-28T13:07:50+00:00" - }, - { - "name": "sebastian/cli-parser", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", - "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", - "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:41:36+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "6bb7d09d6623567178cf54126afa9c2310114268" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/6bb7d09d6623567178cf54126afa9c2310114268", - "reference": "6bb7d09d6623567178cf54126afa9c2310114268", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "security": "https://github.com/sebastianbergmann/code-unit/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:44:28+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "183a9b2632194febd219bb9246eee421dad8d45e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", - "reference": "183a9b2632194febd219bb9246eee421dad8d45e", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:45:54+00:00" - }, - { - "name": "sebastian/comparator", - "version": "6.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739", - "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-mbstring": "*", - "php": ">=8.2", - "sebastian/diff": "^6.0", - "sebastian/exporter": "^6.0" - }, - "require-dev": { - "phpunit/phpunit": "^11.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.2.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-10-31T05:30:08+00:00" - }, - { - "name": "sebastian/complexity", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", - "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^5.0", - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", - "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:49:50+00:00" - }, - { - "name": "sebastian/diff", - "version": "6.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", - "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0", - "symfony/process": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:53:05+00:00" - }, - { - "name": "sebastian/environment", - "version": "7.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "7.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "https://github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:54:44+00:00" - }, - { - "name": "sebastian/exporter", - "version": "6.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e", - "reference": "c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=8.2", - "sebastian/recursion-context": "^6.0" - }, - "require-dev": { - "phpunit/phpunit": "^11.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/6.1.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:56:19+00:00" - }, - { - "name": "sebastian/global-state", - "version": "7.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "3be331570a721f9a4b5917f4209773de17f747d7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", - "reference": "3be331570a721f9a4b5917f4209773de17f747d7", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "7.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "https://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:57:36+00:00" - }, - { - "name": "sebastian/lines-of-code", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", - "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^5.0", - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", - "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:58:38+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "6.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "f5b498e631a74204185071eb41f33f38d64608aa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", - "reference": "f5b498e631a74204185071eb41f33f38d64608aa", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T05:00:13+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", - "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T05:01:32+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "6.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", - "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "https://github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T05:10:34+00:00" - }, - { - "name": "sebastian/type", - "version": "5.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/461b9c5da241511a2a0e8f240814fb23ce5c0aac", - "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "5.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "security": "https://github.com/sebastianbergmann/type/security/policy", - "source": "https://github.com/sebastianbergmann/type/tree/5.1.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-09-17T13:12:04+00:00" - }, - { - "name": "sebastian/version", - "version": "5.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", - "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-10-09T05:16:32+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.3", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.3" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2024-03-03T12:36:25+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": {}, - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^8.3", - "ext-mbstring": "*", - "ext-ctype": "*" - }, - "platform-dev": {}, - "platform-overrides": { - "php": "8.3" - }, - "plugin-api-version": "2.6.0" -} diff --git a/extra/grammar/.vscode/settings.json b/extra/grammar/.vscode/settings.json deleted file mode 100644 index e45a149..0000000 --- a/extra/grammar/.vscode/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "antlr4.generation": { - "language": "PHP", - "mode": "external", - "outputDir": "out", - "listeners": false, - "visitors": true, - "package": "JsonScout\\JsonPath\\Parser" - }, -} \ No newline at end of file diff --git a/extra/grammar/JsonPathLexer.g4 b/extra/grammar/JsonPathLexer.g4 deleted file mode 100644 index 73b5bdb..0000000 --- a/extra/grammar/JsonPathLexer.g4 +++ /dev/null @@ -1,103 +0,0 @@ -lexer grammar JsonPathLexer; - - - -fragment Digit: [0-9]; -fragment Digit1: [1-9]; -fragment Hexdig: [A-F0-9]; -fragment Alpha: [a-zA-Z]; - -fragment ESC: '\\'; - -fragment NonSurrogate - : ((Digit | [ABCEFabcef]) Hexdig Hexdig Hexdig) - | ([dD] [0-7] Hexdig Hexdig); -fragment HighSurrogate: [dD] [89ABab] Hexdig Hexdig; -fragment LowSurrogate: [dD] [CDEFcdef] Hexdig Hexdig; - -fragment HexChar - : NonSurrogate - | (HighSurrogate '\\u' LowSurrogate) -; - -fragment Unescaped - : '\u0020'..'\u0021' - | '\u0023'..'\u0026' - | '\u0028'..'\u005B' - | '\u005D'..'\uD7FF' - | '\uE000'..'\uFFFF' -; -fragment Escapable - : [\b\f\n\r\t/\\] - | 'u' HexChar -; - -fragment Fraction: '.' Digit*; -fragment Exponent: [eE] [\-+]? Digit*; - -fragment NameFirst - : Alpha - | '_' - | '\u0080'..'\uD7FF' - | '\uE000'..'\uFFFF' -; -fragment NameChar - : Digit - | NameFirst -; - -fragment TEXT_DOUBLE_QUOTED - : Unescaped - | '\'' - | ESC '"' - | ESC Escapable -; -fragment TEXT_SINGLE_QUOTED - : Unescaped - | '"' - | ESC '\'' - | ESC Escapable -; - - - -/** Literals */ -STRING - : OP_QUOTE_SINGLE TEXT_SINGLE_QUOTED* OP_QUOTE_SINGLE - | OP_QUOTE_DOUBLE TEXT_DOUBLE_QUOTED* OP_QUOTE_DOUBLE -; -INT - : '0' - | ('-'? Digit1 Digit*) -; -NUMBER: (INT | '-0') Fraction? Exponent?; -BOOLEAN: 'true' | 'false'; -NULL: 'null'; - -NAME: NameFirst NameChar*; - -OP_ROOT: '$'; -OP_WILDCARD: '*'; -OP_SLICE: ':'; -OP_FILTER: '?'; -OP_NOT: '!'; -OP_PATH: '.'; -OP_RECURSE: '..'; -OP_CURRENT: '@'; -OP_COMMA: ','; -OP_OR: '||'; -OP_AND: '&&'; -OP_COMP: '==' | '!=' | '<=' | '>=' | '<' | '>'; -OP_PAREN_OPEN: '('; -OP_PAREN_CLOSE: ')'; -OP_BRACK_OPEN: '['; -OP_BRACK_CLOSE: ']'; -OP_QUOTE_SINGLE: '\''; -OP_QUOTE_DOUBLE: '"'; - -S: ( - ' ' - | '\t' - | '\n' - | '\r' -) -> skip; diff --git a/extra/grammar/JsonPathParser.g4 b/extra/grammar/JsonPathParser.g4 deleted file mode 100644 index ffb3a6e..0000000 --- a/extra/grammar/JsonPathParser.g4 +++ /dev/null @@ -1,118 +0,0 @@ -parser grammar JsonPathParser; - -options { - tokenVocab = JsonPathLexer; -} - - - -//====================================================================================================================== -// Advanced query -query: rootQuery EOF; - -/* Queries */ -rootQuery: OP_ROOT (S* segment)*; -relQuery: OP_CURRENT (S* segment)*; -filterQuery - : relQuery - | rootQuery -; - -absSingularQuery: OP_ROOT (S* singularSegment)*; -relSingularQuery: OP_CURRENT (S* singularSegment)*; -singularQuery - : relSingularQuery - | absSingularQuery -; - - - -/* Expressions */ -logicalAndExpression: basicExpression (S* OP_AND S* basicExpression)*; -logicalOrExpression: logicalAndExpression (S* OP_OR S* logicalAndExpression)*; - -testExpression: (OP_NOT S*)? (filterQuery | functionExpression); -comparisonExpression: left=comparable S* OP_COMP S* right=comparable; - -parenExpression: (OP_NOT S*)? OP_PAREN_OPEN S* logicalExpression S* OP_PAREN_CLOSE; -basicExpression - : parenExpression - | comparisonExpression - | testExpression -; - -logicalExpression: logicalOrExpression; -functionExpression: functionName OP_PAREN_OPEN S* (functionArgument (S* OP_COMMA S* functionArgument)*)? S* OP_PAREN_CLOSE; - - - -/* Selectors */ -nameSelector: STRING; -wildcardSelector: OP_WILDCARD; -sliceSelector: (sliceStart=INT S*)? OP_SLICE S* (sliceEnd=INT S*)? (OP_SLICE (S* sliceStep=INT)?)?; -indexSelector: INT; -filterSelector: OP_FILTER S* logicalExpression; - -selector - : nameSelector - | wildcardSelector - | sliceSelector - | indexSelector - | filterSelector -; - - - -/* Segments */ -segment - : childSegment - | descendantSegment -; -childSegment - : bracketedSelection - | OP_PATH (wildcardSelector | memberName) -; -descendantSegment: OP_RECURSE (bracketedSelection | wildcardSelector | memberName); - -singularSegment - : nameSegment - | indexSegment -; -nameSegment - : OP_BRACK_OPEN nameSelector OP_BRACK_CLOSE - | OP_PATH memberName -; -indexSegment: OP_BRACK_OPEN indexSelector OP_BRACK_CLOSE; - - - -/* Atoms */ -literal - : INT - | NUMBER - | STRING - | BOOLEAN - | NULL -; -functionName: NAME; -memberName: NAME|NULL|BOOLEAN; - - - -/* Operands */ -comparable - : literal - | singularQuery - | functionExpression -; -functionArgument - : literal - | filterQuery - | functionExpression - | logicalExpression -; - - - -/* Misc */ -bracketedSelection: OP_BRACK_OPEN S* selector (S* OP_COMMA S* selector)* S* OP_BRACK_CLOSE; diff --git a/img/banner_preview.jpg b/img/banner_preview.jpg new file mode 100644 index 0000000..3649da3 Binary files /dev/null and b/img/banner_preview.jpg differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..a6dfbfa --- /dev/null +++ b/index.html @@ -0,0 +1,7 @@ + + + + Redirect to to Wiki + + + diff --git a/phpstan.neon b/phpstan.neon deleted file mode 100644 index 52332b3..0000000 --- a/phpstan.neon +++ /dev/null @@ -1,40 +0,0 @@ -includes: -- phar://phpstan.phar/conf/bleedingEdge.neon - -parameters: - level: 9 - treatPhpDocTypesAsCertain: false - - paths: - - src - - test - - typeAliases: - # General - JSONValue: "array|object|int|float|string|bool|null" - - # JSONPointer - JSONPointer: string - - # JSONPatch - JSONPatchOperation: "object{op:non-empty-string, path:JSONPointer, arg1?:JSONValue, arg2?:JSONValue, arg3?:JSONValue, arg4?:JSONValue}" - JSONPatchPropertyType: "'string'|'integer'|'double'|'boolean'|'array'|'object'|'null'|'*'|'JsonScout\\JsonPointer'" - JSONPatchPropertyDefinition: "array{name:non-empty-string, type:JSONPatchPropertyType, required:bool}" - - # Document - JSONDocumentOptions: "array{max_depth?:int<1,max>}" - - excludePaths: - analyse: - - src/JsonPath/Parser/JsonPathLexer.php - - src/JsonPath/Parser/JsonPathParser.php - - src/JsonPath/Parser/JsonPathParserVisitor.php - - exceptions: - uncheckedExceptionClasses: - - JsonScout\Common\Exception\LibraryException - - ignoreErrors: - - identifier: property.onlyWritten - - identifier: method.unused - - identifier: classConstant.unused \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 80d5e4e..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - test/DocumentTest.php - - - test/ParserTest.php - - - test/ExtensionTest.php - - - test/NormalisedTest.php - - - test/PointerTest.php - - - test/PatchTest.php - - - - - - - diff --git a/src/Common/Exception/ErrorCode.php b/src/Common/Exception/ErrorCode.php deleted file mode 100644 index ce2c3a1..0000000 --- a/src/Common/Exception/ErrorCode.php +++ /dev/null @@ -1,165 +0,0 @@ - $message, - ($line < 0) => "$message (at column $column)", - default => "$message (on line $line:$column)" - }, - $errorCode); - } -} diff --git a/src/Common/Exception/LibraryException.php b/src/Common/Exception/LibraryException.php deleted file mode 100644 index 2ac880a..0000000 --- a/src/Common/Exception/LibraryException.php +++ /dev/null @@ -1,41 +0,0 @@ -value, $previous); - } -} diff --git a/src/Document.php b/src/Document.php deleted file mode 100644 index 0ebcd64..0000000 --- a/src/Document.php +++ /dev/null @@ -1,316 +0,0 @@ - - * @implements \IteratorAggregate - */ -class Document - implements \ArrayAccess, - \IteratorAggregate, - \Stringable, - \Countable -{ - //================================================================================================================== - /** @var JSONDocumentOptions */ - public const array DEFAULT_OPTIONS = [ - 'max_depth' => 512 - ]; - - //================================================================================================================== - /** - * Reads the given file and tries to parse the entire file as JSON string and returns a new Document. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Document/fromFile%23lang-php - * @param non-empty-string $file The file to read from - * @param JSONDocumentOptions $options A list of options for the parser - * @return self A new Document instance with the parsed JSON data - * - * @throws ExceptionReadFailure Thrown whenever there was a problem reading from the file - * @throws ExceptionSyntaxError Thrown whenever the JSON content in the input was malformed - */ - public static function fromFile(string $file, array $options = self::DEFAULT_OPTIONS) - : self - { - set_error_handler(fn(int $errno, string $errmsg) - => throw new ExceptionReadFailure( - "error reading file '$file', $errmsg", - ErrorCode::DOCUMENT_FILE_READ_FAILURE)); - - $contents = file_get_contents($file); - restore_error_handler(); - - assert(is_string($contents)); - return new self($contents, $options); - } - - //================================================================================================================== - /** @var JSONValue */ - private mixed $rawData = null; - - //================================================================================================================== - /** - * Constructs a new JSON document from a JSON input string or resource. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Document/Document%23lang-php - * @param string $input The JSON string to parse - * @param array $options A list of options for the parser - * - * @throws ExceptionSyntaxError Thrown whenever the JSON content in the input was malformed - */ - public function __construct(string $input, array $options = self::DEFAULT_OPTIONS) - { - $max_depth = (isset($options['max_depth']) && is_int($options['max_depth']) ? $options['max_depth'] : 512); - $data = json_decode($input, null, max(1, $max_depth)); - - if ($data === false && json_last_error() !== JSON_ERROR_NONE) - { - throw new ExceptionSyntaxError( - json_last_error_msg(), - ErrorCode::from(ErrorCode::DOCUMENT_DEPTH->value + (json_last_error() - 1))); - } - - /** @var JSONValue $data */ - $this->rawData = $data; - } - - //------------------------------------------------------------------------------------------------------------------ - #region JSONPath - /** - * Executes a JSONPath query on the current document and returns a list of nodes that matched the query. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Document/query%23lang-php - * @param non-empty-string|JsonPath $query The JSONPath query string or compiled query - * @return NodesType A list of nodes that matched the query - * - * @throws ExceptionSyntaxError Thrown whenever the query has a syntax problem - * @throws ExceptionFunctionExtension Thrown whenever there was an issue involving a function extension - */ - public function query(string|JsonPath $query) - : NodesType - { - return (is_string($query) ? JsonPath::query($query, $this->rawData) : $query->apply($this->rawData)); - } - #endregion JSONPath - - //------------------------------------------------------------------------------------------------------------------ - #region JSONPointer - /** - * Fetches a value from the current JSON document pointed to by the given pointer. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Document/fetch%23lang-php - * @param string|JsonPointer $pointer The pointer string or JsonPointer object - * @return JSONValue The JSON value reference the pointer points to - * - * @throws ExceptionSyntaxError Thrown whenever there was a syntax error in the pointer expression - * @throws ExceptionAccessViolation Thrown whenever a member is accessed that can not be accessed in a certain way - * @throws ExceptionNullPointer Thrown whenever a member is accessed that does not exist - */ - public function &fetch(string|JsonPointer $pointer) - : mixed - { - return (is_string($pointer) ? new JsonPointer($pointer) : $pointer)->get($this->rawData); - } - #endregion JSONPointer - - //------------------------------------------------------------------------------------------------------------------ - #region JSONPatch - /** - * Fetches a value from the current JSON document pointed to by the given pointer. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Document/patch%23lang-php - * @param non-empty-string|JSONPatchOperation[]|JsonPatch $patch The JSONPatch document - * @return bool True if all tests succeeded and the document was sub-sequentially updated, false otherwise - * - * @throws ExceptionSyntaxError Thrown whenever any of the given JSON pointers in the patch document were malformed - * @throws ExceptionMalformedPatch Thrown whenever the given JSON patch document was malformed. - */ - public function patch(array|string|JsonPatch $patch) - : bool - { - $result = ($patch instanceof JsonPatch ? $patch : new JsonPatch($patch))->apply($this->rawData); - $this->rawData = $result->data; - - return $result->successful; - } - #endregion JSONPatch - - //------------------------------------------------------------------------------------------------------------------ - /** @return JSONValue */ - public function getData() : mixed { return $this->rawData; } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @param string|int $offset - * @return bool - */ - #[\Override] - public function offsetExists(mixed $offset) - : bool - { - if (is_object($this->rawData)) - { - return property_exists($this->rawData, (string) $offset); - } - - if (is_array($this->rawData)) - { - return array_key_exists($offset, $this->rawData); - } - - return false; - } - - /** - * @param string|int $offset - * @return JSONValue - */ - #[\Override] - public function offsetGet(mixed $offset) - : mixed - { - if (is_object($this->rawData)) - { - assert($this->rawData instanceof \stdClass); - return $this->rawData->{$offset}; - } - - if (is_array($this->rawData)) - { - /** @var JSONValue */ - return $this->rawData[$offset]; - } - - trigger_error("trying to access non-existent member '$offset'", E_USER_WARNING); - return null; - } - - /** - * @param string|int|null $offset - * @param JSONValue $value - */ - #[\Override] - public function offsetSet(mixed $offset, mixed $value) - : void - { - if ($offset === null && !is_array($this->rawData)) - { - trigger_error("trying to append value to a non-array object", E_USER_WARNING); - return; - } - - if (is_object($this->rawData)) - { - assert($this->rawData instanceof \stdClass); - $this->rawData->{$offset} = $value; - } - else if (is_array($this->rawData)) - { - $this->rawData[$offset] = $value; - } - else - { - trigger_error("trying to set child of value that is not an array or object '$offset'", E_USER_WARNING); - } - } - - /** - * @param string|int $offset - */ - #[\Override] - public function offsetUnset(mixed $offset) - : void - { - if (is_object($this->rawData)) - { - assert($this->rawData instanceof \stdClass); - unset($this->rawData->{$offset}); - } - else if (is_array($this->rawData)) - { - unset($this->rawData[$offset]); - } - } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @return \Traversable - */ - #[\Override] - public function getIterator() - : \Traversable - { - if (is_object($this->rawData) || is_array($this->rawData)) - { - return new \ArrayIterator((array) $this->rawData); - } - - trigger_error( - 'trying to iterate over non traversable object of type \''.gettype($this->rawData).'\'', - E_USER_ERROR - ); - } - - //------------------------------------------------------------------------------------------------------------------ - #[\Override] - public function count() - : int - { - if (is_array($this->rawData) || is_object($this->rawData)) - { - return count((array) $this->rawData); - } - - return 0; - } - - //------------------------------------------------------------------------------------------------------------------ - #[\Override] - public function __toString() - : string - { - $result = json_encode($this->rawData); - - if ($result === false) - { - trigger_error( - 'there was a problem encoding the document, ' . json_last_error_msg(), - E_USER_WARNING - ); - - return ''; - } - - return $result; - } -} diff --git a/src/JsonPatch.php b/src/JsonPatch.php deleted file mode 100644 index 72126bf..0000000 --- a/src/JsonPatch.php +++ /dev/null @@ -1,92 +0,0 @@ -operations = JsonPatchParser::parse($document); - } - - //------------------------------------------------------------------------------------------------------------------ - /** - * Applies the current patch document to the given JSON document. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPatch/apply%23lang-php - * @param JSONValue $data The JSON document to apply the current JSON patch document to - * @return PatchResult The result of the patch operation - */ - public function apply(mixed $data) - : PatchResult - { - $temp = (is_object($data) ? clone $data : $data); - - foreach ($this->operations as $op) - { - if (!$op->execute($temp)) - { - return new PatchResult(false, $data); - } - } - - return new PatchResult(true, $temp); - } - - //------------------------------------------------------------------------------------------------------------------ - public function __toString() - : string - { - return (is_string($this->document) - ? $this->document - : (string) json_encode($this->document)); - } -} diff --git a/src/JsonPatch/Exception/ExceptionMalformedPatch.php b/src/JsonPatch/Exception/ExceptionMalformedPatch.php deleted file mode 100644 index 1de79ac..0000000 --- a/src/JsonPatch/Exception/ExceptionMalformedPatch.php +++ /dev/null @@ -1,36 +0,0 @@ - */ - private const array OP_TYPES = [ - 'add' => Operation\PatchOperationAdd::class, - 'remove' => Operation\PatchOperationRemove::class, - 'replace' => Operation\PatchOperationReplace::class, - 'copy' => Operation\PatchOperationCopy::class, - 'move' => Operation\PatchOperationMove::class, - 'test' => Operation\PatchOperationTest::class, - ]; - - //================================================================================================================== - /** - * @param non-empty-string|JSONPatchOperation[] $operations - * @return IPatchOperation[] - * - * @throws ExceptionMalformedPatch - * @throws ExceptionSyntaxError - */ - public static function parse(string|array $operations) - : array - { - if (is_string($operations)) - { - $operations = (new Document($operations))->getData(); - - if (!is_array($operations)) - { - throw new ExceptionMalformedPatch( - "JSON Patch document is not an array", - ErrorCode::JSON_PATCH_INVALID_ROOT); - } - } - else - { - // Just to make sure that, for error handling purposes, we get the correct indices - $operations = array_values($operations); - } - - $result = []; - - foreach ($operations as $i => $operation) - { - if (!is_object($operation)) - { - throw new ExceptionMalformedPatch( - "operation entry at index $i is not a JSON object", - ErrorCode::JSON_PATCH_OP_NOT_OBJECT); - } - - if (!property_exists($operation, 'op') || !in_array($operation->op, array_keys(self::OP_TYPES), true)) - { - throw new ExceptionMalformedPatch( - "operation entry at index $i is missing 'op' property or contains an invalid opcode", - ErrorCode::JSON_PATCH_INVALID_OP_CODE); - } - - $class = self::OP_TYPES[$operation->op]; - $result[] = new $class(self::getProperties($i, $operation, $class)); - } - - return $result; - } - - /** - * @param class-string $class - * @return array - * @throws ExceptionMalformedPatch - * @throws ExceptionSyntaxError - */ - private static function getProperties(int $index, object $operation, string $class) - : array - { - if (!property_exists($operation, 'path') || !is_string($operation->path)) - { - throw new ExceptionMalformedPatch( - "operation entry at index $index is missing 'path' property or is not a string", - ErrorCode::JSON_PATCH_INVALID_PATH); - } - - $props = [ 'path' => new JsonPointer($operation->path) ]; - $operation_data = (array) $operation; - - foreach ($class::propertyDefinitions() as $def) - { - $name = $def['name']; - - if (!array_key_exists($name, $operation_data)) - { - if ($def['required']) - { - throw new ExceptionMalformedPatch( - "missing required patch operation argument '{$def['name']}'", - ErrorCode::JSON_PATCH_MISSING_REQUIRED_PROPERTY); - } - - continue; - } - - $value = $operation_data[$name]; - - if (!(is_scalar($value) || $value === null || is_array($value) || is_object($value))) - { - throw new ExceptionMalformedPatch( - "patch operation argument '$name' expects a valid JSON value", - ErrorCode::JSON_PATCH_PROPERTY_WRONG_TYPE); - } - - $expected = $def['type']; - $got = strtolower(gettype($value)); - - if ($expected === JsonPointer::class) - { - if (!is_string($value)) - { - throw new ExceptionMalformedPatch( - "patch operation argument '$name' expects a 'string'", - ErrorCode::JSON_PATCH_PROPERTY_WRONG_TYPE); - } - - $value = new JsonPointer($value); - } - else if ($expected !== '*' && $expected !== $got) - { - throw new ExceptionMalformedPatch( - "patch operation argument '$name' expects a '$expected'", - ErrorCode::JSON_PATCH_PROPERTY_WRONG_TYPE); - } - - $props[$name] = $value; - } - - return $props; - } -} diff --git a/src/JsonPatch/Operation/IPatchOperation.php b/src/JsonPatch/Operation/IPatchOperation.php deleted file mode 100644 index 5963f81..0000000 --- a/src/JsonPatch/Operation/IPatchOperation.php +++ /dev/null @@ -1,39 +0,0 @@ - 'value', - 'required' => true, - 'type' => '*' - ] - ]; - - //================================================================================================================== - /** - * @param array $properties - */ - public function __construct( - private readonly array $properties - ) {} - - //------------------------------------------------------------------------------------------------------------------ - #[\Override] - public static function propertyDefinitions() : array { return self::PROPERTIES; } - - #[\Override] - public static function operationId() : string { return 'add'; } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @throws ExceptionAccessViolation - * @throws ExceptionNullPointer - */ - #[\Override] - public function execute(mixed &$data) - : bool - { - $pointer = $this->properties['path']; - assert($pointer instanceof JsonPointer); - - $value = $this->properties['value']; - $pointer->add($data, $value); - - return true; - } -} diff --git a/src/JsonPatch/Operation/PatchOperationCopy.php b/src/JsonPatch/Operation/PatchOperationCopy.php deleted file mode 100644 index cb23fc9..0000000 --- a/src/JsonPatch/Operation/PatchOperationCopy.php +++ /dev/null @@ -1,83 +0,0 @@ - 'from', - 'required' => true, - 'type' => JsonPointer::class - ] - ]; - - //================================================================================================================== - /** - * @param array $properties - */ - public function __construct( - private readonly array $properties - ) {} - - //------------------------------------------------------------------------------------------------------------------ - #[\Override] - public static function propertyDefinitions() : array { return self::PROPERTIES; } - - #[\Override] - public static function operationId() : string { return 'copy'; } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @throws ExceptionAccessViolation - * @throws ExceptionNullPointer - */ - #[\Override] - public function execute(mixed &$data) - : bool - { - $from_pointer = $this->properties['from']; - assert($from_pointer instanceof JsonPointer); - - $value = $from_pointer->get($data); - - if (is_object($value)) - { - $value = clone $value; - } - - $pointer = $this->properties['path']; - assert($pointer instanceof JsonPointer); - - $pointer->add($data, $value); - - return true; - } -} diff --git a/src/JsonPatch/Operation/PatchOperationMove.php b/src/JsonPatch/Operation/PatchOperationMove.php deleted file mode 100644 index 4e39ab3..0000000 --- a/src/JsonPatch/Operation/PatchOperationMove.php +++ /dev/null @@ -1,80 +0,0 @@ - 'from', - 'required' => true, - 'type' => JsonPointer::class - ] - ]; - - //================================================================================================================== - /** - * @param array $properties - */ - public function __construct( - private readonly array $properties - ) {} - - //------------------------------------------------------------------------------------------------------------------ - #[\Override] - public static function propertyDefinitions() : array { return self::PROPERTIES; } - - #[\Override] - public static function operationId() : string { return 'move'; } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @throws ExceptionInvalidOperation - * @throws ExceptionAccessViolation - * @throws ExceptionNullPointer - */ - #[\Override] - public function execute(mixed &$data) - : bool - { - $from_pointer = $this->properties['from']; - assert($from_pointer instanceof JsonPointer); - - $value = $from_pointer->remove($data); - - $pointer = $this->properties['path']; - assert($pointer instanceof JsonPointer); - - $pointer->add($data, $value); - - return true; - } -} diff --git a/src/JsonPatch/Operation/PatchOperationRemove.php b/src/JsonPatch/Operation/PatchOperationRemove.php deleted file mode 100644 index b1e7caf..0000000 --- a/src/JsonPatch/Operation/PatchOperationRemove.php +++ /dev/null @@ -1,66 +0,0 @@ - $properties - */ - public function __construct( - private array $properties - ) {} - - //------------------------------------------------------------------------------------------------------------------ - #[\Override] - public static function propertyDefinitions() : array { return []; } - - #[\Override] - public static function operationId() : string { return 'remove'; } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @throws ExceptionInvalidOperation - * @throws ExceptionNullPointer - * @throws ExceptionAccessViolation - */ - #[\Override] - public function execute(mixed &$data) - : bool - { - $pointer = $this->properties['path']; - assert($pointer instanceof JsonPointer); - - $pointer->remove($data); - - return true; - } -} diff --git a/src/JsonPatch/Operation/PatchOperationReplace.php b/src/JsonPatch/Operation/PatchOperationReplace.php deleted file mode 100644 index 7de9881..0000000 --- a/src/JsonPatch/Operation/PatchOperationReplace.php +++ /dev/null @@ -1,74 +0,0 @@ - 'value', - 'required' => true, - 'type' => '*' - ] - ]; - - //================================================================================================================== - /** - * @param array $properties - */ - public function __construct( - private readonly array $properties - ) {} - - //------------------------------------------------------------------------------------------------------------------ - #[\Override] - public static function propertyDefinitions() : array { return self::PROPERTIES; } - - #[\Override] - public static function operationId() : string { return 'replace'; } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @throws ExceptionAccessViolation - * @throws ExceptionNullPointer - */ - #[\Override] - public function execute(mixed &$data) - : bool - { - $pointer = $this->properties['path']; - assert($pointer instanceof JsonPointer); - - $value = $this->properties['value']; - $pointer->set($data, $value); - - return true; - } -} diff --git a/src/JsonPatch/Operation/PatchOperationTest.php b/src/JsonPatch/Operation/PatchOperationTest.php deleted file mode 100644 index c932f9a..0000000 --- a/src/JsonPatch/Operation/PatchOperationTest.php +++ /dev/null @@ -1,76 +0,0 @@ - 'value', - 'required' => true, - 'type' => '*' - ] - ]; - - //================================================================================================================== - /** - * @param array $properties - */ - public function __construct( - private readonly array $properties - ) {} - - //------------------------------------------------------------------------------------------------------------------ - #[\Override] - public static function propertyDefinitions() : array { return self::PROPERTIES; } - - #[\Override] - public static function operationId() : string { return 'test'; } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @throws ExceptionAccessViolation - * @throws ExceptionNullPointer - */ - #[\Override] - public function execute(mixed &$data) - : bool - { - $pointer = $this->properties['path']; - assert($pointer instanceof JsonPointer); - - $value = $pointer->get($data); - $test_value = $this->properties['value']; - - return TypeUtil::equalityCompareOperands($value, $test_value); - } -} diff --git a/src/JsonPatch/PatchResult.php b/src/JsonPatch/PatchResult.php deleted file mode 100644 index 68ddaf5..0000000 --- a/src/JsonPatch/PatchResult.php +++ /dev/null @@ -1,38 +0,0 @@ -apply($data); - } - - /** - * Compiles and applies the given normalised JSONPath query to the given query argument and returns a - * {@see NodesType} with the single node that matched the normalised path, - * or empty if no such node was found. Other than {@link query()}, - * this should be a little more efficient because the query is just a normalised path and not a full JSONPath query. - * - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPath/queryNormalised%23lang-php - * - * @param non-empty-string $query The JSONPath query string to evaluate - * @param JSONValue $data The query argument to query - * - * @return NodesType The resultant node list - * - * @throws ExceptionSyntaxError Thrown whenever the query has a syntax problem - */ - public static function queryNormalised(string $query, mixed $data) - : NodesType - { - $query_expression = NormalisedParser::parse($query); - return $query_expression->execute($data); - } - - //================================================================================================================== - private static function compile(string $query) - : JsonPathQuery - { - $input = InputStream::fromString($query); - $lexer = new JsonPathLexer($input); - $tokens = new CommonTokenStream($lexer); - $parser = new JsonPathParser($tokens); - - $interpreter = $parser->getInterpreter(); - assert($interpreter instanceof ParserATNSimulator); - - $interpreter->setPredictionMode(PredictionMode::SLL); - $parser->setErrorHandler(new JsonPathErrorStrategy()); // Controls any errors we get during parsing - $parser->addErrorListener(new SyntaxErrorListener()); // Controls errors that were missed by our strategy - - $visitor = new JsonPathVisitor(); - $tree = $parser->query(); - - $result = $visitor->visit($tree); - assert($result instanceof JsonPathQuery); - - return $result; - } - - //================================================================================================================== - private JsonPathQuery $queryCompiled; - - //================================================================================================================== - /** - * Constructs a new JsonPath query and compiles the given query string. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPath/JsonPath%23lang-php - * - * @param non-empty-string $query The JSONPath query string to evaluate - * - * @throws ExceptionSyntaxError Thrown whenever the query has a syntax problem - * @throws ExceptionInternalError - * Thrown whenever there was an internal issue with the library (because of the developer's stupidity) - * @throws ExceptionFunctionExtension Thrown whenever there was an issue involving a function extension - */ - public function __construct( - public string $query - ) - { - $this->queryCompiled = self::compile($query); - } - - //================================================================================================================== - /** - * Applies the compiled JSONPath query to the given query argument and returns a {@see NodesType} - * with all nodes that matched the query. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPath/apply%23lang-php - * - * @param JSONValue $data The query argument to query - * @return NodesType The resultant node list - * - * @throws ExceptionInternalError Thrown whenever there was an internal issue with the library - * (because of the developer's stupidity) - */ - public function apply(mixed $data) - : NodesType - { - return $this->queryCompiled->execute($data); - } -} diff --git a/src/JsonPath/Exception/ExceptionFunctionExtension.php b/src/JsonPath/Exception/ExceptionFunctionExtension.php deleted file mode 100644 index a77b9bf..0000000 --- a/src/JsonPath/Exception/ExceptionFunctionExtension.php +++ /dev/null @@ -1,36 +0,0 @@ -nodes as $node) - { - if (!$node->isCollection()) - { - continue; - } - - foreach ((array) $node->value as $key => $child_value) - { - $new_node = new Node(new Location($key, $node), $child_value); - $eval = $this->evaluate($root, $new_node); - - if ($eval === LogicalType::True) - { - $result[] = $new_node; - } - } - } - - return new NodesType($result); - } - - #[\Override] - public function toParameter(string $parameterType, Node $root, Node $current) - : LogicalType - { - return $this->evaluate($root, $current); - } - - #[\Override] - public function validateParameter(string $parameterType, string &$error) - : bool - { - if ($parameterType !== LogicalType::class) - { - $unqualified_name = RefUtil::getUnqualifiedName($parameterType); - $error = "expected $unqualified_name instead got LogicalType"; - - return false; - } - - return true; - } -} diff --git a/src/JsonPath/Expression/ChildSelectorExpression.php b/src/JsonPath/Expression/ChildSelectorExpression.php deleted file mode 100644 index 05dfc25..0000000 --- a/src/JsonPath/Expression/ChildSelectorExpression.php +++ /dev/null @@ -1,86 +0,0 @@ -key; - - if (is_int($key)) - { - foreach ($context->nodes as $node) - { - $value = $node->value; - - if (is_array($value)) - { - $len = count($value); - - if ($key < 0) - { - $key += $len; - } - - if ($key >= 0 && $key < $len) - { - /** @var JSONValue $node_value */ - $node_value = $value[$key]; - $result[] = new Node(new Location($key, $node), $node_value); - } - } - } - } - else - { - foreach ($context->nodes as $node) - { - $value = $node->value; - - if (is_object($value) && property_exists($value, $key)) - { - // @phpstan-ignore property.dynamicName - $result[] = new Node(new Location($key, $node), $value->{$key}); - } - } - } - - return new NodesType($result); - } -} diff --git a/src/JsonPath/Expression/ComparisonExpression.php b/src/JsonPath/Expression/ComparisonExpression.php deleted file mode 100644 index ab7e1a4..0000000 --- a/src/JsonPath/Expression/ComparisonExpression.php +++ /dev/null @@ -1,117 +0,0 @@ -validForContext(FunctionExtension::CONTEXT_COMPARISON)) - { - $unqualified_name = RefUtil::getUnqualifiedName($comparable->extension->returnType); - throw new ExceptionFunctionExtension( - "function extension '{$comparable->extension->extensionName}' can not be used in a comparison, " - ."returns '$unqualified_name' but expected ValueType", - ErrorCode::JSON_PATH_EXT_WRONG_CONTEXT); - } - } - - //------------------------------------------------------------------------------------------------------------------ - private static function compareEqual(ValueType $left, ValueType $right) - : bool - { - if (!$left->hasValue() && !$right->hasValue()) - { - return true; - } - - return TypeUtil::equalityCompareOperands($left->value, $right->value); - } - - private static function compareLess(ValueType $left, ValueType $right) - : bool - { - if (!$left->hasValue() || !$right->hasValue()) - { - return false; - } - - return TypeUtil::lessCompareOperands($left->value, $right->value); - } - - //================================================================================================================== - /** - * @throws ExceptionFunctionExtension - */ - public function __construct( - private ComparisonOperation $type, - private IComparable $left, - private IComparable $right - ) - { - self::validateComparable($left); - self::validateComparable($right); - } - - //================================================================================================================== - #[\Override] - public function evaluate(Node $root, Node $current) - : LogicalType - { - $left = $this->left ->toComparable($root, $current); - $right = $this->right->toComparable($root, $current); - - return LogicalType::fromBool(match($this->type) { - ComparisonOperation::Equal => self::compareEqual($left, $right), - ComparisonOperation::NotEqual => !self::compareEqual($left, $right), - ComparisonOperation::LessThan => self::compareLess ($left, $right), - ComparisonOperation::GreaterThan => self::compareLess ($right, $left), - - ComparisonOperation::LessThanOrEqual - => (self::compareLess($left, $right) || self::compareEqual($left, $right)), - ComparisonOperation::GreaterThanOrEqual - => (self::compareLess($right, $left) || self::compareEqual($left, $right)) - }); - } -} diff --git a/src/JsonPath/Expression/ComparisonOperation.php b/src/JsonPath/Expression/ComparisonOperation.php deleted file mode 100644 index 18ccf1f..0000000 --- a/src/JsonPath/Expression/ComparisonOperation.php +++ /dev/null @@ -1,49 +0,0 @@ -'; - case GreaterThanOrEqual = '>='; - - //================================================================================================================== - public static function fromString(string $op) - : self - { - foreach (self::cases() as $case) - { - if ($case->value === $op) - { - return $case; - } - } - - trigger_error("unimplemented comparison operation '$op'", E_USER_ERROR); - } -} \ No newline at end of file diff --git a/src/JsonPath/Expression/FilterSelectorExpression.php b/src/JsonPath/Expression/FilterSelectorExpression.php deleted file mode 100644 index d9c7754..0000000 --- a/src/JsonPath/Expression/FilterSelectorExpression.php +++ /dev/null @@ -1,44 +0,0 @@ -evaluable->process($root, $context); - } -} diff --git a/src/JsonPath/Expression/FunctionExpression.php b/src/JsonPath/Expression/FunctionExpression.php deleted file mode 100644 index 1825a3a..0000000 --- a/src/JsonPath/Expression/FunctionExpression.php +++ /dev/null @@ -1,293 +0,0 @@ -getType() instanceof \ReflectionNamedType); - - /** @var class-string $type_name */ - $type_name = $parameter->getType()->getName(); - assert(in_array($type_name, [ ValueType::class, LogicalType::class, NodesType::class ], true)); - - $error = ""; - - if (!$argument->validateParameter($type_name, $error)) - { - throw new ExceptionFunctionExtension( - "invalid function call to '$ext->extensionName' at parameter #$index ({$parameter->getName()}), " - .$error, - ErrorCode::JSON_PATH_EXT_WRONG_PARAMETER); - } - } - - //================================================================================================================== - public FunctionExtension $extension; - - //------------------------------------------------------------------------------------------------------------------ - private ValueType|LogicalType|NodesType|null $cache; - - //================================================================================================================== - /** - * @param array $arguments - * @throws ExceptionFunctionExtension - */ - public function __construct( - private array $arguments, - string $extensionName - ) - { - $registry = FunctionRegistry::getInstance(); - $extension = $registry->getExtension($extensionName); - - if ($extension === null) - { - throw new ExceptionFunctionExtension( - "no function extension with name '$extensionName' was registered", - ErrorCode::JSON_PATH_EXT_DOES_NOT_EXIST); - } - - $temp_args = $arguments; - - foreach ($extension->parameters as $i => $parameter) - { - $ctx = self::popFront($temp_args); - - if ($parameter->isVariadic()) - { - while ($ctx !== false) - { - self::validateArgument($parameter, $ctx, $extension, $i); - $ctx = self::popFront($temp_args); - } - } - else - { - if ($ctx === false) - { - if (!$parameter->isDefaultValueAvailable()) - { - $needs = count( - array_filter($extension->parameters, function($param) - { - return !$param->isDefaultValueAvailable() && !$param->isVariadic(); - }) - ); - - throw new ExceptionFunctionExtension( - "too few arguments to function extension '$extensionName', " - ."expected at least $needs but received only ".count($arguments), - ErrorCode::JSON_PATH_EXT_TOO_FEW_ARGUMENTS); - } - - break; - } - - self::validateArgument($parameter, $ctx, $extension, $i); - } - } - - $this->extension = $extension; - $this->cache = $this->precompile(); - } - - //================================================================================================================== - public function evaluate(Node $root, Node $current) - : ValueType|LogicalType|NodesType - { - if ($this->cache !== null) - { - return $this->cache; - } - - return $this->evaluateHelper($root, $current); - } - - //================================================================================================================== - #[\Override] - public function test(Node $root, Node $current) - : LogicalType - { - $result = $this->evaluate($root, $current); - assert($result instanceof NodesType || $result instanceof LogicalType); - - if ($result instanceof NodesType) - { - return LogicalType::fromBool(count($result->nodes) > 0); - } - - return $result; - } - - #[\Override] - public function toComparable(Node $root, Node $current) - : ValueType - { - $result = $this->evaluate($root, $current); - assert($result instanceof ValueType); - - return $result; - } - - #[\Override] - public function toParameter(string $parameterType, Node $root, Node $current) - : LogicalType|ValueType|NodesType - { - $this_type = $this->extension->returnType; - $value = $this->evaluate($root, $current); - - if ($parameterType !== $this_type) - { - assert($value instanceof NodesType); - return LogicalType::fromBool(count($value->nodes) > 0); - } - - return $value; - } - - #[\Override] - public function validateParameter(string $parameterType, string &$error): bool - { - $this_type = $this->extension->returnType; - - if ($parameterType !== $this_type) - { - $unqualified_this_name = RefUtil::getUnqualifiedName($this_type); - - switch ($parameterType) - { - case LogicalType::class: - { - if ($this_type !== NodesType::class) - { - $error = "expected LogicalType (or NodesType) instead got $unqualified_this_name"; - return false; - } - } - - case ValueType::class: - { - $error = "expected ValueType instead got $unqualified_this_name"; - return false; - } - - case NodesType::class: - { - $error = "expected NodesType instead got $unqualified_this_name"; - return false; - } - } - } - - return true; - } - //================================================================================================================== - public function validForContext(int $context) : bool { return ($this->extension->canBeUsedFor($context)); } - - //================================================================================================================== - /** - * @return class-string - */ - private function getExpectedClassForArgument(int $index) - : string - { - $ext_params = $this->extension->parameters; - - $param = $ext_params[min($index, (count($ext_params) - 1))]; - assert($param->getType() instanceof \ReflectionNamedType); - - /** @var class-string */ - return $param->getType()->getName(); - } - - private function precompile() - : ValueType|LogicalType|NodesType|null - { - $should_compile = true; - - foreach ($this->arguments as $arg) - { - if (!($arg instanceof Literal) && (!($arg instanceof FunctionExpression) || $arg->cache === null)) - { - $should_compile = false; - break; - } - } - - $empty = new Node(new Location('', null), null); - return ($should_compile ? $this->evaluateHelper($empty, $empty) : null); - } - - private function evaluateHelper(Node $root, Node $current) - : ValueType|LogicalType|NodesType - { - $args = []; - - foreach ($this->arguments as $i => $argument) - { - $class = $this->getExpectedClassForArgument($i); - $args[] = $argument->toParameter($class, $root, $current); - } - - return $this->extension->invoke(...$args); - } -} diff --git a/src/JsonPath/Expression/IComparable.php b/src/JsonPath/Expression/IComparable.php deleted file mode 100644 index da83cf5..0000000 --- a/src/JsonPath/Expression/IComparable.php +++ /dev/null @@ -1,32 +0,0 @@ -value; } - - #[\Override] - public function toParameter(string $parameterType, Node $root, Node $current) : ValueType { return $this->value; } - - public function validateParameter(string $parameterType, string &$error): bool - { - if ($parameterType !== ValueType::class) - { - $unqualified_name = RefUtil::getUnqualifiedName($parameterType); - $error = "expected $unqualified_name but instead got ValueType"; - - return false; - } - - return true; - } -} diff --git a/src/JsonPath/Expression/LogicalExpression.php b/src/JsonPath/Expression/LogicalExpression.php deleted file mode 100644 index e8f7ef4..0000000 --- a/src/JsonPath/Expression/LogicalExpression.php +++ /dev/null @@ -1,84 +0,0 @@ -type) - { - case LogicalOperation::Or: - { - $result = LogicalType::False; - - foreach ($this->subExps as $expr) - { - if ($expr->evaluate($root, $current) === LogicalType::True) - { - $result = LogicalType::True; - break; - } - } - - break; - } - - case LogicalOperation::And: - { - $result = LogicalType::True; - - foreach ($this->subExps as $expr) - { - if ($expr->evaluate($root, $current) === LogicalType::False) - { - $result = LogicalType::False; - break; - } - } - - break; - } - - /** @noinspection PhpUnusedSwitchBranchInspection */ - default: trigger_error("unhandled logical operation '{$this->type->name}'", E_USER_ERROR); - } - - return $result; - } -} diff --git a/src/JsonPath/Expression/LogicalOperation.php b/src/JsonPath/Expression/LogicalOperation.php deleted file mode 100644 index 180cdb5..0000000 --- a/src/JsonPath/Expression/LogicalOperation.php +++ /dev/null @@ -1,30 +0,0 @@ -evaluable->evaluate($root, $current); - return $result->negate(); - } -} diff --git a/src/JsonPath/Expression/QueryExpression.php b/src/JsonPath/Expression/QueryExpression.php deleted file mode 100644 index f4555e7..0000000 --- a/src/JsonPath/Expression/QueryExpression.php +++ /dev/null @@ -1,134 +0,0 @@ -singular) - { - $singular = false; - break; - } - } - - $this->singular = $singular; - } - - //================================================================================================================== - public function process(Node $root, NodesType $context) - : NodesType - { - foreach ($this->segments as $segment) - { - if (count($context->nodes) === 0) - { - break; - } - - $context = $segment->process($root, $context); - } - - return $context; - } - - //================================================================================================================== - #[\Override] - public function toComparable(Node $root, Node $current) - : ValueType - { - if (!$this->singular) - { - trigger_error("falsely assumed was a singular query", E_USER_ERROR); - } - - $eval = $this->process($root, new NodesType([ ($this->relative ? $current : $root) ])); - return new ValueType(count($eval->nodes) > 0 ? $eval->nodes[0]->value : Nothing::NoValue); - } - - #[\Override] - public function test(Node $root, Node $current) - : LogicalType - { - $eval = $this->process($root, new NodesType([ ($this->relative ? $current : $root) ])); - return LogicalType::fromBool(count($eval->nodes) > 0); - } - - #[\Override] - public function toParameter(string $parameterType, Node $root, Node $current) - : NodesType|LogicalType|ValueType - { - $value = $this->process($root, new NodesType([ ($this->relative ? $current : $root) ])); - - return match($parameterType) { - ValueType::class => (count($value->nodes) > 0 ? new ValueType($value->nodes[0]->value) : new ValueType), - LogicalType::class => LogicalType::fromBool(count($value->nodes) > 0), - NodesType::class => $value, - default => trigger_error("invalid parametrisation for '$parameterType'", E_USER_ERROR) - }; - } - - #[\Override] - public function validateParameter(string $parameterType, string &$error) - : bool - { - if ($parameterType === ValueType::class) - { - if (!$this->singular) - { - $error = "cannot convert non-singular query to ValueType"; - return false; - } - } - - return true; - } -} diff --git a/src/JsonPath/Expression/SegmentExpression.php b/src/JsonPath/Expression/SegmentExpression.php deleted file mode 100644 index 4533384..0000000 --- a/src/JsonPath/Expression/SegmentExpression.php +++ /dev/null @@ -1,93 +0,0 @@ -nodes, function($node) { return $node->isCollection(); }); - $result = $queue; - - while (count($queue) > 0) - { - $node = reset($queue); - unset($queue[key($queue)]); - - $value = (array) $node->value; - - foreach ($value as $key => $child_value) - { - $new_node = new Node(new Location($key, $node), $child_value); - $result[] = $new_node; - - if ($new_node->isCollection()) - { - $queue[] = $new_node; - } - } - } - - return new NodesType($result); - } - - //================================================================================================================== - public bool $singular; - - //================================================================================================================== - /** @param ISegmentSelector[] $selectors */ - public function __construct( - private array $selectors, - private bool $recursive - ) - { - $this->singular = (count($selectors) === 1 && $selectors[0] instanceof ChildSelectorExpression); - } - - //================================================================================================================== - public function process(Node $root, NodesType $context) - : NodesType - { - $result = []; - - if ($this->recursive) - { - $context = self::recurseNodes($context); - } - - foreach ($this->selectors as $selector) - { - array_push($result, ...($selector->process($root, $context)->nodes)); - } - - return new NodesType($result); - } -} diff --git a/src/JsonPath/Expression/SliceSelectorExpression.php b/src/JsonPath/Expression/SliceSelectorExpression.php deleted file mode 100644 index 81a5c4f..0000000 --- a/src/JsonPath/Expression/SliceSelectorExpression.php +++ /dev/null @@ -1,105 +0,0 @@ -= 0 ? $value : ($len + $value)) : $fallback); - } - - //================================================================================================================== - public function __construct( - private ?int $start, - private ?int $end, - private int $step - ) {} - - //================================================================================================================== - #[\Override] - public function process(Node $root, NodesType $context) - : NodesType - { - $result = []; - - if ($this->step === 0) - { - return new NodesType; - } - - foreach ($context->nodes as $node) - { - $value = $node->value; - - if (is_array($value)) - { - $len = count($value); - - if ($len === 0) - { - continue; - } - - if ($this->step > 0) - { - $start = self::normaliseOrFallback($this->start, $len, 0); - $end = self::normaliseOrFallback($this->end, $len, $len); - $lower = min(max($start, 0), $len); - $upper = min(max($end, 0), $len); - - for ($i = $lower; $i < $upper; $i += $this->step) - { - /** @var JSONValue $val */ - $val = $value[$i]; - $result[] = new Node(new Location($i, $node), $val); - } - } - else - { - $start = self::normaliseOrFallback($this->start, $len, ( $len - 1)); - $end = self::normaliseOrFallback($this->end, $len, (-$len - 1)); - $lower = min(max($end, -1), $len - 1); - $upper = min(max($start, -1), $len - 1); - - for ($i = $upper; $lower < $i; $i += $this->step) - { - /** @var JSONValue $val */ - $val = $value[$i]; - $result[] = new Node(new Location($i, $node), $val); - } - } - } - } - - return new NodesType($result); - } -} diff --git a/src/JsonPath/Expression/TestExpression.php b/src/JsonPath/Expression/TestExpression.php deleted file mode 100644 index a14b36c..0000000 --- a/src/JsonPath/Expression/TestExpression.php +++ /dev/null @@ -1,64 +0,0 @@ -validForContext(FunctionExtension::CONTEXT_TEST)) - { - $unqualified_name = RefUtil::getUnqualifiedName($testExpr->extension->returnType); - throw new ExceptionFunctionExtension( - "function extension '{$testExpr->extension->extensionName}' can not be used in a test expression, " - ."returns '$unqualified_name' but expected LogicalType (or NodesType)", - ErrorCode::JSON_PATH_EXT_WRONG_CONTEXT - ); - } - } - - //================================================================================================================== - #[\Override] - public function evaluate(Node $root, Node $current) - : LogicalType - { - $eval = $this->testExpr->test($root, $current); - return ($this->negate ? $eval->negate() : $eval); - } -} diff --git a/src/JsonPath/Expression/WildcardSelectorExpression.php b/src/JsonPath/Expression/WildcardSelectorExpression.php deleted file mode 100644 index 7023853..0000000 --- a/src/JsonPath/Expression/WildcardSelectorExpression.php +++ /dev/null @@ -1,52 +0,0 @@ -nodes as $node) - { - if ($node->isCollection()) - { - foreach ((array) $node->value as $key => $child_value) - { - $result[] = new Node(new Location($key, $node), $child_value); - } - } - } - - return new NodesType($result); - } -} diff --git a/src/JsonPath/Function/Builtins/ArrayExtension.php b/src/JsonPath/Function/Builtins/ArrayExtension.php deleted file mode 100644 index 5017b25..0000000 --- a/src/JsonPath/Function/Builtins/ArrayExtension.php +++ /dev/null @@ -1,58 +0,0 @@ - self::in(...) - ]; - } - - //================================================================================================================== - public static function in(ValueType $array, ValueType $search) - : LogicalType - { - $arr = $array->value; - $s = $search->value; - - if ((is_array($arr) || is_object($arr)) && $s !== Nothing::NoValue) - { - return LogicalType::fromBool(in_array($s, (array) $arr, true)); - } - - return LogicalType::False; - } -} diff --git a/src/JsonPath/Function/Builtins/CommonExtension.php b/src/JsonPath/Function/Builtins/CommonExtension.php deleted file mode 100644 index 611f0eb..0000000 --- a/src/JsonPath/Function/Builtins/CommonExtension.php +++ /dev/null @@ -1,98 +0,0 @@ - self::any_of(...), - 'all_of' => self::all_of(...), - 'none_of' => self::none_of(...) - ]; - } - - //================================================================================================================== - public static function any_of(ValueType $value, ValueType ...$search) - : LogicalType - { - foreach ($search as $s) - { - if (self::compareEqual($value, $s)) - { - return LogicalType::True; - } - } - - return LogicalType::False; - } - - public static function all_of(ValueType $value, ValueType ...$search) - : LogicalType - { - foreach ($search as $s) - { - if (!self::compareEqual($value, $s)) - { - return LogicalType::False; - } - } - - return LogicalType::True; - } - - public static function none_of(ValueType $value, ValueType ...$search) - : LogicalType - { - foreach ($search as $s) - { - if (self::compareEqual($value, $s)) - { - return LogicalType::False; - } - } - - return LogicalType::True; - } - - //------------------------------------------------------------------------------------------------------------------ - private static function compareEqual(ValueType $left, ValueType $right) - : bool - { - if (!$left->hasValue() && !$right->hasValue()) - { - return true; - } - - return TypeUtil::equalityCompareOperands($left->value, $right->value); - } -} diff --git a/src/JsonPath/Function/Builtins/MathExtension.php b/src/JsonPath/Function/Builtins/MathExtension.php deleted file mode 100644 index 3ab7346..0000000 --- a/src/JsonPath/Function/Builtins/MathExtension.php +++ /dev/null @@ -1,216 +0,0 @@ - self::add(...), - 'sub' => self::sub(...), - 'div' => self::div(...), - 'mul' => self::mul(...), - 'min' => self::min(...), - 'max' => self::max(...), - 'abs' => self::abs(...), - 'ceil' => self::ceil(...), - 'floor' => self::floor(...), - 'round' => self::round(...), - 'trunc' => self::trunc(...) - ]; - } - - //================================================================================================================== - public static function add(ValueType $op1, ValueType $op2) - : ValueType - { - $val1 = $op1->value; - $val2 = $op2->value; - - if ((is_float($val1) || is_int($val1)) && (is_float($val2) || is_int($val2))) - { - return new ValueType($val1 + $val2); - } - - return new ValueType(); - } - - public static function sub(ValueType $op1, ValueType $op2) - : ValueType - { - $val1 = $op1->value; - $val2 = $op2->value; - - if ((is_float($val1) || is_int($val1)) && (is_float($val2) || is_int($val2))) - { - return new ValueType($val1 - $val2); - } - - return new ValueType(); - } - - public static function div(ValueType $op1, ValueType $op2) - : ValueType - { - $val1 = $op1->value; - $val2 = $op2->value; - - if ((is_float($val1) || is_int($val1)) && (is_float($val2) || is_int($val2))) - { - return new ValueType($val1 / $val2); - } - - return new ValueType(); - } - - public static function mul(ValueType $op1, ValueType $op2) - : ValueType - { - $val1 = $op1->value; - $val2 = $op2->value; - - if ((is_float($val1) || is_int($val1)) && (is_float($val2) || is_int($val2))) - { - return new ValueType($val1 * $val2); - } - - return new ValueType(); - } - - //================================================================================================================== - public static function min(ValueType $op1, ValueType $op2) - : ValueType - { - $val1 = $op1->value; - $val2 = $op2->value; - - if ((is_float($val1) || is_int($val1)) && (is_float($val2) || is_int($val2))) - { - return new ValueType(min($val1, $val2)); - } - - return new ValueType(); - } - - public static function max(ValueType $op1, ValueType $op2) - : ValueType - { - $val1 = $op1->value; - $val2 = $op2->value; - - if ((is_float($val1) || is_int($val1)) && (is_float($val2) || is_int($val2))) - { - return new ValueType(max($val1, $val2)); - } - - return new ValueType(); - } - - //================================================================================================================== - public static function abs(ValueType $value) - : ValueType - { - $val = $value->value; - - if (!(is_float($val) || is_int($val))) - { - return new ValueType(); - } - - return new ValueType(abs($val)); - } - - public static function ceil(ValueType $value) - : ValueType - { - $val = $value->value; - - if (!(is_float($val) || is_int($val))) - { - return new ValueType(); - } - - return new ValueType(ceil($val)); - } - - public static function floor(ValueType $value) - : ValueType - { - $val = $value->value; - - if (!(is_float($val) || is_int($val))) - { - return new ValueType(); - } - - return new ValueType(floor($val)); - } - - public static function round(ValueType $value) - : ValueType - { - $val = $value->value; - - if (!(is_float($val) || is_int($val))) - { - return new ValueType(); - } - - return new ValueType(round($val)); - } - - public static function sqrt(ValueType $value) - : ValueType - { - $val = $value->value; - - if (!(is_float($val) || is_int($val))) - { - return new ValueType(); - } - - return new ValueType(sqrt($val)); - } - - public static function trunc(ValueType $value) - : ValueType - { - $val = $value->value; - - if (!(is_float($val) || is_int($val))) - { - return new ValueType(); - } - - return new ValueType((int) $val); - } -} diff --git a/src/JsonPath/Function/Builtins/StandardExtension.php b/src/JsonPath/Function/Builtins/StandardExtension.php deleted file mode 100644 index 8878f27..0000000 --- a/src/JsonPath/Function/Builtins/StandardExtension.php +++ /dev/null @@ -1,104 +0,0 @@ - self::length(...), - 'count' => self::count(...), - 'match' => self::match_(...), - 'search' => self::search(...), - 'value' => self::value(...) - ]; - } - - //================================================================================================================== - public static function length(ValueType $value) - : ValueType - { - $val = $value->value; - - if (is_string($val)) - { - return new ValueType(mb_strlen($val)); - } - - if (is_array($val) || is_object($val)) - { - return new ValueType(count((array) $val)); - } - - return new ValueType(); - } - - public static function count(NodesType $nodes) - : ValueType - { - return new ValueType(count($nodes->nodes)); - } - - public static function match_(ValueType $input, ValueType $pattern) - : LogicalType - { - if (!is_string($input->value) || !is_string($pattern->value)) - { - return LogicalType::False; - } - - return LogicalType::fromBool(preg_match('/^'.$pattern->value.'$/', $input->value) !== 0); - } - - public static function search(ValueType $input, ValueType $pattern) - : LogicalType - { - if (!is_string($input->value) || !is_string($pattern->value)) - { - return LogicalType::False; - } - - return LogicalType::fromBool(preg_match('/'.$pattern->value.'/', $input->value) !== 0); - } - - public static function value(NodesType $nodes) - : ValueType - { - if (count($nodes->nodes)=== 1) - { - return new ValueType($nodes->nodes[0]->value); - } - - return new ValueType(); - } -} diff --git a/src/JsonPath/Function/Builtins/StringExtension.php b/src/JsonPath/Function/Builtins/StringExtension.php deleted file mode 100644 index acf0077..0000000 --- a/src/JsonPath/Function/Builtins/StringExtension.php +++ /dev/null @@ -1,138 +0,0 @@ - self::contains(...), - 'starts_with' => self::starts_with(...), - 'ends_with' => self::ends_with(...), - 'to_lower' => self::to_lower(...), - 'to_upper' => self::to_upper(...), - 'concat' => self::concat(...) - ]; - } - - //================================================================================================================== - public static function contains(ValueType $string, ValueType $search) - : LogicalType - { - $str = $string->value; - $s = $search->value; - - if (is_string($str) && is_string($s)) - { - return LogicalType::fromBool(str_contains($str, $s)); - } - - return LogicalType::False; - } - - //================================================================================================================== - public static function starts_with(ValueType $value, ValueType $search) - : LogicalType - { - $val = $value->value; - $s = $search->value; - - if (is_string($val) && is_string($s)) - { - return LogicalType::fromBool(str_starts_with($val, $s)); - } - - return LogicalType::False; - } - - public static function ends_with(ValueType $value, ValueType $search) - : LogicalType - { - $val = $value->value; - $s = $search->value; - - if (is_string($val) && is_string($s)) - { - return LogicalType::fromBool(str_ends_with($val, $s)); - } - - return LogicalType::False; - } - - public static function to_lower(ValueType $value) - : ValueType - { - $val = $value->value; - - if (is_string($val)) - { - return new ValueType(strtolower($val)); - } - - return new ValueType(); - } - - public static function to_upper(ValueType $value) - : ValueType - { - $val = $value->value; - - if (is_string($val)) - { - return new ValueType(strtoupper($val)); - } - - return new ValueType(); - } - - public static function concat(ValueType $value, ValueType ...$elements) - : ValueType - { - $parts = [ $value, ...$elements ]; - $result = ''; - - foreach ($parts as $part) - { - $val = $part->value; - - if (!is_string($val)) - { - return new ValueType(); - } - - $result .= $val; - } - - return new ValueType($result); - } -} diff --git a/src/JsonPath/Function/Builtins/TypeExtension.php b/src/JsonPath/Function/Builtins/TypeExtension.php deleted file mode 100644 index e791367..0000000 --- a/src/JsonPath/Function/Builtins/TypeExtension.php +++ /dev/null @@ -1,123 +0,0 @@ - self::array(...), - 'object' => self::object(...), - 'typeof' => self::typeof(...) - ]; - } - - //================================================================================================================== - public static function array(ValueType ...$elements) - : ValueType - { - $values = []; - - foreach ($elements as $element) - { - if ($element->hasValue()) - { - $values[] = $element->value; - } - } - - return new ValueType($values); - } - - public static function object(ValueType ...$pairs) - : ValueType - { - $result = new \stdClass; - $len = count($pairs); - - for ($i = 0; $i < $len; $i += 2) - { - $n = ($i + 1); - - if ($n >= $len) - { - break; - } - - $key = $pairs[$i]; - $value = $pairs[$n]; - - if (!is_string($key->value) || !$value->hasValue()) - { - continue; - } - - $result->{$key} = $value; - } - - return new ValueType($result); - } - - //================================================================================================================== - public static function typeof(ValueType $value) - : ValueType - { - if (!$value->hasValue()) - { - return $value; - } - - $val = $value->value; - - if (is_float($val) || is_int($val)) - { - return new ValueType('number'); - } - - if (is_object($val)) - { - return new ValueType('object'); - } - - if ($val === null) - { - return new ValueType('null'); - } - - if (is_bool($val)) - { - return new ValueType('bool'); - } - - return new ValueType(gettype($value->value)); - } -} diff --git a/src/JsonPath/Function/FunctionExtension.php b/src/JsonPath/Function/FunctionExtension.php deleted file mode 100644 index 492b4b8..0000000 --- a/src/JsonPath/Function/FunctionExtension.php +++ /dev/null @@ -1,178 +0,0 @@ -getName(), [ ValueType::class, LogicalType::class, NodesType::class ], true)) - { - $error = "invalid $element for function extension '$extName', " - ."found type '{$type->getName()}' but expected either ValueType, LogicalType or NodesType"; - } - else - { - return; - } - } - - throw new ExceptionFunctionRegistration($error, ErrorCode::JSON_PATH_EXTREG_INVALID_PARAMETER_TYPE); - } - - /** - * @throws \ReflectionException - */ - private static function getReflector(callable $callable) - : \ReflectionFunctionAbstract - { - $reflection = CallableReflection::fromCallable($callable); - $refl = new \ReflectionObject($reflection); - - $prop = $refl->getProperty('reflector'); - $result = $prop->getValue($reflection); - assert($result instanceof \ReflectionFunctionAbstract); - - return $result; - } - - //================================================================================================================== - /** - * @var callable $callable - */ - private mixed $callable; - private int $applicableContexts; - - /** - * @var \ReflectionParameter[] $parameters The reflection parameters of this function extension - */ - public array $parameters; - - /** - * @var class-string $returnType The return type class of this function extension - */ - public string $returnType; - - //================================================================================================================== - - /** - * @param non-empty-string $extensionName - * @param-later-invoked-callable $callable - * @throws ExceptionFunctionRegistration - */ - public function __construct( - public string $extensionName, - callable $callable - ) - { - if (preg_match('/[a-z][a-z0-9_]+/', $extensionName) === false) - { - throw new ExceptionFunctionRegistration( - "invalid function extension name '$extensionName', must start with a lower-case letter," - ."at least one character long and can only contain lower-case letters, digits und underscores", - ErrorCode::JSON_PATH_EXTREG_INVALID_NAME); - } - - try - { - $refl = self::getReflector($callable); - } - catch (\Exception $ex) - { - throw new ExceptionFunctionRegistration($ex->getMessage(), ErrorCode::JSON_PATH_EXTREG_REFLECTION_ERROR); - } - - $pars = []; - - foreach ($refl->getParameters() as $parameter) - { - self::validateType("parameter '{$parameter->getName()}'", $extensionName, $parameter->getType()); - $pars[] = $parameter; - } - - $type = $refl->getReturnType(); - self::validateType("return type", $extensionName, $type); - assert($type instanceof \ReflectionNamedType); - - /** @var class-string $name */ - $name = $type->getName(); - $contexts = 0b0111; - - if ($name === NodesType::class || $name === LogicalType::class) - { - $contexts &= ~self::CONTEXT_COMPARISON; - } - else if ($name === ValueType::class) - { - $contexts &= ~self::CONTEXT_TEST; - } - - $this->callable = $callable; - $this->applicableContexts = $contexts; - $this->returnType = $name; - $this->parameters = $pars; - } - - //================================================================================================================== - public function canBeUsedFor(int $flag) : bool { return (($this->applicableContexts & $flag) === $flag); } - - //================================================================================================================== - public function invoke(ValueType|NodesType|LogicalType ...$arguments) - : ValueType|LogicalType|NodesType - { - return ($this->callable)(...$arguments); - } -} diff --git a/src/JsonPath/Function/FunctionRegistry.php b/src/JsonPath/Function/FunctionRegistry.php deleted file mode 100644 index 63aabf6..0000000 --- a/src/JsonPath/Function/FunctionRegistry.php +++ /dev/null @@ -1,161 +0,0 @@ - $extensions - */ - private array $extensions = []; - - //================================================================================================================== - /** - * @throws ExceptionFunctionRegistration - */ - private function __construct() - { - $this->registerExtensionProvider( - // Standard extensions - StandardExtension::class, - - // Additional extensions - ArrayExtension::class, StringExtension::class, MathExtension::class, TypeExtension::class, - CommonExtension::class - ); - } - - //================================================================================================================== - /** - * Gets a function extension by name (with namespace prefix) or null if no such function extension exists. - * - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/FunctionRegistry/getExtension%23lang-php - * - * @param string $name The name of the function extension - * @return ?FunctionExtension The function extension or null - */ - public function getExtension(string $name) : ?FunctionExtension { return ($this->extensions[$name] ?? null); } - - //------------------------------------------------------------------------------------------------------------------ - /** - * Tries to register one or more function extension provider. - * - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/FunctionRegistry/registerExtensionProvider%23lang-php - * - * @param class-string $class The class providing the extension functions - * @param class-string ...$other Additional classes to register for this namespace - * - * @throws ExceptionFunctionRegistration Thrown if there was an issue registering this function extension - */ - public function registerExtensionProvider(string $class, string ...$other) - : void - { - $classes = [ $class, ...$other ]; - - foreach ($classes as $class_name) - { - $interfaces = class_implements($class_name); - - if (!in_array(IExtensionProvider::class, $interfaces, true)) - { - throw new ExceptionFunctionRegistration( - "class '$class_name' is not an IFunctionProvider", - ErrorCode::JSON_PATH_EXTREG_NOT_A_PROVIDER); - } - - $instance = new $class_name(); - $functions = $instance->createExtension(); - - foreach ($functions as $name => $function) - { - if (!is_callable($function)) - { - throw new ExceptionFunctionRegistration( - "'$function' is not a callable", - ErrorCode::JSON_PATH_EXTREG_NOT_A_CALLABLE); - } - - $this->registerExtension($name, $function); - } - } - } - - /** - * Tries to register a callable as function extension. - * - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/FunctionRegistry/registerExtension%23lang-php - * - * @param non-empty-string $name The name of the function extension - * @param callable $invocable The callable to register - * - * @param-later-invoked-callable $invocable - * @throws ExceptionFunctionRegistration - */ - public function registerExtension(string $name, callable $invocable) - : void - { - if (array_key_exists($name, $this->extensions)) - { - throw new ExceptionFunctionRegistration( - "function extension with the name '$name' already registered", - ErrorCode::JSON_PATH_EXTREG_ALREADY_REGISTERED); - } - - $this->extensions[$name] = new FunctionExtension($name, $invocable); - } -} diff --git a/src/JsonPath/Function/IErrorListener.php b/src/JsonPath/Function/IErrorListener.php deleted file mode 100644 index a249129..0000000 --- a/src/JsonPath/Function/IErrorListener.php +++ /dev/null @@ -1,10 +0,0 @@ - The list of function callbacks to register for this provider - */ - public function createExtension() : array; -} diff --git a/src/JsonPath/Object/Location.php b/src/JsonPath/Object/Location.php deleted file mode 100644 index b258827..0000000 --- a/src/JsonPath/Object/Location.php +++ /dev/null @@ -1,98 +0,0 @@ - $segments The list of child segments this location comprises */ - public array $segments; - - //================================================================================================================== - /** - * Constructs a new Location object. - * - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Location/Location%23lang-php - * - * @param string|int $key The key of the current child in the parent - * @param Location|Node|null $parent The parent the node is a child of (either a Location or a Node), or null if - * it is the root object - */ - public function __construct(string|int $key, Location|Node|null $parent) - { - $segments = []; - - if ($parent instanceof Location) - { - array_push($segments, ...$parent->segments); - } - else if ($parent instanceof Node) - { - array_push($segments, ...$parent->location->segments); - } - - $this->segments = [ ...$segments, $key ]; - } - - //================================================================================================================== - /** - * Returns the normalised query string computed from the segments of this location object. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Location/toString%23lang-php - * @return string The normalised query string - */ - public function toString() - : string - { - $result = "$"; - - foreach (array_slice($this->segments, 1) as $segment) - { - $result .= self::getNormalisedName($segment); - } - - return $result; - } - - //================================================================================================================== - #[\Override] - public function __toString() : string { return $this->toString(); } -} diff --git a/src/JsonPath/Object/LogicalType.php b/src/JsonPath/Object/LogicalType.php deleted file mode 100644 index d60cf55..0000000 --- a/src/JsonPath/Object/LogicalType.php +++ /dev/null @@ -1,77 +0,0 @@ - LogicalType::True and vice versa. - * - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/LogicalType/fromBool%23lang-php - * - * @param bool $value The boolean to convert - * @return self The converted LogicalType - */ - public static function fromBool(bool $value) : self { return ($value ? self::True : self::False); } - - //================================================================================================================== - /** - * Inverts the current case to the opposite case, e.g. LogicalType::True => LogicalType::False and vice versa. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/LogicalType/negate%23lang-php - * @return self The negated LogicalType - */ - public function negate() - : self - { - return match ($this) { - LogicalType::True => LogicalType::False, - LogicalType::False => LogicalType::True - }; - } - - /** - * Converts the current case value to its boolean variant, e.g. LogicalType::True => true and vice versa. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/LogicalType/toBool%23lang-php - * @return bool True if LogicalType::True, otherwise false - */ - public function toBool() : bool { return ($this === LogicalType::True); } -} diff --git a/src/JsonPath/Object/Node.php b/src/JsonPath/Object/Node.php deleted file mode 100644 index fb9160a..0000000 --- a/src/JsonPath/Object/Node.php +++ /dev/null @@ -1,95 +0,0 @@ -isArray() || $this->isMap()); } - - /** - * Determines whether this node represents a JSON array. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Node/isArray%23lang-php - * @return bool True if the contained value is a JSON array - */ - public function isArray() : bool { return is_array($this->value); } - - /** - * Determines whether this node represents a JSON map. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Node/isMap%23lang-php - * @return bool True if the contained value is a JSON map - */ - public function isMap() : bool { return is_object($this->value); } - - /** - * Determines whether this node represents a JSON number (int or float). - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Node/isNumber%23lang-php - * @return bool True if the contained value is a JSON number - */ - public function isNumber() : bool { return (is_float($this->value) || is_int($this->value)); } - - /** - * Determines whether this node represents a JSON bool. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Node/isBool%23lang-php - * @return bool True if the contained value is a JSON bool - */ - public function isBool() : bool { return is_bool($this->value); } - - /** - * Determines whether this node represents a JSON string. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Node/isString%23lang-php - * @return bool True if the contained value is a JSON string - */ - public function isString() : bool { return is_string($this->value); } - - /** - * Determines whether this node represents a JSON null value. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/Node/isNull%23lang-php - * @return bool True if the contained value is a JSON null - */ - public function isNull() : bool { return ($this->value === null); } -} diff --git a/src/JsonPath/Object/NodesType.php b/src/JsonPath/Object/NodesType.php deleted file mode 100644 index 037a50c..0000000 --- a/src/JsonPath/Object/NodesType.php +++ /dev/null @@ -1,136 +0,0 @@ - $nodes The node list - */ - public function __construct( - public array $nodes = [] - ) {} - - //================================================================================================================== - /** - * Gets an array with all the nodes unpacked. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/NodesType/toArray%23lang-php - * @return JSONValue[] The value array - */ - public function toArray() - : array - { - return array_map(function(Node $node) { return $node->value; }, $this->nodes); - } - - /** - * If there is just one node in the node-list will return that node's value, otherwise an array of nodes is called. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/NodesType/toValue%23lang-php - * @return JSONValue The unpacked value - */ - public function toValue() - : mixed - { - return (count($this->nodes) === 1 ? $this->nodes[0]->value : $this->toArray()); - } - - /** - * Returns the contents of this node-list as JSON string. - * - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/NodesType/toJson%23lang-php - * - * @param int $flags The result flags, specifying how to output the nodes - * @param int $encodeFlags Any flags that can be passed to {@see json_encode} - * - * @return string|false The JSON string or false if there was a problem encoding the nodes - */ - public function toJson(int $flags = 0, int $encodeFlags = 0) - : string|false - { - $contents = []; - $is_assoc = false; - - if (($flags & self::FLAG_UNPACK) === self::FLAG_UNPACK) - { - $contents = $this->toArray(); - } - else - { - if (($flags & self::FLAG_NODES_AS_OBJECTS) === self::FLAG_NODES_AS_OBJECTS) - { - foreach ($this->nodes as $node) - { - $contents[] = [ - 'location' => (string) $node->location, - 'value' => $node->value - ]; - } - } - else - { - $is_assoc = true; - - foreach ($this->nodes as $node) - { - $contents[(string) $node->location] = $node->value; - } - } - } - - if (($flags & self::FLAG_INLINE) === self::FLAG_INLINE - && count($contents) === 1 - && !$is_assoc) - { - $contents = $contents[0]; - } - - return json_encode($contents, $encodeFlags); - } -} diff --git a/src/JsonPath/Object/Nothing.php b/src/JsonPath/Object/Nothing.php deleted file mode 100644 index 7c1cb69..0000000 --- a/src/JsonPath/Object/Nothing.php +++ /dev/null @@ -1,33 +0,0 @@ -value !== Nothing::NoValue); } -} diff --git a/src/JsonPath/Parser/JsonPathErrorStrategy.php b/src/JsonPath/Parser/JsonPathErrorStrategy.php deleted file mode 100644 index 03a31d1..0000000 --- a/src/JsonPath/Parser/JsonPathErrorStrategy.php +++ /dev/null @@ -1,191 +0,0 @@ -removeOne(JsonPathLexer::S); - - $expected = array_map(function(int $token) use($vocab) - { - return strtolower($vocab->getDisplayName($token)); - }, $expectedTokens->toArray()); - - $result = ""; - - foreach ($expected as $key => $id) - { - if ($key !== array_key_first($expected)) - { - if ($key === array_key_last($expected)) - { - $result .= ' or '; - } - else - { - $result .= ', '; - } - } - - $result .= $id; - } - - return $result; - } - - //================================================================================================================== - /** - * @throws ExceptionSyntaxError - */ - #[\Override] - protected function reportInputMismatch(Parser $recognizer, InputMismatchException $e) - : void - { - $expected_tokens = $e->getExpectedTokens(); - - if ($expected_tokens === null) - { - throw new \LogicException('unexpected null expected tokens'); - } - - $offending_token = $e->getOffendingToken(); - $msg = "mismatched input {$this->getTokenErrorDisplay($offending_token)} expecting " - .self::getExpected($expected_tokens, $recognizer->getVocabulary()); - - throw new ExceptionSyntaxError( - $msg, - ErrorCode::JSON_PATH_SYNTAX_ERROR, - ($offending_token?->getLine() ?? -1), - ($offending_token?->getCharPositionInLine() ?? -1)); - } - - /** - * @throws ExceptionSyntaxError - */ - #[\Override] - protected function reportUnwantedToken(Parser $recognizer) - : void - { - if ($this->inErrorRecoveryMode($recognizer)) - { - return; - } - - $this->beginErrorCondition($recognizer); - - $t = $recognizer->getCurrentToken(); - $tokenName = $this->getTokenErrorDisplay($t); - $expecting = $this->getExpectedTokens($recognizer); - - $msg = "extraneous input $tokenName expecting ".self::getExpected($expecting, $recognizer->getVocabulary()); - - throw new ExceptionSyntaxError( - $msg, - ErrorCode::JSON_PATH_SYNTAX_ERROR, - ($t?->getLine() ?? -1), - ($t?->getCharPositionInLine() ?? -1)); - } - - /** - * @throws ExceptionSyntaxError - */ - protected function reportMissingToken(Parser $recognizer): void - { - if ($this->inErrorRecoveryMode($recognizer)) { - return; - } - - $this->beginErrorCondition($recognizer); - - $t = $recognizer->getCurrentToken(); - $expecting = $this->getExpectedTokens($recognizer); - - $msg = sprintf( - 'missing %s at %s', - self::getExpected($expecting, $recognizer->getVocabulary()), - $this->getTokenErrorDisplay($t) - ); - - throw new ExceptionSyntaxError( - $msg, - ErrorCode::JSON_PATH_SYNTAX_ERROR, - ($t?->getLine() ?? -1), - ($t?->getCharPositionInLine() ?? -1)); - } - - /** - * @throws ExceptionSyntaxError - */ - protected function reportNoViableAlternative(Parser $recognizer, NoViableAltException $e): void - { - $tokens = $recognizer->getTokenStream(); - $offending_token = $recognizer->getCurrentToken(); - - if ($tokens !== null) - { - $startToken = $e->getStartToken(); - - if ($startToken === null) - { - throw new \LogicException('unexpected null start token'); - } - - if ($startToken->getType() === Token::EOF) - { - $msg = 'unexpected end of expression'; - } - else - { - $input = $tokens->getTextByTokens($e->getStartToken(), $e->getOffendingToken()); - $unexpr = ($offending_token?->getText() ?? ''); - $msg = "unexpected input '$unexpr' at input '$input'"; - } - } - else - { - $msg = "unexpected input '' at input ''"; - } - - throw new ExceptionSyntaxError( - $msg, - ErrorCode::JSON_PATH_SYNTAX_ERROR, - ($offending_token?->getLine() ?? -1), - (($offending_token?->getCharPositionInLine() ?? -2) + 1)); - } -} diff --git a/src/JsonPath/Parser/JsonPathLexer.php b/src/JsonPath/Parser/JsonPathLexer.php deleted file mode 100644 index cdd9790..0000000 --- a/src/JsonPath/Parser/JsonPathLexer.php +++ /dev/null @@ -1,306 +0,0 @@ - - */ - public const CHANNEL_NAMES = [ - 'DEFAULT_TOKEN_CHANNEL', 'HIDDEN' - ]; - - /** - * @var array - */ - public const MODE_NAMES = [ - 'DEFAULT_MODE' - ]; - - /** - * @var array - */ - public const RULE_NAMES = [ - 'Digit', 'Digit1', 'Hexdig', 'Alpha', 'ESC', 'NonSurrogate', 'HighSurrogate', - 'LowSurrogate', 'HexChar', 'Unescaped', 'Escapable', 'Fraction', 'Exponent', - 'NameFirst', 'NameChar', 'TEXT_DOUBLE_QUOTED', 'TEXT_SINGLE_QUOTED', - 'STRING', 'INT', 'NUMBER', 'BOOLEAN', 'NULL', 'NAME', 'OP_ROOT', 'OP_WILDCARD', - 'OP_SLICE', 'OP_FILTER', 'OP_NOT', 'OP_PATH', 'OP_RECURSE', 'OP_CURRENT', - 'OP_COMMA', 'OP_OR', 'OP_AND', 'OP_COMP', 'OP_PAREN_OPEN', 'OP_PAREN_CLOSE', - 'OP_BRACK_OPEN', 'OP_BRACK_CLOSE', 'OP_QUOTE_SINGLE', 'OP_QUOTE_DOUBLE', - 'S' - ]; - - /** - * @var array - */ - private const LITERAL_NAMES = [ - null, null, null, null, null, "'null'", null, "'\$'", "'*'", "':'", - "'?'", "'!'", "'.'", "'..'", "'@'", "','", "'||'", "'&&'", null, "'('", - "')'", "'['", "']'", "'''", "'\"'" - ]; - - /** - * @var array - */ - private const SYMBOLIC_NAMES = [ - null, "STRING", "INT", "NUMBER", "BOOLEAN", "NULL", "NAME", "OP_ROOT", - "OP_WILDCARD", "OP_SLICE", "OP_FILTER", "OP_NOT", "OP_PATH", "OP_RECURSE", - "OP_CURRENT", "OP_COMMA", "OP_OR", "OP_AND", "OP_COMP", "OP_PAREN_OPEN", - "OP_PAREN_CLOSE", "OP_BRACK_OPEN", "OP_BRACK_CLOSE", "OP_QUOTE_SINGLE", - "OP_QUOTE_DOUBLE", "S" - ]; - - private const SERIALIZED_ATN = - [4, 0, 25, 300, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, - 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, - 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, - 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, - 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, - 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, - 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, - 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, - 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 1, 0, 1, 0, 1, - 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 3, 5, 98, - 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, - 109, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, - 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 128, 8, 8, 1, 9, - 1, 9, 1, 10, 1, 10, 1, 10, 3, 10, 135, 8, 10, 1, 11, 1, 11, 5, 11, - 139, 8, 11, 10, 11, 12, 11, 142, 9, 11, 1, 12, 1, 12, 3, 12, 146, - 8, 12, 1, 12, 5, 12, 149, 8, 12, 10, 12, 12, 12, 152, 9, 12, 1, 13, - 1, 13, 3, 13, 156, 8, 13, 1, 14, 1, 14, 3, 14, 160, 8, 14, 1, 15, - 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 170, 8, 15, - 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 180, - 8, 16, 1, 17, 1, 17, 5, 17, 184, 8, 17, 10, 17, 12, 17, 187, 9, 17, - 1, 17, 1, 17, 1, 17, 1, 17, 5, 17, 193, 8, 17, 10, 17, 12, 17, 196, - 9, 17, 1, 17, 1, 17, 3, 17, 200, 8, 17, 1, 18, 1, 18, 3, 18, 204, - 8, 18, 1, 18, 1, 18, 5, 18, 208, 8, 18, 10, 18, 12, 18, 211, 9, 18, - 3, 18, 213, 8, 18, 1, 19, 1, 19, 1, 19, 3, 19, 218, 8, 19, 1, 19, - 3, 19, 221, 8, 19, 1, 19, 3, 19, 224, 8, 19, 1, 20, 1, 20, 1, 20, - 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 235, 8, 20, 1, 21, - 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 5, 22, 244, 8, 22, 10, 22, - 12, 22, 247, 9, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, - 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 30, 1, - 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 34, - 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 283, - 8, 34, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 1, 37, 1, 38, 1, 38, 1, - 39, 1, 39, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 0, 0, 42, 1, - 0, 3, 0, 5, 0, 7, 0, 9, 0, 11, 0, 13, 0, 15, 0, 17, 0, 19, 0, 21, - 0, 23, 0, 25, 0, 27, 0, 29, 0, 31, 0, 33, 0, 35, 1, 37, 2, 39, 3, - 41, 4, 43, 5, 45, 6, 47, 7, 49, 8, 51, 9, 53, 10, 55, 11, 57, 12, - 59, 13, 61, 14, 63, 15, 65, 16, 67, 17, 69, 18, 71, 19, 73, 20, 75, - 21, 77, 22, 79, 23, 81, 24, 83, 25, 1, 0, 16, 1, 0, 48, 57, 1, 0, - 49, 57, 2, 0, 48, 57, 65, 70, 2, 0, 65, 90, 97, 122, 4, 0, 65, 67, - 69, 70, 97, 99, 101, 102, 2, 0, 68, 68, 100, 100, 1, 0, 48, 55, 3, - 0, 56, 57, 65, 66, 97, 98, 2, 0, 67, 70, 99, 102, 5, 0, 32, 33, 35, - 38, 40, 91, 93, 55295, 57344, 65535, 4, 0, 8, 10, 12, 13, 47, 47, - 92, 92, 2, 0, 69, 69, 101, 101, 2, 0, 43, 43, 45, 45, 3, 0, 95, 95, - 128, 55295, 57344, 65535, 2, 0, 60, 60, 62, 62, 3, 0, 9, 10, 13, 13, - 32, 32, 312, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, - 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, - 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, - 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, - 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, - 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, - 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, - 0, 0, 83, 1, 0, 0, 0, 1, 85, 1, 0, 0, 0, 3, 87, 1, 0, 0, 0, 5, 89, - 1, 0, 0, 0, 7, 91, 1, 0, 0, 0, 9, 93, 1, 0, 0, 0, 11, 108, 1, 0, 0, - 0, 13, 110, 1, 0, 0, 0, 15, 115, 1, 0, 0, 0, 17, 127, 1, 0, 0, 0, - 19, 129, 1, 0, 0, 0, 21, 134, 1, 0, 0, 0, 23, 136, 1, 0, 0, 0, 25, - 143, 1, 0, 0, 0, 27, 155, 1, 0, 0, 0, 29, 159, 1, 0, 0, 0, 31, 169, - 1, 0, 0, 0, 33, 179, 1, 0, 0, 0, 35, 199, 1, 0, 0, 0, 37, 212, 1, - 0, 0, 0, 39, 217, 1, 0, 0, 0, 41, 234, 1, 0, 0, 0, 43, 236, 1, 0, - 0, 0, 45, 241, 1, 0, 0, 0, 47, 248, 1, 0, 0, 0, 49, 250, 1, 0, 0, - 0, 51, 252, 1, 0, 0, 0, 53, 254, 1, 0, 0, 0, 55, 256, 1, 0, 0, 0, - 57, 258, 1, 0, 0, 0, 59, 260, 1, 0, 0, 0, 61, 263, 1, 0, 0, 0, 63, - 265, 1, 0, 0, 0, 65, 267, 1, 0, 0, 0, 67, 270, 1, 0, 0, 0, 69, 282, - 1, 0, 0, 0, 71, 284, 1, 0, 0, 0, 73, 286, 1, 0, 0, 0, 75, 288, 1, - 0, 0, 0, 77, 290, 1, 0, 0, 0, 79, 292, 1, 0, 0, 0, 81, 294, 1, 0, - 0, 0, 83, 296, 1, 0, 0, 0, 85, 86, 7, 0, 0, 0, 86, 2, 1, 0, 0, 0, - 87, 88, 7, 1, 0, 0, 88, 4, 1, 0, 0, 0, 89, 90, 7, 2, 0, 0, 90, 6, - 1, 0, 0, 0, 91, 92, 7, 3, 0, 0, 92, 8, 1, 0, 0, 0, 93, 94, 5, 92, - 0, 0, 94, 10, 1, 0, 0, 0, 95, 98, 3, 1, 0, 0, 96, 98, 7, 4, 0, 0, - 97, 95, 1, 0, 0, 0, 97, 96, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 100, - 3, 5, 2, 0, 100, 101, 3, 5, 2, 0, 101, 102, 3, 5, 2, 0, 102, 109, - 1, 0, 0, 0, 103, 104, 7, 5, 0, 0, 104, 105, 7, 6, 0, 0, 105, 106, - 3, 5, 2, 0, 106, 107, 3, 5, 2, 0, 107, 109, 1, 0, 0, 0, 108, 97, 1, - 0, 0, 0, 108, 103, 1, 0, 0, 0, 109, 12, 1, 0, 0, 0, 110, 111, 7, 5, - 0, 0, 111, 112, 7, 7, 0, 0, 112, 113, 3, 5, 2, 0, 113, 114, 3, 5, - 2, 0, 114, 14, 1, 0, 0, 0, 115, 116, 7, 5, 0, 0, 116, 117, 7, 8, 0, - 0, 117, 118, 3, 5, 2, 0, 118, 119, 3, 5, 2, 0, 119, 16, 1, 0, 0, 0, - 120, 128, 3, 11, 5, 0, 121, 122, 3, 13, 6, 0, 122, 123, 5, 92, 0, - 0, 123, 124, 5, 117, 0, 0, 124, 125, 1, 0, 0, 0, 125, 126, 3, 15, - 7, 0, 126, 128, 1, 0, 0, 0, 127, 120, 1, 0, 0, 0, 127, 121, 1, 0, - 0, 0, 128, 18, 1, 0, 0, 0, 129, 130, 7, 9, 0, 0, 130, 20, 1, 0, 0, - 0, 131, 135, 7, 10, 0, 0, 132, 133, 5, 117, 0, 0, 133, 135, 3, 17, - 8, 0, 134, 131, 1, 0, 0, 0, 134, 132, 1, 0, 0, 0, 135, 22, 1, 0, 0, - 0, 136, 140, 5, 46, 0, 0, 137, 139, 3, 1, 0, 0, 138, 137, 1, 0, 0, - 0, 139, 142, 1, 0, 0, 0, 140, 138, 1, 0, 0, 0, 140, 141, 1, 0, 0, - 0, 141, 24, 1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 143, 145, 7, 11, 0, - 0, 144, 146, 7, 12, 0, 0, 145, 144, 1, 0, 0, 0, 145, 146, 1, 0, 0, - 0, 146, 150, 1, 0, 0, 0, 147, 149, 3, 1, 0, 0, 148, 147, 1, 0, 0, - 0, 149, 152, 1, 0, 0, 0, 150, 148, 1, 0, 0, 0, 150, 151, 1, 0, 0, - 0, 151, 26, 1, 0, 0, 0, 152, 150, 1, 0, 0, 0, 153, 156, 3, 7, 3, 0, - 154, 156, 7, 13, 0, 0, 155, 153, 1, 0, 0, 0, 155, 154, 1, 0, 0, 0, - 156, 28, 1, 0, 0, 0, 157, 160, 3, 1, 0, 0, 158, 160, 3, 27, 13, 0, - 159, 157, 1, 0, 0, 0, 159, 158, 1, 0, 0, 0, 160, 30, 1, 0, 0, 0, 161, - 170, 3, 19, 9, 0, 162, 170, 5, 39, 0, 0, 163, 164, 3, 9, 4, 0, 164, - 165, 5, 34, 0, 0, 165, 170, 1, 0, 0, 0, 166, 167, 3, 9, 4, 0, 167, - 168, 3, 21, 10, 0, 168, 170, 1, 0, 0, 0, 169, 161, 1, 0, 0, 0, 169, - 162, 1, 0, 0, 0, 169, 163, 1, 0, 0, 0, 169, 166, 1, 0, 0, 0, 170, - 32, 1, 0, 0, 0, 171, 180, 3, 19, 9, 0, 172, 180, 5, 34, 0, 0, 173, - 174, 3, 9, 4, 0, 174, 175, 5, 39, 0, 0, 175, 180, 1, 0, 0, 0, 176, - 177, 3, 9, 4, 0, 177, 178, 3, 21, 10, 0, 178, 180, 1, 0, 0, 0, 179, - 171, 1, 0, 0, 0, 179, 172, 1, 0, 0, 0, 179, 173, 1, 0, 0, 0, 179, - 176, 1, 0, 0, 0, 180, 34, 1, 0, 0, 0, 181, 185, 3, 79, 39, 0, 182, - 184, 3, 33, 16, 0, 183, 182, 1, 0, 0, 0, 184, 187, 1, 0, 0, 0, 185, - 183, 1, 0, 0, 0, 185, 186, 1, 0, 0, 0, 186, 188, 1, 0, 0, 0, 187, - 185, 1, 0, 0, 0, 188, 189, 3, 79, 39, 0, 189, 200, 1, 0, 0, 0, 190, - 194, 3, 81, 40, 0, 191, 193, 3, 31, 15, 0, 192, 191, 1, 0, 0, 0, 193, - 196, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195, - 197, 1, 0, 0, 0, 196, 194, 1, 0, 0, 0, 197, 198, 3, 81, 40, 0, 198, - 200, 1, 0, 0, 0, 199, 181, 1, 0, 0, 0, 199, 190, 1, 0, 0, 0, 200, - 36, 1, 0, 0, 0, 201, 213, 5, 48, 0, 0, 202, 204, 5, 45, 0, 0, 203, - 202, 1, 0, 0, 0, 203, 204, 1, 0, 0, 0, 204, 205, 1, 0, 0, 0, 205, - 209, 3, 3, 1, 0, 206, 208, 3, 1, 0, 0, 207, 206, 1, 0, 0, 0, 208, - 211, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, - 213, 1, 0, 0, 0, 211, 209, 1, 0, 0, 0, 212, 201, 1, 0, 0, 0, 212, - 203, 1, 0, 0, 0, 213, 38, 1, 0, 0, 0, 214, 218, 3, 37, 18, 0, 215, - 216, 5, 45, 0, 0, 216, 218, 5, 48, 0, 0, 217, 214, 1, 0, 0, 0, 217, - 215, 1, 0, 0, 0, 218, 220, 1, 0, 0, 0, 219, 221, 3, 23, 11, 0, 220, - 219, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 223, 1, 0, 0, 0, 222, - 224, 3, 25, 12, 0, 223, 222, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, 224, - 40, 1, 0, 0, 0, 225, 226, 5, 116, 0, 0, 226, 227, 5, 114, 0, 0, 227, - 228, 5, 117, 0, 0, 228, 235, 5, 101, 0, 0, 229, 230, 5, 102, 0, 0, - 230, 231, 5, 97, 0, 0, 231, 232, 5, 108, 0, 0, 232, 233, 5, 115, 0, - 0, 233, 235, 5, 101, 0, 0, 234, 225, 1, 0, 0, 0, 234, 229, 1, 0, 0, - 0, 235, 42, 1, 0, 0, 0, 236, 237, 5, 110, 0, 0, 237, 238, 5, 117, - 0, 0, 238, 239, 5, 108, 0, 0, 239, 240, 5, 108, 0, 0, 240, 44, 1, - 0, 0, 0, 241, 245, 3, 27, 13, 0, 242, 244, 3, 29, 14, 0, 243, 242, - 1, 0, 0, 0, 244, 247, 1, 0, 0, 0, 245, 243, 1, 0, 0, 0, 245, 246, - 1, 0, 0, 0, 246, 46, 1, 0, 0, 0, 247, 245, 1, 0, 0, 0, 248, 249, 5, - 36, 0, 0, 249, 48, 1, 0, 0, 0, 250, 251, 5, 42, 0, 0, 251, 50, 1, - 0, 0, 0, 252, 253, 5, 58, 0, 0, 253, 52, 1, 0, 0, 0, 254, 255, 5, - 63, 0, 0, 255, 54, 1, 0, 0, 0, 256, 257, 5, 33, 0, 0, 257, 56, 1, - 0, 0, 0, 258, 259, 5, 46, 0, 0, 259, 58, 1, 0, 0, 0, 260, 261, 5, - 46, 0, 0, 261, 262, 5, 46, 0, 0, 262, 60, 1, 0, 0, 0, 263, 264, 5, - 64, 0, 0, 264, 62, 1, 0, 0, 0, 265, 266, 5, 44, 0, 0, 266, 64, 1, - 0, 0, 0, 267, 268, 5, 124, 0, 0, 268, 269, 5, 124, 0, 0, 269, 66, - 1, 0, 0, 0, 270, 271, 5, 38, 0, 0, 271, 272, 5, 38, 0, 0, 272, 68, - 1, 0, 0, 0, 273, 274, 5, 61, 0, 0, 274, 283, 5, 61, 0, 0, 275, 276, - 5, 33, 0, 0, 276, 283, 5, 61, 0, 0, 277, 278, 5, 60, 0, 0, 278, 283, - 5, 61, 0, 0, 279, 280, 5, 62, 0, 0, 280, 283, 5, 61, 0, 0, 281, 283, - 7, 14, 0, 0, 282, 273, 1, 0, 0, 0, 282, 275, 1, 0, 0, 0, 282, 277, - 1, 0, 0, 0, 282, 279, 1, 0, 0, 0, 282, 281, 1, 0, 0, 0, 283, 70, 1, - 0, 0, 0, 284, 285, 5, 40, 0, 0, 285, 72, 1, 0, 0, 0, 286, 287, 5, - 41, 0, 0, 287, 74, 1, 0, 0, 0, 288, 289, 5, 91, 0, 0, 289, 76, 1, - 0, 0, 0, 290, 291, 5, 93, 0, 0, 291, 78, 1, 0, 0, 0, 292, 293, 5, - 39, 0, 0, 293, 80, 1, 0, 0, 0, 294, 295, 5, 34, 0, 0, 295, 82, 1, - 0, 0, 0, 296, 297, 7, 15, 0, 0, 297, 298, 1, 0, 0, 0, 298, 299, 6, - 41, 0, 0, 299, 84, 1, 0, 0, 0, 24, 0, 97, 108, 127, 134, 140, 145, - 150, 155, 159, 169, 179, 185, 194, 199, 203, 209, 212, 217, 220, 223, - 234, 245, 282, 1, 6, 0, 0]; - protected static $atn; - protected static $decisionToDFA; - protected static $sharedContextCache; - public function __construct(CharStream $input) - { - parent::__construct($input); - - self::initialize(); - - $this->interp = new LexerATNSimulator($this, self::$atn, self::$decisionToDFA, self::$sharedContextCache); - } - - private static function initialize(): void - { - if (self::$atn !== null) { - return; - } - - RuntimeMetaData::checkVersion('4.13.1', RuntimeMetaData::VERSION); - - $atn = (new ATNDeserializer())->deserialize(self::SERIALIZED_ATN); - - $decisionToDFA = []; - for ($i = 0, $count = $atn->getNumberOfDecisions(); $i < $count; $i++) { - $decisionToDFA[] = new DFA($atn->getDecisionState($i), $i); - } - - self::$atn = $atn; - self::$decisionToDFA = $decisionToDFA; - self::$sharedContextCache = new PredictionContextCache(); - } - - public static function vocabulary(): Vocabulary - { - static $vocabulary; - - return $vocabulary = $vocabulary ?? new VocabularyImpl(self::LITERAL_NAMES, self::SYMBOLIC_NAMES); - } - - public function getGrammarFileName(): string - { - return 'JsonPathLexer.g4'; - } - - public function getRuleNames(): array - { - return self::RULE_NAMES; - } - - public function getSerializedATN(): array - { - return self::SERIALIZED_ATN; - } - - /** - * @return array - */ - public function getChannelNames(): array - { - return self::CHANNEL_NAMES; - } - - /** - * @return array - */ - public function getModeNames(): array - { - return self::MODE_NAMES; - } - - public function getATN(): ATN - { - return self::$atn; - } - - public function getVocabulary(): Vocabulary - { - return self::vocabulary(); - } - } -} \ No newline at end of file diff --git a/src/JsonPath/Parser/JsonPathParser.php b/src/JsonPath/Parser/JsonPathParser.php deleted file mode 100644 index b75bfba..0000000 --- a/src/JsonPath/Parser/JsonPathParser.php +++ /dev/null @@ -1,3410 +0,0 @@ - - */ - public const RULE_NAMES = [ - 'query', 'rootQuery', 'relQuery', 'filterQuery', 'absSingularQuery', - 'relSingularQuery', 'singularQuery', 'logicalAndExpression', 'logicalOrExpression', - 'testExpression', 'comparisonExpression', 'parenExpression', 'basicExpression', - 'logicalExpression', 'functionExpression', 'nameSelector', 'wildcardSelector', - 'sliceSelector', 'indexSelector', 'filterSelector', 'selector', 'segment', - 'childSegment', 'descendantSegment', 'singularSegment', 'nameSegment', - 'indexSegment', 'literal', 'functionName', 'memberName', 'comparable', - 'functionArgument', 'bracketedSelection' - ]; - - /** - * @var array - */ - private const LITERAL_NAMES = [ - null, null, null, null, null, "'null'", null, "'\$'", "'*'", "':'", - "'?'", "'!'", "'.'", "'..'", "'@'", "','", "'||'", "'&&'", null, "'('", - "')'", "'['", "']'", "'''", "'\"'" - ]; - - /** - * @var array - */ - private const SYMBOLIC_NAMES = [ - null, "STRING", "INT", "NUMBER", "BOOLEAN", "NULL", "NAME", "OP_ROOT", - "OP_WILDCARD", "OP_SLICE", "OP_FILTER", "OP_NOT", "OP_PATH", "OP_RECURSE", - "OP_CURRENT", "OP_COMMA", "OP_OR", "OP_AND", "OP_COMP", "OP_PAREN_OPEN", - "OP_PAREN_CLOSE", "OP_BRACK_OPEN", "OP_BRACK_CLOSE", "OP_QUOTE_SINGLE", - "OP_QUOTE_DOUBLE", "S" - ]; - - private const SERIALIZED_ATN = - [4, 1, 25, 414, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, - 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, - 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, - 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, - 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, - 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, - 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 1, 0, 1, 0, - 1, 0, 1, 1, 1, 1, 5, 1, 72, 8, 1, 10, 1, 12, 1, 75, 9, 1, 1, 1, 5, - 1, 78, 8, 1, 10, 1, 12, 1, 81, 9, 1, 1, 2, 1, 2, 5, 2, 85, 8, 2, 10, - 2, 12, 2, 88, 9, 2, 1, 2, 5, 2, 91, 8, 2, 10, 2, 12, 2, 94, 9, 2, - 1, 3, 1, 3, 3, 3, 98, 8, 3, 1, 4, 1, 4, 5, 4, 102, 8, 4, 10, 4, 12, - 4, 105, 9, 4, 1, 4, 5, 4, 108, 8, 4, 10, 4, 12, 4, 111, 9, 4, 1, 5, - 1, 5, 5, 5, 115, 8, 5, 10, 5, 12, 5, 118, 9, 5, 1, 5, 5, 5, 121, 8, - 5, 10, 5, 12, 5, 124, 9, 5, 1, 6, 1, 6, 3, 6, 128, 8, 6, 1, 7, 1, - 7, 5, 7, 132, 8, 7, 10, 7, 12, 7, 135, 9, 7, 1, 7, 1, 7, 5, 7, 139, - 8, 7, 10, 7, 12, 7, 142, 9, 7, 1, 7, 5, 7, 145, 8, 7, 10, 7, 12, 7, - 148, 9, 7, 1, 8, 1, 8, 5, 8, 152, 8, 8, 10, 8, 12, 8, 155, 9, 8, 1, - 8, 1, 8, 5, 8, 159, 8, 8, 10, 8, 12, 8, 162, 9, 8, 1, 8, 5, 8, 165, - 8, 8, 10, 8, 12, 8, 168, 9, 8, 1, 9, 1, 9, 5, 9, 172, 8, 9, 10, 9, - 12, 9, 175, 9, 9, 3, 9, 177, 8, 9, 1, 9, 1, 9, 3, 9, 181, 8, 9, 1, - 10, 1, 10, 5, 10, 185, 8, 10, 10, 10, 12, 10, 188, 9, 10, 1, 10, 1, - 10, 5, 10, 192, 8, 10, 10, 10, 12, 10, 195, 9, 10, 1, 10, 1, 10, 1, - 11, 1, 11, 5, 11, 201, 8, 11, 10, 11, 12, 11, 204, 9, 11, 3, 11, 206, - 8, 11, 1, 11, 1, 11, 5, 11, 210, 8, 11, 10, 11, 12, 11, 213, 9, 11, - 1, 11, 1, 11, 5, 11, 217, 8, 11, 10, 11, 12, 11, 220, 9, 11, 1, 11, - 1, 11, 1, 12, 1, 12, 1, 12, 3, 12, 227, 8, 12, 1, 13, 1, 13, 1, 14, - 1, 14, 1, 14, 5, 14, 234, 8, 14, 10, 14, 12, 14, 237, 9, 14, 1, 14, - 1, 14, 5, 14, 241, 8, 14, 10, 14, 12, 14, 244, 9, 14, 1, 14, 1, 14, - 5, 14, 248, 8, 14, 10, 14, 12, 14, 251, 9, 14, 1, 14, 5, 14, 254, - 8, 14, 10, 14, 12, 14, 257, 9, 14, 3, 14, 259, 8, 14, 1, 14, 5, 14, - 262, 8, 14, 10, 14, 12, 14, 265, 9, 14, 1, 14, 1, 14, 1, 15, 1, 15, - 1, 16, 1, 16, 1, 17, 1, 17, 5, 17, 275, 8, 17, 10, 17, 12, 17, 278, - 9, 17, 3, 17, 280, 8, 17, 1, 17, 1, 17, 5, 17, 284, 8, 17, 10, 17, - 12, 17, 287, 9, 17, 1, 17, 1, 17, 5, 17, 291, 8, 17, 10, 17, 12, 17, - 294, 9, 17, 3, 17, 296, 8, 17, 1, 17, 1, 17, 5, 17, 300, 8, 17, 10, - 17, 12, 17, 303, 9, 17, 1, 17, 3, 17, 306, 8, 17, 3, 17, 308, 8, 17, - 1, 18, 1, 18, 1, 19, 1, 19, 5, 19, 314, 8, 19, 10, 19, 12, 19, 317, - 9, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 326, - 8, 20, 1, 21, 1, 21, 3, 21, 330, 8, 21, 1, 22, 1, 22, 1, 22, 1, 22, - 3, 22, 336, 8, 22, 3, 22, 338, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, - 3, 23, 344, 8, 23, 1, 24, 1, 24, 3, 24, 348, 8, 24, 1, 25, 1, 25, - 1, 25, 1, 25, 1, 25, 1, 25, 3, 25, 356, 8, 25, 1, 26, 1, 26, 1, 26, - 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, - 30, 3, 30, 371, 8, 30, 1, 31, 1, 31, 1, 31, 1, 31, 3, 31, 377, 8, - 31, 1, 32, 1, 32, 5, 32, 381, 8, 32, 10, 32, 12, 32, 384, 9, 32, 1, - 32, 1, 32, 5, 32, 388, 8, 32, 10, 32, 12, 32, 391, 9, 32, 1, 32, 1, - 32, 5, 32, 395, 8, 32, 10, 32, 12, 32, 398, 9, 32, 1, 32, 5, 32, 401, - 8, 32, 10, 32, 12, 32, 404, 9, 32, 1, 32, 5, 32, 407, 8, 32, 10, 32, - 12, 32, 410, 9, 32, 1, 32, 1, 32, 1, 32, 0, 0, 33, 0, 2, 4, 6, 8, - 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, - 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 0, 2, 1, 0, 1, 5, 1, 0, - 4, 6, 443, 0, 66, 1, 0, 0, 0, 2, 69, 1, 0, 0, 0, 4, 82, 1, 0, 0, 0, - 6, 97, 1, 0, 0, 0, 8, 99, 1, 0, 0, 0, 10, 112, 1, 0, 0, 0, 12, 127, - 1, 0, 0, 0, 14, 129, 1, 0, 0, 0, 16, 149, 1, 0, 0, 0, 18, 176, 1, - 0, 0, 0, 20, 182, 1, 0, 0, 0, 22, 205, 1, 0, 0, 0, 24, 226, 1, 0, - 0, 0, 26, 228, 1, 0, 0, 0, 28, 230, 1, 0, 0, 0, 30, 268, 1, 0, 0, - 0, 32, 270, 1, 0, 0, 0, 34, 279, 1, 0, 0, 0, 36, 309, 1, 0, 0, 0, - 38, 311, 1, 0, 0, 0, 40, 325, 1, 0, 0, 0, 42, 329, 1, 0, 0, 0, 44, - 337, 1, 0, 0, 0, 46, 339, 1, 0, 0, 0, 48, 347, 1, 0, 0, 0, 50, 355, - 1, 0, 0, 0, 52, 357, 1, 0, 0, 0, 54, 361, 1, 0, 0, 0, 56, 363, 1, - 0, 0, 0, 58, 365, 1, 0, 0, 0, 60, 370, 1, 0, 0, 0, 62, 376, 1, 0, - 0, 0, 64, 378, 1, 0, 0, 0, 66, 67, 3, 2, 1, 0, 67, 68, 5, 0, 0, 1, - 68, 1, 1, 0, 0, 0, 69, 79, 5, 7, 0, 0, 70, 72, 5, 25, 0, 0, 71, 70, - 1, 0, 0, 0, 72, 75, 1, 0, 0, 0, 73, 71, 1, 0, 0, 0, 73, 74, 1, 0, - 0, 0, 74, 76, 1, 0, 0, 0, 75, 73, 1, 0, 0, 0, 76, 78, 3, 42, 21, 0, - 77, 73, 1, 0, 0, 0, 78, 81, 1, 0, 0, 0, 79, 77, 1, 0, 0, 0, 79, 80, - 1, 0, 0, 0, 80, 3, 1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 82, 92, 5, 14, - 0, 0, 83, 85, 5, 25, 0, 0, 84, 83, 1, 0, 0, 0, 85, 88, 1, 0, 0, 0, - 86, 84, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 89, 1, 0, 0, 0, 88, 86, - 1, 0, 0, 0, 89, 91, 3, 42, 21, 0, 90, 86, 1, 0, 0, 0, 91, 94, 1, 0, - 0, 0, 92, 90, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 5, 1, 0, 0, 0, 94, - 92, 1, 0, 0, 0, 95, 98, 3, 4, 2, 0, 96, 98, 3, 2, 1, 0, 97, 95, 1, - 0, 0, 0, 97, 96, 1, 0, 0, 0, 98, 7, 1, 0, 0, 0, 99, 109, 5, 7, 0, - 0, 100, 102, 5, 25, 0, 0, 101, 100, 1, 0, 0, 0, 102, 105, 1, 0, 0, - 0, 103, 101, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 106, 1, 0, 0, - 0, 105, 103, 1, 0, 0, 0, 106, 108, 3, 48, 24, 0, 107, 103, 1, 0, 0, - 0, 108, 111, 1, 0, 0, 0, 109, 107, 1, 0, 0, 0, 109, 110, 1, 0, 0, - 0, 110, 9, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 112, 122, 5, 14, 0, 0, - 113, 115, 5, 25, 0, 0, 114, 113, 1, 0, 0, 0, 115, 118, 1, 0, 0, 0, - 116, 114, 1, 0, 0, 0, 116, 117, 1, 0, 0, 0, 117, 119, 1, 0, 0, 0, - 118, 116, 1, 0, 0, 0, 119, 121, 3, 48, 24, 0, 120, 116, 1, 0, 0, 0, - 121, 124, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 122, 123, 1, 0, 0, 0, - 123, 11, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 125, 128, 3, 10, 5, 0, - 126, 128, 3, 8, 4, 0, 127, 125, 1, 0, 0, 0, 127, 126, 1, 0, 0, 0, - 128, 13, 1, 0, 0, 0, 129, 146, 3, 24, 12, 0, 130, 132, 5, 25, 0, 0, - 131, 130, 1, 0, 0, 0, 132, 135, 1, 0, 0, 0, 133, 131, 1, 0, 0, 0, - 133, 134, 1, 0, 0, 0, 134, 136, 1, 0, 0, 0, 135, 133, 1, 0, 0, 0, - 136, 140, 5, 17, 0, 0, 137, 139, 5, 25, 0, 0, 138, 137, 1, 0, 0, 0, - 139, 142, 1, 0, 0, 0, 140, 138, 1, 0, 0, 0, 140, 141, 1, 0, 0, 0, - 141, 143, 1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 143, 145, 3, 24, 12, 0, - 144, 133, 1, 0, 0, 0, 145, 148, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, - 146, 147, 1, 0, 0, 0, 147, 15, 1, 0, 0, 0, 148, 146, 1, 0, 0, 0, 149, - 166, 3, 14, 7, 0, 150, 152, 5, 25, 0, 0, 151, 150, 1, 0, 0, 0, 152, - 155, 1, 0, 0, 0, 153, 151, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, - 156, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 156, 160, 5, 16, 0, 0, 157, - 159, 5, 25, 0, 0, 158, 157, 1, 0, 0, 0, 159, 162, 1, 0, 0, 0, 160, - 158, 1, 0, 0, 0, 160, 161, 1, 0, 0, 0, 161, 163, 1, 0, 0, 0, 162, - 160, 1, 0, 0, 0, 163, 165, 3, 14, 7, 0, 164, 153, 1, 0, 0, 0, 165, - 168, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, - 17, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 169, 173, 5, 11, 0, 0, 170, - 172, 5, 25, 0, 0, 171, 170, 1, 0, 0, 0, 172, 175, 1, 0, 0, 0, 173, - 171, 1, 0, 0, 0, 173, 174, 1, 0, 0, 0, 174, 177, 1, 0, 0, 0, 175, - 173, 1, 0, 0, 0, 176, 169, 1, 0, 0, 0, 176, 177, 1, 0, 0, 0, 177, - 180, 1, 0, 0, 0, 178, 181, 3, 6, 3, 0, 179, 181, 3, 28, 14, 0, 180, - 178, 1, 0, 0, 0, 180, 179, 1, 0, 0, 0, 181, 19, 1, 0, 0, 0, 182, 186, - 3, 60, 30, 0, 183, 185, 5, 25, 0, 0, 184, 183, 1, 0, 0, 0, 185, 188, - 1, 0, 0, 0, 186, 184, 1, 0, 0, 0, 186, 187, 1, 0, 0, 0, 187, 189, - 1, 0, 0, 0, 188, 186, 1, 0, 0, 0, 189, 193, 5, 18, 0, 0, 190, 192, - 5, 25, 0, 0, 191, 190, 1, 0, 0, 0, 192, 195, 1, 0, 0, 0, 193, 191, - 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 196, 1, 0, 0, 0, 195, 193, - 1, 0, 0, 0, 196, 197, 3, 60, 30, 0, 197, 21, 1, 0, 0, 0, 198, 202, - 5, 11, 0, 0, 199, 201, 5, 25, 0, 0, 200, 199, 1, 0, 0, 0, 201, 204, - 1, 0, 0, 0, 202, 200, 1, 0, 0, 0, 202, 203, 1, 0, 0, 0, 203, 206, - 1, 0, 0, 0, 204, 202, 1, 0, 0, 0, 205, 198, 1, 0, 0, 0, 205, 206, - 1, 0, 0, 0, 206, 207, 1, 0, 0, 0, 207, 211, 5, 19, 0, 0, 208, 210, - 5, 25, 0, 0, 209, 208, 1, 0, 0, 0, 210, 213, 1, 0, 0, 0, 211, 209, - 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 214, 1, 0, 0, 0, 213, 211, - 1, 0, 0, 0, 214, 218, 3, 26, 13, 0, 215, 217, 5, 25, 0, 0, 216, 215, - 1, 0, 0, 0, 217, 220, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, - 1, 0, 0, 0, 219, 221, 1, 0, 0, 0, 220, 218, 1, 0, 0, 0, 221, 222, - 5, 20, 0, 0, 222, 23, 1, 0, 0, 0, 223, 227, 3, 22, 11, 0, 224, 227, - 3, 20, 10, 0, 225, 227, 3, 18, 9, 0, 226, 223, 1, 0, 0, 0, 226, 224, - 1, 0, 0, 0, 226, 225, 1, 0, 0, 0, 227, 25, 1, 0, 0, 0, 228, 229, 3, - 16, 8, 0, 229, 27, 1, 0, 0, 0, 230, 231, 3, 56, 28, 0, 231, 235, 5, - 19, 0, 0, 232, 234, 5, 25, 0, 0, 233, 232, 1, 0, 0, 0, 234, 237, 1, - 0, 0, 0, 235, 233, 1, 0, 0, 0, 235, 236, 1, 0, 0, 0, 236, 258, 1, - 0, 0, 0, 237, 235, 1, 0, 0, 0, 238, 255, 3, 62, 31, 0, 239, 241, 5, - 25, 0, 0, 240, 239, 1, 0, 0, 0, 241, 244, 1, 0, 0, 0, 242, 240, 1, - 0, 0, 0, 242, 243, 1, 0, 0, 0, 243, 245, 1, 0, 0, 0, 244, 242, 1, - 0, 0, 0, 245, 249, 5, 15, 0, 0, 246, 248, 5, 25, 0, 0, 247, 246, 1, - 0, 0, 0, 248, 251, 1, 0, 0, 0, 249, 247, 1, 0, 0, 0, 249, 250, 1, - 0, 0, 0, 250, 252, 1, 0, 0, 0, 251, 249, 1, 0, 0, 0, 252, 254, 3, - 62, 31, 0, 253, 242, 1, 0, 0, 0, 254, 257, 1, 0, 0, 0, 255, 253, 1, - 0, 0, 0, 255, 256, 1, 0, 0, 0, 256, 259, 1, 0, 0, 0, 257, 255, 1, - 0, 0, 0, 258, 238, 1, 0, 0, 0, 258, 259, 1, 0, 0, 0, 259, 263, 1, - 0, 0, 0, 260, 262, 5, 25, 0, 0, 261, 260, 1, 0, 0, 0, 262, 265, 1, - 0, 0, 0, 263, 261, 1, 0, 0, 0, 263, 264, 1, 0, 0, 0, 264, 266, 1, - 0, 0, 0, 265, 263, 1, 0, 0, 0, 266, 267, 5, 20, 0, 0, 267, 29, 1, - 0, 0, 0, 268, 269, 5, 1, 0, 0, 269, 31, 1, 0, 0, 0, 270, 271, 5, 8, - 0, 0, 271, 33, 1, 0, 0, 0, 272, 276, 5, 2, 0, 0, 273, 275, 5, 25, - 0, 0, 274, 273, 1, 0, 0, 0, 275, 278, 1, 0, 0, 0, 276, 274, 1, 0, - 0, 0, 276, 277, 1, 0, 0, 0, 277, 280, 1, 0, 0, 0, 278, 276, 1, 0, - 0, 0, 279, 272, 1, 0, 0, 0, 279, 280, 1, 0, 0, 0, 280, 281, 1, 0, - 0, 0, 281, 285, 5, 9, 0, 0, 282, 284, 5, 25, 0, 0, 283, 282, 1, 0, - 0, 0, 284, 287, 1, 0, 0, 0, 285, 283, 1, 0, 0, 0, 285, 286, 1, 0, - 0, 0, 286, 295, 1, 0, 0, 0, 287, 285, 1, 0, 0, 0, 288, 292, 5, 2, - 0, 0, 289, 291, 5, 25, 0, 0, 290, 289, 1, 0, 0, 0, 291, 294, 1, 0, - 0, 0, 292, 290, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 296, 1, 0, - 0, 0, 294, 292, 1, 0, 0, 0, 295, 288, 1, 0, 0, 0, 295, 296, 1, 0, - 0, 0, 296, 307, 1, 0, 0, 0, 297, 305, 5, 9, 0, 0, 298, 300, 5, 25, - 0, 0, 299, 298, 1, 0, 0, 0, 300, 303, 1, 0, 0, 0, 301, 299, 1, 0, - 0, 0, 301, 302, 1, 0, 0, 0, 302, 304, 1, 0, 0, 0, 303, 301, 1, 0, - 0, 0, 304, 306, 5, 2, 0, 0, 305, 301, 1, 0, 0, 0, 305, 306, 1, 0, - 0, 0, 306, 308, 1, 0, 0, 0, 307, 297, 1, 0, 0, 0, 307, 308, 1, 0, - 0, 0, 308, 35, 1, 0, 0, 0, 309, 310, 5, 2, 0, 0, 310, 37, 1, 0, 0, - 0, 311, 315, 5, 10, 0, 0, 312, 314, 5, 25, 0, 0, 313, 312, 1, 0, 0, - 0, 314, 317, 1, 0, 0, 0, 315, 313, 1, 0, 0, 0, 315, 316, 1, 0, 0, - 0, 316, 318, 1, 0, 0, 0, 317, 315, 1, 0, 0, 0, 318, 319, 3, 26, 13, - 0, 319, 39, 1, 0, 0, 0, 320, 326, 3, 30, 15, 0, 321, 326, 3, 32, 16, - 0, 322, 326, 3, 34, 17, 0, 323, 326, 3, 36, 18, 0, 324, 326, 3, 38, - 19, 0, 325, 320, 1, 0, 0, 0, 325, 321, 1, 0, 0, 0, 325, 322, 1, 0, - 0, 0, 325, 323, 1, 0, 0, 0, 325, 324, 1, 0, 0, 0, 326, 41, 1, 0, 0, - 0, 327, 330, 3, 44, 22, 0, 328, 330, 3, 46, 23, 0, 329, 327, 1, 0, - 0, 0, 329, 328, 1, 0, 0, 0, 330, 43, 1, 0, 0, 0, 331, 338, 3, 64, - 32, 0, 332, 335, 5, 12, 0, 0, 333, 336, 3, 32, 16, 0, 334, 336, 3, - 58, 29, 0, 335, 333, 1, 0, 0, 0, 335, 334, 1, 0, 0, 0, 336, 338, 1, - 0, 0, 0, 337, 331, 1, 0, 0, 0, 337, 332, 1, 0, 0, 0, 338, 45, 1, 0, - 0, 0, 339, 343, 5, 13, 0, 0, 340, 344, 3, 64, 32, 0, 341, 344, 3, - 32, 16, 0, 342, 344, 3, 58, 29, 0, 343, 340, 1, 0, 0, 0, 343, 341, - 1, 0, 0, 0, 343, 342, 1, 0, 0, 0, 344, 47, 1, 0, 0, 0, 345, 348, 3, - 50, 25, 0, 346, 348, 3, 52, 26, 0, 347, 345, 1, 0, 0, 0, 347, 346, - 1, 0, 0, 0, 348, 49, 1, 0, 0, 0, 349, 350, 5, 21, 0, 0, 350, 351, - 3, 30, 15, 0, 351, 352, 5, 22, 0, 0, 352, 356, 1, 0, 0, 0, 353, 354, - 5, 12, 0, 0, 354, 356, 3, 58, 29, 0, 355, 349, 1, 0, 0, 0, 355, 353, - 1, 0, 0, 0, 356, 51, 1, 0, 0, 0, 357, 358, 5, 21, 0, 0, 358, 359, - 3, 36, 18, 0, 359, 360, 5, 22, 0, 0, 360, 53, 1, 0, 0, 0, 361, 362, - 7, 0, 0, 0, 362, 55, 1, 0, 0, 0, 363, 364, 5, 6, 0, 0, 364, 57, 1, - 0, 0, 0, 365, 366, 7, 1, 0, 0, 366, 59, 1, 0, 0, 0, 367, 371, 3, 54, - 27, 0, 368, 371, 3, 12, 6, 0, 369, 371, 3, 28, 14, 0, 370, 367, 1, - 0, 0, 0, 370, 368, 1, 0, 0, 0, 370, 369, 1, 0, 0, 0, 371, 61, 1, 0, - 0, 0, 372, 377, 3, 54, 27, 0, 373, 377, 3, 6, 3, 0, 374, 377, 3, 28, - 14, 0, 375, 377, 3, 26, 13, 0, 376, 372, 1, 0, 0, 0, 376, 373, 1, - 0, 0, 0, 376, 374, 1, 0, 0, 0, 376, 375, 1, 0, 0, 0, 377, 63, 1, 0, - 0, 0, 378, 382, 5, 21, 0, 0, 379, 381, 5, 25, 0, 0, 380, 379, 1, 0, - 0, 0, 381, 384, 1, 0, 0, 0, 382, 380, 1, 0, 0, 0, 382, 383, 1, 0, - 0, 0, 383, 385, 1, 0, 0, 0, 384, 382, 1, 0, 0, 0, 385, 402, 3, 40, - 20, 0, 386, 388, 5, 25, 0, 0, 387, 386, 1, 0, 0, 0, 388, 391, 1, 0, - 0, 0, 389, 387, 1, 0, 0, 0, 389, 390, 1, 0, 0, 0, 390, 392, 1, 0, - 0, 0, 391, 389, 1, 0, 0, 0, 392, 396, 5, 15, 0, 0, 393, 395, 5, 25, - 0, 0, 394, 393, 1, 0, 0, 0, 395, 398, 1, 0, 0, 0, 396, 394, 1, 0, - 0, 0, 396, 397, 1, 0, 0, 0, 397, 399, 1, 0, 0, 0, 398, 396, 1, 0, - 0, 0, 399, 401, 3, 40, 20, 0, 400, 389, 1, 0, 0, 0, 401, 404, 1, 0, - 0, 0, 402, 400, 1, 0, 0, 0, 402, 403, 1, 0, 0, 0, 403, 408, 1, 0, - 0, 0, 404, 402, 1, 0, 0, 0, 405, 407, 5, 25, 0, 0, 406, 405, 1, 0, - 0, 0, 407, 410, 1, 0, 0, 0, 408, 406, 1, 0, 0, 0, 408, 409, 1, 0, - 0, 0, 409, 411, 1, 0, 0, 0, 410, 408, 1, 0, 0, 0, 411, 412, 5, 22, - 0, 0, 412, 65, 1, 0, 0, 0, 55, 73, 79, 86, 92, 97, 103, 109, 116, - 122, 127, 133, 140, 146, 153, 160, 166, 173, 176, 180, 186, 193, 202, - 205, 211, 218, 226, 235, 242, 249, 255, 258, 263, 276, 279, 285, 292, - 295, 301, 305, 307, 315, 325, 329, 335, 337, 343, 347, 355, 370, 376, - 382, 389, 396, 402, 408]; - protected static $atn; - protected static $decisionToDFA; - protected static $sharedContextCache; - - public function __construct(TokenStream $input) - { - parent::__construct($input); - - self::initialize(); - - $this->interp = new ParserATNSimulator($this, self::$atn, self::$decisionToDFA, self::$sharedContextCache); - } - - private static function initialize(): void - { - if (self::$atn !== null) { - return; - } - - RuntimeMetaData::checkVersion('4.13.1', RuntimeMetaData::VERSION); - - $atn = (new ATNDeserializer())->deserialize(self::SERIALIZED_ATN); - - $decisionToDFA = []; - for ($i = 0, $count = $atn->getNumberOfDecisions(); $i < $count; $i++) { - $decisionToDFA[] = new DFA($atn->getDecisionState($i), $i); - } - - self::$atn = $atn; - self::$decisionToDFA = $decisionToDFA; - self::$sharedContextCache = new PredictionContextCache(); - } - - public function getGrammarFileName(): string - { - return "JsonPathParser.g4"; - } - - public function getRuleNames(): array - { - return self::RULE_NAMES; - } - - public function getSerializedATN(): array - { - return self::SERIALIZED_ATN; - } - - public function getATN(): ATN - { - return self::$atn; - } - - public function getVocabulary(): Vocabulary - { - static $vocabulary; - - return $vocabulary = $vocabulary ?? new VocabularyImpl(self::LITERAL_NAMES, self::SYMBOLIC_NAMES); - } - - /** - * @throws RecognitionException - */ - public function query(): Context\QueryContext - { - $localContext = new Context\QueryContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 0, self::RULE_query); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(66); - $this->rootQuery(); - $this->setState(67); - $this->match(self::EOF); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function rootQuery(): Context\RootQueryContext - { - $localContext = new Context\RootQueryContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 2, self::RULE_rootQuery); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(69); - $this->match(self::OP_ROOT); - $this->setState(79); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 1, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(73); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(70); - $this->match(self::S); - $this->setState(75); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(76); - $this->segment(); - } - - $this->setState(81); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 1, $this->ctx); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function relQuery(): Context\RelQueryContext - { - $localContext = new Context\RelQueryContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 4, self::RULE_relQuery); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(82); - $this->match(self::OP_CURRENT); - $this->setState(92); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 3, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(86); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(83); - $this->match(self::S); - $this->setState(88); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(89); - $this->segment(); - } - - $this->setState(94); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 3, $this->ctx); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function filterQuery(): Context\FilterQueryContext - { - $localContext = new Context\FilterQueryContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 6, self::RULE_filterQuery); - - try { - $this->setState(97); - $this->errorHandler->sync($this); - - switch ($this->input->LA(1)) { - case self::OP_CURRENT: - $this->enterOuterAlt($localContext, 1); - $this->setState(95); - $this->relQuery(); - break; - - case self::OP_ROOT: - $this->enterOuterAlt($localContext, 2); - $this->setState(96); - $this->rootQuery(); - break; - - default: - throw new NoViableAltException($this); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function absSingularQuery(): Context\AbsSingularQueryContext - { - $localContext = new Context\AbsSingularQueryContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 8, self::RULE_absSingularQuery); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(99); - $this->match(self::OP_ROOT); - $this->setState(109); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 6, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(103); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(100); - $this->match(self::S); - $this->setState(105); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(106); - $this->singularSegment(); - } - - $this->setState(111); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 6, $this->ctx); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function relSingularQuery(): Context\RelSingularQueryContext - { - $localContext = new Context\RelSingularQueryContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 10, self::RULE_relSingularQuery); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(112); - $this->match(self::OP_CURRENT); - $this->setState(122); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 8, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(116); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(113); - $this->match(self::S); - $this->setState(118); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(119); - $this->singularSegment(); - } - - $this->setState(124); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 8, $this->ctx); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function singularQuery(): Context\SingularQueryContext - { - $localContext = new Context\SingularQueryContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 12, self::RULE_singularQuery); - - try { - $this->setState(127); - $this->errorHandler->sync($this); - - switch ($this->input->LA(1)) { - case self::OP_CURRENT: - $this->enterOuterAlt($localContext, 1); - $this->setState(125); - $this->relSingularQuery(); - break; - - case self::OP_ROOT: - $this->enterOuterAlt($localContext, 2); - $this->setState(126); - $this->absSingularQuery(); - break; - - default: - throw new NoViableAltException($this); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function logicalAndExpression(): Context\LogicalAndExpressionContext - { - $localContext = new Context\LogicalAndExpressionContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 14, self::RULE_logicalAndExpression); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(129); - $this->basicExpression(); - $this->setState(146); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 12, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(133); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(130); - $this->match(self::S); - $this->setState(135); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(136); - $this->match(self::OP_AND); - $this->setState(140); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(137); - $this->match(self::S); - $this->setState(142); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(143); - $this->basicExpression(); - } - - $this->setState(148); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 12, $this->ctx); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function logicalOrExpression(): Context\LogicalOrExpressionContext - { - $localContext = new Context\LogicalOrExpressionContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 16, self::RULE_logicalOrExpression); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(149); - $this->logicalAndExpression(); - $this->setState(166); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 15, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(153); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(150); - $this->match(self::S); - $this->setState(155); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(156); - $this->match(self::OP_OR); - $this->setState(160); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(157); - $this->match(self::S); - $this->setState(162); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(163); - $this->logicalAndExpression(); - } - - $this->setState(168); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 15, $this->ctx); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function testExpression(): Context\TestExpressionContext - { - $localContext = new Context\TestExpressionContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 18, self::RULE_testExpression); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(176); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - - if ($_la === self::OP_NOT) { - $this->setState(169); - $this->match(self::OP_NOT); - $this->setState(173); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(170); - $this->match(self::S); - $this->setState(175); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - } - $this->setState(180); - $this->errorHandler->sync($this); - - switch ($this->input->LA(1)) { - case self::OP_ROOT: - case self::OP_CURRENT: - $this->setState(178); - $this->filterQuery(); - break; - - case self::NAME: - $this->setState(179); - $this->functionExpression(); - break; - - default: - throw new NoViableAltException($this); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function comparisonExpression(): Context\ComparisonExpressionContext - { - $localContext = new Context\ComparisonExpressionContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 20, self::RULE_comparisonExpression); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(182); - $localContext->left = $this->comparable(); - $this->setState(186); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(183); - $this->match(self::S); - $this->setState(188); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(189); - $this->match(self::OP_COMP); - $this->setState(193); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(190); - $this->match(self::S); - $this->setState(195); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(196); - $localContext->right = $this->comparable(); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function parenExpression(): Context\ParenExpressionContext - { - $localContext = new Context\ParenExpressionContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 22, self::RULE_parenExpression); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(205); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - - if ($_la === self::OP_NOT) { - $this->setState(198); - $this->match(self::OP_NOT); - $this->setState(202); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(199); - $this->match(self::S); - $this->setState(204); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - } - $this->setState(207); - $this->match(self::OP_PAREN_OPEN); - $this->setState(211); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(208); - $this->match(self::S); - $this->setState(213); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(214); - $this->logicalExpression(); - $this->setState(218); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(215); - $this->match(self::S); - $this->setState(220); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(221); - $this->match(self::OP_PAREN_CLOSE); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function basicExpression(): Context\BasicExpressionContext - { - $localContext = new Context\BasicExpressionContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 24, self::RULE_basicExpression); - - try { - $this->setState(226); - $this->errorHandler->sync($this); - - switch ($this->getInterpreter()->adaptivePredict($this->input, 25, $this->ctx)) { - case 1: - $this->enterOuterAlt($localContext, 1); - $this->setState(223); - $this->parenExpression(); - break; - - case 2: - $this->enterOuterAlt($localContext, 2); - $this->setState(224); - $this->comparisonExpression(); - break; - - case 3: - $this->enterOuterAlt($localContext, 3); - $this->setState(225); - $this->testExpression(); - break; - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function logicalExpression(): Context\LogicalExpressionContext - { - $localContext = new Context\LogicalExpressionContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 26, self::RULE_logicalExpression); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(228); - $this->logicalOrExpression(); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function functionExpression(): Context\FunctionExpressionContext - { - $localContext = new Context\FunctionExpressionContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 28, self::RULE_functionExpression); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(230); - $this->functionName(); - $this->setState(231); - $this->match(self::OP_PAREN_OPEN); - $this->setState(235); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 26, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(232); - $this->match(self::S); - } - - $this->setState(237); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 26, $this->ctx); - } - $this->setState(258); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - - if (((($_la) & ~0x3f) === 0 && ((1 << $_la) & 542974) !== 0)) { - $this->setState(238); - $this->functionArgument(); - $this->setState(255); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 29, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(242); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(239); - $this->match(self::S); - $this->setState(244); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(245); - $this->match(self::OP_COMMA); - $this->setState(249); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(246); - $this->match(self::S); - $this->setState(251); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(252); - $this->functionArgument(); - } - - $this->setState(257); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 29, $this->ctx); - } - } - $this->setState(263); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(260); - $this->match(self::S); - $this->setState(265); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(266); - $this->match(self::OP_PAREN_CLOSE); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function nameSelector(): Context\NameSelectorContext - { - $localContext = new Context\NameSelectorContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 30, self::RULE_nameSelector); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(268); - $this->match(self::STRING); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function wildcardSelector(): Context\WildcardSelectorContext - { - $localContext = new Context\WildcardSelectorContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 32, self::RULE_wildcardSelector); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(270); - $this->match(self::OP_WILDCARD); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function sliceSelector(): Context\SliceSelectorContext - { - $localContext = new Context\SliceSelectorContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 34, self::RULE_sliceSelector); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(279); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - - if ($_la === self::INT) { - $this->setState(272); - $localContext->sliceStart = $this->match(self::INT); - $this->setState(276); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(273); - $this->match(self::S); - $this->setState(278); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - } - $this->setState(281); - $this->match(self::OP_SLICE); - $this->setState(285); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 34, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(282); - $this->match(self::S); - } - - $this->setState(287); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 34, $this->ctx); - } - $this->setState(295); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - - if ($_la === self::INT) { - $this->setState(288); - $localContext->sliceEnd = $this->match(self::INT); - $this->setState(292); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 35, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(289); - $this->match(self::S); - } - - $this->setState(294); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 35, $this->ctx); - } - } - $this->setState(307); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - - if ($_la === self::OP_SLICE) { - $this->setState(297); - $this->match(self::OP_SLICE); - $this->setState(305); - $this->errorHandler->sync($this); - - switch ($this->getInterpreter()->adaptivePredict($this->input, 38, $this->ctx)) { - case 1: - $this->setState(301); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(298); - $this->match(self::S); - $this->setState(303); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(304); - $localContext->sliceStep = $this->match(self::INT); - break; - } - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function indexSelector(): Context\IndexSelectorContext - { - $localContext = new Context\IndexSelectorContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 36, self::RULE_indexSelector); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(309); - $this->match(self::INT); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function filterSelector(): Context\FilterSelectorContext - { - $localContext = new Context\FilterSelectorContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 38, self::RULE_filterSelector); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(311); - $this->match(self::OP_FILTER); - $this->setState(315); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(312); - $this->match(self::S); - $this->setState(317); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(318); - $this->logicalExpression(); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function selector(): Context\SelectorContext - { - $localContext = new Context\SelectorContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 40, self::RULE_selector); - - try { - $this->setState(325); - $this->errorHandler->sync($this); - - switch ($this->getInterpreter()->adaptivePredict($this->input, 41, $this->ctx)) { - case 1: - $this->enterOuterAlt($localContext, 1); - $this->setState(320); - $this->nameSelector(); - break; - - case 2: - $this->enterOuterAlt($localContext, 2); - $this->setState(321); - $this->wildcardSelector(); - break; - - case 3: - $this->enterOuterAlt($localContext, 3); - $this->setState(322); - $this->sliceSelector(); - break; - - case 4: - $this->enterOuterAlt($localContext, 4); - $this->setState(323); - $this->indexSelector(); - break; - - case 5: - $this->enterOuterAlt($localContext, 5); - $this->setState(324); - $this->filterSelector(); - break; - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function segment(): Context\SegmentContext - { - $localContext = new Context\SegmentContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 42, self::RULE_segment); - - try { - $this->setState(329); - $this->errorHandler->sync($this); - - switch ($this->input->LA(1)) { - case self::OP_PATH: - case self::OP_BRACK_OPEN: - $this->enterOuterAlt($localContext, 1); - $this->setState(327); - $this->childSegment(); - break; - - case self::OP_RECURSE: - $this->enterOuterAlt($localContext, 2); - $this->setState(328); - $this->descendantSegment(); - break; - - default: - throw new NoViableAltException($this); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function childSegment(): Context\ChildSegmentContext - { - $localContext = new Context\ChildSegmentContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 44, self::RULE_childSegment); - - try { - $this->setState(337); - $this->errorHandler->sync($this); - - switch ($this->input->LA(1)) { - case self::OP_BRACK_OPEN: - $this->enterOuterAlt($localContext, 1); - $this->setState(331); - $this->bracketedSelection(); - break; - - case self::OP_PATH: - $this->enterOuterAlt($localContext, 2); - $this->setState(332); - $this->match(self::OP_PATH); - $this->setState(335); - $this->errorHandler->sync($this); - - switch ($this->input->LA(1)) { - case self::OP_WILDCARD: - $this->setState(333); - $this->wildcardSelector(); - break; - - case self::BOOLEAN: - case self::NULL: - case self::NAME: - $this->setState(334); - $this->memberName(); - break; - - default: - throw new NoViableAltException($this); - } - break; - - default: - throw new NoViableAltException($this); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function descendantSegment(): Context\DescendantSegmentContext - { - $localContext = new Context\DescendantSegmentContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 46, self::RULE_descendantSegment); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(339); - $this->match(self::OP_RECURSE); - $this->setState(343); - $this->errorHandler->sync($this); - - switch ($this->input->LA(1)) { - case self::OP_BRACK_OPEN: - $this->setState(340); - $this->bracketedSelection(); - break; - - case self::OP_WILDCARD: - $this->setState(341); - $this->wildcardSelector(); - break; - - case self::BOOLEAN: - case self::NULL: - case self::NAME: - $this->setState(342); - $this->memberName(); - break; - - default: - throw new NoViableAltException($this); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function singularSegment(): Context\SingularSegmentContext - { - $localContext = new Context\SingularSegmentContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 48, self::RULE_singularSegment); - - try { - $this->setState(347); - $this->errorHandler->sync($this); - - switch ($this->getInterpreter()->adaptivePredict($this->input, 46, $this->ctx)) { - case 1: - $this->enterOuterAlt($localContext, 1); - $this->setState(345); - $this->nameSegment(); - break; - - case 2: - $this->enterOuterAlt($localContext, 2); - $this->setState(346); - $this->indexSegment(); - break; - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function nameSegment(): Context\NameSegmentContext - { - $localContext = new Context\NameSegmentContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 50, self::RULE_nameSegment); - - try { - $this->setState(355); - $this->errorHandler->sync($this); - - switch ($this->input->LA(1)) { - case self::OP_BRACK_OPEN: - $this->enterOuterAlt($localContext, 1); - $this->setState(349); - $this->match(self::OP_BRACK_OPEN); - $this->setState(350); - $this->nameSelector(); - $this->setState(351); - $this->match(self::OP_BRACK_CLOSE); - break; - - case self::OP_PATH: - $this->enterOuterAlt($localContext, 2); - $this->setState(353); - $this->match(self::OP_PATH); - $this->setState(354); - $this->memberName(); - break; - - default: - throw new NoViableAltException($this); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function indexSegment(): Context\IndexSegmentContext - { - $localContext = new Context\IndexSegmentContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 52, self::RULE_indexSegment); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(357); - $this->match(self::OP_BRACK_OPEN); - $this->setState(358); - $this->indexSelector(); - $this->setState(359); - $this->match(self::OP_BRACK_CLOSE); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function literal(): Context\LiteralContext - { - $localContext = new Context\LiteralContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 54, self::RULE_literal); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(361); - - $_la = $this->input->LA(1); - - if (!(((($_la) & ~0x3f) === 0 && ((1 << $_la) & 62) !== 0))) { - $this->errorHandler->recoverInline($this); - } else { - if ($this->input->LA(1) === Token::EOF) { - $this->matchedEOF = true; - } - - $this->errorHandler->reportMatch($this); - $this->consume(); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function functionName(): Context\FunctionNameContext - { - $localContext = new Context\FunctionNameContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 56, self::RULE_functionName); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(363); - $this->match(self::NAME); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function memberName(): Context\MemberNameContext - { - $localContext = new Context\MemberNameContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 58, self::RULE_memberName); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(365); - - $_la = $this->input->LA(1); - - if (!(((($_la) & ~0x3f) === 0 && ((1 << $_la) & 112) !== 0))) { - $this->errorHandler->recoverInline($this); - } else { - if ($this->input->LA(1) === Token::EOF) { - $this->matchedEOF = true; - } - - $this->errorHandler->reportMatch($this); - $this->consume(); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function comparable(): Context\ComparableContext - { - $localContext = new Context\ComparableContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 60, self::RULE_comparable); - - try { - $this->setState(370); - $this->errorHandler->sync($this); - - switch ($this->input->LA(1)) { - case self::STRING: - case self::INT: - case self::NUMBER: - case self::BOOLEAN: - case self::NULL: - $this->enterOuterAlt($localContext, 1); - $this->setState(367); - $this->literal(); - break; - - case self::OP_ROOT: - case self::OP_CURRENT: - $this->enterOuterAlt($localContext, 2); - $this->setState(368); - $this->singularQuery(); - break; - - case self::NAME: - $this->enterOuterAlt($localContext, 3); - $this->setState(369); - $this->functionExpression(); - break; - - default: - throw new NoViableAltException($this); - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function functionArgument(): Context\FunctionArgumentContext - { - $localContext = new Context\FunctionArgumentContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 62, self::RULE_functionArgument); - - try { - $this->setState(376); - $this->errorHandler->sync($this); - - switch ($this->getInterpreter()->adaptivePredict($this->input, 49, $this->ctx)) { - case 1: - $this->enterOuterAlt($localContext, 1); - $this->setState(372); - $this->literal(); - break; - - case 2: - $this->enterOuterAlt($localContext, 2); - $this->setState(373); - $this->filterQuery(); - break; - - case 3: - $this->enterOuterAlt($localContext, 3); - $this->setState(374); - $this->functionExpression(); - break; - - case 4: - $this->enterOuterAlt($localContext, 4); - $this->setState(375); - $this->logicalExpression(); - break; - } - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - - /** - * @throws RecognitionException - */ - public function bracketedSelection(): Context\BracketedSelectionContext - { - $localContext = new Context\BracketedSelectionContext($this->ctx, $this->getState()); - - $this->enterRule($localContext, 64, self::RULE_bracketedSelection); - - try { - $this->enterOuterAlt($localContext, 1); - $this->setState(378); - $this->match(self::OP_BRACK_OPEN); - $this->setState(382); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(379); - $this->match(self::S); - $this->setState(384); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(385); - $this->selector(); - $this->setState(402); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 53, $this->ctx); - - while ($alt !== 2 && $alt !== ATN::INVALID_ALT_NUMBER) { - if ($alt === 1) { - $this->setState(389); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(386); - $this->match(self::S); - $this->setState(391); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(392); - $this->match(self::OP_COMMA); - $this->setState(396); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(393); - $this->match(self::S); - $this->setState(398); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(399); - $this->selector(); - } - - $this->setState(404); - $this->errorHandler->sync($this); - - $alt = $this->getInterpreter()->adaptivePredict($this->input, 53, $this->ctx); - } - $this->setState(408); - $this->errorHandler->sync($this); - - $_la = $this->input->LA(1); - while ($_la === self::S) { - $this->setState(405); - $this->match(self::S); - $this->setState(410); - $this->errorHandler->sync($this); - $_la = $this->input->LA(1); - } - $this->setState(411); - $this->match(self::OP_BRACK_CLOSE); - } catch (RecognitionException $exception) { - $localContext->exception = $exception; - $this->errorHandler->reportError($this, $exception); - $this->errorHandler->recover($this, $exception); - } finally { - $this->exitRule(); - } - - return $localContext; - } - } -} - -namespace JsonScout\JsonPath\Parser\Context { - use Antlr\Antlr4\Runtime\ParserRuleContext; - use Antlr\Antlr4\Runtime\Token; - use Antlr\Antlr4\Runtime\Tree\ParseTreeVisitor; - use Antlr\Antlr4\Runtime\Tree\TerminalNode; - use Antlr\Antlr4\Runtime\Tree\ParseTreeListener; - use JsonScout\JsonPath\Parser\JsonPathParser; - use JsonScout\JsonPath\Parser\JsonPathParserVisitor; - - class QueryContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_query; - } - - public function rootQuery(): ?RootQueryContext - { - return $this->getTypedRuleContext(RootQueryContext::class, 0); - } - - public function EOF(): ?TerminalNode - { - return $this->getToken(JsonPathParser::EOF, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitQuery($this); - } - - return $visitor->visitChildren($this); - } - } - - class RootQueryContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_rootQuery; - } - - public function OP_ROOT(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_ROOT, 0); - } - - /** - * @return array|SegmentContext|null - */ - public function segment(?int $index = null) - { - if ($index === null) { - return $this->getTypedRuleContexts(SegmentContext::class); - } - - return $this->getTypedRuleContext(SegmentContext::class, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitRootQuery($this); - } - - return $visitor->visitChildren($this); - } - } - - class RelQueryContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_relQuery; - } - - public function OP_CURRENT(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_CURRENT, 0); - } - - /** - * @return array|SegmentContext|null - */ - public function segment(?int $index = null) - { - if ($index === null) { - return $this->getTypedRuleContexts(SegmentContext::class); - } - - return $this->getTypedRuleContext(SegmentContext::class, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitRelQuery($this); - } - - return $visitor->visitChildren($this); - } - } - - class FilterQueryContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_filterQuery; - } - - public function relQuery(): ?RelQueryContext - { - return $this->getTypedRuleContext(RelQueryContext::class, 0); - } - - public function rootQuery(): ?RootQueryContext - { - return $this->getTypedRuleContext(RootQueryContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitFilterQuery($this); - } - - return $visitor->visitChildren($this); - } - } - - class AbsSingularQueryContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_absSingularQuery; - } - - public function OP_ROOT(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_ROOT, 0); - } - - /** - * @return array|SingularSegmentContext|null - */ - public function singularSegment(?int $index = null) - { - if ($index === null) { - return $this->getTypedRuleContexts(SingularSegmentContext::class); - } - - return $this->getTypedRuleContext(SingularSegmentContext::class, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitAbsSingularQuery($this); - } - - return $visitor->visitChildren($this); - } - } - - class RelSingularQueryContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_relSingularQuery; - } - - public function OP_CURRENT(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_CURRENT, 0); - } - - /** - * @return array|SingularSegmentContext|null - */ - public function singularSegment(?int $index = null) - { - if ($index === null) { - return $this->getTypedRuleContexts(SingularSegmentContext::class); - } - - return $this->getTypedRuleContext(SingularSegmentContext::class, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitRelSingularQuery($this); - } - - return $visitor->visitChildren($this); - } - } - - class SingularQueryContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_singularQuery; - } - - public function relSingularQuery(): ?RelSingularQueryContext - { - return $this->getTypedRuleContext(RelSingularQueryContext::class, 0); - } - - public function absSingularQuery(): ?AbsSingularQueryContext - { - return $this->getTypedRuleContext(AbsSingularQueryContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitSingularQuery($this); - } - - return $visitor->visitChildren($this); - } - } - - class LogicalAndExpressionContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_logicalAndExpression; - } - - /** - * @return array|BasicExpressionContext|null - */ - public function basicExpression(?int $index = null) - { - if ($index === null) { - return $this->getTypedRuleContexts(BasicExpressionContext::class); - } - - return $this->getTypedRuleContext(BasicExpressionContext::class, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function OP_AND(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::OP_AND); - } - - return $this->getToken(JsonPathParser::OP_AND, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitLogicalAndExpression($this); - } - - return $visitor->visitChildren($this); - } - } - - class LogicalOrExpressionContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_logicalOrExpression; - } - - /** - * @return array|LogicalAndExpressionContext|null - */ - public function logicalAndExpression(?int $index = null) - { - if ($index === null) { - return $this->getTypedRuleContexts(LogicalAndExpressionContext::class); - } - - return $this->getTypedRuleContext(LogicalAndExpressionContext::class, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function OP_OR(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::OP_OR); - } - - return $this->getToken(JsonPathParser::OP_OR, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitLogicalOrExpression($this); - } - - return $visitor->visitChildren($this); - } - } - - class TestExpressionContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_testExpression; - } - - public function filterQuery(): ?FilterQueryContext - { - return $this->getTypedRuleContext(FilterQueryContext::class, 0); - } - - public function functionExpression(): ?FunctionExpressionContext - { - return $this->getTypedRuleContext(FunctionExpressionContext::class, 0); - } - - public function OP_NOT(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_NOT, 0); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitTestExpression($this); - } - - return $visitor->visitChildren($this); - } - } - - class ComparisonExpressionContext extends ParserRuleContext - { - /** - * @var ComparableContext|null $left - */ - public $left; - - /** - * @var ComparableContext|null $right - */ - public $right; - - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_comparisonExpression; - } - - public function OP_COMP(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_COMP, 0); - } - - /** - * @return array|ComparableContext|null - */ - public function comparable(?int $index = null) - { - if ($index === null) { - return $this->getTypedRuleContexts(ComparableContext::class); - } - - return $this->getTypedRuleContext(ComparableContext::class, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitComparisonExpression($this); - } - - return $visitor->visitChildren($this); - } - } - - class ParenExpressionContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_parenExpression; - } - - public function OP_PAREN_OPEN(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_PAREN_OPEN, 0); - } - - public function logicalExpression(): ?LogicalExpressionContext - { - return $this->getTypedRuleContext(LogicalExpressionContext::class, 0); - } - - public function OP_PAREN_CLOSE(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_PAREN_CLOSE, 0); - } - - public function OP_NOT(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_NOT, 0); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitParenExpression($this); - } - - return $visitor->visitChildren($this); - } - } - - class BasicExpressionContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_basicExpression; - } - - public function parenExpression(): ?ParenExpressionContext - { - return $this->getTypedRuleContext(ParenExpressionContext::class, 0); - } - - public function comparisonExpression(): ?ComparisonExpressionContext - { - return $this->getTypedRuleContext(ComparisonExpressionContext::class, 0); - } - - public function testExpression(): ?TestExpressionContext - { - return $this->getTypedRuleContext(TestExpressionContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitBasicExpression($this); - } - - return $visitor->visitChildren($this); - } - } - - class LogicalExpressionContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_logicalExpression; - } - - public function logicalOrExpression(): ?LogicalOrExpressionContext - { - return $this->getTypedRuleContext(LogicalOrExpressionContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitLogicalExpression($this); - } - - return $visitor->visitChildren($this); - } - } - - class FunctionExpressionContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_functionExpression; - } - - public function functionName(): ?FunctionNameContext - { - return $this->getTypedRuleContext(FunctionNameContext::class, 0); - } - - public function OP_PAREN_OPEN(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_PAREN_OPEN, 0); - } - - public function OP_PAREN_CLOSE(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_PAREN_CLOSE, 0); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - /** - * @return array|FunctionArgumentContext|null - */ - public function functionArgument(?int $index = null) - { - if ($index === null) { - return $this->getTypedRuleContexts(FunctionArgumentContext::class); - } - - return $this->getTypedRuleContext(FunctionArgumentContext::class, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function OP_COMMA(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::OP_COMMA); - } - - return $this->getToken(JsonPathParser::OP_COMMA, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitFunctionExpression($this); - } - - return $visitor->visitChildren($this); - } - } - - class NameSelectorContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_nameSelector; - } - - public function STRING(): ?TerminalNode - { - return $this->getToken(JsonPathParser::STRING, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitNameSelector($this); - } - - return $visitor->visitChildren($this); - } - } - - class WildcardSelectorContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_wildcardSelector; - } - - public function OP_WILDCARD(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_WILDCARD, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitWildcardSelector($this); - } - - return $visitor->visitChildren($this); - } - } - - class SliceSelectorContext extends ParserRuleContext - { - /** - * @var Token|null $sliceStart - */ - public $sliceStart; - - /** - * @var Token|null $sliceEnd - */ - public $sliceEnd; - - /** - * @var Token|null $sliceStep - */ - public $sliceStep; - - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_sliceSelector; - } - - /** - * @return array|TerminalNode|null - */ - public function OP_SLICE(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::OP_SLICE); - } - - return $this->getToken(JsonPathParser::OP_SLICE, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function INT(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::INT); - } - - return $this->getToken(JsonPathParser::INT, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitSliceSelector($this); - } - - return $visitor->visitChildren($this); - } - } - - class IndexSelectorContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_indexSelector; - } - - public function INT(): ?TerminalNode - { - return $this->getToken(JsonPathParser::INT, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitIndexSelector($this); - } - - return $visitor->visitChildren($this); - } - } - - class FilterSelectorContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_filterSelector; - } - - public function OP_FILTER(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_FILTER, 0); - } - - public function logicalExpression(): ?LogicalExpressionContext - { - return $this->getTypedRuleContext(LogicalExpressionContext::class, 0); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitFilterSelector($this); - } - - return $visitor->visitChildren($this); - } - } - - class SelectorContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_selector; - } - - public function nameSelector(): ?NameSelectorContext - { - return $this->getTypedRuleContext(NameSelectorContext::class, 0); - } - - public function wildcardSelector(): ?WildcardSelectorContext - { - return $this->getTypedRuleContext(WildcardSelectorContext::class, 0); - } - - public function sliceSelector(): ?SliceSelectorContext - { - return $this->getTypedRuleContext(SliceSelectorContext::class, 0); - } - - public function indexSelector(): ?IndexSelectorContext - { - return $this->getTypedRuleContext(IndexSelectorContext::class, 0); - } - - public function filterSelector(): ?FilterSelectorContext - { - return $this->getTypedRuleContext(FilterSelectorContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitSelector($this); - } - - return $visitor->visitChildren($this); - } - } - - class SegmentContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_segment; - } - - public function childSegment(): ?ChildSegmentContext - { - return $this->getTypedRuleContext(ChildSegmentContext::class, 0); - } - - public function descendantSegment(): ?DescendantSegmentContext - { - return $this->getTypedRuleContext(DescendantSegmentContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitSegment($this); - } - - return $visitor->visitChildren($this); - } - } - - class ChildSegmentContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_childSegment; - } - - public function bracketedSelection(): ?BracketedSelectionContext - { - return $this->getTypedRuleContext(BracketedSelectionContext::class, 0); - } - - public function OP_PATH(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_PATH, 0); - } - - public function wildcardSelector(): ?WildcardSelectorContext - { - return $this->getTypedRuleContext(WildcardSelectorContext::class, 0); - } - - public function memberName(): ?MemberNameContext - { - return $this->getTypedRuleContext(MemberNameContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitChildSegment($this); - } - - return $visitor->visitChildren($this); - } - } - - class DescendantSegmentContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_descendantSegment; - } - - public function OP_RECURSE(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_RECURSE, 0); - } - - public function bracketedSelection(): ?BracketedSelectionContext - { - return $this->getTypedRuleContext(BracketedSelectionContext::class, 0); - } - - public function wildcardSelector(): ?WildcardSelectorContext - { - return $this->getTypedRuleContext(WildcardSelectorContext::class, 0); - } - - public function memberName(): ?MemberNameContext - { - return $this->getTypedRuleContext(MemberNameContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitDescendantSegment($this); - } - - return $visitor->visitChildren($this); - } - } - - class SingularSegmentContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_singularSegment; - } - - public function nameSegment(): ?NameSegmentContext - { - return $this->getTypedRuleContext(NameSegmentContext::class, 0); - } - - public function indexSegment(): ?IndexSegmentContext - { - return $this->getTypedRuleContext(IndexSegmentContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitSingularSegment($this); - } - - return $visitor->visitChildren($this); - } - } - - class NameSegmentContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_nameSegment; - } - - public function OP_BRACK_OPEN(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_BRACK_OPEN, 0); - } - - public function nameSelector(): ?NameSelectorContext - { - return $this->getTypedRuleContext(NameSelectorContext::class, 0); - } - - public function OP_BRACK_CLOSE(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_BRACK_CLOSE, 0); - } - - public function OP_PATH(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_PATH, 0); - } - - public function memberName(): ?MemberNameContext - { - return $this->getTypedRuleContext(MemberNameContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitNameSegment($this); - } - - return $visitor->visitChildren($this); - } - } - - class IndexSegmentContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_indexSegment; - } - - public function OP_BRACK_OPEN(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_BRACK_OPEN, 0); - } - - public function indexSelector(): ?IndexSelectorContext - { - return $this->getTypedRuleContext(IndexSelectorContext::class, 0); - } - - public function OP_BRACK_CLOSE(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_BRACK_CLOSE, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitIndexSegment($this); - } - - return $visitor->visitChildren($this); - } - } - - class LiteralContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_literal; - } - - public function INT(): ?TerminalNode - { - return $this->getToken(JsonPathParser::INT, 0); - } - - public function NUMBER(): ?TerminalNode - { - return $this->getToken(JsonPathParser::NUMBER, 0); - } - - public function STRING(): ?TerminalNode - { - return $this->getToken(JsonPathParser::STRING, 0); - } - - public function BOOLEAN(): ?TerminalNode - { - return $this->getToken(JsonPathParser::BOOLEAN, 0); - } - - public function NULL(): ?TerminalNode - { - return $this->getToken(JsonPathParser::NULL, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitLiteral($this); - } - - return $visitor->visitChildren($this); - } - } - - class FunctionNameContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_functionName; - } - - public function NAME(): ?TerminalNode - { - return $this->getToken(JsonPathParser::NAME, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitFunctionName($this); - } - - return $visitor->visitChildren($this); - } - } - - class MemberNameContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_memberName; - } - - public function NAME(): ?TerminalNode - { - return $this->getToken(JsonPathParser::NAME, 0); - } - - public function NULL(): ?TerminalNode - { - return $this->getToken(JsonPathParser::NULL, 0); - } - - public function BOOLEAN(): ?TerminalNode - { - return $this->getToken(JsonPathParser::BOOLEAN, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitMemberName($this); - } - - return $visitor->visitChildren($this); - } - } - - class ComparableContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_comparable; - } - - public function literal(): ?LiteralContext - { - return $this->getTypedRuleContext(LiteralContext::class, 0); - } - - public function singularQuery(): ?SingularQueryContext - { - return $this->getTypedRuleContext(SingularQueryContext::class, 0); - } - - public function functionExpression(): ?FunctionExpressionContext - { - return $this->getTypedRuleContext(FunctionExpressionContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitComparable($this); - } - - return $visitor->visitChildren($this); - } - } - - class FunctionArgumentContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_functionArgument; - } - - public function literal(): ?LiteralContext - { - return $this->getTypedRuleContext(LiteralContext::class, 0); - } - - public function filterQuery(): ?FilterQueryContext - { - return $this->getTypedRuleContext(FilterQueryContext::class, 0); - } - - public function functionExpression(): ?FunctionExpressionContext - { - return $this->getTypedRuleContext(FunctionExpressionContext::class, 0); - } - - public function logicalExpression(): ?LogicalExpressionContext - { - return $this->getTypedRuleContext(LogicalExpressionContext::class, 0); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitFunctionArgument($this); - } - - return $visitor->visitChildren($this); - } - } - - class BracketedSelectionContext extends ParserRuleContext - { - public function __construct(?ParserRuleContext $parent, ?int $invokingState = null) - { - parent::__construct($parent, $invokingState); - } - - public function getRuleIndex(): int - { - return JsonPathParser::RULE_bracketedSelection; - } - - public function OP_BRACK_OPEN(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_BRACK_OPEN, 0); - } - - /** - * @return array|SelectorContext|null - */ - public function selector(?int $index = null) - { - if ($index === null) { - return $this->getTypedRuleContexts(SelectorContext::class); - } - - return $this->getTypedRuleContext(SelectorContext::class, $index); - } - - public function OP_BRACK_CLOSE(): ?TerminalNode - { - return $this->getToken(JsonPathParser::OP_BRACK_CLOSE, 0); - } - - /** - * @return array|TerminalNode|null - */ - public function S(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::S); - } - - return $this->getToken(JsonPathParser::S, $index); - } - - /** - * @return array|TerminalNode|null - */ - public function OP_COMMA(?int $index = null) - { - if ($index === null) { - return $this->getTokens(JsonPathParser::OP_COMMA); - } - - return $this->getToken(JsonPathParser::OP_COMMA, $index); - } - - public function accept(ParseTreeVisitor $visitor): mixed - { - if ($visitor instanceof JsonPathParserVisitor) { - return $visitor->visitBracketedSelection($this); - } - - return $visitor->visitChildren($this); - } - } -} \ No newline at end of file diff --git a/src/JsonPath/Parser/JsonPathParserVisitor.php b/src/JsonPath/Parser/JsonPathParserVisitor.php deleted file mode 100644 index e586047..0000000 --- a/src/JsonPath/Parser/JsonPathParserVisitor.php +++ /dev/null @@ -1,327 +0,0 @@ -expression->process($root_node, new NodesType([ $root_node ])); - } -} \ No newline at end of file diff --git a/src/JsonPath/Parser/JsonPathVisitor.php b/src/JsonPath/Parser/JsonPathVisitor.php deleted file mode 100644 index 0cc5321..0000000 --- a/src/JsonPath/Parser/JsonPathVisitor.php +++ /dev/null @@ -1,570 +0,0 @@ - - */ -class JsonPathVisitor - extends AbstractParseTreeVisitor - implements JsonPathParserVisitor -{ -#region helpers - //================================================================================================================== - /** - * @param Context\SegmentContext[]|Context\SingularSegmentContext[] $segmentArray - */ - private function queryFromSegments(array $segmentArray, bool $relative) - : Expression\QueryExpression - { - $segments = []; - - foreach ($segmentArray as $segment_ctx) - { - $segment = $this->visit($segment_ctx); - assert($segment instanceof Expression\SegmentExpression); - - $segments[] = $segment; - } - - return new Expression\QueryExpression($segments, $relative); - } - - /** - * @param Context\BracketedSelectionContext|Context\WildcardSelectorContext|Context\MemberNameContext $context - */ - private function segmentFromSelectors(mixed $context, bool $recursive) - : Expression\SegmentExpression - { - if ($context instanceof Context\BracketedSelectionContext) - { - /** @var ISegmentSelector[] $result */ - $result = $this->visit($context); - assert(is_array($result)); - return new Expression\SegmentExpression($result, $recursive); - } - - $result = $this->visit($context); - assert($result instanceof Expression\ISegmentSelector); - - return new Expression\SegmentExpression([ $result ], $recursive); - } - - /** - * @param Context\LogicalAndExpressionContext[]|Context\BasicExpressionContext[] $children - */ - private function logicalExpressionFromChildren(array $children, Expression\LogicalOperation $opType) - : Expression\AbstractLogicalExpression - { - $result = []; - - foreach ($children as $expr) - { - $operation = $this->visit($expr); - assert($operation instanceof Expression\AbstractLogicalExpression); - $result[] = $operation; - } - - if (count($result) === 1) - { - return $result[0]; - } - - return new Expression\LogicalExpression($opType, $result); - } -#endregion helpers -#region query - #[\Override] - public function visitQuery(Context\QueryContext $context) - : JsonPathQuery - { - assert($context->rootQuery() !== null); - - $result = $this->visit($context->rootQuery()); - assert($result instanceof Expression\QueryExpression); - - return new JsonPathQuery($result); - } - - #[\Override] - public function visitRootQuery(Context\RootQueryContext $context) - : Expression\QueryExpression - { - $segments = $context->segment(); - assert(is_array($segments)); - return $this->queryFromSegments($segments, false); - } - - #[\Override] - public function visitRelQuery(Context\RelQueryContext $context) - : Expression\QueryExpression - { - $segments = $context->segment(); - assert(is_array($segments)); - return $this->queryFromSegments($segments, true); - } - - #[\Override] - public function visitAbsSingularQuery(Context\AbsSingularQueryContext $context) - : Expression\QueryExpression - { - $segments = $context->singularSegment(); - assert(is_array($segments)); - return $this->queryFromSegments($segments, false); - } - - #[\Override] - public function visitRelSingularQuery(Context\RelSingularQueryContext $context) - : Expression\QueryExpression - { - $segments = $context->singularSegment(); - assert(is_array($segments)); - return $this->queryFromSegments($segments, true); - } - - #[\Override] - public function visitFilterQuery(Context\FilterQueryContext $context) - : Expression\QueryExpression - { - $actor = ($context->relQuery() ?? $context->rootQuery()); - assert($actor !== null); - - $result = $this->visit($actor); - assert($result instanceof Expression\QueryExpression); - - return $result; - } - - #[\Override] - public function visitSingularQuery(Context\SingularQueryContext $context) - : Expression\QueryExpression - { - $actor = ($context->relSingularQuery() ?? $context->absSingularQuery()); - assert($actor !== null); - - $result = $this->visit($actor); - assert($result instanceof Expression\QueryExpression); - - return $result; - } -#endregion query -#region selector - #[\Override] - public function visitNameSelector(Context\NameSelectorContext $context) - : Expression\ChildSelectorExpression - { - $string = $context->STRING()?->getText(); - assert($string !== null); - return new Expression\ChildSelectorExpression(substr($string, 1, -1)); - } - - #[\Override] - public function visitWildcardSelector(Context\WildcardSelectorContext $context) - : Expression\WildcardSelectorExpression - { - return new Expression\WildcardSelectorExpression(); - } - - #[\Override] - public function visitSliceSelector(Context\SliceSelectorContext $context) - : Expression\SliceSelectorExpression - { - - $start = (isset($context->sliceStart) ? (int) $context->sliceStart->getText() : null); - $end = (isset($context->sliceEnd) ? (int) $context->sliceEnd ->getText() : null); - $step = (isset($context->sliceStep) ? (int) $context->sliceStep ->getText() : 1); - - return new Expression\SliceSelectorExpression($start, $end, $step); - } - - #[\Override] - public function visitIndexSelector(Context\IndexSelectorContext $context) - : Expression\ChildSelectorExpression - { - $string = $context->INT()?->getText(); - assert($string !== null); - return new Expression\ChildSelectorExpression((int) $string); - } - - #[\Override] - public function visitFilterSelector(Context\FilterSelectorContext $context) - : Expression\FilterSelectorExpression - { - assert($context->logicalExpression() !== null); - - $filter = $this->visit($context->logicalExpression()); - assert($filter instanceof Expression\AbstractLogicalExpression); - - return new Expression\FilterSelectorExpression($filter); - } - - #[\Override] - public function visitSelector(Context\SelectorContext $context) - : Expression\ISegmentSelector - { - $child = $context->getChild(0); - assert($child !== null); - - $result = $child->accept($this); - assert($result instanceof Expression\ISegmentSelector); - - return $result; - } - - /** @return Expression\ISegmentSelector[] */ - #[\Override] - public function visitBracketedSelection(Context\BracketedSelectionContext $context) - : array - { - assert(is_array($context->selector())); - $result = []; - - foreach ($context->selector() as $selector) - { - $expression = $this->visit($selector); - assert($expression instanceof Expression\ISegmentSelector); - - $result[] = $expression; - } - - return $result; - } -#endregion selector -#region segment - #[\Override] - public function visitDescendantSegment(Context\DescendantSegmentContext $context) - : Expression\SegmentExpression - { - $actor = ($context->memberName() ?? $context->bracketedSelection() ?? $context->wildcardSelector()); - assert($actor !== null); - return $this->segmentFromSelectors($actor, true); - } - - #[\Override] - public function visitChildSegment(Context\ChildSegmentContext $context) - : Expression\SegmentExpression - { - $actor = ($context->memberName() ?? $context->bracketedSelection() ?? $context->wildcardSelector()); - assert($actor !== null); - return $this->segmentFromSelectors($actor, false); - } - - #[\Override] - public function visitSegment(Context\SegmentContext $context) - : Expression\SegmentExpression - { - $actor = ($context->childSegment() ?? $context->descendantSegment()); - assert($actor !== null); - - $result = $this->visit($actor); - assert($result instanceof Expression\SegmentExpression); - - return $result; - } - - #[\Override] - public function visitNameSegment(Context\NameSegmentContext $context) - : Expression\ChildSelectorExpression - { - $actor = ($context->memberName() ?? $context->nameSelector()); - assert($actor !== null); - - $result = $this->visit($actor); - assert($result instanceof Expression\ChildSelectorExpression); - - return $result; - } - - #[\Override] - public function visitMemberName(Context\MemberNameContext $context) - : Expression\ChildSelectorExpression - { - $name = ($context->NAME() ?? $context->NULL() ?? $context->BOOLEAN())?->getText(); - assert($name !== null); - return new Expression\ChildSelectorExpression($name); - } - - #[\Override] - public function visitIndexSegment(Context\IndexSegmentContext $context) - : Expression\ChildSelectorExpression - { - assert($context->indexSelector() !== null); - - $result = $this->visit($context->indexSelector()); - assert($result instanceof Expression\ChildSelectorExpression); - - return $result; - } - - #[\Override] - public function visitSingularSegment(Context\SingularSegmentContext $context) - : Expression\SegmentExpression - { - $actor = ($context->nameSegment() ?? $context->indexSegment()); - assert($actor !== null); - - $result = $this->visit($actor); - assert($result instanceof Expression\ChildSelectorExpression); - - return new Expression\SegmentExpression([ $result ], false); - } -#endregion segment -#region filter - /** - * @throws ExceptionFunctionExtension - */ - #[\Override] - public function visitTestExpression(Context\TestExpressionContext $context) - : Expression\TestExpression - { - $actor = ($context->filterQuery() ?? $context->functionExpression()); - assert($actor !== null); - - $result = $this->visit($actor); - assert($result instanceof Expression\ITestable); - - return new Expression\TestExpression($result, ($context->OP_NOT() !== null)); - } - - /** - * @throws ExceptionFunctionExtension - */ - #[\Override] - public function visitComparisonExpression(Context\ComparisonExpressionContext $context) - : Expression\ComparisonExpression - { - assert($context->left !== null && $context->right !== null); - - $left = $this->visit($context->left); - $right = $this->visit($context->right); - - assert($left instanceof Expression\IComparable && $right instanceof Expression\IComparable); - - $op = $context->OP_COMP()?->getText(); - assert($op !== null); - - return new Expression\ComparisonExpression(Expression\ComparisonOperation::fromString($op), $left, $right); - } - - #[\Override] - public function visitParenExpression(Context\ParenExpressionContext $context) - : Expression\AbstractLogicalExpression - { - $actor = $context->logicalExpression(); - assert($actor !== null); - - $result = $this->visit($actor); - assert($result instanceof Expression\AbstractLogicalExpression); - - return ($context->OP_NOT() !== null - ? new Expression\NegationExpression($result) - : $result); - } - - #[\Override] - public function visitLogicalAndExpression(Context\LogicalAndExpressionContext $context) - : Expression\AbstractLogicalExpression - { - $actor = $context->basicExpression(); - assert(is_array($actor)); - - return $this->logicalExpressionFromChildren($actor, Expression\LogicalOperation::And); - } - - #[\Override] - public function visitLogicalOrExpression(Context\LogicalOrExpressionContext $context) - : Expression\AbstractLogicalExpression - { - $actor = $context->logicalAndExpression(); - assert(is_array($actor)); - - return $this->logicalExpressionFromChildren($actor, Expression\LogicalOperation::Or); - } - - #[\Override] - public function visitLogicalExpression(Context\LogicalExpressionContext $context) - : Expression\AbstractLogicalExpression - { - $actor = $context->logicalOrExpression(); - assert($actor !== null); - - $op = $this->visit($actor); - assert($op instanceof Expression\AbstractLogicalExpression); - - return $op; - } - - #[\Override] - public function visitBasicExpression(Context\BasicExpressionContext $context) - : Expression\AbstractLogicalExpression - { - $child = $context->getChild(0); - assert($child !== null); - - $result = $child->accept($this); - assert($result instanceof Expression\AbstractLogicalExpression); - - return $result; - } - - #[\Override] - public function visitLiteral(Context\LiteralContext $context) - : Expression\Literal - { - if ($context->NUMBER() !== null || $context->INT() !== null) - { - $number_string = ($context->NUMBER() ?? $context->INT())?->getText(); - assert($number_string !== null); - - if (preg_match('/[eE.]/', $number_string) === 1) - { - $result = (float) $number_string; - } - else - { - $result = (int) $number_string; - } - } - else if ($context->STRING() !== null) - { - $string = $context->STRING()->getText(); - assert($string !== null); - - $result = substr($string, 1, -1); - } - else if ($context->BOOLEAN() !== null) - { - $boolean = $context->BOOLEAN()->getText(); - assert($boolean === 'false' || $boolean === 'true'); - - $result = ($boolean === 'true'); - } - else if ($context->NULL() !== null) - { - assert($context->NULL()->getText() === 'null'); - $result = null; - } - else - { - trigger_error("literal could not be processed, got '{$context->getText()}'", E_USER_ERROR); - } - - return new Expression\Literal(new ValueType($result)); - } - - #[\Override] - public function visitComparable(Context\ComparableContext $context) - : Expression\IComparable - { - $actor = ($context->singularQuery() ?? $context->functionExpression() ?? $context->literal()); - assert($actor !== null); - - $result = $this->visit($actor); - assert($result instanceof Expression\IComparable); - - return $result; - } -#endregion filter -#region function - /** - * @throws ExceptionFunctionExtension - */ - #[\Override] - public function visitFunctionExpression(Context\FunctionExpressionContext $context) - : Expression\FunctionExpression|Expression\Literal - { - $name_ctx = $context->functionName(); - assert($name_ctx !== null); - - $name = $this->visit($name_ctx); - assert(is_string($name)); - - $args_ctx = $context->functionArgument(); - assert(is_array($args_ctx)); - - $arguments = []; - - foreach ($args_ctx as $arg) - { - $result = $this->visit($arg); - assert($result instanceof Expression\IFunctionParameter); - - $arguments[] = $result; - } - - return new Expression\FunctionExpression($arguments, $name); - } - - /** - * @throws ExceptionSyntaxError - */ - #[\Override] - public function visitFunctionName(Context\FunctionNameContext $context) - : string - { - $name = $context->NAME()?->getText(); - assert($name !== null); - - if (preg_match("/^[a-z][a-z0-9_]*$/", $name) === false) - { - $token = $context->getStart(); - assert($token !== null); - - $line = $token->getLine(); - $column = $token->getCharPositionInLine(); - - throw new ExceptionSyntaxError( - "function name '$name' contains invalid characters, must start with a lowercase letter and only " - ."contain lowercase letters, digits and underscores", - ErrorCode::JSON_PATH_INVALID_FUNCTION_NAME, - $line, - $column - ); - } - - return $name; - } - - #[\Override] - public function visitFunctionArgument(Context\FunctionArgumentContext $context) - : Expression\IFunctionParameter - { - $child = $context->getChild(0); - assert($child !== null); - - $result = $child->accept($this); - assert($result instanceof Expression\IFunctionParameter); - - return $result; - } -#endregion function -} diff --git a/src/JsonPath/Parser/NormalisedParser.php b/src/JsonPath/Parser/NormalisedParser.php deleted file mode 100644 index 0594c62..0000000 --- a/src/JsonPath/Parser/NormalisedParser.php +++ /dev/null @@ -1,341 +0,0 @@ -= $end || $chars[$j] === ']') - { - break; - } - - $selector .= $chars[$j]; - } - - throw new ExceptionSyntaxError( - "invalid selector '$selector', expected either a string or an index, did you mean to quote it?", - ErrorCode::JSON_PATH_SYNTAX_ERROR, - -1, - ($i + 2)); - } - - return new JsonPathQuery(new QueryExpression($segments, false)); - } - - //================================================================================================================== - /** - * @param string[] $chars - */ - private static function consumeString(int &$i, array $chars, string &$output) - : true|string - { - $len = count($chars); - $end = ($len - 1); - $start = $i; - - ++$i; - - for (;; ++$i) - { - if ($i >= $end) - { - throw new ExceptionSyntaxError( - 'unterminated string "'.implode(array_slice($chars, $start, $end)).'"', - ErrorCode::JSON_PATH_SYNTAX_ERROR, - -1, - ($start + 1)); - } - - $c = $chars[$i]; - - if ($c === '\'') - { - break; - } - - if ($c === '\\') - { - $output .= $c; - $c = $chars[++$i]; - - // Is Unicode code point - if ($c === 'u') - { - if ($i === $end) - { - return '\\u'; - } - - $output .= $c; - $c = $chars[++$i]; - - if ($c !== '0') - { - return "\\u$c"; - } - - if ($i === $end) - { - return '\\u0'; - } - - $output .= $c; - $c = $chars[++$i]; - - if ($c !== '0') - { - return "\\u0$c"; - } - - if ($i === $end) - { - return '\\u00'; - } - - $output .= $c; - $c = $chars[++$i]; - - if ($c === '0') - { - if ($i === $end) - { - return '\\u000'; - } - - $output .= $c; - $c = $chars[++$i]; - $c_ord = mb_ord($c); - - if ( ($c_ord >= mb_ord("0") && $c_ord <= mb_ord("7")) - || $c === "\u{000b}" || $c === 'e' || $c === 'f') - { - $output .= $c; - continue; - } - - return "\\u000$c"; - } - else if ($c === '1') - { - if ($i === $end) - { - return '\\u001'; - } - - $output .= $c; - $c = $chars[++$i]; - $c_ord = mb_ord($c); - - if (ctype_digit($c) || ($c_ord >= mb_ord("a") && $c_ord <= mb_ord("f"))) - { - $output .= $c; - continue; - } - - return "\\u001$c"; - } - else - { - return "\\u00$c"; - } - } - - // Is character escape - if (!in_array($c, ['b','f','n','r','t','\'','\\'], true)) - { - return "\\$c"; - } - - $output .= $c; - continue; - } - - $c_ord = mb_ord($c); - - if ( ($c_ord >= mb_ord(" ") && $c_ord <= mb_ord("&")) - || ($c_ord >= mb_ord("(") && $c_ord <= mb_ord("[")) - || ($c_ord >= mb_ord("]") && $c_ord <= mb_ord("\u{D7FF}")) - || ($c_ord >= mb_ord("\u{E000}") && $c_ord <= mb_ord("\u{10FFFF}"))) - { - $output .= $c; - continue; - } - - return $c; - } - - return true; - } -} diff --git a/src/JsonPath/Parser/SyntaxErrorListener.php b/src/JsonPath/Parser/SyntaxErrorListener.php deleted file mode 100644 index 0fa23ba..0000000 --- a/src/JsonPath/Parser/SyntaxErrorListener.php +++ /dev/null @@ -1,49 +0,0 @@ - An array containing all the objects - */ - public static function toFlatMap(mixed &$data, bool $urlEncoded = false) - : array - { - if (!is_array($data) && !is_object($data)) - { - return [ - '' => $data - ]; - } - - $queue = [ ($urlEncoded ? '#' : '') => &$data ]; - $map = $queue; - - while (count($queue) > 0) - { - $node = reset($queue); - $ref = key($queue); - unset($queue[$ref]); - - foreach ((array) $node as $key => &$child) - { - $ptr = $ref . '/' . JsonPointerParser::escapeReference($key, $urlEncoded); - $map[$ptr] = &$child; - - if (is_array($child) || is_object($child)) - { - $queue[$ptr] = &$child; - } - } - } - - return $map; - } - - //================================================================================================================== - - /** - * @param JSONValue $data - * @param string[] $references - * @return JSONValue - * @throws ExceptionNullPointer - * @throws ExceptionAccessViolation - */ - private static function &resolveDocument(mixed &$data, array $references) - : mixed - { - $context = &$data; - $pointer = ''; - - foreach ($references as $ref) - { - $pointer .= "/$ref"; - - if (is_array($context)) - { - if ($ref === '-') - { - throw new ExceptionNullPointer($pointer); - } - - if (preg_match("/^0|[1-9][0-9]*$/", $ref) === 1) - { - if (!array_key_exists($ref, $context)) - { - throw new ExceptionNullPointer($pointer); - } - - $context = &$context[$ref]; - continue; - } - - throw new ExceptionAccessViolation( - "invalid array index '$ref'", - ErrorCode::JSON_POINTER_INVALID_INDEX); - } - - if (is_object($context)) - { - if (!property_exists($context, $ref)) - { - throw new ExceptionNullPointer($pointer); - } - - $context = &$context->{$ref}; // @phpstan-ignore property.dynamicName - continue; - } - - throw new ExceptionAccessViolation( - "invalid reference token '$ref', can only access elements/members of arrays/objects", - ErrorCode::JSON_POINTER_NO_DATA_STRUCTURE); - } - - return $context; - } - - //================================================================================================================== - /** @var string[] $references */ - private array $references = []; - - //================================================================================================================== - /** - * Constructs a new JSON pointer object. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/JsonPointer%23lang-php - * @param string $pointer The pointer expression - * @param ?self $parent The optional parent pointer, from which to start - * @throws ExceptionSyntaxError Thrown whenever there was a syntax error in the pointer expression - */ - public function __construct( - public readonly string $pointer, - ?self $parent = null - ) - { - // @phpstan-ignore nullsafe.neverNull - $this->references = array_merge($parent?->references ?? [], JsonPointerParser::parse($pointer)); - } - - //------------------------------------------------------------------------------------------------------------------ - /** - * Gets a reference to the value pointed to by this pointer from the given JSON object. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/get%23lang-php - * @param JSONValue $data The JSON data to search - * @return JSONValue A reference to a value pointed to by this pointer of object $data - * @throws ExceptionAccessViolation Thrown whenever a member is accessed that can not be accessed in a certain way - * @throws ExceptionNullPointer Thrown whenever a member is accessed that does not exist - */ - public function &get(mixed &$data) - : mixed - { - return self::resolveDocument($data, $this->references); - } - - /** - * Sets the value pointed to by this pointer from the given JSON data to the given new value. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/set%23lang-php - * @param JSONValue $data The JSON data to search - * @param JSONValue $value The new value to set - * @throws ExceptionAccessViolation Thrown whenever a member is accessed that can not be accessed in a certain way - * @throws ExceptionNullPointer Thrown whenever a member is accessed that does not exist - */ - public function set(mixed &$data, mixed $value) - : void - { - if ($this->isRootPointer()) - { - $data = $value; - } - else - { - $reference_token = $this->getUnqualifiedName(); - - if ($reference_token === '-') - { - $parent = &$this->internalGetParent($data); - - if (is_array($parent)) - { - $parent[] = $value; - return; - } - } - - $target = &self::resolveDocument($data, $this->references); - $target = $value; - } - } - - /** - * Adds a new value to an array or object if it doesn't already exist, otherwise overrides it. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/add%23lang-php - * @param JSONValue $data The JSON data to search - * @param JSONValue $value The new value to add - * @throws ExceptionAccessViolation Thrown whenever a member is accessed that can not be accessed in a certain way - * @throws ExceptionNullPointer Thrown whenever a member is accessed that does not exist - */ - public function add(mixed &$data, mixed $value) - : void - { - if ($this->isRootPointer()) - { - $data = $value; - } - else - { - $reference_token = $this->getUnqualifiedName(); - $parent = &$this->internalGetParent($data); - - if (is_object($parent)) - { - $parent->{$reference_token} = $value; // @phpstan-ignore property.dynamicName - } - else if (is_array($parent)) - { - if ($reference_token === '-') - { - $parent[] = $value; - } - else if (preg_match("/^0|[1-9][0-9]*$/", $reference_token) === 1) - { - $index = (int) $reference_token; - $size = count($parent); - - if ($index > $size) - { - throw new ExceptionAccessViolation( - "array index $reference_token out of bounds ([0, $size]", - ErrorCode::JSON_POINTER_INDEX_OUT_OF_BOUNDS); - } - - array_splice($parent, $index, 0, $value); - } - else - { - throw new ExceptionAccessViolation( - "invalid array index '$reference_token'", - ErrorCode::JSON_POINTER_INVALID_INDEX); - } - } - else - { - $path = implode('/', array_slice(explode('/', $this->pointer), 0, -1)); - throw new ExceptionAccessViolation( - "parent '$path' is neither a JSON array nor a JSON object", - ErrorCode::JSON_POINTER_NO_DATA_STRUCTURE); - } - } - } - - /** - * Removes the value pointed to by this pointer from the given JSON data. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/remove%23lang-php - * @param JSONValue $data The JSON data to search - * @return JSONValue The removed value - * - * @throws ExceptionAccessViolation Thrown whenever a member is accessed that can not be accessed in a certain way - * @throws ExceptionNullPointer Thrown whenever a member is accessed that does not exist - * @throws ExceptionInvalidOperation Thrown whenever this operation was done on the root or on a pseudo-element - */ - public function remove(mixed &$data) - : mixed - { - if ($this->isRootPointer()) - { - throw new ExceptionInvalidOperation("root cannot be removed", ErrorCode::JSON_POINTER_ROOT_REMOVAL); - } - - $reference_token = $this->getUnqualifiedName(); - $parent = &self::resolveDocument($data, array_slice($this->references, 0, -1)); - - if (is_object($parent)) - { - if (!property_exists($parent, $reference_token)) - { - throw new ExceptionNullPointer($this->pointer); - } - - $value = $parent->{$reference_token}; // @phpstan-ignore property.dynamicName - unset($parent->{$reference_token}); // @phpstan-ignore property.dynamicName - - return $value; - } - else if (is_array($parent)) - { - if ($reference_token === '-') - { - $path = implode('/', array_slice(explode('/', $this->pointer), 0, -1)); - throw new ExceptionInvalidOperation( - "cannot remove pseudo array element from '$path'", - ErrorCode::JSON_POINTER_PSEUDO_ELEMENT_REMOVAL); - } - - if (!array_key_exists($reference_token, $parent)) - { - throw new ExceptionNullPointer($this->pointer); - } - - /** @var JSONValue $value */ - $value = $parent[$reference_token]; - unset($parent[$reference_token]); - $parent = array_values($parent); - - return $value; - } - else - { - $path = implode('/', array_slice(explode('/', $this->pointer), 0, -1)); - throw new ExceptionAccessViolation( - "parent '$path' is neither a JSON array nor a JSON object", - ErrorCode::JSON_POINTER_NO_DATA_STRUCTURE); - } - } - - //------------------------------------------------------------------------------------------------------------------ - /** - * Gets the parent object of this pointer's reference. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/getParent%23lang-php - * @param JSONValue $data The JSON data to search - * @return JSONValue The parent value containing this reference - * @throws ExceptionAccessViolation Thrown whenever a member is accessed that can not be accessed in a certain way - * @throws ExceptionNullPointer Thrown whenever a member is accessed that does not exist - */ - public function &getParent(mixed &$data) - : mixed - { - if ($this->isRootPointer()) - { - throw new ExceptionAccessViolation("root does not have a parent", ErrorCode::JSON_POINTER_PARENT_NOT_FOUND); - } - - return $this->internalGetParent($data); - } - - /** - * Gets the current pointer reference value's siblings in the parent. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/getSiblings%23lang-php - * @param JSONValue $data The JSON data to search - * @return array An array containing all the siblings mapped to their pointer - * @throws ExceptionAccessViolation Thrown whenever a member is accessed that can not be accessed in a certain way - * @throws ExceptionNullPointer Thrown whenever a member is accessed that does not exist - */ - public function getSiblings(mixed &$data) - : array - { - if ($this->isRootPointer()) - { - throw new ExceptionAccessViolation("root does not have siblings", ErrorCode::JSON_POINTER_PARENT_NOT_FOUND); - } - - $reference_token = $this->getUnqualifiedName(); - $parent = &self::resolveDocument($data, array_slice($this->references, 0, -1)); - - $siblings = []; - $parent_pointer = substr($this->pointer, 0, (int) strrpos($this->pointer, '/')).'/'; - - if (!is_object($parent) && !is_array($parent)) - { - $path = implode('/', array_slice(explode('/', $this->pointer), 0, -1)); - throw new ExceptionAccessViolation( - "parent '$path' is neither a JSON array nor a JSON object", - ErrorCode::JSON_POINTER_NO_DATA_STRUCTURE); - } - - foreach ((array) $parent as $key => &$value) - { - if ($key !== $reference_token) - { - $pointer = $parent_pointer . JsonPointerParser::escapeReference($key); - $siblings[$pointer] = &$value; - } - } - - return $siblings; - } - - //------------------------------------------------------------------------------------------------------------------ - /** - * Gets the unqualified name of the target. (without parent names) - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/getUnqualifiedName%23lang-php - * @return string The unqualified name - */ - public function getUnqualifiedName() : string { return $this->references[$this->getDepth() - 1]; } - - /** - * Gets the pointer string url encoded. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/encoded%23lang-php - * @return string The pointer string - */ - public function encoded() - : string - { - return '#'.implode('/', array_map(rawurlencode(...), explode('/', $this->pointer))); - } - - //------------------------------------------------------------------------------------------------------------------ - /** - * Determines whether the current pointer is pointing to the root of a JSON document. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/isRootPointer%23lang-php - * @return bool True if the current pointer points to the root - */ - public function isRootPointer() : bool { return (count($this->references) === 0); } - - /** - * Gets the depth of the value the current pointer is pointing to inside a JSON document. - * @link https://elandasunshine.github.io/wiki?page=JsonScout/types/JsonPointer/getDepth%23lang-php - * @return int The depth of the value - */ - public function getDepth() : int { return count($this->references); } - - //------------------------------------------------------------------------------------------------------------------ - #[\Override] - public function __toString() : string { return $this->pointer; } - - //================================================================================================================== - /** - * @param JSONValue $data - * @return JSONValue - * @throws ExceptionAccessViolation - * @throws ExceptionNullPointer - */ - private function &internalGetParent(mixed &$data) - : mixed - { - return self::resolveDocument($data, array_slice($this->references, 0, -1)); - } -} diff --git a/src/JsonPointer/Exception/ExceptionAccessViolation.php b/src/JsonPointer/Exception/ExceptionAccessViolation.php deleted file mode 100644 index db29e32..0000000 --- a/src/JsonPointer/Exception/ExceptionAccessViolation.php +++ /dev/null @@ -1,36 +0,0 @@ -'; - } - - $c = $chars[++$i]; - - switch ($c) - { - case '0': - $output .= '~'; - continue 2; - - case '1': - $output .= '/'; - continue 2; - } - - --$i; - return "~$c"; - } - - $output .= $c; - } - - return true; - } -} diff --git a/src/Util/MathUtil.php b/src/Util/MathUtil.php deleted file mode 100644 index d78fc62..0000000 --- a/src/Util/MathUtil.php +++ /dev/null @@ -1,41 +0,0 @@ - $l_item) - { - if (!array_key_exists($key, $right)) - { - return false; - } - - $r_item = $right[$key]; - - if (!self::equalityCompareOperands($l_item, $r_item)) - { - return false; - } - } - - return true; - } - - public static function equalityCompareObjects(object $left, object $right) - : bool - { - return self::equalityCompareArrayLoose((array) $left, (array) $right); - } - - /** - * @param mixed $left - * @param mixed $right - */ - public static function equalityCompareOperands(mixed $left, mixed $right) - : bool - { - // Numeric comparison - if ((is_int($left) || is_float($left)) && (is_int($right) || is_float($right))) - { - return MathUtil::compareNumericEqualSafe($left, $right); - } - - if (is_object($left) && is_object($right)) - { - return self::equalityCompareObjects($left, $right); - } - - if (is_array($left) && is_array($right)) - { - return self::equalityCompareArray($left, $right); - } - - // Remaining type comparisons (string, bool, null) - return ($left === $right); - } - - /** - * @param mixed $left - * @param mixed $right - */ - public static function lessCompareOperands(mixed $left, mixed $right) - : bool - { - if ((is_int($left) || is_float($left)) && (is_int($right) || is_float($right))) - { - return ($left < $right); - } - - if (is_string($left) && is_string($right)) - { - return (strcmp($left, $right) < 0); - } - - return false; - } -} \ No newline at end of file diff --git a/test/DocumentTest.php b/test/DocumentTest.php deleted file mode 100644 index 03d5444..0000000 --- a/test/DocumentTest.php +++ /dev/null @@ -1,155 +0,0 @@ -basicTests(); - $this->streamedParsingTest(); - } - - //================================================================================================================== - private function basicTests() - : void - { - //............... - // From string - $string = file_get_contents(self::TEST_FILE); - assert($string !== false); - - self::assertEquals(json_decode($string), (new Document($string))->getData()); - - // From file - $file = __DIR__ . '/testdata/colours.json'; - $in = file_get_contents($file); - self::assertTrue(is_string($in)); - self::assertEquals(json_decode($in), Document::fromFile($file)->getData()); - - //............... - $document = new Document($string); - - // Query - self::assertEquals([231, 42, 420], $document->query('$..[?typeof(@) == \'number\']')->toArray()); - - // Pointer - $number = &$document->fetch('/value/1'); - $number = 42; - self::assertTrue(isset($document['value'])); - self::assertTrue(is_array($document['value'])); - self::assertEquals(42, $document['value'][1]); - - // Patch - $document->patch(<<getData()); - - $document->patch(<<getData()); - - $results = [ - [ - 665, - "string", - 42, - false, - null, - true, - [ 42, 420 ], - "string" - ] - ]; - - foreach ($document as $entry) - { - $expected = reset($results); - unset($results[key($results)]); - self::assertEquals($expected, $entry); - } - - // to string - self::assertEquals(json_encode($document->getData()), (string) $document); - } - - public function streamedParsingTest() - : void - { - - } -} diff --git a/test/ExtensionTest.php b/test/ExtensionTest.php deleted file mode 100644 index 30cac3a..0000000 --- a/test/ExtensionTest.php +++ /dev/null @@ -1,206 +0,0 @@ -testCallback = JsonPath::query(...); - - $this->testData = [ - // Example from: https://github.com/codebrainz/color-names/blob/master/output/colors.json - "colours" => Document::fromFile(__DIR__ . '/testdata/colours.json')->getData() - ]; - - $wood_result = [ - (object) [ - "name" => "Burlywood", - "hex" => "#deb887", - "rgb" => [222, 184, 135] - ], - (object) [ - "name" => "Redwood", - "hex" => "#ab4e52", - "rgb" => [171, 78, 82] - ], - (object) [ - "name" => "Rosewood", - "hex" => "#65000b", - "rgb" => [101, 0, 11] - ], - (object) [ - "name" => "Dogwood Rose", - "hex" => "#d71868", - "rgb" => [215, 24, 104] - ], - (object) [ - "name" => "Hollywood Cerise", - "hex" => "#f400a1", - "rgb" => [244, 0, 161] - ], - (object) [ - "name" => "Wood Brown", - "hex" => "#c19a6b", - "rgb" => [193, 154, 107] - ] - ]; - - /** @var array $only_green */ - $only_green = Document::fromFile(__DIR__ . '/testdata/only_green.json')->getData(); - - /** @var array $only_128 */ - $only_128 = Document::fromFile(__DIR__ . '/testdata/only_128.json')->getData(); - - $this->testCases = [ - // ======================= contains - // find all green colours with "contains" - [ - 'query' => '$[?contains(@.name, "Green")]', - 'data' => 'colours', - 'expect' => $only_green - ], - - // ======================= starts_with - [ - 'query' => '$[?starts_with(@.name, "Raspberry")]', - 'data' => 'colours', - 'expect' => [ - (object) [ - "name" => "Raspberry", - "hex" => "#e30b5d", - "rgb" => [227, 11, 93] - ], - (object) [ - "name" => "Raspberry Glace", - "hex" => "#915f6d", - "rgb" => [145, 95, 109] - ], - (object) [ - "name" => "Raspberry Pink", - "hex" => "#e25098", - "rgb" => [226, 80, 152] - ], - (object) [ - "name" => "Raspberry Rose", - "hex" => "#b3446c", - "rgb" => [179, 68, 108] - ] - ] - ], - - // ======================= ends_with - [ - 'query' => '$[?ends_with(@.name, "wood")]', - 'data' => 'colours', - 'expect' => [ - (object) [ - "name" => "Burlywood", - "hex" => "#deb887", - "rgb" => [222, 184, 135] - ], - (object) [ - "name" => "Redwood", - "hex" => "#ab4e52", - "rgb" => [171, 78, 82] - ], - (object) [ - "name" => "Rosewood", - "hex" => "#65000b", - "rgb" => [101, 0, 11] - ] - ] - ], - - // ======================= to_lower & to_upper - // find all that contain "wood" regardless case - [ - 'query' => '$[?contains(to_lower(@.name), "wood")]', - 'data' => 'colours', - 'expect' => $wood_result, - 'order' => false - ], - [ - 'query' => '$[?contains(to_upper(@.name), "WOOD")]', - 'data' => 'colours', - 'expect' => $wood_result, - 'order' => false - ], - - // should fail, no case conversion - [ - 'query' => '$[?contains(@.name, "wood")]', - 'data' => 'colours', - 'expect' => $wood_result, - 'order' => false, - 'fail' => true - ], - - // ======================= in - // All that got any rgb value of 128 with "contains" (array) - [ - 'query' => '$[?in(@.rgb, 128)]', - 'data' => 'colours', - 'expect' => $only_128 - ], - - // ======================= typeof - // All strings from the first 4 elements - [ - 'query' => '$["air_force_blue_raf", "air_force_blue_usaf", "air_superiority_blue", "alabama_crimson"][?typeof(@) == "string"]', - 'data' => 'colours', - 'expect' => [ - "Air Force Blue (Raf)", - "#5d8aa8", - "Air Force Blue (Usaf)", - "#00308f", - "Air Superiority Blue", - "#72a0c1", - "Alabama Crimson", - "#a32638" - ], - 'order' => false - ], - - // All numbers from the first 4 elements - [ - 'query' => '$["air_force_blue_raf", "air_force_blue_usaf", "air_superiority_blue", "alabama_crimson"]..[?typeof(@) == "number"]', - 'data' => 'colours', - 'expect' => [ - 93, 138, 168, - 0, 48, 143, - 114, 160, 193, - 163, 38, 56 - ], - 'order' => false - ], - ]; - } -} diff --git a/test/NormalisedTest.php b/test/NormalisedTest.php deleted file mode 100644 index 9551656..0000000 --- a/test/NormalisedTest.php +++ /dev/null @@ -1,76 +0,0 @@ -testCallback = JsonPath::queryNormalised(...); - $this->testData = [ - // Example from: https://github.com/codebrainz/color-names/blob/master/output/colors.json - "colours" => Document::fromFile(__DIR__ . '/testdata/colours.json')->getData(), - "unicode" => (object) [ - "hello 😊" => "daz an emote", - "\u001a" => "substitute", - "\\'\\b\\t\\r\\n\\f\\\\" => "WITH ESCAPES" - ] - ]; - - $this->testCases = [ - [ - 'query' => "$['alice_blue']['name']", - 'data' => 'colours', - 'expect' => ["Alice Blue"] - ], - [ - 'query' => "$['alice_blue']['rgb'][1]", - 'data' => 'colours', - 'expect' => [248] - ], - [ - 'query' => "$['hello 😊']", - 'data' => 'unicode', - 'expect' => ["daz an emote"] - ], - [ - 'query' => "$['\u001a']", - 'data' => 'unicode', - 'expect' => ["substitute"] - ], - [ - 'query' => "$['\\'\\b\\t\\r\\n\\f\\\\']", - 'data' => 'unicode', - 'expect' => ["WITH ESCAPES"] - ] - ]; - } -} - diff --git a/test/ParserTest.php b/test/ParserTest.php deleted file mode 100644 index 067a312..0000000 --- a/test/ParserTest.php +++ /dev/null @@ -1,812 +0,0 @@ -testCallback = JsonPath::query(...); - $this->testData = [ - 'example1' => (object) [ - "store" => (object) [ - "book" => [ - (object) [ - "category" => "reference", - "author" => "Nigel Rees", - "title" => "Sayings of the Century", - "price" => 8.95 - ], - (object) [ - "category" => "fiction", - "author" => "Evelyn Waugh", - "title" => "Sword of Honour", - "price" => 12.99 - ], - (object) [ - "category" => "fiction", - "author" => "Herman Melville", - "title" => "Moby Dick", - "isbn" => "0-553-21311-3", - "price" => 8.99 - ], - (object) [ - "category" => "fiction", - "author" => "J. R. R. Tolkien", - "title" => "The Lord of the Rings", - "isbn" => "0-395-19395-8", - "price" => 22.99 - ] - ], - "bicycle" => (object) [ - "color" => "red", - "price" => 399 - ] - ] - ], - 'example2' => (object) [ - "o" => (object) [ - "j j" => (object) [ - "k.k" => 3 - ] - ], - "'" => (object) [ - "@" => 2 - ] - ], - 'example3' => (object) [ - "o" => (object)[ - "j" => 1, - "k" => 2 - ], - "a" => [ 5, 3 ] - ], - 'example4' => (object) [ - "a" => [ - 3, 5, 1, 2, 4, 6, - (object) [ "b" => "j" ], - (object) [ "b" => "k" ], - (object) [ "b" => (object)[] ], - (object) [ "b" => "kilo" ] - ], - "o" => (object) [ - "p" => 1, - "q" => 2, - "r" => 3, - "s" => 5, - "t" => (object) [ "u" => 6 ] - ], - "e" => "f" - ], - 'example5' => (object) [ - "o" => (object) [ - "j" => 1, - "k" => 2 - ], - "a" => [ - 5, 3, - [ - (object) [ "j" => 4 ], - (object) [ "k" => 6 ] - ] - ] - ] - ]; - - $this->testCases = [ - [ - 'query' => '$.store.book[*].author', - 'data' => 'example1', - 'expect' => [ 'Nigel Rees', 'Evelyn Waugh', 'Herman Melville', 'J. R. R. Tolkien' ] - ], - [ - 'query' => '$..author', - 'data' => 'example1', - 'expect' => [ 'Nigel Rees', 'Evelyn Waugh', 'Herman Melville', 'J. R. R. Tolkien' ] - ], - [ - 'query' => '$.store.*', - 'data' => 'example1', - 'expect' => [ - [ - (object) [ - "category" => "reference", - "author" => "Nigel Rees", - "title" => "Sayings of the Century", - "price" => 8.95 - ], - (object) [ - "category" => "fiction", - "author" => "Evelyn Waugh", - "title" => "Sword of Honour", - "price" => 12.99 - ], - (object) [ - "category" => "fiction", - "author" => "Herman Melville", - "title" => "Moby Dick", - "isbn" => "0-553-21311-3", - "price" => 8.99 - ], - (object) [ - "category" => "fiction", - "author" => "J. R. R. Tolkien", - "title" => "The Lord of the Rings", - "isbn" => "0-395-19395-8", - "price" => 22.99 - ] - ], - (object) [ - "color" => "red", - "price" => 399 - ] - ] - ], - [ - 'query' => '$.store..price', - 'data' => 'example1', - 'expect' => [ 8.95, 12.99, 8.99, 22.99, 399 ], - 'order' => false - ], - [ - 'query' => '$..book[2]', - 'data' => 'example1', - 'expect' => [ - (object) [ - "category" => "fiction", - "author" => "Herman Melville", - "title" => "Moby Dick", - "isbn" => "0-553-21311-3", - "price" => 8.99 - ] - ] - ], - [ - 'query' => '$..book[2].author', - 'data' => 'example1', - 'expect' => [ "Herman Melville" ] - ], - [ - 'query' => '$..book[2].publisher', - 'data' => 'example1', - 'expect' => [] - ], - [ - 'query' => '$..book[-1]', - 'data' => 'example1', - 'expect' => [ - (object) [ - "category" => "fiction", - "author" => "J. R. R. Tolkien", - "title" => "The Lord of the Rings", - "isbn" => "0-395-19395-8", - "price" => 22.99 - ] - ] - ], - [ - 'query' => '$..book[0,1]', - 'data' => 'example1', - 'expect' => [ - (object) [ - "category" => "reference", - "author" => "Nigel Rees", - "title" => "Sayings of the Century", - "price" => 8.95 - ], - (object) [ - "category" => "fiction", - "author" => "Evelyn Waugh", - "title" => "Sword of Honour", - "price" => 12.99 - ] - ] - ], - [ - 'query' => '$..book[:2]', - 'data' => 'example1', - 'expect' => [ - (object) [ - "category" => "reference", - "author" => "Nigel Rees", - "title" => "Sayings of the Century", - "price" => 8.95 - ], - (object) [ - "category" => "fiction", - "author" => "Evelyn Waugh", - "title" => "Sword of Honour", - "price" => 12.99 - ] - ] - ], - [ - 'query' => '$..book[?@.isbn]', - 'data' => 'example1', - 'expect' => [ - (object) [ - "category" => "fiction", - "author" => "Herman Melville", - "title" => "Moby Dick", - "isbn" => "0-553-21311-3", - "price" => 8.99 - ], - (object) [ - "category" => "fiction", - "author" => "J. R. R. Tolkien", - "title" => "The Lord of the Rings", - "isbn" => "0-395-19395-8", - "price" => 22.99 - ] - ] - ], - [ - 'query' => '$..book[?@.price<10]', - 'data' => 'example1', - 'expect' => [ - (object) [ - "category" => "reference", - "author" => "Nigel Rees", - "title" => "Sayings of the Century", - "price" => 8.95 - ], - (object) [ - "category" => "fiction", - "author" => "Herman Melville", - "title" => "Moby Dick", - "isbn" => "0-553-21311-3", - "price" => 8.99 - ], - ] - ], - [ - 'query' => '$..*', - 'data' => 'example1', - 'expect' => [ - (object) [ - "book" => [ - (object) [ - "category" => "reference", - "author" => "Nigel Rees", - "title" => "Sayings of the Century", - "price" => 8.95 - ], - (object) [ - "category" => "fiction", - "author" => "Evelyn Waugh", - "title" => "Sword of Honour", - "price" => 12.99 - ], - (object) [ - "category" => "fiction", - "author" => "Herman Melville", - "title" => "Moby Dick", - "isbn" => "0-553-21311-3", - "price" => 8.99 - ], - (object) [ - "category" => "fiction", - "author" => "J. R. R. Tolkien", - "title" => "The Lord of the Rings", - "isbn" => "0-395-19395-8", - "price" => 22.99 - ] - ], - "bicycle" => (object) [ - "color" => "red", - "price" => 399 - ] - ], - [ - (object) [ - "category" => "reference", - "author" => "Nigel Rees", - "title" => "Sayings of the Century", - "price" => 8.95 - ], - (object) [ - "category" => "fiction", - "author" => "Evelyn Waugh", - "title" => "Sword of Honour", - "price" => 12.99 - ], - (object) [ - "category" => "fiction", - "author" => "Herman Melville", - "title" => "Moby Dick", - "isbn" => "0-553-21311-3", - "price" => 8.99 - ], - (object) [ - "category" => "fiction", - "author" => "J. R. R. Tolkien", - "title" => "The Lord of the Rings", - "isbn" => "0-395-19395-8", - "price" => 22.99 - ] - ], - (object) [ - "color" => "red", - "price" => 399 - ], - (object) [ - "category" => "reference", - "author" => "Nigel Rees", - "title" => "Sayings of the Century", - "price" => 8.95 - ], - (object) [ - "category" => "fiction", - "author" => "Evelyn Waugh", - "title" => "Sword of Honour", - "price" => 12.99 - ], - (object) [ - "category" => "fiction", - "author" => "Herman Melville", - "title" => "Moby Dick", - "isbn" => "0-553-21311-3", - "price" => 8.99 - ], - (object) [ - "category" => "fiction", - "author" => "J. R. R. Tolkien", - "title" => "The Lord of the Rings", - "isbn" => "0-395-19395-8", - "price" => 22.99 - ], - "red", - 399, - "reference", - "Nigel Rees", - "Sayings of the Century", - 8.95, - "fiction", - "Evelyn Waugh", - "Sword of Honour", - 12.99, - "fiction", - "Herman Melville", - "Moby Dick", - "0-553-21311-3", - 8.99, - "fiction", - "J. R. R. Tolkien", - "The Lord of the Rings", - "0-395-19395-8", - 22.99 - ] - ], - - // Root op - [ - 'query' => '$', - 'data' => (object) [ "k" => "v" ], - 'expect' => [ - (object) [ "k" => "v" ] - ] - ], - - // Child selector - [ - 'query' => '$.o["j j"]', - 'data' => 'example2', - 'expect' => [ - (object) [ "k.k" => 3 ] - ] - ], - [ - 'query' => '$.o["j j"]["k.k"]', - 'data' => 'example2', - 'expect' => [ 3 ] - ], - [ - 'query' => '$["\'"]["@"]', - 'data' => 'example2', - 'expect' => [2] - ], - - // Wildcard selector - [ - 'query' => '$[*]', - 'data' => 'example3', - 'expect' => [ - (object)["j" => 1, "k" => 2], - [5, 3] - ] - ], - [ - 'query' => '$.o[*]', - 'data' => 'example3', - 'expect' => [1, 2] - ], - [ - 'query' => '$.o[*, *]', - 'data' => 'example3', - 'expect' => [1, 2, 1, 2] - ], - [ - 'query' => '$.a[*]', - 'data' => 'example3', - 'expect' => [5, 3] - ], - - // index selector - [ - 'query' => '$[1]', - 'data' => ["a", "b"], - 'expect' => ["b"] - ], - [ - 'query' => '$[-2]', - 'data' => ["a", "b"], - 'expect' => ["a"] - ], - - // slice selector - [ - 'query' => '$[1:3]', - 'data' => ["a", "b", "c", "d", "e", "f", "g"], - 'expect' => ["b", "c"] - ], - [ - 'query' => '$[5:]', - 'data' => ["a", "b", "c", "d", "e", "f", "g"], - 'expect' => ["f", "g"] - ], - [ - 'query' => '$[1:5:2]', - 'data' => ["a", "b", "c", "d", "e", "f", "g"], - 'expect' => ["b", "d"] - ], - [ - 'query' => '$[5:1:-2]', - 'data' => ["a", "b", "c", "d", "e", "f", "g"], - 'expect' => ["f", "d"] - ], - [ - 'query' => '$[::-1]', - 'data' => ["a", "b", "c", "d", "e", "f", "g"], - 'expect' => ["g", "f", "e", "d", "c", "b", "a"] - ], - - // filter selector - [ - 'query' => '$.a[?@.b == "kilo"]', - 'data' => 'example4', - 'expect' => [(object)["b" => "kilo"]] - ], - [ - 'query' => '$.a[?(@.b == "kilo")]', - 'data' => 'example4', - 'expect' => [(object)["b" => "kilo"]] - ], - [ - 'query' => '$.a[?@ > 3.5]', - 'data' => 'example4', - 'expect' => [5, 4, 6] - ], - [ - 'query' => '$.a[?@.b]', - 'data' => 'example4', - 'expect' => [ - (object)["b" => "j"], - (object)["b" => "k"], - (object)["b" => (object)[]], - (object)["b" => "kilo"] - ] - ], - [ - 'query' => '$[?@.*]', - 'data' => 'example4', - 'expect' => [ - [ - 3, 5, 1, 2, 4, 6, - (object)["b" => "j"], - (object)["b" => "k"], - (object)["b" => (object)[]], - (object)["b" => "kilo"] - ], - (object)[ - "p" => 1, - "q" => 2, - "r" => 3, - "s" => 5, - "t" => (object)["u" => 6] - ] - ] - ], - [ - 'query' => '$[?@[?@.b]]', - 'data' => 'example4', - 'expect' => [ - [ - 3, 5, 1, 2, 4, 6, - (object)["b" => "j"], - (object)["b" => "k"], - (object)["b" => (object)[]], - (object)["b" => "kilo"] - ] - ] - ], - [ - 'query' => '$.o[?@<3, ?@<3]', - 'data' => 'example4', - 'expect' => [1, 2, 2, 1], - 'order' => false - ], - [ - 'query' => '$.a[?@<2 || @.b == "k"]', - 'data' => 'example4', - 'expect' => [ - 1, - (object)["b" => "k"] - ] - ], - [ - 'query' => '$.a[?match(@.b, "[jk]")]', - 'data' => 'example4', - 'expect' => [ - (object)["b" => "j"], - (object)["b" => "k"] - ] - ], - [ - 'query' => '$.a[?search(@.b, "[jk]")]', - 'data' => 'example4', - 'expect' => [ - (object)["b" => "j"], - (object)["b" => "k"], - (object)["b" => "kilo"] - ] - ], - [ - 'query' => '$.o[?@ > 1 && @ < 4]', - 'data' => 'example4', - 'expect' => [2, 3], - 'order' => false - ], - [ - 'query' => '$.o[?@.u || @.x]', - 'data' => 'example4', - 'expect' => [(object)["u" => 6]] - ], - [ - 'query' => '$.a[?@.b == $.x]', - 'data' => 'example4', - 'expect' => [3, 5, 1, 2, 4, 6] - ], - [ - 'query' => '$.a[?@ == @]', - 'data' => 'example4', - 'expect' => [ - 3, 5, 1, 2, 4, 6, - (object)["b" => "j"], - (object)["b" => "k"], - (object)["b" => (object)[]], - (object)["b" => "kilo"] - ] - ], - - // segments - [ - 'query' => '$[0, 3]', - 'data' => ["a", "b", "c", "d", "e", "f", "g"], - 'expect' => ["a", "d"] - ], - [ - 'query' => '$[0:2, 5]', - 'data' => ["a", "b", "c", "d", "e", "f", "g"], - 'expect' => ["a", "b", "f"] - ], - [ - 'query' => '$[0, 0]', - 'data' => ["a", "b", "c", "d", "e", "f", "g"], - 'expect' => ["a", "a"] - ], - - // descendant segment - [ - 'query' => '$..j', - 'data' => 'example5', - 'expect' => [1, 4], - 'order' => false - ], - [ - 'query' => '$..[0]', - 'data' => 'example5', - 'expect' => [ - 5, - (object)["j" => 4] - ] - ], - [ - 'query' => '$..[*]', - 'data' => 'example5', - 'expect' => [ - (object)["j" => 1, "k" => 2], - [ - 5, 3, - [ - (object)["j" => 4], - (object)["k" => 6] - ] - ], - 1, 2, 5, 3, - [ - (object)["j" => 4], - (object)["k" => 6] - ], - (object)["j" => 4], - (object)["k" => 6], - 4, 6 - ] - ], - [ - 'query' => '$..*', - 'data' => 'example5', - 'expect' => [ - (object)["j" => 1, "k" => 2], - [ - 5, 3, - [ - (object)["j" => 4], - (object)["k" => 6] - ] - ], - 1, 2, 5, 3, - [ - (object)["j" => 4], - (object)["k" => 6] - ], - (object)["j" => 4], - (object)["k" => 6], - 4, 6 - ] - ], - [ - 'query' => '$..o', - 'data' => 'example5', - 'expect' => [ - (object)["j" => 1, "k" => 2] - ] - ], - [ - 'query' => '$.o..[*, *]', - 'data' => 'example5', - 'expect' => [1, 2, 2, 1], - 'order' => false - ], - [ - 'query' => '$.a..[0, 1]', - 'data' => 'example5', - 'expect' => [ - 5, 3, - (object)["j" => 4], - (object)["k" => 6] - ], - 'order' => false - ], - - // null semantics - [ - 'query' => '$.a', - 'data' => (object)[ - "a" => null, - "b" => [null], - "c" => [(object)[]], - "null" => 1 - ], - 'expect' => [null] - ], - [ - 'query' => '$.a[0]', - 'data' => (object)[ - "a" => null, - "b" => [null], - "c" => [(object)[]], - "null" => 1 - ], - 'expect' => [] - ], - [ - 'query' => '$.a.d', - 'data' => (object)[ - "a" => null, - "b" => [null], - "c" => [(object)[]], - "null" => 1 - ], - 'expect' => [] - ], - [ - 'query' => '$.b[0]', - 'data' => (object)[ - "a" => null, - "b" => [null], - "c" => [(object)[]], - "null" => 1 - ], - 'expect' => [null] - ], - [ - 'query' => '$.b[*]', - 'data' => (object)[ - "a" => null, - "b" => [null], - "c" => [(object)[]], - "null" => 1 - ], - 'expect' => [null] - ], - [ - 'query' => '$.b[?@]', - 'data' => (object)[ - "a" => null, - "b" => [null], - "c" => [(object)[]], - "null" => 1 - ], - 'expect' => [null] - ], - [ - 'query' => '$.b[?@ == null]', - 'data' => (object)[ - "a" => null, - "b" => [null], - "c" => [(object)[]], - "null" => 1 - ], - 'expect' => [null] - ], - [ - 'query' => '$.c[?@.d == null]', - 'data' => (object)[ - "a" => null, - "b" => [null], - "c" => [(object)[]], - "null" => 1 - ], - 'expect' => [] - ], - [ - 'query' => '$.null', - 'data' => (object)[ - "a" => null, - "b" => [null], - "c" => [(object)[]], - "null" => 1 - ], - 'expect' => [1] - ] - ]; - } -} diff --git a/test/PatchTest.php b/test/PatchTest.php deleted file mode 100644 index 7e7f3bb..0000000 --- a/test/PatchTest.php +++ /dev/null @@ -1,442 +0,0 @@ - "add", - "path" => "/someplace", - "value" => "" - ] - ]); - } - ); */ - - // Test invalid document format: operation 'copy' has wrong value for argument 'from' (which requires string) - self::testExpectedException(ExceptionMalformedPatch::class, - 'patch operation argument \'from\' expects a \'string\'', - function() - { - new JsonPatch(<< "bar" ], - << "bar", - "baz" => "qux" - ] - ); - - // A.2 - self::subCase( - (object)[ "foo" => [ "bar", "baz" ] ], - << [ "bar", "qux", "baz" ] ] - ); - - // A.3 - self::subCase( - (object)[ - "baz" => "qux", - "foo" => "bar" - ], - << "bar" - ] - ); - - // A.4 - self::subCase( - (object)[ "foo" => [ "bar", "qux", "baz" ] ], - << [ "bar", "baz" ] ] - ); - - // A.5 - self::subCase( - (object)[ - "baz" => "qux", - "foo" => "bar" - ], - << "boo", - "foo" => "bar" - ], - ); - - // A.6 - self::subCase( - (object)[ - "foo" => (object)[ - "bar" => "baz", - "waldo" => "fred" - ], - "qux" => (object)[ - "corge" => "grault" - ] - ], - << (object)[ - "bar" => "baz", - ], - "qux" => (object)[ - "corge" => "grault", - "thud" => "fred" - ] - ], - ); - - // A.7 - self::subCase( - (object)[ "foo" => [ "all", "grass", "cows", "eat" ] ], - << [ "all", "cows", "eat", "grass" ] ] - ); - - // A.8 - self::subCase( - (object)[ - "baz" => "qux", - "foo" => [ "a", 2, "c" ] - ], - << "qux", - "foo" => [ "a", 2, "c" ] - ] - ); - - // A.9 - self::subCase( - (object)[ "baz" => "qux" ], - << "qux" ], - false - ); - - // A.10 - self::subCase( - (object)[ "foo" => "bar" ], - << "bar", - "child" => (object)[ - "grandchild" => (object)[] - ] - ] - ); - - // A.11 - self::subCase( - (object)[ "foo" => "bar" ], - << "bar", - "baz" => "qux" - ] - ); - - // A.12 - self::testExpectedException(ExceptionNullPointer::class, null, - function() - { - $patcher = new JsonPatch(<<apply((object)[ "foo" => "bar" ]); - } - ); - - // A.13 - // Disabled because can't have the same key in a PHP array, 'remove' would just override 'add', - // same issue when using json_decode - /* self::testExpectedException(ExceptionMalformedPatch::class, null, - function() - { - $patcher = new JsonPatch(<<apply((object)[ "foo" => "bar" ]); - } - ); */ - - // A.14 - self::subCase( - (object)[ - "/" => 9, - "~1" => 10 - ], - << 9, - "~1" => 10 - ] - ); - - // A.15 - self::subCase( - (object)[ - "/" => 9, - "~1" => 10 - ], - << 9, - "~1" => 10 - ], - false - ); - - // A.16 - self::subCase( - (object)[ "foo" => [ "bar" ] ], - << [ "bar", [ "abc", "def" ] ] ] - ); - } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @param JSONValue $data - * @param non-empty-string $patch - * @param JSONValue $expected - * @param bool $mustBeSuccess - * @return void - */ - private static function subCase(mixed $data, string $patch, mixed $expected, bool $mustBeSuccess = true) - : void - { - $patcher = new JsonPatch($patch); - $result = $patcher->apply($data); - - self::assertEquals($mustBeSuccess, $result->successful, - 'test\'s \'test\' operations should have been '.($mustBeSuccess ? 'successful' : 'failing') - . ' but were ' . ($result->successful ? 'successful' : 'failing')); - self::assertEquals($expected, $result->data); - } - - //------------------------------------------------------------------------------------------------------------------ - /** - * @param class-string $exception - */ - private static function testExpectedException(string $exception, ?string $expectedMessage, callable $test) - : void - { - $thrown_message = null; - $actually_thrown = null; - - try - { - ($test)(); - } - catch (Exception $ex) - { - $thrown_message = $ex->getMessage(); - $actually_thrown = get_class($ex); - } - - self::assertNotEquals(null, $thrown_message, "no exception of type was thrown"); - self::assertEquals ($exception, $actually_thrown, 'wrong exception thrown: '.$thrown_message); - - if ($expectedMessage !== null) - { - self::assertEquals($expectedMessage, $thrown_message); - } - } -} diff --git a/test/PointerTest.php b/test/PointerTest.php deleted file mode 100644 index e6c24d2..0000000 --- a/test/PointerTest.php +++ /dev/null @@ -1,341 +0,0 @@ -getData(); - - //............... - $pointer = new JsonPointer(''); - self::assertEquals($document, $pointer->get($document)); - - //............... - $pointer = new JsonPointer('#'); - self::assertEquals($document, $pointer->get($document)); - - //............... - $pointer = new JsonPointer('/alice_blue'); - self::assertTrue(is_object($document)); - self::assertTrue(property_exists($document, 'alice_blue')); - self::assertEquals($document->alice_blue, $pointer->get($document)); - - //............... - $pointer = new JsonPointer('#/alice_blue/name'); - self::assertEquals('Alice Blue', $pointer->get($document)); - - //............... - $pointer = new JsonPointer('/alice_blue/rgb'); - self::assertEquals([ 240, 248, 255 ], $pointer->get($document)); - - //............... - $pointer = new JsonPointer('#/alice_blue/rgb/0'); - self::assertEquals(240, $pointer->get($document)); - - //............... - self::testExpectedException((new ExceptionSyntaxError("invalid escape sequence in string '~2'", \JsonScout\Common\Exception\ErrorCode::JSON_PATH_SYNTAX_ERROR, -1, 12))->getMessage(), - function () { - new JsonPointer('/alice_blue~2/rgb/0'); - } - ); - - //............... - self::testExpectedException((new ExceptionSyntaxError("invalid escape sequence in string '~2'", \JsonScout\Common\Exception\ErrorCode::JSON_PATH_SYNTAX_ERROR, -1, 13))->getMessage(), - function () { - new JsonPointer('#/alice_blue~2/rgb/0'); - } - ); - - //............... - self::testExpectedException((new ExceptionSyntaxError("expected reference token start character '/'", \JsonScout\Common\Exception\ErrorCode::JSON_PATH_SYNTAX_ERROR, -1, 1))->getMessage(), - function () { - new JsonPointer('alice_blue~2/rgb/0'); - } - ); - - //............... - self::testExpectedException((new ExceptionSyntaxError("expected reference token start character '/'", \JsonScout\Common\Exception\ErrorCode::JSON_PATH_SYNTAX_ERROR, -1, 2))->getMessage(), - function () { - new JsonPointer('#alice_blue~2/rgb/0'); - } - ); - - //............... - $document = (object)[ - "hello world" => [ - (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ] - ], - "number" => 420 - ]; - - //............... - $pointer = new JsonPointer('/hello world/0/someValue%20'); - self::assertTrue ($pointer->get($document)); - self::assertEquals('#/hello%20world/0/someValue%2520', $pointer->encoded()); - - //............... - $pointer = new JsonPointer('#/hello%20world/0/someValue%2520'); - self::assertTrue($pointer->get($document)); - - //............... - $pointer = new JsonPointer('/hello world/0/what~0~1 ever~0'); - self::assertEquals(0, $pointer->get($document)); - self::assertEquals('#/hello%20world/0/what~0~1%20ever~0', $pointer->encoded()); - - //............... - $pointer = new JsonPointer('#/hello%20world/0/what~0~1%20ever~0'); - self::assertEquals(0, $pointer->get($document)); - } - - /** - * @throws JsonPointer\Exception\ExceptionInvalidOperation - * @throws JsonPointer\Exception\ExceptionAccessViolation - * @throws JsonPointer\Exception\ExceptionNullPointer - */ - private static function testSetting() - : void - { - $document = (object)[ - "hello world" => [ - (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ] - ], - "number" => 420 - ]; - - //............... - // Test setting by reference - $pointer = new JsonPointer('/number'); - - $new_doc = clone $document; - $ref = &$pointer->get($new_doc); - - self::assertTrue(is_object($new_doc)); - self::assertEquals(420, $ref); - - $ref = 666; - self::assertTrue(property_exists($new_doc, 'number')); - self::assertEquals(666, $new_doc->number); - - $new_doc = clone $document; - - $pointer->set($new_doc, 666); - self::assertTrue(is_object($new_doc)); - self::assertTrue(property_exists($new_doc, 'number')); - self::assertEquals(666, $new_doc->number); - - //............... - $pointer = new JsonPointer('/hello world/-'); - $new_doc = clone $document; - - $pointer->set($new_doc, 42); - self::assertTrue($new_doc instanceof \stdClass); - self::assertTrue(property_exists($new_doc, 'hello world')); - self::assertTrue(is_array($new_doc->{'hello world'})); - self::assertEquals(42, $new_doc->{'hello world'}[1]); - - $pointer->set($new_doc, 66); - self::assertTrue($new_doc instanceof \stdClass); - self::assertEquals(66, $new_doc->{'hello world'}[2]); - - $pointer->set($new_doc, 546); - self::assertTrue($new_doc instanceof \stdClass); - self::assertEquals(546, $new_doc->{'hello world'}[3]); - - //............... - $pointer = new JsonPointer('/hello world'); - $new_doc = clone $document; - - $pointer->set($new_doc, 420); - self::assertTrue($new_doc instanceof \stdClass); - self::assertEquals(420, $new_doc->{'hello world'}); - - self::assertTrue(property_exists($new_doc, 'hello world')); - $pointer->remove($new_doc); - - self::assertTrue($new_doc instanceof \stdClass); - self::assertTrue(!property_exists($new_doc, 'hello world')); - self::assertEquals($new_doc, (object)[ "number" => 420 ]); - } - - /** - * @throws JsonPointer\Exception\ExceptionAccessViolation - * @throws JsonPointer\Exception\ExceptionNullPointer - */ - private static function testFetches() - : void - { - $document = (object)[ - "hello world" => [ - (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ] - ], - "number" => 420 - ]; - - //............... - $pointer = new JsonPointer('/hello world/someValue%20'); - - $new_doc = clone $document; - $parent = &$pointer->getParent($new_doc); - - self::assertEquals($parent, - [ - (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ] - ] - ); - - $parent = 320; - self::assertTrue($new_doc instanceof \stdClass); - self::assertEquals(320, $new_doc->{'hello world'}); - - //............... - $pointer = new JsonPointer('/hello world'); - - self::assertEquals( - [ - "/number" => 420 - ], - $pointer->getSiblings($document) - ); - - //............... - $pointer = new JsonPointer('/hello world/0/someValue%20'); - - self::assertEquals( - [ - "/hello world/0/what~0~1 ever~0" => 0 - ], - $pointer->getSiblings($document) - ); - - //............... - self::assertEquals( - [ - "" => (object) [ - "hello world" => [ - (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ] - ], - "number" => 420 - ], - "/hello world" => [ - (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ] - ], - "/number" => 420, - "/hello world/0" => (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ], - "/hello world/0/someValue%20" => true, - "/hello world/0/what~0~1 ever~0" => 0 - ], - JsonPointer::toFlatMap($document) - ); - - //............... - self::assertEquals( - [ - "#" => (object) [ - "hello world" => [ - (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ] - ], - "number" => 420 - ], - "#/hello%20world" => [ - (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ] - ], - "#/number" => 420, - "#/hello%20world/0" => (object) [ - "someValue%20" => true, - "what~/ ever~" => 0 - ], - "#/hello%20world/0/someValue%2520" => true, - "#/hello%20world/0/what~0~1%20ever~0" => 0 - ], - JsonPointer::toFlatMap($document, true) - ); - } - - //================================================================================================================== - /** - */ - private static function testExpectedException(string $expectedMessage, callable $test) - : void - { - $thrown_message = ''; - - try - { - ($test)(); - } - catch (ExceptionSyntaxError $ex) - { - $thrown_message = $ex->getMessage(); - self::assertEquals($expectedMessage, $thrown_message); - } - catch (Exception $ex) - { - self::fail("Unexpected exception was thrown: " . get_class($ex)); - } - - if ($thrown_message === '') - { - self::fail("No exception was thrown"); - } - } -} \ No newline at end of file diff --git a/test/TestBase.php b/test/TestBase.php deleted file mode 100644 index b0c10b8..0000000 --- a/test/TestBase.php +++ /dev/null @@ -1,98 +0,0 @@ - */ - protected array $testData = []; - - /** @var array */ - protected array $testCases = []; - - /** @var callable(non-empty-string, JSONValue) : \JsonScout\JsonPath\Object\NodesType */ - protected mixed $testCallback; - - //================================================================================================================== - public function testSuite() - : void - { - foreach ($this->testCases as $data) - { - $json_data = (is_string($data['data']) ? $this->testData[$data['data']] : $data['data']); - $expected = $data['expect']; - $query = $data['query']; - $result = ($this->testCallback)($query, $json_data)->toArray(); - $ordered = (!isset($data['order']) || $data['order'] !== false); - - - if (!$ordered) - { - @sort($result); - @sort($expected); - } - - $result = self::compareResults($expected, $result, !$ordered); - - if (isset($data['fail']) && $data['fail'] === true) - { - self::assertTrue(is_array($result), "expected was equal to input"); - } - else - { - self::assertFalse( - is_array($result), - (is_array($result) ? "query '$query' has failed:\n" . $result[0] . "\n" . $result[1] : '') - ); - } - } - } -} \ No newline at end of file diff --git a/test/testdata/colours.json b/test/testdata/colours.json deleted file mode 100644 index 20b0529..0000000 --- a/test/testdata/colours.json +++ /dev/null @@ -1,4327 +0,0 @@ -{ - "air_force_blue_raf": { - "name": "Air Force Blue (Raf)", - "hex": "#5d8aa8", - "rgb": [93, 138, 168] - }, - "air_force_blue_usaf": { - "name": "Air Force Blue (Usaf)", - "hex": "#00308f", - "rgb": [0, 48, 143] - }, - "air_superiority_blue": { - "name": "Air Superiority Blue", - "hex": "#72a0c1", - "rgb": [114, 160, 193] - }, - "alabama_crimson": { - "name": "Alabama Crimson", - "hex": "#a32638", - "rgb": [163, 38, 56] - }, - "alice_blue": { - "name": "Alice Blue", - "hex": "#f0f8ff", - "rgb": [240, 248, 255] - }, - "alizarin_crimson": { - "name": "Alizarin Crimson", - "hex": "#e32636", - "rgb": [227, 38, 54] - }, - "alloy_orange": { - "name": "Alloy Orange", - "hex": "#c46210", - "rgb": [196, 98, 16] - }, - "almond": { - "name": "Almond", - "hex": "#efdecd", - "rgb": [239, 222, 205] - }, - "amaranth": { - "name": "Amaranth", - "hex": "#e52b50", - "rgb": [229, 43, 80] - }, - "amber": { - "name": "Amber", - "hex": "#ffbf00", - "rgb": [255, 191, 0] - }, - "amber_sae_ece": { - "name": "Amber (Sae/Ece)", - "hex": "#ff7e00", - "rgb": [255, 126, 0] - }, - "american_rose": { - "name": "American Rose", - "hex": "#ff033e", - "rgb": [255, 3, 62] - }, - "amethyst": { - "name": "Amethyst", - "hex": "#96c", - "rgb": [153, 102, 204] - }, - "android_green": { - "name": "Android Green", - "hex": "#a4c639", - "rgb": [164, 198, 57] - }, - "anti_flash_white": { - "name": "Anti-Flash White", - "hex": "#f2f3f4", - "rgb": [242, 243, 244] - }, - "antique_brass": { - "name": "Antique Brass", - "hex": "#cd9575", - "rgb": [205, 149, 117] - }, - "antique_fuchsia": { - "name": "Antique Fuchsia", - "hex": "#915c83", - "rgb": [145, 92, 131] - }, - "antique_ruby": { - "name": "Antique Ruby", - "hex": "#841b2d", - "rgb": [132, 27, 45] - }, - "antique_white": { - "name": "Antique White", - "hex": "#faebd7", - "rgb": [250, 235, 215] - }, - "ao_english": { - "name": "Ao (English)", - "hex": "#008000", - "rgb": [0, 128, 0] - }, - "apple_green": { - "name": "Apple Green", - "hex": "#8db600", - "rgb": [141, 182, 0] - }, - "apricot": { - "name": "Apricot", - "hex": "#fbceb1", - "rgb": [251, 206, 177] - }, - "aqua": { - "name": "Aqua", - "hex": "#0ff", - "rgb": [0, 255, 255] - }, - "aquamarine": { - "name": "Aquamarine", - "hex": "#7fffd4", - "rgb": [127, 255, 212] - }, - "army_green": { - "name": "Army Green", - "hex": "#4b5320", - "rgb": [75, 83, 32] - }, - "arsenic": { - "name": "Arsenic", - "hex": "#3b444b", - "rgb": [59, 68, 75] - }, - "arylide_yellow": { - "name": "Arylide Yellow", - "hex": "#e9d66b", - "rgb": [233, 214, 107] - }, - "ash_grey": { - "name": "Ash Grey", - "hex": "#b2beb5", - "rgb": [178, 190, 181] - }, - "asparagus": { - "name": "Asparagus", - "hex": "#87a96b", - "rgb": [135, 169, 107] - }, - "atomic_tangerine": { - "name": "Atomic Tangerine", - "hex": "#f96", - "rgb": [255, 153, 102] - }, - "auburn": { - "name": "Auburn", - "hex": "#a52a2a", - "rgb": [165, 42, 42] - }, - "aureolin": { - "name": "Aureolin", - "hex": "#fdee00", - "rgb": [253, 238, 0] - }, - "aurometalsaurus": { - "name": "Aurometalsaurus", - "hex": "#6e7f80", - "rgb": [110, 127, 128] - }, - "avocado": { - "name": "Avocado", - "hex": "#568203", - "rgb": [86, 130, 3] - }, - "azure": { - "name": "Azure", - "hex": "#007fff", - "rgb": [0, 127, 255] - }, - "azure_mist_web": { - "name": "Azure Mist/Web", - "hex": "#f0ffff", - "rgb": [240, 255, 255] - }, - "baby_blue": { - "name": "Baby Blue", - "hex": "#89cff0", - "rgb": [137, 207, 240] - }, - "baby_blue_eyes": { - "name": "Baby Blue Eyes", - "hex": "#a1caf1", - "rgb": [161, 202, 241] - }, - "baby_pink": { - "name": "Baby Pink", - "hex": "#f4c2c2", - "rgb": [244, 194, 194] - }, - "ball_blue": { - "name": "Ball Blue", - "hex": "#21abcd", - "rgb": [33, 171, 205] - }, - "banana_mania": { - "name": "Banana Mania", - "hex": "#fae7b5", - "rgb": [250, 231, 181] - }, - "banana_yellow": { - "name": "Banana Yellow", - "hex": "#ffe135", - "rgb": [255, 225, 53] - }, - "barn_red": { - "name": "Barn Red", - "hex": "#7c0a02", - "rgb": [124, 10, 2] - }, - "battleship_grey": { - "name": "Battleship Grey", - "hex": "#848482", - "rgb": [132, 132, 130] - }, - "bazaar": { - "name": "Bazaar", - "hex": "#98777b", - "rgb": [152, 119, 123] - }, - "beau_blue": { - "name": "Beau Blue", - "hex": "#bcd4e6", - "rgb": [188, 212, 230] - }, - "beaver": { - "name": "Beaver", - "hex": "#9f8170", - "rgb": [159, 129, 112] - }, - "beige": { - "name": "Beige", - "hex": "#f5f5dc", - "rgb": [245, 245, 220] - }, - "big_dip_o_ruby": { - "name": "Big Dip O’Ruby", - "hex": "#9c2542", - "rgb": [156, 37, 66] - }, - "bisque": { - "name": "Bisque", - "hex": "#ffe4c4", - "rgb": [255, 228, 196] - }, - "bistre": { - "name": "Bistre", - "hex": "#3d2b1f", - "rgb": [61, 43, 31] - }, - "bittersweet": { - "name": "Bittersweet", - "hex": "#fe6f5e", - "rgb": [254, 111, 94] - }, - "bittersweet_shimmer": { - "name": "Bittersweet Shimmer", - "hex": "#bf4f51", - "rgb": [191, 79, 81] - }, - "black": { - "name": "Black", - "hex": "#000", - "rgb": [0, 0, 0] - }, - "black_bean": { - "name": "Black Bean", - "hex": "#3d0c02", - "rgb": [61, 12, 2] - }, - "black_leather_jacket": { - "name": "Black Leather Jacket", - "hex": "#253529", - "rgb": [37, 53, 41] - }, - "black_olive": { - "name": "Black Olive", - "hex": "#3b3c36", - "rgb": [59, 60, 54] - }, - "blanched_almond": { - "name": "Blanched Almond", - "hex": "#ffebcd", - "rgb": [255, 235, 205] - }, - "blast_off_bronze": { - "name": "Blast-Off Bronze", - "hex": "#a57164", - "rgb": [165, 113, 100] - }, - "bleu_de_france": { - "name": "Bleu De France", - "hex": "#318ce7", - "rgb": [49, 140, 231] - }, - "blizzard_blue": { - "name": "Blizzard Blue", - "hex": "#ace5ee", - "rgb": [172, 229, 238] - }, - "blond": { - "name": "Blond", - "hex": "#faf0be", - "rgb": [250, 240, 190] - }, - "blue": { - "name": "Blue", - "hex": "#00f", - "rgb": [0, 0, 255] - }, - "blue_bell": { - "name": "Blue Bell", - "hex": "#a2a2d0", - "rgb": [162, 162, 208] - }, - "blue_crayola": { - "name": "Blue (Crayola)", - "hex": "#1f75fe", - "rgb": [31, 117, 254] - }, - "blue_gray": { - "name": "Blue Gray", - "hex": "#69c", - "rgb": [102, 153, 204] - }, - "blue_green": { - "name": "Blue-Green", - "hex": "#0d98ba", - "rgb": [13, 152, 186] - }, - "blue_munsell": { - "name": "Blue (Munsell)", - "hex": "#0093af", - "rgb": [0, 147, 175] - }, - "blue_ncs": { - "name": "Blue (Ncs)", - "hex": "#0087bd", - "rgb": [0, 135, 189] - }, - "blue_pigment": { - "name": "Blue (Pigment)", - "hex": "#339", - "rgb": [51, 51, 153] - }, - "blue_ryb": { - "name": "Blue (Ryb)", - "hex": "#0247fe", - "rgb": [2, 71, 254] - }, - "blue_sapphire": { - "name": "Blue Sapphire", - "hex": "#126180", - "rgb": [18, 97, 128] - }, - "blue_violet": { - "name": "Blue-Violet", - "hex": "#8a2be2", - "rgb": [138, 43, 226] - }, - "blush": { - "name": "Blush", - "hex": "#de5d83", - "rgb": [222, 93, 131] - }, - "bole": { - "name": "Bole", - "hex": "#79443b", - "rgb": [121, 68, 59] - }, - "bondi_blue": { - "name": "Bondi Blue", - "hex": "#0095b6", - "rgb": [0, 149, 182] - }, - "bone": { - "name": "Bone", - "hex": "#e3dac9", - "rgb": [227, 218, 201] - }, - "boston_university_red": { - "name": "Boston University Red", - "hex": "#c00", - "rgb": [204, 0, 0] - }, - "bottle_green": { - "name": "Bottle Green", - "hex": "#006a4e", - "rgb": [0, 106, 78] - }, - "boysenberry": { - "name": "Boysenberry", - "hex": "#873260", - "rgb": [135, 50, 96] - }, - "brandeis_blue": { - "name": "Brandeis Blue", - "hex": "#0070ff", - "rgb": [0, 112, 255] - }, - "brass": { - "name": "Brass", - "hex": "#b5a642", - "rgb": [181, 166, 66] - }, - "brick_red": { - "name": "Brick Red", - "hex": "#cb4154", - "rgb": [203, 65, 84] - }, - "bright_cerulean": { - "name": "Bright Cerulean", - "hex": "#1dacd6", - "rgb": [29, 172, 214] - }, - "bright_green": { - "name": "Bright Green", - "hex": "#6f0", - "rgb": [102, 255, 0] - }, - "bright_lavender": { - "name": "Bright Lavender", - "hex": "#bf94e4", - "rgb": [191, 148, 228] - }, - "bright_maroon": { - "name": "Bright Maroon", - "hex": "#c32148", - "rgb": [195, 33, 72] - }, - "bright_pink": { - "name": "Bright Pink", - "hex": "#ff007f", - "rgb": [255, 0, 127] - }, - "bright_turquoise": { - "name": "Bright Turquoise", - "hex": "#08e8de", - "rgb": [8, 232, 222] - }, - "bright_ube": { - "name": "Bright Ube", - "hex": "#d19fe8", - "rgb": [209, 159, 232] - }, - "brilliant_lavender": { - "name": "Brilliant Lavender", - "hex": "#f4bbff", - "rgb": [244, 187, 255] - }, - "brilliant_rose": { - "name": "Brilliant Rose", - "hex": "#ff55a3", - "rgb": [255, 85, 163] - }, - "brink_pink": { - "name": "Brink Pink", - "hex": "#fb607f", - "rgb": [251, 96, 127] - }, - "british_racing_green": { - "name": "British Racing Green", - "hex": "#004225", - "rgb": [0, 66, 37] - }, - "bronze": { - "name": "Bronze", - "hex": "#cd7f32", - "rgb": [205, 127, 50] - }, - "brown_traditional": { - "name": "Brown (Traditional)", - "hex": "#964b00", - "rgb": [150, 75, 0] - }, - "brown_web": { - "name": "Brown (Web)", - "hex": "#a52a2a", - "rgb": [165, 42, 42] - }, - "bubble_gum": { - "name": "Bubble Gum", - "hex": "#ffc1cc", - "rgb": [255, 193, 204] - }, - "bubbles": { - "name": "Bubbles", - "hex": "#e7feff", - "rgb": [231, 254, 255] - }, - "buff": { - "name": "Buff", - "hex": "#f0dc82", - "rgb": [240, 220, 130] - }, - "bulgarian_rose": { - "name": "Bulgarian Rose", - "hex": "#480607", - "rgb": [72, 6, 7] - }, - "burgundy": { - "name": "Burgundy", - "hex": "#800020", - "rgb": [128, 0, 32] - }, - "burlywood": { - "name": "Burlywood", - "hex": "#deb887", - "rgb": [222, 184, 135] - }, - "burnt_orange": { - "name": "Burnt Orange", - "hex": "#c50", - "rgb": [204, 85, 0] - }, - "burnt_sienna": { - "name": "Burnt Sienna", - "hex": "#e97451", - "rgb": [233, 116, 81] - }, - "burnt_umber": { - "name": "Burnt Umber", - "hex": "#8a3324", - "rgb": [138, 51, 36] - }, - "byzantine": { - "name": "Byzantine", - "hex": "#bd33a4", - "rgb": [189, 51, 164] - }, - "byzantium": { - "name": "Byzantium", - "hex": "#702963", - "rgb": [112, 41, 99] - }, - "cadet": { - "name": "Cadet", - "hex": "#536872", - "rgb": [83, 104, 114] - }, - "cadet_blue": { - "name": "Cadet Blue", - "hex": "#5f9ea0", - "rgb": [95, 158, 160] - }, - "cadet_grey": { - "name": "Cadet Grey", - "hex": "#91a3b0", - "rgb": [145, 163, 176] - }, - "cadmium_green": { - "name": "Cadmium Green", - "hex": "#006b3c", - "rgb": [0, 107, 60] - }, - "cadmium_orange": { - "name": "Cadmium Orange", - "hex": "#ed872d", - "rgb": [237, 135, 45] - }, - "cadmium_red": { - "name": "Cadmium Red", - "hex": "#e30022", - "rgb": [227, 0, 34] - }, - "cadmium_yellow": { - "name": "Cadmium Yellow", - "hex": "#fff600", - "rgb": [255, 246, 0] - }, - "caf_au_lait": { - "name": "Café Au Lait", - "hex": "#a67b5b", - "rgb": [166, 123, 91] - }, - "caf_noir": { - "name": "Café Noir", - "hex": "#4b3621", - "rgb": [75, 54, 33] - }, - "cal_poly_green": { - "name": "Cal Poly Green", - "hex": "#1e4d2b", - "rgb": [30, 77, 43] - }, - "cambridge_blue": { - "name": "Cambridge Blue", - "hex": "#a3c1ad", - "rgb": [163, 193, 173] - }, - "camel": { - "name": "Camel", - "hex": "#c19a6b", - "rgb": [193, 154, 107] - }, - "cameo_pink": { - "name": "Cameo Pink", - "hex": "#efbbcc", - "rgb": [239, 187, 204] - }, - "camouflage_green": { - "name": "Camouflage Green", - "hex": "#78866b", - "rgb": [120, 134, 107] - }, - "canary_yellow": { - "name": "Canary Yellow", - "hex": "#ffef00", - "rgb": [255, 239, 0] - }, - "candy_apple_red": { - "name": "Candy Apple Red", - "hex": "#ff0800", - "rgb": [255, 8, 0] - }, - "candy_pink": { - "name": "Candy Pink", - "hex": "#e4717a", - "rgb": [228, 113, 122] - }, - "capri": { - "name": "Capri", - "hex": "#00bfff", - "rgb": [0, 191, 255] - }, - "caput_mortuum": { - "name": "Caput Mortuum", - "hex": "#592720", - "rgb": [89, 39, 32] - }, - "cardinal": { - "name": "Cardinal", - "hex": "#c41e3a", - "rgb": [196, 30, 58] - }, - "caribbean_green": { - "name": "Caribbean Green", - "hex": "#0c9", - "rgb": [0, 204, 153] - }, - "carmine": { - "name": "Carmine", - "hex": "#960018", - "rgb": [150, 0, 24] - }, - "carmine_m_p": { - "name": "Carmine (M&P)", - "hex": "#d70040", - "rgb": [215, 0, 64] - }, - "carmine_pink": { - "name": "Carmine Pink", - "hex": "#eb4c42", - "rgb": [235, 76, 66] - }, - "carmine_red": { - "name": "Carmine Red", - "hex": "#ff0038", - "rgb": [255, 0, 56] - }, - "carnation_pink": { - "name": "Carnation Pink", - "hex": "#ffa6c9", - "rgb": [255, 166, 201] - }, - "carnelian": { - "name": "Carnelian", - "hex": "#b31b1b", - "rgb": [179, 27, 27] - }, - "carolina_blue": { - "name": "Carolina Blue", - "hex": "#99badd", - "rgb": [153, 186, 221] - }, - "carrot_orange": { - "name": "Carrot Orange", - "hex": "#ed9121", - "rgb": [237, 145, 33] - }, - "catalina_blue": { - "name": "Catalina Blue", - "hex": "#062a78", - "rgb": [6, 42, 120] - }, - "ceil": { - "name": "Ceil", - "hex": "#92a1cf", - "rgb": [146, 161, 207] - }, - "celadon": { - "name": "Celadon", - "hex": "#ace1af", - "rgb": [172, 225, 175] - }, - "celadon_blue": { - "name": "Celadon Blue", - "hex": "#007ba7", - "rgb": [0, 123, 167] - }, - "celadon_green": { - "name": "Celadon Green", - "hex": "#2f847c", - "rgb": [47, 132, 124] - }, - "celeste_colour": { - "name": "Celeste (Colour)", - "hex": "#b2ffff", - "rgb": [178, 255, 255] - }, - "celestial_blue": { - "name": "Celestial Blue", - "hex": "#4997d0", - "rgb": [73, 151, 208] - }, - "cerise": { - "name": "Cerise", - "hex": "#de3163", - "rgb": [222, 49, 99] - }, - "cerise_pink": { - "name": "Cerise Pink", - "hex": "#ec3b83", - "rgb": [236, 59, 131] - }, - "cerulean": { - "name": "Cerulean", - "hex": "#007ba7", - "rgb": [0, 123, 167] - }, - "cerulean_blue": { - "name": "Cerulean Blue", - "hex": "#2a52be", - "rgb": [42, 82, 190] - }, - "cerulean_frost": { - "name": "Cerulean Frost", - "hex": "#6d9bc3", - "rgb": [109, 155, 195] - }, - "cg_blue": { - "name": "Cg Blue", - "hex": "#007aa5", - "rgb": [0, 122, 165] - }, - "cg_red": { - "name": "Cg Red", - "hex": "#e03c31", - "rgb": [224, 60, 49] - }, - "chamoisee": { - "name": "Chamoisee", - "hex": "#a0785a", - "rgb": [160, 120, 90] - }, - "champagne": { - "name": "Champagne", - "hex": "#fad6a5", - "rgb": [250, 214, 165] - }, - "charcoal": { - "name": "Charcoal", - "hex": "#36454f", - "rgb": [54, 69, 79] - }, - "charm_pink": { - "name": "Charm Pink", - "hex": "#e68fac", - "rgb": [230, 143, 172] - }, - "chartreuse_traditional": { - "name": "Chartreuse (Traditional)", - "hex": "#dfff00", - "rgb": [223, 255, 0] - }, - "chartreuse_web": { - "name": "Chartreuse (Web)", - "hex": "#7fff00", - "rgb": [127, 255, 0] - }, - "cherry": { - "name": "Cherry", - "hex": "#de3163", - "rgb": [222, 49, 99] - }, - "cherry_blossom_pink": { - "name": "Cherry Blossom Pink", - "hex": "#ffb7c5", - "rgb": [255, 183, 197] - }, - "chestnut": { - "name": "Chestnut", - "hex": "#cd5c5c", - "rgb": [205, 92, 92] - }, - "china_pink": { - "name": "China Pink", - "hex": "#de6fa1", - "rgb": [222, 111, 161] - }, - "china_rose": { - "name": "China Rose", - "hex": "#a8516e", - "rgb": [168, 81, 110] - }, - "chinese_red": { - "name": "Chinese Red", - "hex": "#aa381e", - "rgb": [170, 56, 30] - }, - "chocolate_traditional": { - "name": "Chocolate (Traditional)", - "hex": "#7b3f00", - "rgb": [123, 63, 0] - }, - "chocolate_web": { - "name": "Chocolate (Web)", - "hex": "#d2691e", - "rgb": [210, 105, 30] - }, - "chrome_yellow": { - "name": "Chrome Yellow", - "hex": "#ffa700", - "rgb": [255, 167, 0] - }, - "cinereous": { - "name": "Cinereous", - "hex": "#98817b", - "rgb": [152, 129, 123] - }, - "cinnabar": { - "name": "Cinnabar", - "hex": "#e34234", - "rgb": [227, 66, 52] - }, - "cinnamon": { - "name": "Cinnamon", - "hex": "#d2691e", - "rgb": [210, 105, 30] - }, - "citrine": { - "name": "Citrine", - "hex": "#e4d00a", - "rgb": [228, 208, 10] - }, - "classic_rose": { - "name": "Classic Rose", - "hex": "#fbcce7", - "rgb": [251, 204, 231] - }, - "cobalt": { - "name": "Cobalt", - "hex": "#0047ab", - "rgb": [0, 71, 171] - }, - "cocoa_brown": { - "name": "Cocoa Brown", - "hex": "#d2691e", - "rgb": [210, 105, 30] - }, - "coffee": { - "name": "Coffee", - "hex": "#6f4e37", - "rgb": [111, 78, 55] - }, - "columbia_blue": { - "name": "Columbia Blue", - "hex": "#9bddff", - "rgb": [155, 221, 255] - }, - "congo_pink": { - "name": "Congo Pink", - "hex": "#f88379", - "rgb": [248, 131, 121] - }, - "cool_black": { - "name": "Cool Black", - "hex": "#002e63", - "rgb": [0, 46, 99] - }, - "cool_grey": { - "name": "Cool Grey", - "hex": "#8c92ac", - "rgb": [140, 146, 172] - }, - "copper": { - "name": "Copper", - "hex": "#b87333", - "rgb": [184, 115, 51] - }, - "copper_crayola": { - "name": "Copper (Crayola)", - "hex": "#da8a67", - "rgb": [218, 138, 103] - }, - "copper_penny": { - "name": "Copper Penny", - "hex": "#ad6f69", - "rgb": [173, 111, 105] - }, - "copper_red": { - "name": "Copper Red", - "hex": "#cb6d51", - "rgb": [203, 109, 81] - }, - "copper_rose": { - "name": "Copper Rose", - "hex": "#966", - "rgb": [153, 102, 102] - }, - "coquelicot": { - "name": "Coquelicot", - "hex": "#ff3800", - "rgb": [255, 56, 0] - }, - "coral": { - "name": "Coral", - "hex": "#ff7f50", - "rgb": [255, 127, 80] - }, - "coral_pink": { - "name": "Coral Pink", - "hex": "#f88379", - "rgb": [248, 131, 121] - }, - "coral_red": { - "name": "Coral Red", - "hex": "#ff4040", - "rgb": [255, 64, 64] - }, - "cordovan": { - "name": "Cordovan", - "hex": "#893f45", - "rgb": [137, 63, 69] - }, - "corn": { - "name": "Corn", - "hex": "#fbec5d", - "rgb": [251, 236, 93] - }, - "cornell_red": { - "name": "Cornell Red", - "hex": "#b31b1b", - "rgb": [179, 27, 27] - }, - "cornflower_blue": { - "name": "Cornflower Blue", - "hex": "#6495ed", - "rgb": [100, 149, 237] - }, - "cornsilk": { - "name": "Cornsilk", - "hex": "#fff8dc", - "rgb": [255, 248, 220] - }, - "cosmic_latte": { - "name": "Cosmic Latte", - "hex": "#fff8e7", - "rgb": [255, 248, 231] - }, - "cotton_candy": { - "name": "Cotton Candy", - "hex": "#ffbcd9", - "rgb": [255, 188, 217] - }, - "cream": { - "name": "Cream", - "hex": "#fffdd0", - "rgb": [255, 253, 208] - }, - "crimson": { - "name": "Crimson", - "hex": "#dc143c", - "rgb": [220, 20, 60] - }, - "crimson_glory": { - "name": "Crimson Glory", - "hex": "#be0032", - "rgb": [190, 0, 50] - }, - "cyan": { - "name": "Cyan", - "hex": "#0ff", - "rgb": [0, 255, 255] - }, - "cyan_process": { - "name": "Cyan (Process)", - "hex": "#00b7eb", - "rgb": [0, 183, 235] - }, - "daffodil": { - "name": "Daffodil", - "hex": "#ffff31", - "rgb": [255, 255, 49] - }, - "dandelion": { - "name": "Dandelion", - "hex": "#f0e130", - "rgb": [240, 225, 48] - }, - "dark_blue": { - "name": "Dark Blue", - "hex": "#00008b", - "rgb": [0, 0, 139] - }, - "dark_brown": { - "name": "Dark Brown", - "hex": "#654321", - "rgb": [101, 67, 33] - }, - "dark_byzantium": { - "name": "Dark Byzantium", - "hex": "#5d3954", - "rgb": [93, 57, 84] - }, - "dark_candy_apple_red": { - "name": "Dark Candy Apple Red", - "hex": "#a40000", - "rgb": [164, 0, 0] - }, - "dark_cerulean": { - "name": "Dark Cerulean", - "hex": "#08457e", - "rgb": [8, 69, 126] - }, - "dark_chestnut": { - "name": "Dark Chestnut", - "hex": "#986960", - "rgb": [152, 105, 96] - }, - "dark_coral": { - "name": "Dark Coral", - "hex": "#cd5b45", - "rgb": [205, 91, 69] - }, - "dark_cyan": { - "name": "Dark Cyan", - "hex": "#008b8b", - "rgb": [0, 139, 139] - }, - "dark_electric_blue": { - "name": "Dark Electric Blue", - "hex": "#536878", - "rgb": [83, 104, 120] - }, - "dark_goldenrod": { - "name": "Dark Goldenrod", - "hex": "#b8860b", - "rgb": [184, 134, 11] - }, - "dark_gray": { - "name": "Dark Gray", - "hex": "#a9a9a9", - "rgb": [169, 169, 169] - }, - "dark_green": { - "name": "Dark Green", - "hex": "#013220", - "rgb": [1, 50, 32] - }, - "dark_imperial_blue": { - "name": "Dark Imperial Blue", - "hex": "#00416a", - "rgb": [0, 65, 106] - }, - "dark_jungle_green": { - "name": "Dark Jungle Green", - "hex": "#1a2421", - "rgb": [26, 36, 33] - }, - "dark_khaki": { - "name": "Dark Khaki", - "hex": "#bdb76b", - "rgb": [189, 183, 107] - }, - "dark_lava": { - "name": "Dark Lava", - "hex": "#483c32", - "rgb": [72, 60, 50] - }, - "dark_lavender": { - "name": "Dark Lavender", - "hex": "#734f96", - "rgb": [115, 79, 150] - }, - "dark_magenta": { - "name": "Dark Magenta", - "hex": "#8b008b", - "rgb": [139, 0, 139] - }, - "dark_midnight_blue": { - "name": "Dark Midnight Blue", - "hex": "#036", - "rgb": [0, 51, 102] - }, - "dark_olive_green": { - "name": "Dark Olive Green", - "hex": "#556b2f", - "rgb": [85, 107, 47] - }, - "dark_orange": { - "name": "Dark Orange", - "hex": "#ff8c00", - "rgb": [255, 140, 0] - }, - "dark_orchid": { - "name": "Dark Orchid", - "hex": "#9932cc", - "rgb": [153, 50, 204] - }, - "dark_pastel_blue": { - "name": "Dark Pastel Blue", - "hex": "#779ecb", - "rgb": [119, 158, 203] - }, - "dark_pastel_green": { - "name": "Dark Pastel Green", - "hex": "#03c03c", - "rgb": [3, 192, 60] - }, - "dark_pastel_purple": { - "name": "Dark Pastel Purple", - "hex": "#966fd6", - "rgb": [150, 111, 214] - }, - "dark_pastel_red": { - "name": "Dark Pastel Red", - "hex": "#c23b22", - "rgb": [194, 59, 34] - }, - "dark_pink": { - "name": "Dark Pink", - "hex": "#e75480", - "rgb": [231, 84, 128] - }, - "dark_powder_blue": { - "name": "Dark Powder Blue", - "hex": "#039", - "rgb": [0, 51, 153] - }, - "dark_raspberry": { - "name": "Dark Raspberry", - "hex": "#872657", - "rgb": [135, 38, 87] - }, - "dark_red": { - "name": "Dark Red", - "hex": "#8b0000", - "rgb": [139, 0, 0] - }, - "dark_salmon": { - "name": "Dark Salmon", - "hex": "#e9967a", - "rgb": [233, 150, 122] - }, - "dark_scarlet": { - "name": "Dark Scarlet", - "hex": "#560319", - "rgb": [86, 3, 25] - }, - "dark_sea_green": { - "name": "Dark Sea Green", - "hex": "#8fbc8f", - "rgb": [143, 188, 143] - }, - "dark_sienna": { - "name": "Dark Sienna", - "hex": "#3c1414", - "rgb": [60, 20, 20] - }, - "dark_slate_blue": { - "name": "Dark Slate Blue", - "hex": "#483d8b", - "rgb": [72, 61, 139] - }, - "dark_slate_gray": { - "name": "Dark Slate Gray", - "hex": "#2f4f4f", - "rgb": [47, 79, 79] - }, - "dark_spring_green": { - "name": "Dark Spring Green", - "hex": "#177245", - "rgb": [23, 114, 69] - }, - "dark_tan": { - "name": "Dark Tan", - "hex": "#918151", - "rgb": [145, 129, 81] - }, - "dark_tangerine": { - "name": "Dark Tangerine", - "hex": "#ffa812", - "rgb": [255, 168, 18] - }, - "dark_taupe": { - "name": "Dark Taupe", - "hex": "#483c32", - "rgb": [72, 60, 50] - }, - "dark_terra_cotta": { - "name": "Dark Terra Cotta", - "hex": "#cc4e5c", - "rgb": [204, 78, 92] - }, - "dark_turquoise": { - "name": "Dark Turquoise", - "hex": "#00ced1", - "rgb": [0, 206, 209] - }, - "dark_violet": { - "name": "Dark Violet", - "hex": "#9400d3", - "rgb": [148, 0, 211] - }, - "dark_yellow": { - "name": "Dark Yellow", - "hex": "#9b870c", - "rgb": [155, 135, 12] - }, - "dartmouth_green": { - "name": "Dartmouth Green", - "hex": "#00703c", - "rgb": [0, 112, 60] - }, - "davy_s_grey": { - "name": "Davy'S Grey", - "hex": "#555", - "rgb": [85, 85, 85] - }, - "debian_red": { - "name": "Debian Red", - "hex": "#d70a53", - "rgb": [215, 10, 83] - }, - "deep_carmine": { - "name": "Deep Carmine", - "hex": "#a9203e", - "rgb": [169, 32, 62] - }, - "deep_carmine_pink": { - "name": "Deep Carmine Pink", - "hex": "#ef3038", - "rgb": [239, 48, 56] - }, - "deep_carrot_orange": { - "name": "Deep Carrot Orange", - "hex": "#e9692c", - "rgb": [233, 105, 44] - }, - "deep_cerise": { - "name": "Deep Cerise", - "hex": "#da3287", - "rgb": [218, 50, 135] - }, - "deep_champagne": { - "name": "Deep Champagne", - "hex": "#fad6a5", - "rgb": [250, 214, 165] - }, - "deep_chestnut": { - "name": "Deep Chestnut", - "hex": "#b94e48", - "rgb": [185, 78, 72] - }, - "deep_coffee": { - "name": "Deep Coffee", - "hex": "#704241", - "rgb": [112, 66, 65] - }, - "deep_fuchsia": { - "name": "Deep Fuchsia", - "hex": "#c154c1", - "rgb": [193, 84, 193] - }, - "deep_jungle_green": { - "name": "Deep Jungle Green", - "hex": "#004b49", - "rgb": [0, 75, 73] - }, - "deep_lilac": { - "name": "Deep Lilac", - "hex": "#95b", - "rgb": [153, 85, 187] - }, - "deep_magenta": { - "name": "Deep Magenta", - "hex": "#c0c", - "rgb": [204, 0, 204] - }, - "deep_peach": { - "name": "Deep Peach", - "hex": "#ffcba4", - "rgb": [255, 203, 164] - }, - "deep_pink": { - "name": "Deep Pink", - "hex": "#ff1493", - "rgb": [255, 20, 147] - }, - "deep_ruby": { - "name": "Deep Ruby", - "hex": "#843f5b", - "rgb": [132, 63, 91] - }, - "deep_saffron": { - "name": "Deep Saffron", - "hex": "#f93", - "rgb": [255, 153, 51] - }, - "deep_sky_blue": { - "name": "Deep Sky Blue", - "hex": "#00bfff", - "rgb": [0, 191, 255] - }, - "deep_tuscan_red": { - "name": "Deep Tuscan Red", - "hex": "#66424d", - "rgb": [102, 66, 77] - }, - "denim": { - "name": "Denim", - "hex": "#1560bd", - "rgb": [21, 96, 189] - }, - "desert": { - "name": "Desert", - "hex": "#c19a6b", - "rgb": [193, 154, 107] - }, - "desert_sand": { - "name": "Desert Sand", - "hex": "#edc9af", - "rgb": [237, 201, 175] - }, - "dim_gray": { - "name": "Dim Gray", - "hex": "#696969", - "rgb": [105, 105, 105] - }, - "dodger_blue": { - "name": "Dodger Blue", - "hex": "#1e90ff", - "rgb": [30, 144, 255] - }, - "dogwood_rose": { - "name": "Dogwood Rose", - "hex": "#d71868", - "rgb": [215, 24, 104] - }, - "dollar_bill": { - "name": "Dollar Bill", - "hex": "#85bb65", - "rgb": [133, 187, 101] - }, - "drab": { - "name": "Drab", - "hex": "#967117", - "rgb": [150, 113, 23] - }, - "duke_blue": { - "name": "Duke Blue", - "hex": "#00009c", - "rgb": [0, 0, 156] - }, - "earth_yellow": { - "name": "Earth Yellow", - "hex": "#e1a95f", - "rgb": [225, 169, 95] - }, - "ebony": { - "name": "Ebony", - "hex": "#555d50", - "rgb": [85, 93, 80] - }, - "ecru": { - "name": "Ecru", - "hex": "#c2b280", - "rgb": [194, 178, 128] - }, - "eggplant": { - "name": "Eggplant", - "hex": "#614051", - "rgb": [97, 64, 81] - }, - "eggshell": { - "name": "Eggshell", - "hex": "#f0ead6", - "rgb": [240, 234, 214] - }, - "egyptian_blue": { - "name": "Egyptian Blue", - "hex": "#1034a6", - "rgb": [16, 52, 166] - }, - "electric_blue": { - "name": "Electric Blue", - "hex": "#7df9ff", - "rgb": [125, 249, 255] - }, - "electric_crimson": { - "name": "Electric Crimson", - "hex": "#ff003f", - "rgb": [255, 0, 63] - }, - "electric_cyan": { - "name": "Electric Cyan", - "hex": "#0ff", - "rgb": [0, 255, 255] - }, - "electric_green": { - "name": "Electric Green", - "hex": "#0f0", - "rgb": [0, 255, 0] - }, - "electric_indigo": { - "name": "Electric Indigo", - "hex": "#6f00ff", - "rgb": [111, 0, 255] - }, - "electric_lavender": { - "name": "Electric Lavender", - "hex": "#f4bbff", - "rgb": [244, 187, 255] - }, - "electric_lime": { - "name": "Electric Lime", - "hex": "#cf0", - "rgb": [204, 255, 0] - }, - "electric_purple": { - "name": "Electric Purple", - "hex": "#bf00ff", - "rgb": [191, 0, 255] - }, - "electric_ultramarine": { - "name": "Electric Ultramarine", - "hex": "#3f00ff", - "rgb": [63, 0, 255] - }, - "electric_violet": { - "name": "Electric Violet", - "hex": "#8f00ff", - "rgb": [143, 0, 255] - }, - "electric_yellow": { - "name": "Electric Yellow", - "hex": "#ff0", - "rgb": [255, 255, 0] - }, - "emerald": { - "name": "Emerald", - "hex": "#50c878", - "rgb": [80, 200, 120] - }, - "english_lavender": { - "name": "English Lavender", - "hex": "#b48395", - "rgb": [180, 131, 149] - }, - "eton_blue": { - "name": "Eton Blue", - "hex": "#96c8a2", - "rgb": [150, 200, 162] - }, - "fallow": { - "name": "Fallow", - "hex": "#c19a6b", - "rgb": [193, 154, 107] - }, - "falu_red": { - "name": "Falu Red", - "hex": "#801818", - "rgb": [128, 24, 24] - }, - "fandango": { - "name": "Fandango", - "hex": "#b53389", - "rgb": [181, 51, 137] - }, - "fashion_fuchsia": { - "name": "Fashion Fuchsia", - "hex": "#f400a1", - "rgb": [244, 0, 161] - }, - "fawn": { - "name": "Fawn", - "hex": "#e5aa70", - "rgb": [229, 170, 112] - }, - "feldgrau": { - "name": "Feldgrau", - "hex": "#4d5d53", - "rgb": [77, 93, 83] - }, - "fern_green": { - "name": "Fern Green", - "hex": "#4f7942", - "rgb": [79, 121, 66] - }, - "ferrari_red": { - "name": "Ferrari Red", - "hex": "#ff2800", - "rgb": [255, 40, 0] - }, - "field_drab": { - "name": "Field Drab", - "hex": "#6c541e", - "rgb": [108, 84, 30] - }, - "fire_engine_red": { - "name": "Fire Engine Red", - "hex": "#ce2029", - "rgb": [206, 32, 41] - }, - "firebrick": { - "name": "Firebrick", - "hex": "#b22222", - "rgb": [178, 34, 34] - }, - "flame": { - "name": "Flame", - "hex": "#e25822", - "rgb": [226, 88, 34] - }, - "flamingo_pink": { - "name": "Flamingo Pink", - "hex": "#fc8eac", - "rgb": [252, 142, 172] - }, - "flavescent": { - "name": "Flavescent", - "hex": "#f7e98e", - "rgb": [247, 233, 142] - }, - "flax": { - "name": "Flax", - "hex": "#eedc82", - "rgb": [238, 220, 130] - }, - "floral_white": { - "name": "Floral White", - "hex": "#fffaf0", - "rgb": [255, 250, 240] - }, - "fluorescent_orange": { - "name": "Fluorescent Orange", - "hex": "#ffbf00", - "rgb": [255, 191, 0] - }, - "fluorescent_pink": { - "name": "Fluorescent Pink", - "hex": "#ff1493", - "rgb": [255, 20, 147] - }, - "fluorescent_yellow": { - "name": "Fluorescent Yellow", - "hex": "#cf0", - "rgb": [204, 255, 0] - }, - "folly": { - "name": "Folly", - "hex": "#ff004f", - "rgb": [255, 0, 79] - }, - "forest_green_traditional": { - "name": "Forest Green (Traditional)", - "hex": "#014421", - "rgb": [1, 68, 33] - }, - "forest_green_web": { - "name": "Forest Green (Web)", - "hex": "#228b22", - "rgb": [34, 139, 34] - }, - "french_beige": { - "name": "French Beige", - "hex": "#a67b5b", - "rgb": [166, 123, 91] - }, - "french_blue": { - "name": "French Blue", - "hex": "#0072bb", - "rgb": [0, 114, 187] - }, - "french_lilac": { - "name": "French Lilac", - "hex": "#86608e", - "rgb": [134, 96, 142] - }, - "french_lime": { - "name": "French Lime", - "hex": "#cf0", - "rgb": [204, 255, 0] - }, - "french_raspberry": { - "name": "French Raspberry", - "hex": "#c72c48", - "rgb": [199, 44, 72] - }, - "french_rose": { - "name": "French Rose", - "hex": "#f64a8a", - "rgb": [246, 74, 138] - }, - "fuchsia": { - "name": "Fuchsia", - "hex": "#f0f", - "rgb": [255, 0, 255] - }, - "fuchsia_crayola": { - "name": "Fuchsia (Crayola)", - "hex": "#c154c1", - "rgb": [193, 84, 193] - }, - "fuchsia_pink": { - "name": "Fuchsia Pink", - "hex": "#f7f", - "rgb": [255, 119, 255] - }, - "fuchsia_rose": { - "name": "Fuchsia Rose", - "hex": "#c74375", - "rgb": [199, 67, 117] - }, - "fulvous": { - "name": "Fulvous", - "hex": "#e48400", - "rgb": [228, 132, 0] - }, - "fuzzy_wuzzy": { - "name": "Fuzzy Wuzzy", - "hex": "#c66", - "rgb": [204, 102, 102] - }, - "gainsboro": { - "name": "Gainsboro", - "hex": "#dcdcdc", - "rgb": [220, 220, 220] - }, - "gamboge": { - "name": "Gamboge", - "hex": "#e49b0f", - "rgb": [228, 155, 15] - }, - "ghost_white": { - "name": "Ghost White", - "hex": "#f8f8ff", - "rgb": [248, 248, 255] - }, - "ginger": { - "name": "Ginger", - "hex": "#b06500", - "rgb": [176, 101, 0] - }, - "glaucous": { - "name": "Glaucous", - "hex": "#6082b6", - "rgb": [96, 130, 182] - }, - "glitter": { - "name": "Glitter", - "hex": "#e6e8fa", - "rgb": [230, 232, 250] - }, - "gold_metallic": { - "name": "Gold (Metallic)", - "hex": "#d4af37", - "rgb": [212, 175, 55] - }, - "gold_web_golden": { - "name": "Gold (Web) (Golden)", - "hex": "#ffd700", - "rgb": [255, 215, 0] - }, - "golden_brown": { - "name": "Golden Brown", - "hex": "#996515", - "rgb": [153, 101, 21] - }, - "golden_poppy": { - "name": "Golden Poppy", - "hex": "#fcc200", - "rgb": [252, 194, 0] - }, - "golden_yellow": { - "name": "Golden Yellow", - "hex": "#ffdf00", - "rgb": [255, 223, 0] - }, - "goldenrod": { - "name": "Goldenrod", - "hex": "#daa520", - "rgb": [218, 165, 32] - }, - "granny_smith_apple": { - "name": "Granny Smith Apple", - "hex": "#a8e4a0", - "rgb": [168, 228, 160] - }, - "gray": { - "name": "Gray", - "hex": "#808080", - "rgb": [128, 128, 128] - }, - "gray_asparagus": { - "name": "Gray-Asparagus", - "hex": "#465945", - "rgb": [70, 89, 69] - }, - "gray_html_css_gray": { - "name": "Gray (Html/Css Gray)", - "hex": "#808080", - "rgb": [128, 128, 128] - }, - "gray_x11_gray": { - "name": "Gray (X11 Gray)", - "hex": "#bebebe", - "rgb": [190, 190, 190] - }, - "green_color_wheel_x11_green": { - "name": "Green (Color Wheel) (X11 Green)", - "hex": "#0f0", - "rgb": [0, 255, 0] - }, - "green_crayola": { - "name": "Green (Crayola)", - "hex": "#1cac78", - "rgb": [28, 172, 120] - }, - "green_html_css_green": { - "name": "Green (Html/Css Green)", - "hex": "#008000", - "rgb": [0, 128, 0] - }, - "green_munsell": { - "name": "Green (Munsell)", - "hex": "#00a877", - "rgb": [0, 168, 119] - }, - "green_ncs": { - "name": "Green (Ncs)", - "hex": "#009f6b", - "rgb": [0, 159, 107] - }, - "green_pigment": { - "name": "Green (Pigment)", - "hex": "#00a550", - "rgb": [0, 165, 80] - }, - "green_ryb": { - "name": "Green (Ryb)", - "hex": "#66b032", - "rgb": [102, 176, 50] - }, - "green_yellow": { - "name": "Green-Yellow", - "hex": "#adff2f", - "rgb": [173, 255, 47] - }, - "grullo": { - "name": "Grullo", - "hex": "#a99a86", - "rgb": [169, 154, 134] - }, - "guppie_green": { - "name": "Guppie Green", - "hex": "#00ff7f", - "rgb": [0, 255, 127] - }, - "halay_be": { - "name": "Halayà úBe", - "hex": "#663854", - "rgb": [102, 56, 84] - }, - "han_blue": { - "name": "Han Blue", - "hex": "#446ccf", - "rgb": [68, 108, 207] - }, - "han_purple": { - "name": "Han Purple", - "hex": "#5218fa", - "rgb": [82, 24, 250] - }, - "hansa_yellow": { - "name": "Hansa Yellow", - "hex": "#e9d66b", - "rgb": [233, 214, 107] - }, - "harlequin": { - "name": "Harlequin", - "hex": "#3fff00", - "rgb": [63, 255, 0] - }, - "harvard_crimson": { - "name": "Harvard Crimson", - "hex": "#c90016", - "rgb": [201, 0, 22] - }, - "harvest_gold": { - "name": "Harvest Gold", - "hex": "#da9100", - "rgb": [218, 145, 0] - }, - "heart_gold": { - "name": "Heart Gold", - "hex": "#808000", - "rgb": [128, 128, 0] - }, - "heliotrope": { - "name": "Heliotrope", - "hex": "#df73ff", - "rgb": [223, 115, 255] - }, - "hollywood_cerise": { - "name": "Hollywood Cerise", - "hex": "#f400a1", - "rgb": [244, 0, 161] - }, - "honeydew": { - "name": "Honeydew", - "hex": "#f0fff0", - "rgb": [240, 255, 240] - }, - "honolulu_blue": { - "name": "Honolulu Blue", - "hex": "#007fbf", - "rgb": [0, 127, 191] - }, - "hooker_s_green": { - "name": "Hooker'S Green", - "hex": "#49796b", - "rgb": [73, 121, 107] - }, - "hot_magenta": { - "name": "Hot Magenta", - "hex": "#ff1dce", - "rgb": [255, 29, 206] - }, - "hot_pink": { - "name": "Hot Pink", - "hex": "#ff69b4", - "rgb": [255, 105, 180] - }, - "hunter_green": { - "name": "Hunter Green", - "hex": "#355e3b", - "rgb": [53, 94, 59] - }, - "iceberg": { - "name": "Iceberg", - "hex": "#71a6d2", - "rgb": [113, 166, 210] - }, - "icterine": { - "name": "Icterine", - "hex": "#fcf75e", - "rgb": [252, 247, 94] - }, - "imperial_blue": { - "name": "Imperial Blue", - "hex": "#002395", - "rgb": [0, 35, 149] - }, - "inchworm": { - "name": "Inchworm", - "hex": "#b2ec5d", - "rgb": [178, 236, 93] - }, - "india_green": { - "name": "India Green", - "hex": "#138808", - "rgb": [19, 136, 8] - }, - "indian_red": { - "name": "Indian Red", - "hex": "#cd5c5c", - "rgb": [205, 92, 92] - }, - "indian_yellow": { - "name": "Indian Yellow", - "hex": "#e3a857", - "rgb": [227, 168, 87] - }, - "indigo": { - "name": "Indigo", - "hex": "#6f00ff", - "rgb": [111, 0, 255] - }, - "indigo_dye": { - "name": "Indigo (Dye)", - "hex": "#00416a", - "rgb": [0, 65, 106] - }, - "indigo_web": { - "name": "Indigo (Web)", - "hex": "#4b0082", - "rgb": [75, 0, 130] - }, - "international_klein_blue": { - "name": "International Klein Blue", - "hex": "#002fa7", - "rgb": [0, 47, 167] - }, - "international_orange_aerospace": { - "name": "International Orange (Aerospace)", - "hex": "#ff4f00", - "rgb": [255, 79, 0] - }, - "international_orange_engineering": { - "name": "International Orange (Engineering)", - "hex": "#ba160c", - "rgb": [186, 22, 12] - }, - "international_orange_golden_gate_bridge": { - "name": "International Orange (Golden Gate Bridge)", - "hex": "#c0362c", - "rgb": [192, 54, 44] - }, - "iris": { - "name": "Iris", - "hex": "#5a4fcf", - "rgb": [90, 79, 207] - }, - "isabelline": { - "name": "Isabelline", - "hex": "#f4f0ec", - "rgb": [244, 240, 236] - }, - "islamic_green": { - "name": "Islamic Green", - "hex": "#009000", - "rgb": [0, 144, 0] - }, - "ivory": { - "name": "Ivory", - "hex": "#fffff0", - "rgb": [255, 255, 240] - }, - "jade": { - "name": "Jade", - "hex": "#00a86b", - "rgb": [0, 168, 107] - }, - "jasmine": { - "name": "Jasmine", - "hex": "#f8de7e", - "rgb": [248, 222, 126] - }, - "jasper": { - "name": "Jasper", - "hex": "#d73b3e", - "rgb": [215, 59, 62] - }, - "jazzberry_jam": { - "name": "Jazzberry Jam", - "hex": "#a50b5e", - "rgb": [165, 11, 94] - }, - "jet": { - "name": "Jet", - "hex": "#343434", - "rgb": [52, 52, 52] - }, - "jonquil": { - "name": "Jonquil", - "hex": "#fada5e", - "rgb": [250, 218, 94] - }, - "june_bud": { - "name": "June Bud", - "hex": "#bdda57", - "rgb": [189, 218, 87] - }, - "jungle_green": { - "name": "Jungle Green", - "hex": "#29ab87", - "rgb": [41, 171, 135] - }, - "kelly_green": { - "name": "Kelly Green", - "hex": "#4cbb17", - "rgb": [76, 187, 23] - }, - "kenyan_copper": { - "name": "Kenyan Copper", - "hex": "#7c1c05", - "rgb": [124, 28, 5] - }, - "khaki_html_css_khaki": { - "name": "Khaki (Html/Css) (Khaki)", - "hex": "#c3b091", - "rgb": [195, 176, 145] - }, - "khaki_x11_light_khaki": { - "name": "Khaki (X11) (Light Khaki)", - "hex": "#f0e68c", - "rgb": [240, 230, 140] - }, - "ku_crimson": { - "name": "Ku Crimson", - "hex": "#e8000d", - "rgb": [232, 0, 13] - }, - "la_salle_green": { - "name": "La Salle Green", - "hex": "#087830", - "rgb": [8, 120, 48] - }, - "languid_lavender": { - "name": "Languid Lavender", - "hex": "#d6cadd", - "rgb": [214, 202, 221] - }, - "lapis_lazuli": { - "name": "Lapis Lazuli", - "hex": "#26619c", - "rgb": [38, 97, 156] - }, - "laser_lemon": { - "name": "Laser Lemon", - "hex": "#fefe22", - "rgb": [254, 254, 34] - }, - "laurel_green": { - "name": "Laurel Green", - "hex": "#a9ba9d", - "rgb": [169, 186, 157] - }, - "lava": { - "name": "Lava", - "hex": "#cf1020", - "rgb": [207, 16, 32] - }, - "lavender_blue": { - "name": "Lavender Blue", - "hex": "#ccf", - "rgb": [204, 204, 255] - }, - "lavender_blush": { - "name": "Lavender Blush", - "hex": "#fff0f5", - "rgb": [255, 240, 245] - }, - "lavender_floral": { - "name": "Lavender (Floral)", - "hex": "#b57edc", - "rgb": [181, 126, 220] - }, - "lavender_gray": { - "name": "Lavender Gray", - "hex": "#c4c3d0", - "rgb": [196, 195, 208] - }, - "lavender_indigo": { - "name": "Lavender Indigo", - "hex": "#9457eb", - "rgb": [148, 87, 235] - }, - "lavender_magenta": { - "name": "Lavender Magenta", - "hex": "#ee82ee", - "rgb": [238, 130, 238] - }, - "lavender_mist": { - "name": "Lavender Mist", - "hex": "#e6e6fa", - "rgb": [230, 230, 250] - }, - "lavender_pink": { - "name": "Lavender Pink", - "hex": "#fbaed2", - "rgb": [251, 174, 210] - }, - "lavender_purple": { - "name": "Lavender Purple", - "hex": "#967bb6", - "rgb": [150, 123, 182] - }, - "lavender_rose": { - "name": "Lavender Rose", - "hex": "#fba0e3", - "rgb": [251, 160, 227] - }, - "lavender_web": { - "name": "Lavender (Web)", - "hex": "#e6e6fa", - "rgb": [230, 230, 250] - }, - "lawn_green": { - "name": "Lawn Green", - "hex": "#7cfc00", - "rgb": [124, 252, 0] - }, - "lemon": { - "name": "Lemon", - "hex": "#fff700", - "rgb": [255, 247, 0] - }, - "lemon_chiffon": { - "name": "Lemon Chiffon", - "hex": "#fffacd", - "rgb": [255, 250, 205] - }, - "lemon_lime": { - "name": "Lemon Lime", - "hex": "#e3ff00", - "rgb": [227, 255, 0] - }, - "licorice": { - "name": "Licorice", - "hex": "#1a1110", - "rgb": [26, 17, 16] - }, - "light_apricot": { - "name": "Light Apricot", - "hex": "#fdd5b1", - "rgb": [253, 213, 177] - }, - "light_blue": { - "name": "Light Blue", - "hex": "#add8e6", - "rgb": [173, 216, 230] - }, - "light_brown": { - "name": "Light Brown", - "hex": "#b5651d", - "rgb": [181, 101, 29] - }, - "light_carmine_pink": { - "name": "Light Carmine Pink", - "hex": "#e66771", - "rgb": [230, 103, 113] - }, - "light_coral": { - "name": "Light Coral", - "hex": "#f08080", - "rgb": [240, 128, 128] - }, - "light_cornflower_blue": { - "name": "Light Cornflower Blue", - "hex": "#93ccea", - "rgb": [147, 204, 234] - }, - "light_crimson": { - "name": "Light Crimson", - "hex": "#f56991", - "rgb": [245, 105, 145] - }, - "light_cyan": { - "name": "Light Cyan", - "hex": "#e0ffff", - "rgb": [224, 255, 255] - }, - "light_fuchsia_pink": { - "name": "Light Fuchsia Pink", - "hex": "#f984ef", - "rgb": [249, 132, 239] - }, - "light_goldenrod_yellow": { - "name": "Light Goldenrod Yellow", - "hex": "#fafad2", - "rgb": [250, 250, 210] - }, - "light_gray": { - "name": "Light Gray", - "hex": "#d3d3d3", - "rgb": [211, 211, 211] - }, - "light_green": { - "name": "Light Green", - "hex": "#90ee90", - "rgb": [144, 238, 144] - }, - "light_khaki": { - "name": "Light Khaki", - "hex": "#f0e68c", - "rgb": [240, 230, 140] - }, - "light_pastel_purple": { - "name": "Light Pastel Purple", - "hex": "#b19cd9", - "rgb": [177, 156, 217] - }, - "light_pink": { - "name": "Light Pink", - "hex": "#ffb6c1", - "rgb": [255, 182, 193] - }, - "light_red_ochre": { - "name": "Light Red Ochre", - "hex": "#e97451", - "rgb": [233, 116, 81] - }, - "light_salmon": { - "name": "Light Salmon", - "hex": "#ffa07a", - "rgb": [255, 160, 122] - }, - "light_salmon_pink": { - "name": "Light Salmon Pink", - "hex": "#f99", - "rgb": [255, 153, 153] - }, - "light_sea_green": { - "name": "Light Sea Green", - "hex": "#20b2aa", - "rgb": [32, 178, 170] - }, - "light_sky_blue": { - "name": "Light Sky Blue", - "hex": "#87cefa", - "rgb": [135, 206, 250] - }, - "light_slate_gray": { - "name": "Light Slate Gray", - "hex": "#789", - "rgb": [119, 136, 153] - }, - "light_taupe": { - "name": "Light Taupe", - "hex": "#b38b6d", - "rgb": [179, 139, 109] - }, - "light_thulian_pink": { - "name": "Light Thulian Pink", - "hex": "#e68fac", - "rgb": [230, 143, 172] - }, - "light_yellow": { - "name": "Light Yellow", - "hex": "#ffffe0", - "rgb": [255, 255, 224] - }, - "lilac": { - "name": "Lilac", - "hex": "#c8a2c8", - "rgb": [200, 162, 200] - }, - "lime_color_wheel": { - "name": "Lime (Color Wheel)", - "hex": "#bfff00", - "rgb": [191, 255, 0] - }, - "lime_green": { - "name": "Lime Green", - "hex": "#32cd32", - "rgb": [50, 205, 50] - }, - "lime_web_x11_green": { - "name": "Lime (Web) (X11 Green)", - "hex": "#0f0", - "rgb": [0, 255, 0] - }, - "limerick": { - "name": "Limerick", - "hex": "#9dc209", - "rgb": [157, 194, 9] - }, - "lincoln_green": { - "name": "Lincoln Green", - "hex": "#195905", - "rgb": [25, 89, 5] - }, - "linen": { - "name": "Linen", - "hex": "#faf0e6", - "rgb": [250, 240, 230] - }, - "lion": { - "name": "Lion", - "hex": "#c19a6b", - "rgb": [193, 154, 107] - }, - "little_boy_blue": { - "name": "Little Boy Blue", - "hex": "#6ca0dc", - "rgb": [108, 160, 220] - }, - "liver": { - "name": "Liver", - "hex": "#534b4f", - "rgb": [83, 75, 79] - }, - "lust": { - "name": "Lust", - "hex": "#e62020", - "rgb": [230, 32, 32] - }, - "magenta": { - "name": "Magenta", - "hex": "#f0f", - "rgb": [255, 0, 255] - }, - "magenta_dye": { - "name": "Magenta (Dye)", - "hex": "#ca1f7b", - "rgb": [202, 31, 123] - }, - "magenta_process": { - "name": "Magenta (Process)", - "hex": "#ff0090", - "rgb": [255, 0, 144] - }, - "magic_mint": { - "name": "Magic Mint", - "hex": "#aaf0d1", - "rgb": [170, 240, 209] - }, - "magnolia": { - "name": "Magnolia", - "hex": "#f8f4ff", - "rgb": [248, 244, 255] - }, - "mahogany": { - "name": "Mahogany", - "hex": "#c04000", - "rgb": [192, 64, 0] - }, - "maize": { - "name": "Maize", - "hex": "#fbec5d", - "rgb": [251, 236, 93] - }, - "majorelle_blue": { - "name": "Majorelle Blue", - "hex": "#6050dc", - "rgb": [96, 80, 220] - }, - "malachite": { - "name": "Malachite", - "hex": "#0bda51", - "rgb": [11, 218, 81] - }, - "manatee": { - "name": "Manatee", - "hex": "#979aaa", - "rgb": [151, 154, 170] - }, - "mango_tango": { - "name": "Mango Tango", - "hex": "#ff8243", - "rgb": [255, 130, 67] - }, - "mantis": { - "name": "Mantis", - "hex": "#74c365", - "rgb": [116, 195, 101] - }, - "mardi_gras": { - "name": "Mardi Gras", - "hex": "#880085", - "rgb": [136, 0, 133] - }, - "maroon_crayola": { - "name": "Maroon (Crayola)", - "hex": "#c32148", - "rgb": [195, 33, 72] - }, - "maroon_html_css": { - "name": "Maroon (Html/Css)", - "hex": "#800000", - "rgb": [128, 0, 0] - }, - "maroon_x11": { - "name": "Maroon (X11)", - "hex": "#b03060", - "rgb": [176, 48, 96] - }, - "mauve": { - "name": "Mauve", - "hex": "#e0b0ff", - "rgb": [224, 176, 255] - }, - "mauve_taupe": { - "name": "Mauve Taupe", - "hex": "#915f6d", - "rgb": [145, 95, 109] - }, - "mauvelous": { - "name": "Mauvelous", - "hex": "#ef98aa", - "rgb": [239, 152, 170] - }, - "maya_blue": { - "name": "Maya Blue", - "hex": "#73c2fb", - "rgb": [115, 194, 251] - }, - "meat_brown": { - "name": "Meat Brown", - "hex": "#e5b73b", - "rgb": [229, 183, 59] - }, - "medium_aquamarine": { - "name": "Medium Aquamarine", - "hex": "#6da", - "rgb": [102, 221, 170] - }, - "medium_blue": { - "name": "Medium Blue", - "hex": "#0000cd", - "rgb": [0, 0, 205] - }, - "medium_candy_apple_red": { - "name": "Medium Candy Apple Red", - "hex": "#e2062c", - "rgb": [226, 6, 44] - }, - "medium_carmine": { - "name": "Medium Carmine", - "hex": "#af4035", - "rgb": [175, 64, 53] - }, - "medium_champagne": { - "name": "Medium Champagne", - "hex": "#f3e5ab", - "rgb": [243, 229, 171] - }, - "medium_electric_blue": { - "name": "Medium Electric Blue", - "hex": "#035096", - "rgb": [3, 80, 150] - }, - "medium_jungle_green": { - "name": "Medium Jungle Green", - "hex": "#1c352d", - "rgb": [28, 53, 45] - }, - "medium_lavender_magenta": { - "name": "Medium Lavender Magenta", - "hex": "#dda0dd", - "rgb": [221, 160, 221] - }, - "medium_orchid": { - "name": "Medium Orchid", - "hex": "#ba55d3", - "rgb": [186, 85, 211] - }, - "medium_persian_blue": { - "name": "Medium Persian Blue", - "hex": "#0067a5", - "rgb": [0, 103, 165] - }, - "medium_purple": { - "name": "Medium Purple", - "hex": "#9370db", - "rgb": [147, 112, 219] - }, - "medium_red_violet": { - "name": "Medium Red-Violet", - "hex": "#bb3385", - "rgb": [187, 51, 133] - }, - "medium_ruby": { - "name": "Medium Ruby", - "hex": "#aa4069", - "rgb": [170, 64, 105] - }, - "medium_sea_green": { - "name": "Medium Sea Green", - "hex": "#3cb371", - "rgb": [60, 179, 113] - }, - "medium_slate_blue": { - "name": "Medium Slate Blue", - "hex": "#7b68ee", - "rgb": [123, 104, 238] - }, - "medium_spring_bud": { - "name": "Medium Spring Bud", - "hex": "#c9dc87", - "rgb": [201, 220, 135] - }, - "medium_spring_green": { - "name": "Medium Spring Green", - "hex": "#00fa9a", - "rgb": [0, 250, 154] - }, - "medium_taupe": { - "name": "Medium Taupe", - "hex": "#674c47", - "rgb": [103, 76, 71] - }, - "medium_turquoise": { - "name": "Medium Turquoise", - "hex": "#48d1cc", - "rgb": [72, 209, 204] - }, - "medium_tuscan_red": { - "name": "Medium Tuscan Red", - "hex": "#79443b", - "rgb": [121, 68, 59] - }, - "medium_vermilion": { - "name": "Medium Vermilion", - "hex": "#d9603b", - "rgb": [217, 96, 59] - }, - "medium_violet_red": { - "name": "Medium Violet-Red", - "hex": "#c71585", - "rgb": [199, 21, 133] - }, - "mellow_apricot": { - "name": "Mellow Apricot", - "hex": "#f8b878", - "rgb": [248, 184, 120] - }, - "mellow_yellow": { - "name": "Mellow Yellow", - "hex": "#f8de7e", - "rgb": [248, 222, 126] - }, - "melon": { - "name": "Melon", - "hex": "#fdbcb4", - "rgb": [253, 188, 180] - }, - "midnight_blue": { - "name": "Midnight Blue", - "hex": "#191970", - "rgb": [25, 25, 112] - }, - "midnight_green_eagle_green": { - "name": "Midnight Green (Eagle Green)", - "hex": "#004953", - "rgb": [0, 73, 83] - }, - "mikado_yellow": { - "name": "Mikado Yellow", - "hex": "#ffc40c", - "rgb": [255, 196, 12] - }, - "mint": { - "name": "Mint", - "hex": "#3eb489", - "rgb": [62, 180, 137] - }, - "mint_cream": { - "name": "Mint Cream", - "hex": "#f5fffa", - "rgb": [245, 255, 250] - }, - "mint_green": { - "name": "Mint Green", - "hex": "#98ff98", - "rgb": [152, 255, 152] - }, - "misty_rose": { - "name": "Misty Rose", - "hex": "#ffe4e1", - "rgb": [255, 228, 225] - }, - "moccasin": { - "name": "Moccasin", - "hex": "#faebd7", - "rgb": [250, 235, 215] - }, - "mode_beige": { - "name": "Mode Beige", - "hex": "#967117", - "rgb": [150, 113, 23] - }, - "moonstone_blue": { - "name": "Moonstone Blue", - "hex": "#73a9c2", - "rgb": [115, 169, 194] - }, - "mordant_red_19": { - "name": "Mordant Red 19", - "hex": "#ae0c00", - "rgb": [174, 12, 0] - }, - "moss_green": { - "name": "Moss Green", - "hex": "#addfad", - "rgb": [173, 223, 173] - }, - "mountain_meadow": { - "name": "Mountain Meadow", - "hex": "#30ba8f", - "rgb": [48, 186, 143] - }, - "mountbatten_pink": { - "name": "Mountbatten Pink", - "hex": "#997a8d", - "rgb": [153, 122, 141] - }, - "msu_green": { - "name": "Msu Green", - "hex": "#18453b", - "rgb": [24, 69, 59] - }, - "mulberry": { - "name": "Mulberry", - "hex": "#c54b8c", - "rgb": [197, 75, 140] - }, - "mustard": { - "name": "Mustard", - "hex": "#ffdb58", - "rgb": [255, 219, 88] - }, - "myrtle": { - "name": "Myrtle", - "hex": "#21421e", - "rgb": [33, 66, 30] - }, - "nadeshiko_pink": { - "name": "Nadeshiko Pink", - "hex": "#f6adc6", - "rgb": [246, 173, 198] - }, - "napier_green": { - "name": "Napier Green", - "hex": "#2a8000", - "rgb": [42, 128, 0] - }, - "naples_yellow": { - "name": "Naples Yellow", - "hex": "#fada5e", - "rgb": [250, 218, 94] - }, - "navajo_white": { - "name": "Navajo White", - "hex": "#ffdead", - "rgb": [255, 222, 173] - }, - "navy_blue": { - "name": "Navy Blue", - "hex": "#000080", - "rgb": [0, 0, 128] - }, - "neon_carrot": { - "name": "Neon Carrot", - "hex": "#ffa343", - "rgb": [255, 163, 67] - }, - "neon_fuchsia": { - "name": "Neon Fuchsia", - "hex": "#fe4164", - "rgb": [254, 65, 100] - }, - "neon_green": { - "name": "Neon Green", - "hex": "#39ff14", - "rgb": [57, 255, 20] - }, - "new_york_pink": { - "name": "New York Pink", - "hex": "#d7837f", - "rgb": [215, 131, 127] - }, - "non_photo_blue": { - "name": "Non-Photo Blue", - "hex": "#a4dded", - "rgb": [164, 221, 237] - }, - "north_texas_green": { - "name": "North Texas Green", - "hex": "#059033", - "rgb": [5, 144, 51] - }, - "ocean_boat_blue": { - "name": "Ocean Boat Blue", - "hex": "#0077be", - "rgb": [0, 119, 190] - }, - "ochre": { - "name": "Ochre", - "hex": "#c72", - "rgb": [204, 119, 34] - }, - "office_green": { - "name": "Office Green", - "hex": "#008000", - "rgb": [0, 128, 0] - }, - "old_gold": { - "name": "Old Gold", - "hex": "#cfb53b", - "rgb": [207, 181, 59] - }, - "old_lace": { - "name": "Old Lace", - "hex": "#fdf5e6", - "rgb": [253, 245, 230] - }, - "old_lavender": { - "name": "Old Lavender", - "hex": "#796878", - "rgb": [121, 104, 120] - }, - "old_mauve": { - "name": "Old Mauve", - "hex": "#673147", - "rgb": [103, 49, 71] - }, - "old_rose": { - "name": "Old Rose", - "hex": "#c08081", - "rgb": [192, 128, 129] - }, - "olive": { - "name": "Olive", - "hex": "#808000", - "rgb": [128, 128, 0] - }, - "olive_drab_7": { - "name": "Olive Drab #7", - "hex": "#3c341f", - "rgb": [60, 52, 31] - }, - "olive_drab_web_olive_drab_3": { - "name": "Olive Drab (Web) (Olive Drab #3)", - "hex": "#6b8e23", - "rgb": [107, 142, 35] - }, - "olivine": { - "name": "Olivine", - "hex": "#9ab973", - "rgb": [154, 185, 115] - }, - "onyx": { - "name": "Onyx", - "hex": "#353839", - "rgb": [53, 56, 57] - }, - "opera_mauve": { - "name": "Opera Mauve", - "hex": "#b784a7", - "rgb": [183, 132, 167] - }, - "orange_color_wheel": { - "name": "Orange (Color Wheel)", - "hex": "#ff7f00", - "rgb": [255, 127, 0] - }, - "orange_peel": { - "name": "Orange Peel", - "hex": "#ff9f00", - "rgb": [255, 159, 0] - }, - "orange_red": { - "name": "Orange-Red", - "hex": "#ff4500", - "rgb": [255, 69, 0] - }, - "orange_ryb": { - "name": "Orange (Ryb)", - "hex": "#fb9902", - "rgb": [251, 153, 2] - }, - "orange_web_color": { - "name": "Orange (Web Color)", - "hex": "#ffa500", - "rgb": [255, 165, 0] - }, - "orchid": { - "name": "Orchid", - "hex": "#da70d6", - "rgb": [218, 112, 214] - }, - "otter_brown": { - "name": "Otter Brown", - "hex": "#654321", - "rgb": [101, 67, 33] - }, - "ou_crimson_red": { - "name": "Ou Crimson Red", - "hex": "#900", - "rgb": [153, 0, 0] - }, - "outer_space": { - "name": "Outer Space", - "hex": "#414a4c", - "rgb": [65, 74, 76] - }, - "outrageous_orange": { - "name": "Outrageous Orange", - "hex": "#ff6e4a", - "rgb": [255, 110, 74] - }, - "oxford_blue": { - "name": "Oxford Blue", - "hex": "#002147", - "rgb": [0, 33, 71] - }, - "pakistan_green": { - "name": "Pakistan Green", - "hex": "#060", - "rgb": [0, 102, 0] - }, - "palatinate_blue": { - "name": "Palatinate Blue", - "hex": "#273be2", - "rgb": [39, 59, 226] - }, - "palatinate_purple": { - "name": "Palatinate Purple", - "hex": "#682860", - "rgb": [104, 40, 96] - }, - "pale_aqua": { - "name": "Pale Aqua", - "hex": "#bcd4e6", - "rgb": [188, 212, 230] - }, - "pale_blue": { - "name": "Pale Blue", - "hex": "#afeeee", - "rgb": [175, 238, 238] - }, - "pale_brown": { - "name": "Pale Brown", - "hex": "#987654", - "rgb": [152, 118, 84] - }, - "pale_carmine": { - "name": "Pale Carmine", - "hex": "#af4035", - "rgb": [175, 64, 53] - }, - "pale_cerulean": { - "name": "Pale Cerulean", - "hex": "#9bc4e2", - "rgb": [155, 196, 226] - }, - "pale_chestnut": { - "name": "Pale Chestnut", - "hex": "#ddadaf", - "rgb": [221, 173, 175] - }, - "pale_copper": { - "name": "Pale Copper", - "hex": "#da8a67", - "rgb": [218, 138, 103] - }, - "pale_cornflower_blue": { - "name": "Pale Cornflower Blue", - "hex": "#abcdef", - "rgb": [171, 205, 239] - }, - "pale_gold": { - "name": "Pale Gold", - "hex": "#e6be8a", - "rgb": [230, 190, 138] - }, - "pale_goldenrod": { - "name": "Pale Goldenrod", - "hex": "#eee8aa", - "rgb": [238, 232, 170] - }, - "pale_green": { - "name": "Pale Green", - "hex": "#98fb98", - "rgb": [152, 251, 152] - }, - "pale_lavender": { - "name": "Pale Lavender", - "hex": "#dcd0ff", - "rgb": [220, 208, 255] - }, - "pale_magenta": { - "name": "Pale Magenta", - "hex": "#f984e5", - "rgb": [249, 132, 229] - }, - "pale_pink": { - "name": "Pale Pink", - "hex": "#fadadd", - "rgb": [250, 218, 221] - }, - "pale_plum": { - "name": "Pale Plum", - "hex": "#dda0dd", - "rgb": [221, 160, 221] - }, - "pale_red_violet": { - "name": "Pale Red-Violet", - "hex": "#db7093", - "rgb": [219, 112, 147] - }, - "pale_robin_egg_blue": { - "name": "Pale Robin Egg Blue", - "hex": "#96ded1", - "rgb": [150, 222, 209] - }, - "pale_silver": { - "name": "Pale Silver", - "hex": "#c9c0bb", - "rgb": [201, 192, 187] - }, - "pale_spring_bud": { - "name": "Pale Spring Bud", - "hex": "#ecebbd", - "rgb": [236, 235, 189] - }, - "pale_taupe": { - "name": "Pale Taupe", - "hex": "#bc987e", - "rgb": [188, 152, 126] - }, - "pale_violet_red": { - "name": "Pale Violet-Red", - "hex": "#db7093", - "rgb": [219, 112, 147] - }, - "pansy_purple": { - "name": "Pansy Purple", - "hex": "#78184a", - "rgb": [120, 24, 74] - }, - "papaya_whip": { - "name": "Papaya Whip", - "hex": "#ffefd5", - "rgb": [255, 239, 213] - }, - "paris_green": { - "name": "Paris Green", - "hex": "#50c878", - "rgb": [80, 200, 120] - }, - "pastel_blue": { - "name": "Pastel Blue", - "hex": "#aec6cf", - "rgb": [174, 198, 207] - }, - "pastel_brown": { - "name": "Pastel Brown", - "hex": "#836953", - "rgb": [131, 105, 83] - }, - "pastel_gray": { - "name": "Pastel Gray", - "hex": "#cfcfc4", - "rgb": [207, 207, 196] - }, - "pastel_green": { - "name": "Pastel Green", - "hex": "#7d7", - "rgb": [119, 221, 119] - }, - "pastel_magenta": { - "name": "Pastel Magenta", - "hex": "#f49ac2", - "rgb": [244, 154, 194] - }, - "pastel_orange": { - "name": "Pastel Orange", - "hex": "#ffb347", - "rgb": [255, 179, 71] - }, - "pastel_pink": { - "name": "Pastel Pink", - "hex": "#dea5a4", - "rgb": [222, 165, 164] - }, - "pastel_purple": { - "name": "Pastel Purple", - "hex": "#b39eb5", - "rgb": [179, 158, 181] - }, - "pastel_red": { - "name": "Pastel Red", - "hex": "#ff6961", - "rgb": [255, 105, 97] - }, - "pastel_violet": { - "name": "Pastel Violet", - "hex": "#cb99c9", - "rgb": [203, 153, 201] - }, - "pastel_yellow": { - "name": "Pastel Yellow", - "hex": "#fdfd96", - "rgb": [253, 253, 150] - }, - "patriarch": { - "name": "Patriarch", - "hex": "#800080", - "rgb": [128, 0, 128] - }, - "payne_s_grey": { - "name": "Payne'S Grey", - "hex": "#536878", - "rgb": [83, 104, 120] - }, - "peach": { - "name": "Peach", - "hex": "#ffe5b4", - "rgb": [255, 229, 180] - }, - "peach_crayola": { - "name": "Peach (Crayola)", - "hex": "#ffcba4", - "rgb": [255, 203, 164] - }, - "peach_orange": { - "name": "Peach-Orange", - "hex": "#fc9", - "rgb": [255, 204, 153] - }, - "peach_puff": { - "name": "Peach Puff", - "hex": "#ffdab9", - "rgb": [255, 218, 185] - }, - "peach_yellow": { - "name": "Peach-Yellow", - "hex": "#fadfad", - "rgb": [250, 223, 173] - }, - "pear": { - "name": "Pear", - "hex": "#d1e231", - "rgb": [209, 226, 49] - }, - "pearl": { - "name": "Pearl", - "hex": "#eae0c8", - "rgb": [234, 224, 200] - }, - "pearl_aqua": { - "name": "Pearl Aqua", - "hex": "#88d8c0", - "rgb": [136, 216, 192] - }, - "pearly_purple": { - "name": "Pearly Purple", - "hex": "#b768a2", - "rgb": [183, 104, 162] - }, - "peridot": { - "name": "Peridot", - "hex": "#e6e200", - "rgb": [230, 226, 0] - }, - "periwinkle": { - "name": "Periwinkle", - "hex": "#ccf", - "rgb": [204, 204, 255] - }, - "persian_blue": { - "name": "Persian Blue", - "hex": "#1c39bb", - "rgb": [28, 57, 187] - }, - "persian_green": { - "name": "Persian Green", - "hex": "#00a693", - "rgb": [0, 166, 147] - }, - "persian_indigo": { - "name": "Persian Indigo", - "hex": "#32127a", - "rgb": [50, 18, 122] - }, - "persian_orange": { - "name": "Persian Orange", - "hex": "#d99058", - "rgb": [217, 144, 88] - }, - "persian_pink": { - "name": "Persian Pink", - "hex": "#f77fbe", - "rgb": [247, 127, 190] - }, - "persian_plum": { - "name": "Persian Plum", - "hex": "#701c1c", - "rgb": [112, 28, 28] - }, - "persian_red": { - "name": "Persian Red", - "hex": "#c33", - "rgb": [204, 51, 51] - }, - "persian_rose": { - "name": "Persian Rose", - "hex": "#fe28a2", - "rgb": [254, 40, 162] - }, - "persimmon": { - "name": "Persimmon", - "hex": "#ec5800", - "rgb": [236, 88, 0] - }, - "peru": { - "name": "Peru", - "hex": "#cd853f", - "rgb": [205, 133, 63] - }, - "phlox": { - "name": "Phlox", - "hex": "#df00ff", - "rgb": [223, 0, 255] - }, - "phthalo_blue": { - "name": "Phthalo Blue", - "hex": "#000f89", - "rgb": [0, 15, 137] - }, - "phthalo_green": { - "name": "Phthalo Green", - "hex": "#123524", - "rgb": [18, 53, 36] - }, - "piggy_pink": { - "name": "Piggy Pink", - "hex": "#fddde6", - "rgb": [253, 221, 230] - }, - "pine_green": { - "name": "Pine Green", - "hex": "#01796f", - "rgb": [1, 121, 111] - }, - "pink": { - "name": "Pink", - "hex": "#ffc0cb", - "rgb": [255, 192, 203] - }, - "pink_lace": { - "name": "Pink Lace", - "hex": "#ffddf4", - "rgb": [255, 221, 244] - }, - "pink_orange": { - "name": "Pink-Orange", - "hex": "#f96", - "rgb": [255, 153, 102] - }, - "pink_pearl": { - "name": "Pink Pearl", - "hex": "#e7accf", - "rgb": [231, 172, 207] - }, - "pink_sherbet": { - "name": "Pink Sherbet", - "hex": "#f78fa7", - "rgb": [247, 143, 167] - }, - "pistachio": { - "name": "Pistachio", - "hex": "#93c572", - "rgb": [147, 197, 114] - }, - "platinum": { - "name": "Platinum", - "hex": "#e5e4e2", - "rgb": [229, 228, 226] - }, - "plum_traditional": { - "name": "Plum (Traditional)", - "hex": "#8e4585", - "rgb": [142, 69, 133] - }, - "plum_web": { - "name": "Plum (Web)", - "hex": "#dda0dd", - "rgb": [221, 160, 221] - }, - "portland_orange": { - "name": "Portland Orange", - "hex": "#ff5a36", - "rgb": [255, 90, 54] - }, - "powder_blue_web": { - "name": "Powder Blue (Web)", - "hex": "#b0e0e6", - "rgb": [176, 224, 230] - }, - "princeton_orange": { - "name": "Princeton Orange", - "hex": "#ff8f00", - "rgb": [255, 143, 0] - }, - "prune": { - "name": "Prune", - "hex": "#701c1c", - "rgb": [112, 28, 28] - }, - "prussian_blue": { - "name": "Prussian Blue", - "hex": "#003153", - "rgb": [0, 49, 83] - }, - "psychedelic_purple": { - "name": "Psychedelic Purple", - "hex": "#df00ff", - "rgb": [223, 0, 255] - }, - "puce": { - "name": "Puce", - "hex": "#c89", - "rgb": [204, 136, 153] - }, - "pumpkin": { - "name": "Pumpkin", - "hex": "#ff7518", - "rgb": [255, 117, 24] - }, - "purple_heart": { - "name": "Purple Heart", - "hex": "#69359c", - "rgb": [105, 53, 156] - }, - "purple_html_css": { - "name": "Purple (Html/Css)", - "hex": "#800080", - "rgb": [128, 0, 128] - }, - "purple_mountain_majesty": { - "name": "Purple Mountain Majesty", - "hex": "#9678b6", - "rgb": [150, 120, 182] - }, - "purple_munsell": { - "name": "Purple (Munsell)", - "hex": "#9f00c5", - "rgb": [159, 0, 197] - }, - "purple_pizzazz": { - "name": "Purple Pizzazz", - "hex": "#fe4eda", - "rgb": [254, 78, 218] - }, - "purple_taupe": { - "name": "Purple Taupe", - "hex": "#50404d", - "rgb": [80, 64, 77] - }, - "purple_x11": { - "name": "Purple (X11)", - "hex": "#a020f0", - "rgb": [160, 32, 240] - }, - "quartz": { - "name": "Quartz", - "hex": "#51484f", - "rgb": [81, 72, 79] - }, - "rackley": { - "name": "Rackley", - "hex": "#5d8aa8", - "rgb": [93, 138, 168] - }, - "radical_red": { - "name": "Radical Red", - "hex": "#ff355e", - "rgb": [255, 53, 94] - }, - "rajah": { - "name": "Rajah", - "hex": "#fbab60", - "rgb": [251, 171, 96] - }, - "raspberry": { - "name": "Raspberry", - "hex": "#e30b5d", - "rgb": [227, 11, 93] - }, - "raspberry_glace": { - "name": "Raspberry Glace", - "hex": "#915f6d", - "rgb": [145, 95, 109] - }, - "raspberry_pink": { - "name": "Raspberry Pink", - "hex": "#e25098", - "rgb": [226, 80, 152] - }, - "raspberry_rose": { - "name": "Raspberry Rose", - "hex": "#b3446c", - "rgb": [179, 68, 108] - }, - "raw_umber": { - "name": "Raw Umber", - "hex": "#826644", - "rgb": [130, 102, 68] - }, - "razzle_dazzle_rose": { - "name": "Razzle Dazzle Rose", - "hex": "#f3c", - "rgb": [255, 51, 204] - }, - "razzmatazz": { - "name": "Razzmatazz", - "hex": "#e3256b", - "rgb": [227, 37, 107] - }, - "red": { - "name": "Red", - "hex": "#f00", - "rgb": [255, 0, 0] - }, - "red_brown": { - "name": "Red-Brown", - "hex": "#a52a2a", - "rgb": [165, 42, 42] - }, - "red_devil": { - "name": "Red Devil", - "hex": "#860111", - "rgb": [134, 1, 17] - }, - "red_munsell": { - "name": "Red (Munsell)", - "hex": "#f2003c", - "rgb": [242, 0, 60] - }, - "red_ncs": { - "name": "Red (Ncs)", - "hex": "#c40233", - "rgb": [196, 2, 51] - }, - "red_orange": { - "name": "Red-Orange", - "hex": "#ff5349", - "rgb": [255, 83, 73] - }, - "red_pigment": { - "name": "Red (Pigment)", - "hex": "#ed1c24", - "rgb": [237, 28, 36] - }, - "red_ryb": { - "name": "Red (Ryb)", - "hex": "#fe2712", - "rgb": [254, 39, 18] - }, - "red_violet": { - "name": "Red-Violet", - "hex": "#c71585", - "rgb": [199, 21, 133] - }, - "redwood": { - "name": "Redwood", - "hex": "#ab4e52", - "rgb": [171, 78, 82] - }, - "regalia": { - "name": "Regalia", - "hex": "#522d80", - "rgb": [82, 45, 128] - }, - "resolution_blue": { - "name": "Resolution Blue", - "hex": "#002387", - "rgb": [0, 35, 135] - }, - "rich_black": { - "name": "Rich Black", - "hex": "#004040", - "rgb": [0, 64, 64] - }, - "rich_brilliant_lavender": { - "name": "Rich Brilliant Lavender", - "hex": "#f1a7fe", - "rgb": [241, 167, 254] - }, - "rich_carmine": { - "name": "Rich Carmine", - "hex": "#d70040", - "rgb": [215, 0, 64] - }, - "rich_electric_blue": { - "name": "Rich Electric Blue", - "hex": "#0892d0", - "rgb": [8, 146, 208] - }, - "rich_lavender": { - "name": "Rich Lavender", - "hex": "#a76bcf", - "rgb": [167, 107, 207] - }, - "rich_lilac": { - "name": "Rich Lilac", - "hex": "#b666d2", - "rgb": [182, 102, 210] - }, - "rich_maroon": { - "name": "Rich Maroon", - "hex": "#b03060", - "rgb": [176, 48, 96] - }, - "rifle_green": { - "name": "Rifle Green", - "hex": "#414833", - "rgb": [65, 72, 51] - }, - "robin_egg_blue": { - "name": "Robin Egg Blue", - "hex": "#0cc", - "rgb": [0, 204, 204] - }, - "rose": { - "name": "Rose", - "hex": "#ff007f", - "rgb": [255, 0, 127] - }, - "rose_bonbon": { - "name": "Rose Bonbon", - "hex": "#f9429e", - "rgb": [249, 66, 158] - }, - "rose_ebony": { - "name": "Rose Ebony", - "hex": "#674846", - "rgb": [103, 72, 70] - }, - "rose_gold": { - "name": "Rose Gold", - "hex": "#b76e79", - "rgb": [183, 110, 121] - }, - "rose_madder": { - "name": "Rose Madder", - "hex": "#e32636", - "rgb": [227, 38, 54] - }, - "rose_pink": { - "name": "Rose Pink", - "hex": "#f6c", - "rgb": [255, 102, 204] - }, - "rose_quartz": { - "name": "Rose Quartz", - "hex": "#aa98a9", - "rgb": [170, 152, 169] - }, - "rose_taupe": { - "name": "Rose Taupe", - "hex": "#905d5d", - "rgb": [144, 93, 93] - }, - "rose_vale": { - "name": "Rose Vale", - "hex": "#ab4e52", - "rgb": [171, 78, 82] - }, - "rosewood": { - "name": "Rosewood", - "hex": "#65000b", - "rgb": [101, 0, 11] - }, - "rosso_corsa": { - "name": "Rosso Corsa", - "hex": "#d40000", - "rgb": [212, 0, 0] - }, - "rosy_brown": { - "name": "Rosy Brown", - "hex": "#bc8f8f", - "rgb": [188, 143, 143] - }, - "royal_azure": { - "name": "Royal Azure", - "hex": "#0038a8", - "rgb": [0, 56, 168] - }, - "royal_blue_traditional": { - "name": "Royal Blue (Traditional)", - "hex": "#002366", - "rgb": [0, 35, 102] - }, - "royal_blue_web": { - "name": "Royal Blue (Web)", - "hex": "#4169e1", - "rgb": [65, 105, 225] - }, - "royal_fuchsia": { - "name": "Royal Fuchsia", - "hex": "#ca2c92", - "rgb": [202, 44, 146] - }, - "royal_purple": { - "name": "Royal Purple", - "hex": "#7851a9", - "rgb": [120, 81, 169] - }, - "royal_yellow": { - "name": "Royal Yellow", - "hex": "#fada5e", - "rgb": [250, 218, 94] - }, - "rubine_red": { - "name": "Rubine Red", - "hex": "#d10056", - "rgb": [209, 0, 86] - }, - "ruby": { - "name": "Ruby", - "hex": "#e0115f", - "rgb": [224, 17, 95] - }, - "ruby_red": { - "name": "Ruby Red", - "hex": "#9b111e", - "rgb": [155, 17, 30] - }, - "ruddy": { - "name": "Ruddy", - "hex": "#ff0028", - "rgb": [255, 0, 40] - }, - "ruddy_brown": { - "name": "Ruddy Brown", - "hex": "#bb6528", - "rgb": [187, 101, 40] - }, - "ruddy_pink": { - "name": "Ruddy Pink", - "hex": "#e18e96", - "rgb": [225, 142, 150] - }, - "rufous": { - "name": "Rufous", - "hex": "#a81c07", - "rgb": [168, 28, 7] - }, - "russet": { - "name": "Russet", - "hex": "#80461b", - "rgb": [128, 70, 27] - }, - "rust": { - "name": "Rust", - "hex": "#b7410e", - "rgb": [183, 65, 14] - }, - "rusty_red": { - "name": "Rusty Red", - "hex": "#da2c43", - "rgb": [218, 44, 67] - }, - "sacramento_state_green": { - "name": "Sacramento State Green", - "hex": "#00563f", - "rgb": [0, 86, 63] - }, - "saddle_brown": { - "name": "Saddle Brown", - "hex": "#8b4513", - "rgb": [139, 69, 19] - }, - "safety_orange_blaze_orange": { - "name": "Safety Orange (Blaze Orange)", - "hex": "#ff6700", - "rgb": [255, 103, 0] - }, - "saffron": { - "name": "Saffron", - "hex": "#f4c430", - "rgb": [244, 196, 48] - }, - "salmon": { - "name": "Salmon", - "hex": "#ff8c69", - "rgb": [255, 140, 105] - }, - "salmon_pink": { - "name": "Salmon Pink", - "hex": "#ff91a4", - "rgb": [255, 145, 164] - }, - "sand": { - "name": "Sand", - "hex": "#c2b280", - "rgb": [194, 178, 128] - }, - "sand_dune": { - "name": "Sand Dune", - "hex": "#967117", - "rgb": [150, 113, 23] - }, - "sandstorm": { - "name": "Sandstorm", - "hex": "#ecd540", - "rgb": [236, 213, 64] - }, - "sandy_brown": { - "name": "Sandy Brown", - "hex": "#f4a460", - "rgb": [244, 164, 96] - }, - "sandy_taupe": { - "name": "Sandy Taupe", - "hex": "#967117", - "rgb": [150, 113, 23] - }, - "sangria": { - "name": "Sangria", - "hex": "#92000a", - "rgb": [146, 0, 10] - }, - "sap_green": { - "name": "Sap Green", - "hex": "#507d2a", - "rgb": [80, 125, 42] - }, - "sapphire": { - "name": "Sapphire", - "hex": "#0f52ba", - "rgb": [15, 82, 186] - }, - "sapphire_blue": { - "name": "Sapphire Blue", - "hex": "#0067a5", - "rgb": [0, 103, 165] - }, - "satin_sheen_gold": { - "name": "Satin Sheen Gold", - "hex": "#cba135", - "rgb": [203, 161, 53] - }, - "scarlet": { - "name": "Scarlet", - "hex": "#ff2400", - "rgb": [255, 36, 0] - }, - "scarlet_crayola": { - "name": "Scarlet (Crayola)", - "hex": "#fd0e35", - "rgb": [253, 14, 53] - }, - "school_bus_yellow": { - "name": "School Bus Yellow", - "hex": "#ffd800", - "rgb": [255, 216, 0] - }, - "screamin_green": { - "name": "Screamin' Green", - "hex": "#76ff7a", - "rgb": [118, 255, 122] - }, - "sea_blue": { - "name": "Sea Blue", - "hex": "#006994", - "rgb": [0, 105, 148] - }, - "sea_green": { - "name": "Sea Green", - "hex": "#2e8b57", - "rgb": [46, 139, 87] - }, - "seal_brown": { - "name": "Seal Brown", - "hex": "#321414", - "rgb": [50, 20, 20] - }, - "seashell": { - "name": "Seashell", - "hex": "#fff5ee", - "rgb": [255, 245, 238] - }, - "selective_yellow": { - "name": "Selective Yellow", - "hex": "#ffba00", - "rgb": [255, 186, 0] - }, - "sepia": { - "name": "Sepia", - "hex": "#704214", - "rgb": [112, 66, 20] - }, - "shadow": { - "name": "Shadow", - "hex": "#8a795d", - "rgb": [138, 121, 93] - }, - "shamrock_green": { - "name": "Shamrock Green", - "hex": "#009e60", - "rgb": [0, 158, 96] - }, - "shocking_pink": { - "name": "Shocking Pink", - "hex": "#fc0fc0", - "rgb": [252, 15, 192] - }, - "shocking_pink_crayola": { - "name": "Shocking Pink (Crayola)", - "hex": "#ff6fff", - "rgb": [255, 111, 255] - }, - "sienna": { - "name": "Sienna", - "hex": "#882d17", - "rgb": [136, 45, 23] - }, - "silver": { - "name": "Silver", - "hex": "#c0c0c0", - "rgb": [192, 192, 192] - }, - "sinopia": { - "name": "Sinopia", - "hex": "#cb410b", - "rgb": [203, 65, 11] - }, - "skobeloff": { - "name": "Skobeloff", - "hex": "#007474", - "rgb": [0, 116, 116] - }, - "sky_blue": { - "name": "Sky Blue", - "hex": "#87ceeb", - "rgb": [135, 206, 235] - }, - "sky_magenta": { - "name": "Sky Magenta", - "hex": "#cf71af", - "rgb": [207, 113, 175] - }, - "slate_blue": { - "name": "Slate Blue", - "hex": "#6a5acd", - "rgb": [106, 90, 205] - }, - "slate_gray": { - "name": "Slate Gray", - "hex": "#708090", - "rgb": [112, 128, 144] - }, - "smalt_dark_powder_blue": { - "name": "Smalt (Dark Powder Blue)", - "hex": "#039", - "rgb": [0, 51, 153] - }, - "smokey_topaz": { - "name": "Smokey Topaz", - "hex": "#933d41", - "rgb": [147, 61, 65] - }, - "smoky_black": { - "name": "Smoky Black", - "hex": "#100c08", - "rgb": [16, 12, 8] - }, - "snow": { - "name": "Snow", - "hex": "#fffafa", - "rgb": [255, 250, 250] - }, - "spiro_disco_ball": { - "name": "Spiro Disco Ball", - "hex": "#0fc0fc", - "rgb": [15, 192, 252] - }, - "spring_bud": { - "name": "Spring Bud", - "hex": "#a7fc00", - "rgb": [167, 252, 0] - }, - "spring_green": { - "name": "Spring Green", - "hex": "#00ff7f", - "rgb": [0, 255, 127] - }, - "st_patrick_s_blue": { - "name": "St. Patrick'S Blue", - "hex": "#23297a", - "rgb": [35, 41, 122] - }, - "steel_blue": { - "name": "Steel Blue", - "hex": "#4682b4", - "rgb": [70, 130, 180] - }, - "stil_de_grain_yellow": { - "name": "Stil De Grain Yellow", - "hex": "#fada5e", - "rgb": [250, 218, 94] - }, - "stizza": { - "name": "Stizza", - "hex": "#900", - "rgb": [153, 0, 0] - }, - "stormcloud": { - "name": "Stormcloud", - "hex": "#4f666a", - "rgb": [79, 102, 106] - }, - "straw": { - "name": "Straw", - "hex": "#e4d96f", - "rgb": [228, 217, 111] - }, - "sunglow": { - "name": "Sunglow", - "hex": "#fc3", - "rgb": [255, 204, 51] - }, - "sunset": { - "name": "Sunset", - "hex": "#fad6a5", - "rgb": [250, 214, 165] - }, - "tan": { - "name": "Tan", - "hex": "#d2b48c", - "rgb": [210, 180, 140] - }, - "tangelo": { - "name": "Tangelo", - "hex": "#f94d00", - "rgb": [249, 77, 0] - }, - "tangerine": { - "name": "Tangerine", - "hex": "#f28500", - "rgb": [242, 133, 0] - }, - "tangerine_yellow": { - "name": "Tangerine Yellow", - "hex": "#fc0", - "rgb": [255, 204, 0] - }, - "tango_pink": { - "name": "Tango Pink", - "hex": "#e4717a", - "rgb": [228, 113, 122] - }, - "taupe": { - "name": "Taupe", - "hex": "#483c32", - "rgb": [72, 60, 50] - }, - "taupe_gray": { - "name": "Taupe Gray", - "hex": "#8b8589", - "rgb": [139, 133, 137] - }, - "tea_green": { - "name": "Tea Green", - "hex": "#d0f0c0", - "rgb": [208, 240, 192] - }, - "tea_rose_orange": { - "name": "Tea Rose (Orange)", - "hex": "#f88379", - "rgb": [248, 131, 121] - }, - "tea_rose_rose": { - "name": "Tea Rose (Rose)", - "hex": "#f4c2c2", - "rgb": [244, 194, 194] - }, - "teal": { - "name": "Teal", - "hex": "#008080", - "rgb": [0, 128, 128] - }, - "teal_blue": { - "name": "Teal Blue", - "hex": "#367588", - "rgb": [54, 117, 136] - }, - "teal_green": { - "name": "Teal Green", - "hex": "#00827f", - "rgb": [0, 130, 127] - }, - "telemagenta": { - "name": "Telemagenta", - "hex": "#cf3476", - "rgb": [207, 52, 118] - }, - "tenn_tawny": { - "name": "Tenné (Tawny)", - "hex": "#cd5700", - "rgb": [205, 87, 0] - }, - "terra_cotta": { - "name": "Terra Cotta", - "hex": "#e2725b", - "rgb": [226, 114, 91] - }, - "thistle": { - "name": "Thistle", - "hex": "#d8bfd8", - "rgb": [216, 191, 216] - }, - "thulian_pink": { - "name": "Thulian Pink", - "hex": "#de6fa1", - "rgb": [222, 111, 161] - }, - "tickle_me_pink": { - "name": "Tickle Me Pink", - "hex": "#fc89ac", - "rgb": [252, 137, 172] - }, - "tiffany_blue": { - "name": "Tiffany Blue", - "hex": "#0abab5", - "rgb": [10, 186, 181] - }, - "tiger_s_eye": { - "name": "Tiger'S Eye", - "hex": "#e08d3c", - "rgb": [224, 141, 60] - }, - "timberwolf": { - "name": "Timberwolf", - "hex": "#dbd7d2", - "rgb": [219, 215, 210] - }, - "titanium_yellow": { - "name": "Titanium Yellow", - "hex": "#eee600", - "rgb": [238, 230, 0] - }, - "tomato": { - "name": "Tomato", - "hex": "#ff6347", - "rgb": [255, 99, 71] - }, - "toolbox": { - "name": "Toolbox", - "hex": "#746cc0", - "rgb": [116, 108, 192] - }, - "topaz": { - "name": "Topaz", - "hex": "#ffc87c", - "rgb": [255, 200, 124] - }, - "tractor_red": { - "name": "Tractor Red", - "hex": "#fd0e35", - "rgb": [253, 14, 53] - }, - "trolley_grey": { - "name": "Trolley Grey", - "hex": "#808080", - "rgb": [128, 128, 128] - }, - "tropical_rain_forest": { - "name": "Tropical Rain Forest", - "hex": "#00755e", - "rgb": [0, 117, 94] - }, - "true_blue": { - "name": "True Blue", - "hex": "#0073cf", - "rgb": [0, 115, 207] - }, - "tufts_blue": { - "name": "Tufts Blue", - "hex": "#417dc1", - "rgb": [65, 125, 193] - }, - "tumbleweed": { - "name": "Tumbleweed", - "hex": "#deaa88", - "rgb": [222, 170, 136] - }, - "turkish_rose": { - "name": "Turkish Rose", - "hex": "#b57281", - "rgb": [181, 114, 129] - }, - "turquoise": { - "name": "Turquoise", - "hex": "#30d5c8", - "rgb": [48, 213, 200] - }, - "turquoise_blue": { - "name": "Turquoise Blue", - "hex": "#00ffef", - "rgb": [0, 255, 239] - }, - "turquoise_green": { - "name": "Turquoise Green", - "hex": "#a0d6b4", - "rgb": [160, 214, 180] - }, - "tuscan_red": { - "name": "Tuscan Red", - "hex": "#7c4848", - "rgb": [124, 72, 72] - }, - "twilight_lavender": { - "name": "Twilight Lavender", - "hex": "#8a496b", - "rgb": [138, 73, 107] - }, - "tyrian_purple": { - "name": "Tyrian Purple", - "hex": "#66023c", - "rgb": [102, 2, 60] - }, - "ua_blue": { - "name": "Ua Blue", - "hex": "#03a", - "rgb": [0, 51, 170] - }, - "ua_red": { - "name": "Ua Red", - "hex": "#d9004c", - "rgb": [217, 0, 76] - }, - "ube": { - "name": "Ube", - "hex": "#8878c3", - "rgb": [136, 120, 195] - }, - "ucla_blue": { - "name": "Ucla Blue", - "hex": "#536895", - "rgb": [83, 104, 149] - }, - "ucla_gold": { - "name": "Ucla Gold", - "hex": "#ffb300", - "rgb": [255, 179, 0] - }, - "ufo_green": { - "name": "Ufo Green", - "hex": "#3cd070", - "rgb": [60, 208, 112] - }, - "ultra_pink": { - "name": "Ultra Pink", - "hex": "#ff6fff", - "rgb": [255, 111, 255] - }, - "ultramarine": { - "name": "Ultramarine", - "hex": "#120a8f", - "rgb": [18, 10, 143] - }, - "ultramarine_blue": { - "name": "Ultramarine Blue", - "hex": "#4166f5", - "rgb": [65, 102, 245] - }, - "umber": { - "name": "Umber", - "hex": "#635147", - "rgb": [99, 81, 71] - }, - "unbleached_silk": { - "name": "Unbleached Silk", - "hex": "#ffddca", - "rgb": [255, 221, 202] - }, - "united_nations_blue": { - "name": "United Nations Blue", - "hex": "#5b92e5", - "rgb": [91, 146, 229] - }, - "university_of_california_gold": { - "name": "University Of California Gold", - "hex": "#b78727", - "rgb": [183, 135, 39] - }, - "unmellow_yellow": { - "name": "Unmellow Yellow", - "hex": "#ff6", - "rgb": [255, 255, 102] - }, - "up_forest_green": { - "name": "Up Forest Green", - "hex": "#014421", - "rgb": [1, 68, 33] - }, - "up_maroon": { - "name": "Up Maroon", - "hex": "#7b1113", - "rgb": [123, 17, 19] - }, - "upsdell_red": { - "name": "Upsdell Red", - "hex": "#ae2029", - "rgb": [174, 32, 41] - }, - "urobilin": { - "name": "Urobilin", - "hex": "#e1ad21", - "rgb": [225, 173, 33] - }, - "usafa_blue": { - "name": "Usafa Blue", - "hex": "#004f98", - "rgb": [0, 79, 152] - }, - "usc_cardinal": { - "name": "Usc Cardinal", - "hex": "#900", - "rgb": [153, 0, 0] - }, - "usc_gold": { - "name": "Usc Gold", - "hex": "#fc0", - "rgb": [255, 204, 0] - }, - "utah_crimson": { - "name": "Utah Crimson", - "hex": "#d3003f", - "rgb": [211, 0, 63] - }, - "vanilla": { - "name": "Vanilla", - "hex": "#f3e5ab", - "rgb": [243, 229, 171] - }, - "vegas_gold": { - "name": "Vegas Gold", - "hex": "#c5b358", - "rgb": [197, 179, 88] - }, - "venetian_red": { - "name": "Venetian Red", - "hex": "#c80815", - "rgb": [200, 8, 21] - }, - "verdigris": { - "name": "Verdigris", - "hex": "#43b3ae", - "rgb": [67, 179, 174] - }, - "vermilion_cinnabar": { - "name": "Vermilion (Cinnabar)", - "hex": "#e34234", - "rgb": [227, 66, 52] - }, - "vermilion_plochere": { - "name": "Vermilion (Plochere)", - "hex": "#d9603b", - "rgb": [217, 96, 59] - }, - "veronica": { - "name": "Veronica", - "hex": "#a020f0", - "rgb": [160, 32, 240] - }, - "violet": { - "name": "Violet", - "hex": "#8f00ff", - "rgb": [143, 0, 255] - }, - "violet_blue": { - "name": "Violet-Blue", - "hex": "#324ab2", - "rgb": [50, 74, 178] - }, - "violet_color_wheel": { - "name": "Violet (Color Wheel)", - "hex": "#7f00ff", - "rgb": [127, 0, 255] - }, - "violet_ryb": { - "name": "Violet (Ryb)", - "hex": "#8601af", - "rgb": [134, 1, 175] - }, - "violet_web": { - "name": "Violet (Web)", - "hex": "#ee82ee", - "rgb": [238, 130, 238] - }, - "viridian": { - "name": "Viridian", - "hex": "#40826d", - "rgb": [64, 130, 109] - }, - "vivid_auburn": { - "name": "Vivid Auburn", - "hex": "#922724", - "rgb": [146, 39, 36] - }, - "vivid_burgundy": { - "name": "Vivid Burgundy", - "hex": "#9f1d35", - "rgb": [159, 29, 53] - }, - "vivid_cerise": { - "name": "Vivid Cerise", - "hex": "#da1d81", - "rgb": [218, 29, 129] - }, - "vivid_tangerine": { - "name": "Vivid Tangerine", - "hex": "#ffa089", - "rgb": [255, 160, 137] - }, - "vivid_violet": { - "name": "Vivid Violet", - "hex": "#9f00ff", - "rgb": [159, 0, 255] - }, - "warm_black": { - "name": "Warm Black", - "hex": "#004242", - "rgb": [0, 66, 66] - }, - "waterspout": { - "name": "Waterspout", - "hex": "#a4f4f9", - "rgb": [164, 244, 249] - }, - "wenge": { - "name": "Wenge", - "hex": "#645452", - "rgb": [100, 84, 82] - }, - "wheat": { - "name": "Wheat", - "hex": "#f5deb3", - "rgb": [245, 222, 179] - }, - "white": { - "name": "White", - "hex": "#fff", - "rgb": [255, 255, 255] - }, - "white_smoke": { - "name": "White Smoke", - "hex": "#f5f5f5", - "rgb": [245, 245, 245] - }, - "wild_blue_yonder": { - "name": "Wild Blue Yonder", - "hex": "#a2add0", - "rgb": [162, 173, 208] - }, - "wild_strawberry": { - "name": "Wild Strawberry", - "hex": "#ff43a4", - "rgb": [255, 67, 164] - }, - "wild_watermelon": { - "name": "Wild Watermelon", - "hex": "#fc6c85", - "rgb": [252, 108, 133] - }, - "wine": { - "name": "Wine", - "hex": "#722f37", - "rgb": [114, 47, 55] - }, - "wine_dregs": { - "name": "Wine Dregs", - "hex": "#673147", - "rgb": [103, 49, 71] - }, - "wisteria": { - "name": "Wisteria", - "hex": "#c9a0dc", - "rgb": [201, 160, 220] - }, - "wood_brown": { - "name": "Wood Brown", - "hex": "#c19a6b", - "rgb": [193, 154, 107] - }, - "xanadu": { - "name": "Xanadu", - "hex": "#738678", - "rgb": [115, 134, 120] - }, - "yale_blue": { - "name": "Yale Blue", - "hex": "#0f4d92", - "rgb": [15, 77, 146] - }, - "yellow": { - "name": "Yellow", - "hex": "#ff0", - "rgb": [255, 255, 0] - }, - "yellow_green": { - "name": "Yellow-Green", - "hex": "#9acd32", - "rgb": [154, 205, 50] - }, - "yellow_munsell": { - "name": "Yellow (Munsell)", - "hex": "#efcc00", - "rgb": [239, 204, 0] - }, - "yellow_ncs": { - "name": "Yellow (Ncs)", - "hex": "#ffd300", - "rgb": [255, 211, 0] - }, - "yellow_orange": { - "name": "Yellow Orange", - "hex": "#ffae42", - "rgb": [255, 174, 66] - }, - "yellow_process": { - "name": "Yellow (Process)", - "hex": "#ffef00", - "rgb": [255, 239, 0] - }, - "yellow_ryb": { - "name": "Yellow (Ryb)", - "hex": "#fefe33", - "rgb": [254, 254, 51] - }, - "zaffre": { - "name": "Zaffre", - "hex": "#0014a8", - "rgb": [0, 20, 168] - }, - "zinnwaldite_brown": { - "name": "Zinnwaldite Brown", - "hex": "#2c1608", - "rgb": [44, 22, 8] - } -} \ No newline at end of file diff --git a/test/testdata/document.json b/test/testdata/document.json deleted file mode 100644 index 557b110..0000000 --- a/test/testdata/document.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "hello": "this a test", - "value": [ - { - "something": "good 👲" - }, - 231, - false, - null, - true, - [ 42, 420 ] - ] -} \ No newline at end of file diff --git a/test/testdata/only_128.json b/test/testdata/only_128.json deleted file mode 100644 index a3769d6..0000000 --- a/test/testdata/only_128.json +++ /dev/null @@ -1,132 +0,0 @@ -[ - { - "name": "Ao (English)", - "hex": "#008000", - "rgb": [0, 128, 0] - }, - { - "name": "Aurometalsaurus", - "hex": "#6e7f80", - "rgb": [110, 127, 128] - }, - { - "name": "Blue Sapphire", - "hex": "#126180", - "rgb": [18, 97, 128] - }, - { - "name": "Burgundy", - "hex": "#800020", - "rgb": [128, 0, 32] - }, - { - "name": "Dark Pink", - "hex": "#e75480", - "rgb": [231, 84, 128] - }, - { - "name": "Ecru", - "hex": "#c2b280", - "rgb": [194, 178, 128] - }, - { - "name": "Falu Red", - "hex": "#801818", - "rgb": [128, 24, 24] - }, - { - "name": "Gray", - "hex": "#808080", - "rgb": [128, 128, 128] - }, - { - "name": "Gray (Html/Css Gray)", - "hex": "#808080", - "rgb": [128, 128, 128] - }, - { - "name": "Green (Html/Css Green)", - "hex": "#008000", - "rgb": [0, 128, 0] - }, - { - "name": "Heart Gold", - "hex": "#808000", - "rgb": [128, 128, 0] - }, - { - "name": "Light Coral", - "hex": "#f08080", - "rgb": [240, 128, 128] - }, - { - "name": "Maroon (Html/Css)", - "hex": "#800000", - "rgb": [128, 0, 0] - }, - { - "name": "Napier Green", - "hex": "#2a8000", - "rgb": [42, 128, 0] - }, - { - "name": "Navy Blue", - "hex": "#000080", - "rgb": [0, 0, 128] - }, - { - "name": "Office Green", - "hex": "#008000", - "rgb": [0, 128, 0] - }, - { - "name": "Old Rose", - "hex": "#c08081", - "rgb": [192, 128, 129] - }, - { - "name": "Olive", - "hex": "#808000", - "rgb": [128, 128, 0] - }, - { - "name": "Patriarch", - "hex": "#800080", - "rgb": [128, 0, 128] - }, - { - "name": "Purple (Html/Css)", - "hex": "#800080", - "rgb": [128, 0, 128] - }, - { - "name": "Regalia", - "hex": "#522d80", - "rgb": [82, 45, 128] - }, - { - "name": "Russet", - "hex": "#80461b", - "rgb": [128, 70, 27] - }, - { - "name": "Sand", - "hex": "#c2b280", - "rgb": [194, 178, 128] - }, - { - "name": "Slate Gray", - "hex": "#708090", - "rgb": [112, 128, 144] - }, - { - "name": "Teal", - "hex": "#008080", - "rgb": [0, 128, 128] - }, - { - "name": "Trolley Grey", - "hex": "#808080", - "rgb": [128, 128, 128] - } -] \ No newline at end of file diff --git a/test/testdata/only_green.json b/test/testdata/only_green.json deleted file mode 100644 index 3cf9bc8..0000000 --- a/test/testdata/only_green.json +++ /dev/null @@ -1,392 +0,0 @@ -[ - { - "name": "Android Green", - "hex": "#a4c639", - "rgb": [164, 198, 57] - }, - { - "name": "Apple Green", - "hex": "#8db600", - "rgb": [141, 182, 0] - }, - { - "name": "Army Green", - "hex": "#4b5320", - "rgb": [75, 83, 32] - }, - { - "name": "Blue-Green", - "hex": "#0d98ba", - "rgb": [13, 152, 186] - }, - { - "name": "Bottle Green", - "hex": "#006a4e", - "rgb": [0, 106, 78] - }, - { - "name": "Bright Green", - "hex": "#6f0", - "rgb": [102, 255, 0] - }, - { - "name": "British Racing Green", - "hex": "#004225", - "rgb": [0, 66, 37] - }, - { - "name": "Cadmium Green", - "hex": "#006b3c", - "rgb": [0, 107, 60] - }, - { - "name": "Cal Poly Green", - "hex": "#1e4d2b", - "rgb": [30, 77, 43] - }, - { - "name": "Camouflage Green", - "hex": "#78866b", - "rgb": [120, 134, 107] - }, - { - "name": "Caribbean Green", - "hex": "#0c9", - "rgb": [0, 204, 153] - }, - { - "name": "Celadon Green", - "hex": "#2f847c", - "rgb": [47, 132, 124] - }, - { - "name": "Dark Green", - "hex": "#013220", - "rgb": [1, 50, 32] - }, - { - "name": "Dark Jungle Green", - "hex": "#1a2421", - "rgb": [26, 36, 33] - }, - { - "name": "Dark Olive Green", - "hex": "#556b2f", - "rgb": [85, 107, 47] - }, - { - "name": "Dark Pastel Green", - "hex": "#03c03c", - "rgb": [3, 192, 60] - }, - { - "name": "Dark Sea Green", - "hex": "#8fbc8f", - "rgb": [143, 188, 143] - }, - { - "name": "Dark Spring Green", - "hex": "#177245", - "rgb": [23, 114, 69] - }, - { - "name": "Dartmouth Green", - "hex": "#00703c", - "rgb": [0, 112, 60] - }, - { - "name": "Deep Jungle Green", - "hex": "#004b49", - "rgb": [0, 75, 73] - }, - { - "name": "Electric Green", - "hex": "#0f0", - "rgb": [0, 255, 0] - }, - { - "name": "Fern Green", - "hex": "#4f7942", - "rgb": [79, 121, 66] - }, - { - "name": "Forest Green (Traditional)", - "hex": "#014421", - "rgb": [1, 68, 33] - }, - { - "name": "Forest Green (Web)", - "hex": "#228b22", - "rgb": [34, 139, 34] - }, - { - "name": "Green (Color Wheel) (X11 Green)", - "hex": "#0f0", - "rgb": [0, 255, 0] - }, - { - "name": "Green (Crayola)", - "hex": "#1cac78", - "rgb": [28, 172, 120] - }, - { - "name": "Green (Html/Css Green)", - "hex": "#008000", - "rgb": [0, 128, 0] - }, - { - "name": "Green (Munsell)", - "hex": "#00a877", - "rgb": [0, 168, 119] - }, - { - "name": "Green (Ncs)", - "hex": "#009f6b", - "rgb": [0, 159, 107] - }, - { - "name": "Green (Pigment)", - "hex": "#00a550", - "rgb": [0, 165, 80] - }, - { - "name": "Green (Ryb)", - "hex": "#66b032", - "rgb": [102, 176, 50] - }, - { - "name": "Green-Yellow", - "hex": "#adff2f", - "rgb": [173, 255, 47] - }, - { - "name": "Guppie Green", - "hex": "#00ff7f", - "rgb": [0, 255, 127] - }, - { - "name": "Hooker'S Green", - "hex": "#49796b", - "rgb": [73, 121, 107] - }, - { - "name": "Hunter Green", - "hex": "#355e3b", - "rgb": [53, 94, 59] - }, - { - "name": "India Green", - "hex": "#138808", - "rgb": [19, 136, 8] - }, - { - "name": "Islamic Green", - "hex": "#009000", - "rgb": [0, 144, 0] - }, - { - "name": "Jungle Green", - "hex": "#29ab87", - "rgb": [41, 171, 135] - }, - { - "name": "Kelly Green", - "hex": "#4cbb17", - "rgb": [76, 187, 23] - }, - { - "name": "La Salle Green", - "hex": "#087830", - "rgb": [8, 120, 48] - }, - { - "name": "Laurel Green", - "hex": "#a9ba9d", - "rgb": [169, 186, 157] - }, - { - "name": "Lawn Green", - "hex": "#7cfc00", - "rgb": [124, 252, 0] - }, - { - "name": "Light Green", - "hex": "#90ee90", - "rgb": [144, 238, 144] - }, - { - "name": "Light Sea Green", - "hex": "#20b2aa", - "rgb": [32, 178, 170] - }, - { - "name": "Lime Green", - "hex": "#32cd32", - "rgb": [50, 205, 50] - }, - { - "name": "Lime (Web) (X11 Green)", - "hex": "#0f0", - "rgb": [0, 255, 0] - }, - { - "name": "Lincoln Green", - "hex": "#195905", - "rgb": [25, 89, 5] - }, - { - "name": "Medium Jungle Green", - "hex": "#1c352d", - "rgb": [28, 53, 45] - }, - { - "name": "Medium Sea Green", - "hex": "#3cb371", - "rgb": [60, 179, 113] - }, - { - "name": "Medium Spring Green", - "hex": "#00fa9a", - "rgb": [0, 250, 154] - }, - { - "name": "Midnight Green (Eagle Green)", - "hex": "#004953", - "rgb": [0, 73, 83] - }, - { - "name": "Mint Green", - "hex": "#98ff98", - "rgb": [152, 255, 152] - }, - { - "name": "Moss Green", - "hex": "#addfad", - "rgb": [173, 223, 173] - }, - { - "name": "Msu Green", - "hex": "#18453b", - "rgb": [24, 69, 59] - }, - { - "name": "Napier Green", - "hex": "#2a8000", - "rgb": [42, 128, 0] - }, - { - "name": "Neon Green", - "hex": "#39ff14", - "rgb": [57, 255, 20] - }, - { - "name": "North Texas Green", - "hex": "#059033", - "rgb": [5, 144, 51] - }, - { - "name": "Office Green", - "hex": "#008000", - "rgb": [0, 128, 0] - }, - { - "name": "Pakistan Green", - "hex": "#060", - "rgb": [0, 102, 0] - }, - { - "name": "Pale Green", - "hex": "#98fb98", - "rgb": [152, 251, 152] - }, - { - "name": "Paris Green", - "hex": "#50c878", - "rgb": [80, 200, 120] - }, - { - "name": "Pastel Green", - "hex": "#7d7", - "rgb": [119, 221, 119] - }, - { - "name": "Persian Green", - "hex": "#00a693", - "rgb": [0, 166, 147] - }, - { - "name": "Phthalo Green", - "hex": "#123524", - "rgb": [18, 53, 36] - }, - { - "name": "Pine Green", - "hex": "#01796f", - "rgb": [1, 121, 111] - }, - { - "name": "Rifle Green", - "hex": "#414833", - "rgb": [65, 72, 51] - }, - { - "name": "Sacramento State Green", - "hex": "#00563f", - "rgb": [0, 86, 63] - }, - { - "name": "Sap Green", - "hex": "#507d2a", - "rgb": [80, 125, 42] - }, - { - "name": "Screamin' Green", - "hex": "#76ff7a", - "rgb": [118, 255, 122] - }, - { - "name": "Sea Green", - "hex": "#2e8b57", - "rgb": [46, 139, 87] - }, - { - "name": "Shamrock Green", - "hex": "#009e60", - "rgb": [0, 158, 96] - }, - { - "name": "Spring Green", - "hex": "#00ff7f", - "rgb": [0, 255, 127] - }, - { - "name": "Tea Green", - "hex": "#d0f0c0", - "rgb": [208, 240, 192] - }, - { - "name": "Teal Green", - "hex": "#00827f", - "rgb": [0, 130, 127] - }, - { - "name": "Turquoise Green", - "hex": "#a0d6b4", - "rgb": [160, 214, 180] - }, - { - "name": "Ufo Green", - "hex": "#3cd070", - "rgb": [60, 208, 112] - }, - { - "name": "Up Forest Green", - "hex": "#014421", - "rgb": [1, 68, 33] - }, - { - "name": "Yellow-Green", - "hex": "#9acd32", - "rgb": [154, 205, 50] - } -] \ No newline at end of file