diff --git a/meow.txt b/meow.txt new file mode 100644 index 0000000..65b5969 Binary files /dev/null and b/meow.txt differ diff --git a/package-lock.json b/package-lock.json index 27bf157..793da9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "@hono/node-server": "^1.14.3", "@mdx-js/mdx": "^3.1.0", "@paperclover/console": "git+https://git.paperclover.net/clo/console.git", + "blurhash": "^2.0.5", "codemirror": "^6.0.1", "devalue": "^5.1.1", "esbuild": "^0.25.5", @@ -15,6 +16,7 @@ "hono": "^4.7.11", "marko": "^6.0.20", "puppeteer": "^24.10.1", + "sharp": "^0.34.2", "unique-names-generator": "^4.7.1" }, "devDependencies": { @@ -487,6 +489,16 @@ "w3c-keyname": "^2.2.4" } }, + "node_modules/@emnapi/runtime": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.4.3.tgz", + "integrity": "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.5", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz", @@ -899,6 +911,402 @@ "hono": "^4" } }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.2.tgz", + "integrity": "sha512-OfXHZPppddivUJnqyKoi5YVeHRkkNE2zUFT2gbpKxp/JZCFYEYubnMg+gOp6lWfasPrTS+KPosKqdI+ELYVDtg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.1.0" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.2.tgz", + "integrity": "sha512-dYvWqmjU9VxqXmjEtjmvHnGqF8GrVjM2Epj9rJ6BUIXvk8slvNDJbhGFvIoXzkDhrJC2jUxNLz/GUjjvSzfw+g==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.1.0" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.1.0.tgz", + "integrity": "sha512-HZ/JUmPwrJSoM4DIQPv/BfNh9yrOA8tlBbqbLz4JZ5uew2+o22Ik+tHQJcih7QJuSa0zo5coHTfD5J8inqj9DA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.1.0.tgz", + "integrity": "sha512-Xzc2ToEmHN+hfvsl9wja0RlnXEgpKNmftriQp6XzY/RaSfwD9th+MSh0WQKzUreLKKINb3afirxW7A0fz2YWuQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.1.0.tgz", + "integrity": "sha512-s8BAd0lwUIvYCJyRdFqvsj+BJIpDBSxs6ivrOPm/R7piTs5UIwY5OjXrP2bqXC9/moGsyRa37eYWYCOGVXxVrA==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.1.0.tgz", + "integrity": "sha512-IVfGJa7gjChDET1dK9SekxFFdflarnUB8PwW8aGwEoF3oAsSDuNUTYS+SKDOyOJxQyDC1aPFMuRYLoDInyV9Ew==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.1.0.tgz", + "integrity": "sha512-tiXxFZFbhnkWE2LA8oQj7KYR+bWBkiV2nilRldT7bqoEZ4HiDOcePr9wVDAZPi/Id5fT1oY9iGnDq20cwUz8lQ==", + "cpu": [ + "ppc64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.1.0.tgz", + "integrity": "sha512-xukSwvhguw7COyzvmjydRb3x/09+21HykyapcZchiCUkTThEQEOMtBj9UhkaBRLuBrgLFzQ2wbxdeCCJW/jgJA==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.1.0.tgz", + "integrity": "sha512-yRj2+reB8iMg9W5sULM3S74jVS7zqSzHG3Ol/twnAAkAhnGQnpjj6e4ayUz7V+FpKypwgs82xbRdYtchTTUB+Q==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.1.0.tgz", + "integrity": "sha512-jYZdG+whg0MDK+q2COKbYidaqW/WTz0cc1E+tMAusiDygrM4ypmSCjOJPmFTvHHJ8j/6cAGyeDWZOsK06tP33w==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.1.0.tgz", + "integrity": "sha512-wK7SBdwrAiycjXdkPnGCPLjYb9lD4l6Ze2gSdAGVZrEL05AOUJESWU2lhlC+Ffn5/G+VKuSm6zzbQSzFX/P65A==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.2.tgz", + "integrity": "sha512-0DZzkvuEOqQUP9mo2kjjKNok5AmnOr1jB2XYjkaoNRwpAYMDzRmAqUIa1nRi58S2WswqSfPOWLNOr0FDT3H5RQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.1.0" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.2.tgz", + "integrity": "sha512-D8n8wgWmPDakc83LORcfJepdOSN6MvWNzzz2ux0MnIbOqdieRZwVYY32zxVx+IFUT8er5KPcyU3XXsn+GzG/0Q==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.1.0" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.2.tgz", + "integrity": "sha512-EGZ1xwhBI7dNISwxjChqBGELCWMGDvmxZXKjQRuqMrakhO8QoMgqCrdjnAqJq/CScxfRn+Bb7suXBElKQpPDiw==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.1.0" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.2.tgz", + "integrity": "sha512-sD7J+h5nFLMMmOXYH4DD9UtSNBD05tWSSdWAcEyzqW8Cn5UxXvsHAxmxSesYUsTOBmUnjtxghKDl15EvfqLFbQ==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.1.0" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.2.tgz", + "integrity": "sha512-NEE2vQ6wcxYav1/A22OOxoSOGiKnNmDzCYFOZ949xFmrWZOVII1Bp3NqVVpvj+3UeHMFyN5eP/V5hzViQ5CZNA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.1.0" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.2.tgz", + "integrity": "sha512-DOYMrDm5E6/8bm/yQLCWyuDJwUnlevR8xtF8bs+gjZ7cyUNYXiSf/E8Kp0Ss5xasIaXSHzb888V1BE4i1hFhAA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.1.0" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.2.tgz", + "integrity": "sha512-/VI4mdlJ9zkaq53MbIG6rZY+QRN3MLbR6usYlgITEzi4Rpx5S6LFKsycOQjkOGmqTNmkIdLjEvooFKwww6OpdQ==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.4.3" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.2.tgz", + "integrity": "sha512-cfP/r9FdS63VA5k0xiqaNaEoGxBg9k7uE+RQGzuK9fHt7jib4zAVVseR9LsE4gJcNWgT6APKMNnCcnyOtmSEUQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.2.tgz", + "integrity": "sha512-QLjGGvAbj0X/FXl8n1WbtQ6iVBpWU7JO94u/P2M4a8CFYsvQi4GW2mRy/JqkRx0qpBzaOdKJKw8uc930EX2AHw==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.2.tgz", + "integrity": "sha512-aUdT6zEYtDKCaxkofmmJDJYGCf0+pJg3eU9/oBuqvEeoB9dKI6ZLc/1iLJCTuJQDO4ptntAlkUmHgGjyuobZbw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", @@ -1385,6 +1793,12 @@ "node": ">=10.0.0" } }, + "node_modules/blurhash": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/blurhash/-/blurhash-2.0.5.tgz", + "integrity": "sha512-cRygWd7kGBQO3VEhPiTgq4Wc43ctsM+o46urrmPOiuAe+07fzlSB9OJVdpgDL0jPqXUVQ9ht7aq7kxOeJHRK+w==", + "license": "MIT" + }, "node_modules/browserslist": { "version": "4.25.0", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.0.tgz", @@ -1596,6 +2010,19 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1614,6 +2041,16 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "license": "MIT" }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "license": "MIT", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, "node_modules/comma-separated-tokens": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", @@ -1739,6 +2176,15 @@ "node": ">=6" } }, + "node_modules/detect-libc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", + "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, "node_modules/devalue": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.1.1.tgz", @@ -3723,6 +4169,74 @@ "semver": "bin/semver.js" } }, + "node_modules/sharp": { + "version": "0.34.2", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.2.tgz", + "integrity": "sha512-lszvBmB9QURERtyKT2bNmsgxXK0ShJrL/fvqlonCo7e6xBF8nT8xU6pW+PMIbLsz0RxQk3rgH9kd8UmvOzlMJg==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.4", + "semver": "^7.7.2" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.34.2", + "@img/sharp-darwin-x64": "0.34.2", + "@img/sharp-libvips-darwin-arm64": "1.1.0", + "@img/sharp-libvips-darwin-x64": "1.1.0", + "@img/sharp-libvips-linux-arm": "1.1.0", + "@img/sharp-libvips-linux-arm64": "1.1.0", + "@img/sharp-libvips-linux-ppc64": "1.1.0", + "@img/sharp-libvips-linux-s390x": "1.1.0", + "@img/sharp-libvips-linux-x64": "1.1.0", + "@img/sharp-libvips-linuxmusl-arm64": "1.1.0", + "@img/sharp-libvips-linuxmusl-x64": "1.1.0", + "@img/sharp-linux-arm": "0.34.2", + "@img/sharp-linux-arm64": "0.34.2", + "@img/sharp-linux-s390x": "0.34.2", + "@img/sharp-linux-x64": "0.34.2", + "@img/sharp-linuxmusl-arm64": "0.34.2", + "@img/sharp-linuxmusl-x64": "0.34.2", + "@img/sharp-wasm32": "0.34.2", + "@img/sharp-win32-arm64": "0.34.2", + "@img/sharp-win32-ia32": "0.34.2", + "@img/sharp-win32-x64": "0.34.2" + } + }, + "node_modules/sharp/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/simple-swizzle/node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "license": "MIT" + }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", diff --git a/package.json b/package.json index 2efd584..c7679c1 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "@hono/node-server": "^1.14.3", "@mdx-js/mdx": "^3.1.0", "@paperclover/console": "git+https://git.paperclover.net/clo/console.git", + "blurhash": "^2.0.5", "codemirror": "^6.0.1", "devalue": "^5.1.1", "esbuild": "^0.25.5", @@ -11,6 +12,7 @@ "hono": "^4.7.11", "marko": "^6.0.20", "puppeteer": "^24.10.1", + "sharp": "^0.34.2", "unique-names-generator": "^4.7.1" }, "devDependencies": { diff --git a/src/blog/pages/25/marko-intro.markodown b/src/blog/pages/25/marko-intro.markodown index 49ef498..3804ca6 100644 --- a/src/blog/pages/25/marko-intro.markodown +++ b/src/blog/pages/25/marko-intro.markodown @@ -17,7 +17,7 @@ JavaScript into HTML. Attributes are JavaScript expressions. ```marko
- // `input` is like props, but in global scope + // `input` is like props, but given in the top-level scope
// ESM `import` / `export` just work as expected. diff --git a/src/file-viewer/backend.tsx b/src/file-viewer/backend.tsx new file mode 100644 index 0000000..aa383bc --- /dev/null +++ b/src/file-viewer/backend.tsx @@ -0,0 +1,425 @@ +import { type Context, Hono } from "hono"; +import * as path from "node:path"; +import { etagMatches, serveAsset } from "../assets.ts"; +import { FilePermissions, MediaFile } from "../db.ts"; +import { renderDynamicPage } from "../framework/dynamic-pages.ts"; +import { renderToStringSync } from "../framework/render-to-string.ts"; +import { MediaPanel } from "../pages-dynamic/file_viewer.tsx"; +import mimeTypeDb from "./mime.json" with { type: "json" }; +import { Speedbump } from "./cotyledon.tsx"; +import { hasAsset } from "../assets.ts"; +import { CompressionFormat, fetchFile, prefetchFile } from "./cache.ts"; +import { requireFriendAuth } from "../journal/backend.ts"; + +const app = new Hono(); + +interface APIDirectoryList { + path: string; + readme: string | null; + files: APIFile[]; +} + +interface APIFile { + basename: string; + dir: boolean; + time: number; + size: number; + duration: number | null; +} + +function checkCotyledonCookie(c: Context) { + const cookie = c.req.header("Cookie"); + if (!cookie) return false; + const cookies = cookie.split("; ").map((x) => x.split("=")); + return cookies.some( + (kv) => kv[0].trim() === "cotyledon" && kv[1].trim() === "agree", + ); +} + +function isCotyledonPath(path: string) { + if (path === "/cotyledon") return true; + const year = path.match(/^\/(\d{4})($|\/)/); + if (!year) return false; + const yearInt = parseInt(year[1]); + if (yearInt < 2025 && yearInt >= 2017) return true; + return false; +} + +app.post("/file/cotyledon", async (c) => { + c.res = new Response(null, { + status: 200, + headers: { + "Set-Cookie": "cotyledon=agree; Path=/", + }, + }); +}); + +app.get("/file/*", async (c, next) => { + if (c.req.header("User-Agent")?.toLowerCase()?.includes("discordbot")) { + return next(); + } + let rawFilePath = c.req.path.slice(5) || "/"; + if (rawFilePath.endsWith("$partial")) { + return getPartialPage(c, rawFilePath.slice(0, -"$partial".length)); + } + let hasCotyledonCookie = checkCotyledonCookie(c); + if (isCotyledonPath(rawFilePath)) { + if (!hasCotyledonCookie) { + return serveAsset(c, "/file/cotyledon_speedbump", 403); + } else if (rawFilePath === "/cotyledon") { + return serveAsset(c, "/file/cotyledon_enterance", 200); + } + } + while (rawFilePath.length > 1 && rawFilePath.endsWith("/")) { + rawFilePath = rawFilePath.slice(0, -1); + } + const file = MediaFile.getByPath(rawFilePath); + if (!file) { + // perhaps a specific 404 page for media files? + return next(); + } + + const permissions = FilePermissions.getByPrefix(rawFilePath); + if (permissions !== 0) { + const friendAuthChallenge = requireFriendAuth(c); + if (friendAuthChallenge) return friendAuthChallenge; + } + + // File listings + if (file.kind === MediaFile.Kind.directory) { + if (c.req.header("Accept")?.includes("application/json")) { + const json = { + path: file.path, + files: file.getPublicChildren().map((f) => ({ + basename: f.basename, + dir: f.kind === MediaFile.Kind.directory, + time: f.date.getTime(), + size: f.size, + duration: f.duration ? f.duration : null, + })), + readme: file.contents ? file.contents : null, + } satisfies APIDirectoryList; + return c.json(json); + } + c.res = await renderDynamicPage(c.req.raw, "file_viewer", { + file, + hasCotyledonCookie, + }); + return; + } + + // Redirect to directory list for regular files if client accepts HTML + let viewMode = c.req.query("view"); + if (c.req.query("dl") !== undefined) { + viewMode = "download"; + } + if (viewMode == undefined && c.req.header("Accept")?.includes("text/html")) { + prefetchFile(file.path); + c.res = await renderDynamicPage(c.req.raw, "file_viewer", { + file, + hasCotyledonCookie, + }); + return; + } + const download = viewMode === "download"; + + const etag = file.hash; + const filePath = file.path; + const expectedSize = file.size; + + let encoding = decideEncoding(c.req.header("Accept-Encoding")); + + let sizeHeader = encoding === "raw" + ? expectedSize + // Size cannot be known because of compression modes + : undefined; + + // Etag + { + const ifNoneMatch = c.req.header("If-None-Match"); + if (ifNoneMatch && etagMatches(etag, ifNoneMatch)) { + c.res = new Response(null, { + status: 304, + statusText: "Not Modified", + headers: fileHeaders(file, download, sizeHeader), + }); + return; + } + } + + // Head + if (c.req.method === "HEAD") { + c.res = new Response(null, { + headers: fileHeaders(file, download, sizeHeader), + }); + return; + } + + // Prevalidate range requests + let rangeHeader = c.req.header("Range") ?? null; + if (rangeHeader) encoding = "raw"; + + const ifRangeHeader = c.req.header("If-Range"); + if (ifRangeHeader && ifRangeOutdated(file, ifRangeHeader)) { + // > If the condition is not fulfilled, the full resource is + // > sent back with a 200 OK status. + rangeHeader = null; + } + + let foundFile; + while (true) { + let second = false; + try { + foundFile = await fetchFile(filePath, encoding); + if (second) { + console.warn(`File ${filePath} has missing compression: ${encoding}`); + } + break; + } catch (error) { + if (encoding !== "raw") { + encoding = "raw"; + sizeHeader = file.size; + second = true; + continue; + } + + return c.text( + "internal server error: this file is present in the database but could not be fetched", + ); + } + } + const [streamOrBuffer, actualEncoding, src] = foundFile; + encoding = actualEncoding; + + // Range requests + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests + // Compression is skipped because it's a confusing, but solvable problem. + // See https://stackoverflow.com/questions/33947562/is-it-possible-to-send-http-response-using-gzip-and-byte-ranges-at-the-same-time + if (rangeHeader) { + const ranges = parseRange(rangeHeader, file.size); + // TODO: multiple ranges + if (ranges && ranges.length === 1) { + return (c.res = handleRanges(ranges, file, streamOrBuffer, download)); + } + } + + // Respond in a streaming fashion + c.res = new Response(streamOrBuffer, { + headers: { + ...fileHeaders(file, download, sizeHeader), + ...(encoding !== "raw" && { + "Content-Encoding": encoding, + }), + "X-Cache": src, + }, + }); +}); + +app.get("/canvas/:script", async (c, next) => { + const script = c.req.param("script"); + if (!hasAsset(`/js/canvas/${script}.js`)) { + return next(); + } + return renderDynamicPage(c.req.raw, "canvas", { + script, + }); +}); + +function decideEncoding(encodings: string | undefined): CompressionFormat { + if (encodings?.includes("zstd")) return "zstd"; + if (encodings?.includes("gzip")) return "gzip"; + return "raw"; +} + +function fileHeaders( + file: MediaFile, + download: boolean, + size: number | undefined = file.size, +) { + return { + Vary: "Accept-Encoding, Accept", + "Content-Type": mimeType(file.path), + "Content-Length": size.toString(), + ETag: file.hash, + "Last-Modified": file.date.toUTCString(), + ...(download && { + "Content-Disposition": `attachment; filename="${file.basename}"`, + }), + }; +} + +function ifRangeOutdated(file: MediaFile, ifRangeHeader: string) { + // etag + if (ifRangeHeader[0] === '"') { + return ifRangeHeader.slice(1, -1) !== file.hash; + } + // date + return new Date(ifRangeHeader) < file.date; +} + +/** The end is inclusive */ +type Ranges = Array<[start: number, end: number]>; + +function parseRange(rangeHeader: string, fileSize: number): Ranges | null { + const [unit, ranges] = rangeHeader.split("="); + if (unit !== "bytes") return null; + + const result: Array<[start: number, end: number]> = []; + const rangeParts = ranges.split(","); + + for (const range of rangeParts) { + const split = range.split("-"); + if (split.length !== 2) return null; + const [start, end] = split; + if (start === "" && end === "") return null; + const parsedRange: [number, number] = [ + start === "" ? fileSize - +end : +start, + end === "" ? fileSize - 1 : +end, + ]; + result.push(parsedRange); + } + + // Validate that ranges do not intersect + result.sort((a, b) => a[0] - b[0]); + for (let i = 1; i < result.length; i++) { + if (result[i][0] <= result[i - 1][1]) { + return null; + } + } + + return result; +} + +function handleRanges( + ranges: Ranges, + file: MediaFile, + streamOrBuffer: ReadableStream | Buffer, + download: boolean, +): Response { + // TODO: multiple ranges + const rangeSize = ranges.reduce((a, b) => a + (b[1] - b[0] + 1), 0); + const rangeBody = streamOrBuffer instanceof ReadableStream + ? applySingleRangeToStream(streamOrBuffer, ranges) + : applyRangesToBuffer(streamOrBuffer, ranges, rangeSize); + return new Response(rangeBody, { + status: 206, + headers: { + ...fileHeaders(file, download, rangeSize), + "Content-Range": `bytes ${ranges[0][0]}-${ranges[0][1]}/${file.size}`, + }, + }); +} + +function applyRangesToBuffer( + buffer: Buffer, + ranges: Ranges, + rangeSize: number, +): Uint8Array { + const result = new Uint8Array(rangeSize); + let offset = 0; + for (const [start, end] of ranges) { + result.set(buffer.slice(start, end + 1), offset); + offset += end - start + 1; + } + return result; +} + +function applySingleRangeToStream( + stream: ReadableStream, + ranges: Ranges, +): ReadableStream { + let reader: ReadableStreamDefaultReader; + let position = 0; + const [start, end] = ranges[0]; + return new ReadableStream({ + async start(controller) { + reader = stream.getReader(); + try { + while (position <= end) { + const { done, value } = await reader.read(); + + if (done) { + controller.close(); + return; + } + + const buffer = new Uint8Array(value); + + const bufferStart = position; + const bufferEnd = position + buffer.length - 1; + + position += buffer.length; + + if (bufferEnd < start) { + continue; + } + + if (bufferStart > end) { + break; + } + + const sendStart = Math.max(0, start - bufferStart); + const sendEnd = Math.min(buffer.length - 1, end - bufferStart); + + if (sendStart <= sendEnd) { + controller.enqueue(buffer.slice(sendStart, sendEnd + 1)); + } + } + + controller.close(); + } catch (error) { + controller.error(error); + } finally { + reader.releaseLock(); + } + }, + cancel() { + reader?.releaseLock(); + }, + }); +} + +function mimeType(file: string) { + return (mimeTypeDb as any)[path.extname(file)] ?? "application/octet-stream"; +} + +function getPartialPage(c: Context, rawFilePath: string) { + if (isCotyledonPath(rawFilePath)) { + if (!checkCotyledonCookie(c)) { + let root = Speedbump(); + // Remove the root element, it's created client side! + root = root.props.children; + + const html = renderToStringSync(root); + c.header("X-Cotyledon", "true"); + return c.html(html); + } + } + + const file = MediaFile.getByPath(rawFilePath); + const permissions = FilePermissions.getByPrefix(rawFilePath); + if (permissions !== 0) { + const friendAuthChallenge = requireFriendAuth(c); + if (friendAuthChallenge) return friendAuthChallenge; + } + if (rawFilePath.endsWith("/")) { + rawFilePath = rawFilePath.slice(0, -1); + } + if (!file) { + return c.json({ error: "File not found" }, 404); + } + + let root = MediaPanel({ + file, + isLast: true, + activeFilename: null, + hasCotyledonCookie: rawFilePath === "" && checkCotyledonCookie(c), + }); + // Remove the root element, it's created client side! + root = root.props.children; + + const html = renderToStringSync(root); + return c.html(html); +} + +export { app as mediaApp }; diff --git a/src/file-viewer/bin/extension-stats.ts b/src/file-viewer/bin/extension-stats.ts new file mode 100644 index 0000000..46cbf87 --- /dev/null +++ b/src/file-viewer/bin/extension-stats.ts @@ -0,0 +1,83 @@ +import * as path from "node:path"; +import { cache, MediaFile } from "../db"; + +// Function to get file extension statistics +function getExtensionStats() { + // Get all files (not directories) from the database + const query = ` + SELECT path FROM media_files + WHERE kind = ${MediaFile.Kind.file} + `; + + // Use raw query to get all file paths + const rows = cache.query(query).all() as { path: string }[]; + + // Count extensions + const extensionCounts: Record = {}; + + for (const row of rows) { + const extension = path.extname(row.path).toLowerCase(); + extensionCounts[extension] = (extensionCounts[extension] || 0) + 1; + } + + // Sort extensions by count (descending) + const sortedExtensions = Object.entries(extensionCounts) + .sort((a, b) => b[1] - a[1]); + + return { + totalFiles: rows.length, + extensions: sortedExtensions, + }; +} + +// Function to print a visual table +function printExtensionTable() { + const stats = getExtensionStats(); + + // Calculate column widths + const extensionColWidth = Math.max( + ...stats.extensions.map(([ext]) => ext.length), + "Extension".length, + ) + 2; + + const countColWidth = Math.max( + ...stats.extensions.map(([_, count]) => count.toString().length), + "Count".length, + ) + 2; + + const percentColWidth = "Percentage".length + 2; + + // Print header + console.log("MediaFile Extension Statistics"); + console.log(`Total files: ${stats.totalFiles}`); + console.log(); + + // Print table header + console.log( + "Extension".padEnd(extensionColWidth) + + "Count".padEnd(countColWidth) + + "Percentage".padEnd(percentColWidth), + ); + + // Print separator + console.log( + "-".repeat(extensionColWidth) + + "-".repeat(countColWidth) + + "-".repeat(percentColWidth), + ); + + // Print rows + for (const [extension, count] of stats.extensions) { + const percentage = ((count / stats.totalFiles) * 100).toFixed(2); + const ext = extension || "(no extension)"; + + console.log( + ext.padEnd(extensionColWidth) + + count.toString().padEnd(countColWidth) + + `${percentage}%`.padEnd(percentColWidth), + ); + } +} + +// Run the program +printExtensionTable(); diff --git a/src/file-viewer/bin/scan.ts b/src/file-viewer/bin/scan.ts new file mode 100644 index 0000000..1e19e74 --- /dev/null +++ b/src/file-viewer/bin/scan.ts @@ -0,0 +1,1015 @@ +// This file was started by AI and maintained by hand since. +import "@paperclover/console/inject"; +import { Progress } from "@paperclover/console/Progress"; +import { Spinner } from "@paperclover/console/Spinner"; +import assert from "node:assert"; +import { execFile } from "node:child_process"; +import { existsSync, Stats } from "node:fs"; +import * as fsp from "node:fs/promises"; +import * as path from "node:path"; +import { promisify } from "node:util"; +import { BlobAsset, cache, FilePermissions, MediaFile } from "../db.ts"; +import { formatDate, formatSize } from "./share.ts"; +import { highlightCode, type Language } from "./highlight.ts"; + +const execFileAsync = promisify(execFile); + +// Configuration +const FILE_ROOT = process.env.SCAN_FILE_ROOT; +if (!FILE_ROOT) { + throw new Error( + "FILE_ROOT environment variable not set (e.g. '/path/to/files')", + ); +} +const LOCAL_DIR = path.resolve(FILE_ROOT); +const DRY_RUN = process.argv.includes("--dry-run"); +const SHOULD_COMPRESS = true; +const VERBOSE = process.argv.includes("--verbose"); +const SHOULD_SCRUB = true; +const COMPRESS_STORE = process.env.COMPRESS_STORE || + path.join(process.cwd(), ".clover/compressed"); + +// Helper function for logging that respects verbose flag +function log(message: string, always = false): void { + if (always || VERBOSE) { + console.log(message); + } +} + +// File extensions that need duration metadata +const MEDIA_EXTENSIONS = new Set([ + ".mp4", + ".mkv", + ".webm", + ".avi", + ".mov", + ".mp3", + ".flac", + ".wav", + ".ogg", + ".m4a", +]); + +// File extensions that need dimension metadata +const IMAGE_EXTENSIONS = new Set([ + ".jpg", + ".jpeg", + ".png", + ".gif", + ".webp", + ".avif", + ".heic", + ".svg", +]); + +const VIDEO_EXTENSIONS = new Set([".mp4", ".mkv", ".webm", ".avi", ".mov"]); + +// File extensions that need metadata scrubbing +const SCRUB_EXTENSIONS = new Set([ + ".jpg", + ".jpeg", + ".png", + ".mov", + ".mp4", + ".m4a", +]); + +const CODE_EXTENSIONS: Record = { + ".json": "json", + ".toml": "toml", + ".ts": "ts", + ".js": "ts", + ".tsx": "tsx", + ".jsx": "tsx", + ".css": "css", + ".py": "python", + ".lua": "lua", + ".sh": "shell", + ".bat": "dosbatch", + ".ps1": "powershell", + ".cmd": "dosbatch", + ".yaml": "yaml", + ".yml": "yaml", + ".zig": "zig", + ".astro": "astro", + ".mdx": "mdx", + ".xml": "xml", + ".jsonc": "json", + ".php": "php", + ".patch": "diff", + ".diff": "diff", +}; + +const READ_CONTENTS_EXTENSIONS = new Set([".txt", ".chat"]); + +// For files that have changed indexing logic, update the date here rescanning +// will reconstruct the entire file object. This way you can incrementally +// update new file types without having to reindex everything. +const lastUpdateTypes: Record = {}; +lastUpdateTypes[".lnk"] = new Date("2025-05-13 13:58:00"); +for (const ext in CODE_EXTENSIONS) { + lastUpdateTypes[ext] = new Date("2025-05-13 13:58:00"); +} +for (const ext of READ_CONTENTS_EXTENSIONS) { + lastUpdateTypes[ext] = new Date("2025-05-13 13:58:00"); +} +lastUpdateTypes[".diff"] = new Date("2025-05-18 13:58:00"); +lastUpdateTypes[".patch"] = new Date("2025-05-18 13:58:00"); + +// Helper functions for metadata extraction +async function calculateHash(filePath: string): Promise { + try { + const hash = await execFileAsync("sha1sum", [filePath]); + return hash.stdout.split(" ")[0]; + } catch (error) { + console.error(`Error calculating hash for ${filePath}:`, error); + throw error; + } +} + +async function calculateDuration(filePath: string): Promise { + try { + const ext = path.extname(filePath).toLowerCase(); + if (!MEDIA_EXTENSIONS.has(ext)) return 0; + + const { stdout } = await execFileAsync("ffprobe", [ + "-v", + "error", + "-show_entries", + "format=duration", + "-of", + "default=noprint_wrappers=1:nokey=1", + filePath, + ]); + return Math.ceil(parseFloat(stdout.trim())); + } catch (error) { + console.error(`Error calculating duration for ${filePath}:`, error); + return 0; // Return 0 for duration on error + } +} + +async function calculateDimensions(filePath: string): Promise { + const ext = path.extname(filePath).toLowerCase(); + if (!IMAGE_EXTENSIONS.has(ext) && !VIDEO_EXTENSIONS.has(ext)) return ""; + + try { + if (ext === ".svg") { + // For SVG files, parse the file and extract width/height + const content = await fsp.readFile(filePath, "utf8"); + const widthMatch = content.match(/width="(\d+)"/); + const heightMatch = content.match(/height="(\d+)"/); + + if (widthMatch && heightMatch) { + return `${widthMatch[1]}x${heightMatch[1]}`; + } + } else if (IMAGE_EXTENSIONS.has(ext) || VIDEO_EXTENSIONS.has(ext)) { + // Use ffprobe for images and videos + const { stdout } = await execFileAsync("ffprobe", [ + "-v", + "error", + "-select_streams", + "v:0", + "-show_entries", + "stream=width,height", + "-of", + "csv=s=x:p=0", + filePath, + ]); + return stdout.trim(); + } + } catch (error) { + console.error(`Error calculating dimensions for ${filePath}:`, error); + } + + return ""; +} + +// Helper function to check and remove location metadata +async function scrubLocationMetadata( + filePath: string, + stats: Stats, +): Promise { + try { + const ext = path.extname(filePath).toLowerCase(); + if (!SCRUB_EXTENSIONS.has(ext)) return false; + + let hasLocation = false; + let args: string[] = []; + + // Check for location metadata based on file type + const tempOutput = path.join( + path.dirname(filePath), + `.tmp.${path.basename(filePath)}`, + ); + switch (ext) { + case ".jpg": + case ".jpeg": + case ".png": + // Check for GPS tags in EXIF + const { stdout: gpsCheck } = await execFileAsync("exiftool", [ + "-gps:all", + filePath, + ]); + hasLocation = gpsCheck.trim().length > 0; + args = ["-gps:all=", filePath, "-o", tempOutput]; + break; + case ".mov": + case ".mp4": + // Check for GPS metadata in video files + const { stdout: videoCheck } = await execFileAsync("exiftool", [ + "-ee", + "-G3", + "-s", + filePath, + ]); + hasLocation = videoCheck.includes("GPS") || + videoCheck.includes("Location"); + args = ["-gps:all=", "-xmp:all=", filePath, "-o", tempOutput]; + break; + case ".m4a": + // Check for location and other metadata in m4a files + const { stdout: m4aCheck } = await execFileAsync("exiftool", [ + "-ee", + "-G3", + "-s", + filePath, + ]); + hasLocation = m4aCheck.includes("GPS") || + m4aCheck.includes("Location") || + m4aCheck.includes("Filename") || + m4aCheck.includes("Title"); + + if (hasLocation) { + args = [ + "-gps:all=", + "-location:all=", + "-filename:all=", + "-title=", + "-m4a:all=", + filePath, + "-o", + tempOutput, + ]; + } + break; + } + + const accessTime = stats.atime; + const modTime = stats.mtime; + + let backup: string | null = null; + try { + if (hasLocation) { + if (DRY_RUN) return true; + + // Prepare a backup + const tmp = path.join( + path.dirname(filePath), + `.tmp.backup.${path.basename(filePath)}`, + ); + await fsp.copyFile(filePath, tmp); + await fsp.utimes(tmp, accessTime, modTime); + backup = tmp; + + // Remove metadata + await execFileAsync("exiftool", args); + if (!existsSync(tempOutput)) { + throw new Error(`Failed to create output file: ${tempOutput}`); + } + + // Restore original timestamps + await fsp.rename(tempOutput, filePath); + await fsp.utimes(filePath, accessTime, modTime); + + // Backup is no longer needed + await fsp.unlink(backup); + + log( + `Scrubbed location metadata in ${path.relative(LOCAL_DIR, filePath)}`, + true, + ); + return true; + } + } catch (error) { + if (backup) { + await fsp.rename(backup, filePath); + } + if (existsSync(tempOutput)) { + await fsp.unlink(tempOutput); + } + throw error; + } + } catch (error) { + console.error(`Error scrubbing metadata for ${filePath}:`, error); + } + + return false; +} + +// Queue implementation for parallel processing +type AsyncQueueProcessor = (s: Spinner, item: T) => Promise; +class AsyncQueue { + private queue: T[] = []; + private running = 0; + private maxConcurrent: number; + private processed = 0; + private progress?: Progress<{ active: Spinner[] }>; + private name: string; + private estimate?: number; + + constructor(name: string, maxConcurrent: number) { + this.maxConcurrent = maxConcurrent; + this.name = name; + } + + setEstimate(estimate: number) { + this.estimate = estimate; + if (this.progress) { + this.progress.total = Math.max( + this.processed + this.queue.length, + estimate, + ); + } + } + + getProgress() { + if (!this.progress) { + this.progress = new Progress({ + spinner: null, + text: ({ active }) => { + const now = performance.now(); + let text = `[${this.processed}/${ + this.processed + this.queue.length + }] ${this.name}`; + let n = 0; + for (const item of active) { + let itemText = "- " + item.format(now); + text += `\n` + + itemText.slice(0, Math.max(0, process.stdout.columns - 1)); + if (n > 10) { + text += `\n ... + ${active.length - n} more`; + break; + } + n++; + } + return text; + }, + props: { + active: [] as Spinner[], + }, + }); + this.progress.total = this.estimate ?? 0; + this.progress.value = 0; + this.progress.fps = 30; + } + return this.progress; + } + + async add(item: T, processor: AsyncQueueProcessor): Promise { + this.queue.push(item); + this.getProgress().total = Math.max( + this.processed + this.queue.length, + this.estimate ?? 0, + ); + return this.processNext(processor); + } + + async addBatch(items: T[], processor: AsyncQueueProcessor): Promise { + this.queue.push(...items); + this.getProgress().total = Math.max( + this.processed + this.queue.length, + this.estimate ?? 0, + ); + return this.processNext(processor); + } + + private async processNext(processor: AsyncQueueProcessor): Promise { + if (this.running >= this.maxConcurrent || this.queue.length === 0) { + return; + } + + const item = this.queue.shift(); + if (!item) return; + + this.running++; + + try { + const progress = this.getProgress(); + + let itemText = ""; + if (typeof item === "string") { + itemText = item; + } else if (typeof item === "object" && item !== null && "path" in item) { + itemText = "" + item.path; + } else { + itemText = JSON.stringify(item); + } + if (itemText.startsWith(LOCAL_DIR)) { + itemText = path.relative(LOCAL_DIR, itemText); + } + + const spinner = new Spinner(itemText); + spinner.stop(); + progress.props.active.unshift(spinner); + await processor(spinner, item); + progress.props = { + active: progress.props.active.filter((s) => s !== spinner), + }; + this.processed++; + progress.value = this.processed; + } catch (error) { + console.error(`Error processing ${this.name} queue item:`, error); + this.processed++; + this.getProgress().value = this.processed; + } finally { + this.running--; + await this.processNext(processor); + } + } + + async waitForCompletion(): Promise { + if (this.queue.length === 0 && this.running === 0) { + if (this.processed > 0) { + this.#success(); + } + return; + } + + return new Promise((resolve) => { + const checkInterval = setInterval(() => { + if (this.queue.length === 0 && this.running === 0) { + clearInterval(checkInterval); + this.#success(); + resolve(); + } + }, 100); + }); + } + + #success() { + this.getProgress().success(`${this.processed} ${this.name}`); + } +} + +function skipBasename(basename: string): boolean { + // dot files must be incrementally tracked + if (basename === ".dirsort") return true; + if (basename === ".friends") return true; + + return ( + basename.startsWith(".") || + basename.startsWith("._") || + basename.startsWith(".tmp") || + basename === ".DS_Store" || + basename.toLowerCase() === "thumbs.db" || + basename.toLowerCase() === "desktop.ini" + ); +} + +// File system scanner +class FileSystemScanner { + private visitedPaths = new Set(); + private previousPaths = new Set(); + private dirQueue = new AsyncQueue("Scan Directories", 10); + private fileQueue = new AsyncQueue<{ path: string; stat: any }>( + "File metadata", + 20, + ); + private compressQueue: AsyncQueue<{ file: MediaFile; path: string }> | null = + SHOULD_COMPRESS ? new AsyncQueue("Compress Assets", 10) : null; + + private getDbPath(localPath: string): string { + // Convert local file system path to database path + const relativePath = path.relative(LOCAL_DIR, localPath); + return "/" + relativePath.split(path.sep).join(path.posix.sep); + } + + private getLocalPath(dbPath: string): string { + // Convert database path to local file system path + return path.join(LOCAL_DIR, dbPath.slice(1)); + } + + async scanFile(s: Spinner, filePath: string, stat: any): Promise { + const dbPath = this.getDbPath(filePath); + + // Skip hidden files + const basename = path.basename(filePath); + if (skipBasename(basename)) { + return; + } + + this.visitedPaths.add(dbPath); + + // Get existing file info from db + const existingFile = MediaFile.getByPath(dbPath); + + // Determine which date to use (for date protection) + let dateToUse = stat.mtime; + const year2025Start = new Date("2025-01-01T00:00:00Z"); + + if ( + existingFile && + existingFile.date < year2025Start && + stat.mtime >= year2025Start + ) { + console.error( + `Error: ${dbPath} is ${ + formatDate( + existingFile.date, + ) + }, got modified to ${formatDate(stat.mtime)}`, + ); + dateToUse = existingFile.date; + } + + // Check if we need to reprocess the file + if (existingFile && existingFile.size === stat.size && existingFile.hash) { + maybe_skip: { + const lastUpdateDate = lastUpdateTypes[path.extname(filePath)]; + if (lastUpdateDate && existingFile.lastUpdateDate < lastUpdateDate) { + console.log( + `Reprocessing ${dbPath} because indexing logic changed after ${ + formatDate( + lastUpdateDate, + ) + }`, + ); + break maybe_skip; + } + + if (SHOULD_COMPRESS && existingFile.processed !== 2) { + this.compressQueue!.add( + { file: existingFile, path: dbPath }, + this.compressFile.bind(this), + ); + } + + // File hasn't changed, no need to reprocess + MediaFile.createFile({ + path: dbPath, + date: dateToUse, + hash: existingFile.hash, + size: stat.size, + duration: existingFile.duration, + dimensions: existingFile.dimensions, + content: existingFile.contents, + }); + return; + } + } + + // Process the file + log(`Processing file: ${dbPath}`); + + // Scrub location metadata if needed + if (SHOULD_SCRUB) { + if (await scrubLocationMetadata(filePath, stat)) { + // Re-stat the file in case it was modified + const newStat = await fsp.stat(filePath); + stat.size = newStat.size; + } + } + + // Extract content + const hash = await calculateHash(filePath); + let content = ""; + if (filePath.endsWith(".lnk")) { + content = (await fsp.readFile(filePath, "utf8")).trim(); + } + const language = CODE_EXTENSIONS[path.extname(filePath)]; + if (language) { + read_code: { + // An issue is that .ts is an overloaded extension, shared between + // 'transport stream' and 'typescript'. + // + // Filter used here is: + // - more than 1mb + // - invalid UTF-8 + if (stat.size > 1_000_000) break read_code; + let code; + const buf = await fsp.readFile(filePath); + try { + code = new TextDecoder("utf-8", { fatal: true }).decode(buf); + } catch (error) { + break read_code; + } + content = await highlightCode(code, language); + } + } + if (!content && READ_CONTENTS_EXTENSIONS.has(path.extname(filePath))) { + content = await fsp.readFile(filePath, "utf8"); + } + // End extract content + + if (hash === existingFile?.hash) { + MediaFile.createFile({ + path: dbPath, + date: dateToUse, + hash, + size: stat.size, + duration: existingFile.duration, + dimensions: existingFile.dimensions, + content, + }); + return; + } else if (existingFile) { + if (existingFile.processed === 2) { + if (BlobAsset.decrementOrDelete(existingFile.hash)) { + log( + `Deleted compressed asset ${existingFile.hash}.{gzip, zstd}`, + true, + ); + await fsp.unlink( + path.join( + COMPRESS_STORE, + existingFile.hash.substring(0, 2), + existingFile.hash + ".gz", + ), + ); + await fsp.unlink( + path.join( + COMPRESS_STORE, + existingFile.hash.substring(0, 2), + existingFile.hash + ".zstd", + ), + ); + } + } + } + const [duration, dimensions] = await Promise.all([ + calculateDuration(filePath), + calculateDimensions(filePath), + ]); + + // Update database with all metadata + MediaFile.createFile({ + path: dbPath, + date: dateToUse, + hash, + size: stat.size, + duration, + dimensions, + content, + }); + + if (SHOULD_COMPRESS) { + this.compressQueue!.add( + { + file: MediaFile.getByPath(dbPath)!, + path: dbPath, + }, + this.compressFile.bind(this), + ); + } + } + + async compressFile(s: Spinner, { file }: { file: MediaFile }): Promise { + log(`Compressing file: ${file.path}`); + if (DRY_RUN) return; + + const filePath = path.join(FILE_ROOT!, file.path); + + const hash = file.hash; + const firstTwoChars = hash.substring(0, 2); + const compressDir = `${COMPRESS_STORE}/${firstTwoChars}`; + const compressPath = `${compressDir}/${hash}`; + + // Create directory structure if it doesn't exist + await fsp.mkdir(compressDir, { recursive: true }); + + // Compress the file with gzip + const blob = BlobAsset.putOrIncrement(hash); + if (blob.refs > 1) { + log( + `Skipping compression of ${filePath} because it already exists in ${compressPath}`, + ); + return; + } + // Check if already exists + if (existsSync(compressPath + ".gz")) { + file.setCompressed(true); + return; + } + try { + const gzipProcess = Bun.spawn(["gzip", "-c", filePath, "-9"], { + stdout: Bun.file(compressPath + ".gz"), + }); + const zstdProcess = Bun.spawn(["zstd", "-c", filePath, "-9"], { + stdout: Bun.file(compressPath + ".zstd"), + }); + const [gzipExited, zstdExited] = await Promise.all([ + gzipProcess.exited, + zstdProcess.exited, + ]); + assert(gzipExited === 0); + assert(zstdExited === 0); + assert(existsSync(compressPath + ".gz")); + assert(existsSync(compressPath + ".zstd")); + file.setCompressed(true); + } catch (error) { + console.error(`Error compressing file ${filePath}:`, error); + BlobAsset.decrementOrDelete(hash); + file.setCompressed(false); + } + } + + async scanDirectory(s: Spinner, dirPath: string): Promise { + const dbPath = this.getDbPath(dirPath); + + this.visitedPaths.add(dbPath); + + // Create or update directory entry + log(`Scanning directory: ${dbPath}`); + if (!DRY_RUN) { + MediaFile.createOrUpdateDirectory(dbPath); + } + + try { + const entries = await fsp.readdir(dirPath, { withFileTypes: true }); + + // Process files and subdirectories + for (const entry of entries) { + const entryPath = path.join(dirPath, entry.name); + + // Skip hidden files and system files + if (skipBasename(entry.name)) { + continue; + } + + if (entry.isDirectory()) { + // Queue subdirectory for scanning + this.dirQueue.add(entryPath, this.scanDirectory.bind(this)); + } else if (entry.isFile()) { + // Queue file for processing + const stat = await fsp.stat(entryPath); + + this.fileQueue.add( + { path: entryPath, stat }, + async (s, item) => await this.scanFile(s, item.path, item.stat), + ); + } + } + } catch (error) { + console.error(`Error scanning directory ${dirPath}:`, error); + } + } + + async processDirectoryMetadata(dirPath: string): Promise { + const dbPath = this.getDbPath(dirPath); + const dir = MediaFile.getByPath(dbPath); + + if (!dir || dir.kind !== MediaFile.Kind.directory) { + return; + } + + if (DRY_RUN) return; + + const children = dir.getChildren(); + + // Calculate directory metadata + let totalSize = 0; + let newestDate = new Date(0); + let allHashes = ""; + + // Check for readme.txt + let readmeContent = ""; + + try { + readmeContent = await fsp.readFile( + path.join(dirPath, "readme.txt"), + "utf8", + ); + } catch (error: any) { + console.info(`no readme ${dirPath}`); + if (error.code !== "ENOENT") { + console.error(`Error reading readme.txt in ${dirPath}:`, error); + } + } + + let dirsort: string[] | null = null; + try { + dirsort = (await fsp.readFile(path.join(dirPath, ".dirsort"), "utf8")) + .split("\n") + .map((x) => x.trim()) + .filter(Boolean); + } catch (error: any) { + if (error.code !== "ENOENT") { + console.error(`Error reading .dirsort in ${dirPath}:`, error); + } + } + + if (await fsp.exists(path.join(dirPath, ".friends"))) { + FilePermissions.setPermissions(dbPath, 1); + } else { + FilePermissions.setPermissions(dbPath, 0); + } + + // Process children + for (const child of children) { + totalSize += child.size; + allHashes += child.hash; + + // Update newest date, ignoring readme.txt + if (!child.path.endsWith("/readme.txt") && child.date > newestDate) { + newestDate = child.date; + } + } + + // Create a hash for the directory + const dirHash = new Bun.CryptoHasher("sha1") + .update(dbPath + allHashes) + .digest("hex"); + + // Update directory metadata + MediaFile.markDirectoryProcessed({ + id: dir.id, + timestamp: newestDate, + contents: readmeContent, + size: totalSize, + hash: dirHash, + dirsort, + }); + } + + async findDeletedFiles(): Promise { + if (DRY_RUN) return; + + // Find all paths that exist in the DB but not in the filesystem + const deletedPaths = Array.from(this.previousPaths).filter( + (path) => !this.visitedPaths.has(path), + ); + + for (const dbPath of deletedPaths) { + const file = MediaFile.getByPath(dbPath); + if (!file) continue; + + log(`Item Deleted: ${dbPath}`, true); + if (file.processed === 2) { + if (BlobAsset.decrementOrDelete(file.hash)) { + log(`Deleted compressed asset ${file.hash}.{gzip, zstd}`, true); + await fsp.unlink( + path.join( + COMPRESS_STORE, + file.hash.substring(0, 2), + file.hash + ".gz", + ), + ); + await fsp.unlink( + path.join( + COMPRESS_STORE, + file.hash.substring(0, 2), + file.hash + ".zstd", + ), + ); + } + } + MediaFile.deleteByPath(dbPath); + } + } + + async loadPreviousPaths(): Promise { + // Get all files and directories from the database + // This uses a custom query to get all paths at once + const getAllPathsQuery = cache + .prepare(`SELECT path, kind FROM media_files`) + .all() as { + path: string; + kind: MediaFile.Kind; + }[]; + + let dirs = 0; + let files = 0; + for (const row of getAllPathsQuery) { + this.previousPaths.add(row.path); + if (row.kind === MediaFile.Kind.directory) { + dirs++; + } else { + files++; + } + } + + this.dirQueue.setEstimate(dirs); + this.fileQueue.setEstimate(files); + + // log(`Loaded ${this.previousPaths.size} paths from database`, true); + } + + async scan(): Promise { + log(`Starting file system scan in ${LOCAL_DIR}`, true); + + // Check if the root directory exists and is accessible + try { + const rootStat = await fsp.stat(LOCAL_DIR); + if (!rootStat.isDirectory()) { + throw new Error(`${LOCAL_DIR} is not a directory`); + } + } catch (error) { + console.error(`Error: Cannot access root directory ${LOCAL_DIR}`, error); + console.error( + `Aborting scan to prevent database corruption. Please check if the volume is mounted.`, + ); + process.exit(1); + } + + await this.loadPreviousPaths(); + + await this.dirQueue.add(LOCAL_DIR, this.scanDirectory.bind(this)); + + await this.dirQueue.waitForCompletion(); + await this.fileQueue.waitForCompletion(); + + await this.findDeletedFiles(); + + const allDirs = Array.from(this.visitedPaths) + .filter((path) => { + const file = MediaFile.getByPath(path); + return file && file.kind === MediaFile.Kind.directory; + }) + .sort((a, b) => b.length - a.length); + + const dirMetadataQueue = new AsyncQueue("Directory Metadata", 10); + for (const dirPath of allDirs) { + await this.processDirectoryMetadata(this.getLocalPath(dirPath)); + } + + await dirMetadataQueue.waitForCompletion(); + + if (SHOULD_COMPRESS) { + await this.compressQueue!.waitForCompletion(); + } + + log("Scan completed successfully!", true); + } +} + +// Main execution +function showHelp() { + console.log(` +MediaFile Scanner - Index filesystem content for paperclover.net + +Environment variables: + FILE_ROOT Required. Path to the directory to scan + COMPRESS_STORE Optional. Path to store compressed files (default: .clover/compressed) + +Options: + --help Show this help message + --dry-run Don't make any changes to the database + --verbose Show detailed output + +Usage: + bun ./media/scan.ts [options] + +`); + process.exit(0); +} + +{ + // Show help if requested + if (process.argv.includes("--help")) { + showHelp(); + process.exit(0); + } + + // Check if the root directory exists before starting + if (!existsSync(LOCAL_DIR)) { + console.error( + `Error: Root directory ${LOCAL_DIR} does not exist or is not accessible.`, + ); + console.error(`Please check if the volume is mounted correctly.`); + process.exit(1); + } + + const startTime = Date.now(); + + try { + const scanner = new FileSystemScanner(); + await scanner.scan(); + + const endTime = Date.now(); + log(`Scan completed in ${(endTime - startTime) / 1000} seconds`, true); + + const rootDir = MediaFile.getByPath("/")!; + const totalEntries = cache + .prepare(`SELECT COUNT(*) as count FROM media_files`) + .get() as { count: number }; + const totalDuration = cache + .prepare(`SELECT SUM(duration) as duration FROM media_files`) + .get() as { duration: number }; + console.log(); + console.log("Global Stats"); + console.log(` Entry count: ${totalEntries.count}`); + console.log(` Uncompressed size: ${formatSize(rootDir.size)}`); + console.log( + ` Total audio/video duration: ${ + ( + totalDuration.duration / + 60 / + 60 + ).toFixed(1) + } hours`, + ); + } catch (error) { + console.error("Error during scan:", error); + process.exit(1); + } +} diff --git a/src/file-viewer/cache.ts b/src/file-viewer/cache.ts new file mode 100644 index 0000000..c2865a8 --- /dev/null +++ b/src/file-viewer/cache.ts @@ -0,0 +1,418 @@ +import { Agent, get } from "node:https"; +import * as fs from "node:fs"; +import * as path from "node:path"; +import { Buffer } from "node:buffer"; +import type { ClientRequest } from "node:http"; +import { LRUCache } from "lru-cache"; +import { open } from "node:fs/promises"; +import { createHash } from "node:crypto"; +import { scoped } from "@paperclover/console"; +import { escapeUri } from "./share.ts"; + +declare const Deno: any; + +const sourceOfTruth = "https://nas.paperclover.net:43250"; +const caCert = fs.readFileSync(path.join(import.meta.dirname, "cert.pem")); + +const diskCacheRoot = path.join(import.meta.dirname, "../.clover/filecache/"); +const diskCacheMaxSize = 14 * 1024 * 1024 * 1024; // 14GB +const ramCacheMaxSize = 1 * 1024 * 1024 * 1024; // 1.5GB +const loadInProgress = new Map< + string, + Promise<{ stream: ReadableStream }> | { stream: ReadableStream } +>(); +// Disk cache serializes the access times +const diskCacheState: Record = + loadDiskCacheState(); +const diskCache = new LRUCache({ + maxSize: diskCacheMaxSize, + ttl: 0, + sizeCalculation: (value) => value, + dispose: (_, key) => { + delete diskCacheState[key]; + }, + onInsert: (size, key) => { + diskCacheState[key] = [size, Date.now()]; + }, +}); +const ramCache = new LRUCache({ + maxSize: ramCacheMaxSize, + ttl: 0, + sizeCalculation: (value) => value.byteLength, +}); +let diskCacheFlush: NodeJS.Timeout | undefined; + +{ + // Initialize the disk cache by validating all files exist, and then + // inserting them in last to start order. State is repaired pessimistically. + const toDelete = new Set(Object.keys(diskCacheState)); + fs.mkdirSync(diskCacheRoot, { recursive: true }); + for ( + const file of fs.readdirSync(diskCacheRoot, { + recursive: true, + encoding: "utf-8", + }) + ) { + const key = file.split("/").pop()!; + if (key.length !== 40) continue; + const entry = diskCacheState[key]; + if (!entry) { + fs.rmSync(path.join(diskCacheRoot, file), { + recursive: true, + force: true, + }); + delete diskCacheState[key]; + continue; + } + toDelete.delete(key); + } + for (const key of toDelete) { + delete diskCacheState[key]; + } + saveDiskCacheState(); + const sorted = Object.keys(diskCacheState).sort((a, b) => + diskCacheState[b][1] - diskCacheState[a][1] + ); + for (const key of sorted) { + diskCache.set(key, diskCacheState[key][0]); + } +} + +export type CacheSource = "ram" | "disk" | "miss" | "lan" | "flight"; +export type CompressionFormat = "gzip" | "zstd" | "raw"; +const compressionFormatMap = { + gzip: "gz", + zstd: "zstd", + raw: "file", +} as const; + +const log = scoped("file_cache"); + +const lanMount = "/Volumes/clover/Published"; +const hasLanMount = fs.existsSync(lanMount); + +/** + * Fetches a file with the given compression format. + * Uncompressed files are never persisted to disk. + * + * Returns a promise to either: + * - Buffer: the data is from RAM cache + * - ReadableStream: the data is being streamed in from disk/server + * + * Additionally, returns a string indicating the source of the data, for debugging. + * + * Callers must be able to consume both output types. + */ +export async function fetchFile( + pathname: string, + format: CompressionFormat = "raw", +): Promise< + [Buffer | ReadableStream, encoding: CompressionFormat, src: CacheSource] +> { + // 1. Ram cache + const cacheKey = hashKey(`${pathname}:${format}`); + const ramCacheHit = ramCache.get(cacheKey); + if (ramCacheHit) { + log(`ram hit: ${format}${pathname}`); + return [ramCacheHit, format, "ram"]; + } + + // 2. Tee an existing loading stream. + const inProgress = loadInProgress.get(cacheKey); + if (inProgress) { + const stream = await inProgress; + const [stream1, stream2] = stream.stream.tee(); + loadInProgress.set(cacheKey, { stream: stream2 }); + log(`in-flight copy: ${format}${pathname}`); + return [stream1, format, "flight"]; + } + + // 3. Disk cache + Load into ram cache. + if (format !== "raw") { + const diskCacheHit = diskCache.get(cacheKey); + if (diskCacheHit) { + diskCacheState[cacheKey] = [diskCacheHit, Date.now()]; + saveDiskCacheStateLater(); + log(`disk hit: ${format}/${pathname}`); + return [ + startInProgress( + cacheKey, + new ReadableStream({ + start: async (controller) => { + const stream = fs.createReadStream( + path.join(diskCacheRoot, cacheKey), + ); + const chunks: Buffer[] = []; + stream.on("data", (chunk) => { + controller.enqueue(chunk); + chunks.push(chunk as Buffer); + }); + stream.on("end", () => { + controller.close(); + ramCache.set(cacheKey, Buffer.concat(chunks)); + finishInProgress(cacheKey); + }); + stream.on("error", (error) => { + controller.error(error); + }); + }, + }), + ), + format, + "disk", + ]; + } + } + + // 4. Lan Mount (access files that prod may not have) + if (hasLanMount) { + log(`lan hit: ${format}/${pathname}`); + return [ + startInProgress( + cacheKey, + new ReadableStream({ + start: async (controller) => { + const stream = fs.createReadStream( + path.join(lanMount, pathname), + ); + const chunks: Buffer[] = []; + stream.on("data", (chunk) => { + controller.enqueue(chunk); + chunks.push(chunk as Buffer); + }); + stream.on("end", () => { + controller.close(); + ramCache.set(cacheKey, Buffer.concat(chunks)); + finishInProgress(cacheKey); + }); + stream.on("error", (error) => { + controller.error(error); + }); + }, + }), + ), + "raw", + "lan", + ]; + } + + // 4. Fetch from server + const url = `${compressionFormatMap[format]}${escapeUri(pathname)}`; + log(`miss: ${format}${pathname}`); + const response = await startInProgress(cacheKey, fetchFileUncached(url)); + const [stream1, stream2] = response.tee(); + handleDownload(cacheKey, format, stream2); + return [stream1, format, "miss"]; +} + +export async function prefetchFile( + pathname: string, + format: CompressionFormat = "zstd", +) { + const cacheKey = hashKey(`${pathname}:${format}`); + const ramCacheHit = ramCache.get(cacheKey); + if (ramCacheHit) { + return; + } + if (hasLanMount) return; + const url = `${compressionFormatMap[format]}${pathname}`; + log(`prefetch: ${format}${pathname}`); + const stream2 = await startInProgress(cacheKey, fetchFileUncached(url)); + handleDownload(cacheKey, format, stream2); +} + +async function handleDownload( + cacheKey: string, + format: CompressionFormat, + stream2: ReadableStream, +) { + let chunks: Buffer[] = []; + if (format !== "raw") { + const file = await open(path.join(diskCacheRoot, cacheKey), "w"); + try { + for await (const chunk of stream2) { + await file.write(chunk); + chunks.push(chunk); + } + } finally { + file.close(); + } + } else { + for await (const chunk of stream2) { + chunks.push(chunk); + } + } + const final = Buffer.concat(chunks); + chunks.length = 0; + ramCache.set(cacheKey, final); + if (format !== "raw") { + diskCache.set(cacheKey, final.byteLength); + } + finishInProgress(cacheKey); +} + +function hashKey(key: string): string { + return createHash("sha1").update(key).digest("hex"); +} + +function startInProgress | ReadableStream>( + cacheKey: string, + promise: T, +): T { + if (promise instanceof Promise) { + let resolve2: (stream: { stream: ReadableStream }) => void; + let reject2: (error: Error) => void; + const stream2Promise = new Promise<{ stream: ReadableStream }>( + (resolve, reject) => { + resolve2 = resolve; + reject2 = reject; + }, + ); + const stream1Promise = new Promise((resolve, reject) => { + promise.then((stream) => { + const [stream1, stream2] = stream.tee(); + const stream2Obj = { stream: stream2 }; + resolve2(stream2Obj); + loadInProgress.set(cacheKey, stream2Obj); + resolve(stream1); + }, reject); + }); + loadInProgress.set(cacheKey, stream2Promise); + return stream1Promise as T; + } else { + const [stream1, stream2] = promise.tee(); + loadInProgress.set(cacheKey, { stream: stream2 }); + return stream1 as T; + } +} + +function loadDiskCacheState(): Record< + string, + [size: number, lastAccess: number] +> { + try { + const state = JSON.parse( + fs.readFileSync(path.join(diskCacheRoot, "state.json"), "utf-8"), + ); + return state; + } catch (error) { + return {}; + } +} + +function saveDiskCacheStateLater() { + if (diskCacheFlush) { + return; + } + diskCacheFlush = setTimeout(() => { + saveDiskCacheState(); + }, 60_000) as NodeJS.Timeout; + if (diskCacheFlush.unref) { + diskCacheFlush.unref(); + } +} + +process.on("exit", () => { + saveDiskCacheState(); +}); + +function saveDiskCacheState() { + fs.writeFileSync( + path.join(diskCacheRoot, "state.json"), + JSON.stringify(diskCacheState), + ); +} + +function finishInProgress(cacheKey: string) { + loadInProgress.delete(cacheKey); +} + +// Self signed certificate must be trusted to be able to request the above URL. +// +// Unfortunately, Bun and Deno are both not node.js compatible, so those two +// runtimes need fallback implementations. The fallback implementations calls +// fetch with the `agent` value as the RequestInit. Since `fetch` decompresses +// the body for you, it must be disabled. +const agent: any = typeof Bun !== "undefined" + ? { + // Bun has two non-standard fetch extensions + decompress: false, + tls: { + ca: caCert, + }, + } + // TODO: https://github.com/denoland/deno/issues/12291 + // : typeof Deno !== "undefined" + // ? { + // // Deno configures through the non-standard `client` extension + // client: Deno.createHttpClient({ + // caCerts: [caCert.toString()], + // }), + // } + // Node.js supports node:http + : new Agent({ + ca: caCert, + }); + +function fetchFileNode(pathname: string): Promise { + return new Promise((resolve, reject) => { + const request: ClientRequest = get(`${sourceOfTruth}/${pathname}`, { + agent, + }); + request.on("response", (response) => { + if (response.statusCode !== 200) { + reject(new Error(`Failed to fetch ${pathname}`)); + return; + } + + const stream = new ReadableStream({ + start(controller) { + response.on("data", (chunk) => { + controller.enqueue(chunk); + }); + + response.on("end", () => { + controller.close(); + }); + + response.on("error", (error) => { + controller.error(error); + reject(error); + }); + }, + }); + + resolve(stream); + }); + + request.on("error", (error) => { + reject(error); + }); + }); +} + +async function fetchFileDenoBun(pathname: string): Promise { + const req = await fetch(`${sourceOfTruth}/${pathname}`, agent); + if (!req.ok) { + throw new Error(`Failed to fetch ${pathname}`); + } + return req.body!; +} + +const fetchFileUncached = + typeof Bun !== "undefined" || typeof Deno !== "undefined" + ? fetchFileDenoBun + : fetchFileNode; + +export async function toBuffer( + stream: ReadableStream | Buffer, +): Promise { + if (!(stream instanceof ReadableStream)) { + return stream; + } + const chunks: Buffer[] = []; + for await (const chunk of stream) { + chunks.push(chunk); + } + return Buffer.concat(chunks); +} diff --git a/src/file-viewer/cert.pem b/src/file-viewer/cert.pem new file mode 100644 index 0000000..824dd07 --- /dev/null +++ b/src/file-viewer/cert.pem @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIUBaaOXVkkE+6yarNyvzofETb+WLEwDQYJKoZIhvcNAQEL +BQAwdzELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5 +MRUwEwYDVQQKDAxNZWRpYSBTZXJ2ZXIxDzANBgNVBAMMBnplbml0aDEhMB8GCSqG +SIb3DQEJARYSbWVAcGFwZXJjbG92ZXIubmV0MB4XDTI1MDQyNzIxNTU0MFoXDTM1 +MDQyNTIxNTU0MFowdzELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVN0YXRlMQ0wCwYD +VQQHDARDaXR5MRUwEwYDVQQKDAxNZWRpYSBTZXJ2ZXIxDzANBgNVBAMMBnplbml0 +aDEhMB8GCSqGSIb3DQEJARYSbWVAcGFwZXJjbG92ZXIubmV0MIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv7lLwx8XwsuTeaIxTsHDL+Lx7eblsJ0XylVm +0/iIJS1Mrq6Be9St6vDWK/BWqqAn+MdqzSfLMy8EKazuHKtbTm2vlUIkjw28SoWP +6cRSCLx4hFGbF4tmRO+Bo+/4PpHPnheeolkjJ+CLO87tZ752D9JzjVND+WIj1QO+ +bm+JBIi1TFREPh22/fSZBRpaRgqHcUEhICaiXaufvxQ6eihQfGSe00I7zRzGgnMl +51xjzkKkXd+r/FwTykd8ScJN25FMVDLsfJR59//geAZXYS25gQ4YL6R8u7ijidlS +IoDG8N+Fzw7W4yI+y8fIN4W1x/HsjiQ665CuWY3TMYo98OaGwwIDAQABo0kwRzAm +BgNVHREEHzAdggZ6ZW5pdGiCE25hcy5wYXBlcmNsb3Zlci5uZXQwHQYDVR0OBBYE +FDXkgNsMYZv1Pr+95RCCk7eHACGOMA0GCSqGSIb3DQEBCwUAA4IBAQB6942odKyD +TudifxRXbvcVe9LxSd7NimxRZzM5wTgA5KkxQT4CBM2wEPH/7e7Q/8scB9HbH2uP +f2vixoCM+Z3BWiYHFFk+1pf2myUdiFV2BC9g80txEerRkGLc18V6CdYNJ9wNPkiO +LW/RzXfEv+sqhaXh8dA46Ruz6SAbmscTMMYW4e9VYR+1p4Sm5UpTxrHzeg21YJKn +ud8kO1r7RhVgUGzkAzNaIMiBuJqGGdD5yV7Ng5C/DlJ9AAeYu1diM5LkIKjf+/8M +t/3l4eXS3Lda6+21rDvmfoK4Za6CAhcwgXIpqiRixE2MQNsxZ2XiJBVQHPrh8xYk +L5fq8KTGFwtd +-----END CERTIFICATE----- diff --git a/src/file-viewer/cotyledon.tsx b/src/file-viewer/cotyledon.tsx new file mode 100644 index 0000000..85b4669 --- /dev/null +++ b/src/file-viewer/cotyledon.tsx @@ -0,0 +1,291 @@ +export function Speedbump() { + return ( +
+
+ an interlude +
+
+ + +
+

cotyledon

+
+ +
+

+ this place is sacred, but dangerous. i have to keep visitors to an + absolute minimum; you'll get dust on all the artifacts. +

+

+ by entering our museum, you agree not to use your camera. flash off + isn't enough; the bits and bytes are alergic even to a camera's + sensor +

+

+ (in english: please do not store downloads after you're done viewing + them) +

+
+ +
+
+
+
+ ); +} + +export function Readme() { + return ( +
+
+ cotyledon +
+
+
+

+ welcome to the archive. if this is your first time here, i recommend + starting in '2017' and going + chronologically from there. however, there is truly no wrong way to + explore. +

+

+ note that there is a blanket trigger warning for everything in this + archive: while there is nothing visually offensive, some portions of + the text and emotions conveyed through this may hit extremely hard. + you are warned. +

+

+ all file dates are real. at least as real as i could figure out. + when i moved data across drives over my years, i accidentally had a + few points where i stamped over all the dates with the day that + moved the files. even fucked it up a final time in february 2025, + while in the process of unfucking things. +

+

+ thankfully, my past self knew i'd want to assemble this kind of + site, and because of that they were crazy about storing the dates of + things inside of html, json/yaml files, and even in fucking + databases. i'm glad it was all stored though, but jeez what a nerd. +

+

+ a few files were touched up for privacy, or otherwise re-encoded. + some of them i added extra metadata. +

+

+ from the bottom of my heart: i hope you enjoy. it has been a + nightmare putting this all together. technically and emotionally + speaking. i'm glad we can put this all behind us, mark it as + completed, and get started with the good shit. +

+

+ love,
clo +

+
+

+ start here -> 2017 +

+
+
+
+ ); +} + +export function ForEveryone() { + // deno-fmt-ignore + return <>
+

today is my 21st birthday. april 30th, 2025.

+

it's been nearly six months starting hormones.

+

sometimes i feel great,

+

sometimes i get dysphoria.

+

with the walls around me gone

+

that shit hits way harder than it did before.

+

ugh..

+

i'm glad the pain i felt is now explained,

+

but now rendered in high definition.

+

the smallest strands of hair on my face and belly act

+

as sharpened nails to pierce my soul.

+

+

it's all a pathway to better days; the sun had risen.

+

one little step at a time for both of us.

+

today i quit my job. free falling, it feels so weird.

+

like sky diving.

+

the only thing i feel is cold wind.

+

the only thing i see is everything,

+

and it's beautiful.

+

i have a month of falling before the parachute activates,

+

gonna spend as much time of it on art as i can.

+

that was, after all, my life plan:

+

i wanted to make art, all the time,

+

for everyone.

+

+

then you see what happened

+

to the world and the internet.

+

i never really got to live through that golden age,

+

it probably sucked back then too.

+

but now the big sites definitely stopped being fun.

+

they slide their cold hands up my body

+

and feel me around. it's unwelcoming, and

+

inconsiderate to how sensitive my skin is.

+

i'm so fucking glad i broke up with YouTube

+

and their devilish friends.

+

my NAS is at 5 / 24 TB

+

and probably wont fill for the next decade.

+

+

it took 2 months for me to notice my body changed.

+

that day was really nice, but it hurt a lot.

+

a sharp, satisfying pain in my chest gave me life.

+

learned new instincts for my arms

+

so they'd stop poking my new shape.

+

when i look at my face

+

it's like a different person.

+

she was the same as before, but completely new.

+

something changed

+

or i'm now used to seeing what makes me smile.

+

regardless, whatever i see in the mirror, i smile.

+

and, i don't hear that old name much anymore

+

aside from nightmares. and you'll never repeat it, ok?

+

okay.

+

+

been playing 'new canaan' by 'bill wurtz' on loop

+

in the background.

+

it kinda just feels right.

+

especially when that verse near the end comes on.

+

+

more people have been allowed to visit me.

+

my apartment used to be just for me,

+

but the more i felt like a person

+

the more i felt like having others over.

+

still have to decorate and clean it a little,

+

but it isn't a job to do alone.

+

we dragged a giant a rug across the city one day,

+

and it felt was like anything was possible.

+

sometimes i have ten people visit in a day,

+

or sometimes i focus my little eyes on just one.

+

i never really know what i want to do

+

until the time actually comes.

+

+{/* FILIP */} +

i think about the times i was by the water with you.

+

the sun setting warmly, icy air fell on our shoulders.

+{/* NATALIE */} +

and how we walked up to the top of that hill,

+

you picked up and disposed a nail on the ground,

+

walking the city thru places i've never been.

+{/* BEN */} +

or hiking through the park talking about compilers,

+

tiring me out until i'd fall asleep in your arms.

+{/* ELENA */} +

and the way you held on to my hand as i woke up,

+

noticing how i was trying to hide nightmare's tears.

+

+{/* HIGH SCHOOL */} +

i remember we were yelling lyrics loudly,

+

out of key yet cheered on because it was fun.

+{/* ADVAITH/NATALIE */} +

and when we all toured the big corporate office,

+{/* AYU/HARRIS */} +

then snuck in to some startup's office after hours;

+

i don't remember what movie we watched.

+{/* COLLEGE, DAY 1 IN EV's ROOM */} +

i remember laying on the bunk bed,

+

while the rest played a card game.

+{/* MEGHAN/MORE */} +

with us all laying on the rug, staring at the TV

+

as the ending twist to {/* SEVERANCE */'that show'} was revealed.

+

+

all the moments i cherish,

+

i love because it was always me.

+

i didn't have to pretend,

+

even if i didn't know who i was at the time.

+

you all were there. for me.

+

+

i don't want to pretend any more

+

i want to be myself. for everyone.

+

+

oh, the song ended. i thought it was on loop?

+

it's late... can hear the crickets...

+

and i can almost see the moon... mmmm...

+

...nah, too much light pollution.

+

+

one day. one day.

+

+

before i go, i want to show the uncensored version of "journal about a girl", because i can trust you at least. keep in mind, i think you're one of the first people to ever see this.

+
+
+
+

journal - 2024-09-14

+

been at HackMIT today on behalf of the company. it's fun. me and zack were running around looking for people that might be good hires. he had this magic arbitrary criteria to tell "oh this person is probably cracked let's talk to them" and we go to the first one. they were a nerd, perfect. they seemed to be extremely talented with some extreme software projects.
+okay.. oof... its still clouding my mind
+i cant shake that feeling away

+

hold on...

+

at some point they open one of their profiles to navigate to some code, and it displays for a couple of seconds: "pronouns: she/they". i don't actually know anything about this person, but it was my perception that she is trans. their appearance, physique, and age felt similar to me, which tends makes people think you are male.

+

but... she was having fun being herself. being a legend of identity and of her skill in computer science. winning the physics major. making cool shit at the hackathon, and probably in life. my perception of her was the exact essence of who i myself wanted to be. i was jealous of her life.

+

i tried hard to avoid a breakdown. success. but i was feeling distant. the next hour or so was disorienting, trying not to think about it too hard. i think there was one possibly interesting person we talked to. i don't remember any of the other conversations. they were not important. but i couldn't think through them regardless.

+

later, i decided to read some of her code. i either have a huge dislike towards the Rust programming language and/or it was not high quality code. welp, so just is a person studying. my perception was just a perception, inaccurate but impacting. i know i need to become myself, whoever that is. otherwise, i'm just going to feel this shit at higher doses. i think about this every day, and the amount of time i feel being consumed by these problems only grows.

+

getting through it all is a lonely feeling. not because no one is around, but because i am isolated emotionally. i know other people hit these feelings, but we all are too afraid to speak up, and it's all lonely.

+

waiting on a reply from someone from healthcare. it'll be slow, but it will be okay.

+
+
+
+

+i've learned that even when i feel alone, it doesn't have to feel lonely. i know it's hard, dear. i know it's scary. but i promise it's possible. we're all in this together. struggling together. sacrificing together. we dedicate our lives to each you, and our art for everyone. +

+ +

+ and then we knew,
+ just like paper airplanes: that we could fly... +

+
+

+ fin. +

+
+ +} +ForEveryone.class = "text"; diff --git a/src/file-viewer/format.ts b/src/file-viewer/format.ts new file mode 100644 index 0000000..65fc14b --- /dev/null +++ b/src/file-viewer/format.ts @@ -0,0 +1,264 @@ +export function formatSize(bytes: number) { + if (bytes < 1024) return `${bytes} bytes`; + if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`; + if (bytes < 1024 * 1024 * 1024) { + return `${(bytes / 1024 / 1024).toFixed(1)} MB`; + } + return `${(bytes / 1024 / 1024 / 1024).toFixed(1)} GB`; +} +export function formatDate(date: Date) { + // YYYY-MM-DD, format in PST timezone + return date.toLocaleDateString("sv", { timeZone: "America/Los_Angeles" }); +} +export function formatShortDate(date: Date) { + // YY-MM-DD, format in PST timezone + return formatDate(date).slice(2); +} +export function formatDuration(seconds: number) { + const minutes = Math.floor(seconds / 60); + const remainingSeconds = seconds % 60; + return `${minutes}:${remainingSeconds.toString().padStart(2, "0")}`; +} +export const escapeUri = (uri: string) => + encodeURIComponent(uri) + .replace(/%2F/gi, "/") + .replace(/%3A/gi, ":") + .replace(/%2B/gi, "+") + .replace(/%40/gi, "@") + .replace(/%2D/gi, "-") + .replace(/%5F/gi, "_") + .replace(/%2E/gi, ".") + .replace(/%2C/gi, ","); + +import type { MediaFile } from "../db.ts"; +import { escapeHTML } from "../framework/bun-polyfill.ts"; +const findDomain = "paperclover.net"; + +// Returns escaped HTML +// Features: +// - autolink detection +// - via \bpaperclover.net/[a-zA-Z0-9_\.+-]+ +// - via \b/file/[a-zA-Z0-9_\.+-]+ +// - via \bhttps://... +// - via name of a sibling file's basename +// - reformat (c) into © +// +// This formatter was written with AI. +export function highlightLinksInTextView( + text: string, + siblingFiles: MediaFile[] = [], +) { + const siblingLookup = Object.fromEntries( + siblingFiles + .filter((f) => f.basename !== "readme.txt") + .map((f) => [f.basename, f]), + ); + + // First escape the HTML to prevent XSS + let processedText = escapeHTML(text); + + // Replace (c) with © + processedText = processedText.replace(/\(c\)/gi, "©"); + + // Process all URL patterns in a single pass to avoid nested links + // This regex matches: + // 1. https:// or http:// URLs + // 2. domain URLs without protocol (e.g., paperclover.net/path) + // 3. /file/ URLs + // 4. ./ relative paths + + // We'll use a function to determine what kind of URL it is and format accordingly + const urlRegex = new RegExp( + "(" + + // Group 1: https:// or http:// URLs + "\\bhttps?:\\/\\/[a-zA-Z0-9_\\.\\-]+\\.[a-zA-Z0-9_\\.\\-]+[a-zA-Z0-9_\\.\\-\\/\\?=&%+#]*" + + "|" + + // Group 2: domain URLs without protocol + findDomain + + "\\/\\/[a-zA-Z0-9_\\.\\+\\-]+" + + "|" + + // Group 3: /file/ URLs + "\\/file\\/[a-zA-Z0-9_\\.\\+\\-\\/]+" + + ")\\b" + + "|" + + // Group 4: ./ relative paths (not word-bounded) + "(?<=\\s|^)\\.\\/[\\w\\-\\.]+", + "g", + ); + + processedText = processedText.replace(urlRegex, (match: string) => { + // Case 1: https:// or http:// URLs + if (match.startsWith("http")) { + if (match.includes(findDomain)) { + return `${match}`; + } + return `${match}`; + } + + // Case 2: domain URLs without protocol + if (match.startsWith(findDomain)) { + return `${match}`; + } + + // Case 3: /file/ URLs + if (match.startsWith("/file/")) { + return `${match}`; + } + + // Case 4: ./ relative paths + if (match.startsWith("./")) { + const filename = match.substring(2); + + // Check if the filename exists in sibling files + const siblingFile = siblingFiles.find((f) => f.basename === filename); + if (siblingFile) { + return `${match}`; + } + + // If no exact match but we have sibling files, try to create a reasonable link + if (siblingFiles.length > 0) { + const currentDir = siblingFiles[0].path + .split("/") + .slice(0, -1) + .join("/"); + return `${match}`; + } + } + + return match; + }); + + // Match sibling file names (only if they're not already part of a link) + if (siblingFiles.length > 0) { + // Create a regex pattern that matches any of the sibling file basenames + // We need to escape special regex characters in the filenames + const escapedBasenames = siblingFiles.map((f) => + f.basename.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + ); + + // Join all basenames with | for the regex alternation + const pattern = new RegExp(`\\b(${escapedBasenames.join("|")})\\b`, "g"); + + // We need to be careful not to replace text that's already in a link + // So we'll split the text by HTML tags and only process the text parts + const parts = processedText.split(/(<[^>]*>)/); + + for (let i = 0; i < parts.length; i += 2) { + // Only process text parts (even indices), not HTML tags (odd indices) + if (i < parts.length) { + parts[i] = parts[i].replace(pattern, (match: string) => { + const file = siblingLookup[match]; + if (file) { + return `${match}`; + } + return match; + }); + } + } + + processedText = parts.join(""); + } + + return processedText; +} + +export function highlightConvo(text: string) { + text = text.replace(/^#mode=convo\n/, ""); + + const lines = text.split("\n"); + const paras: { speaker: string | null; lines: string[] }[] = []; + let currentPara: string[] = []; + let currentSpeaker: string | null = null; + let firstSpeaker = null; + + const speakers: Record = {}; + const getSpeaker = (s: string) => { + if (s[1] === " " && speakers[s[0]]) { + return s[0]; + } + return null; + }; + + for (const line of lines) { + let trimmed = line.trim(); + if (line.startsWith("#")) { + // parse #X=Y + const [_, speaker, color] = trimmed.match(/^#(.)=(.*)$/)!; + speakers[speaker] = color; + continue; + } + if (trimmed === "") { + continue; + } + let speaker = getSpeaker(trimmed); + if (speaker) { + trimmed = trimmed.substring(speaker.length).trimStart(); + speaker = speakers[speaker]; + } else { + speaker = "me"; + } + + trimmed = trimmed.replace( + /\[IMG:(\/file\/[^\]]+)\]/g, + 'attachment', + ); + + if (trimmed === "---" && speaker === "me") { + trimmed = "
"; + } + + if (speaker === currentSpeaker) { + currentPara.push(trimmed); + } else { + if (currentPara.length > 0) { + paras.push({ + speaker: currentSpeaker, + lines: currentPara, + }); + currentPara = []; + } + currentPara = [trimmed]; + currentSpeaker = speaker; + firstSpeaker ??= speaker; + } + } + + if (currentPara.length > 0) { + paras.push({ + speaker: currentSpeaker, + lines: currentPara, + }); + } + + return paras + .map(({ speaker, lines }) => { + return `
${ + lines + .map((line) => `
${line}
`) + .join("\n") + }
`; + }) + .join("\n"); +} + +export function highlightHashComments(text: string) { + const lines = text.split("\n"); + return lines + .map((line) => { + if (line.startsWith("#")) { + return `
${line}
`; + } + return `
${line.trimEnd() || " "}
`; + }) + .join("\n"); +} diff --git a/src/file-viewer/highlight-grammar/astro.plist b/src/file-viewer/highlight-grammar/astro.plist new file mode 100644 index 0000000..39449cc --- /dev/null +++ b/src/file-viewer/highlight-grammar/astro.plist @@ -0,0 +1,1203 @@ + + + + + fileTypes + + astro + + foldingStartMarker + (?x) +(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl)\b.*?> +|<!--(?!.*--\s*>) +|^<!--\ \#tminclude\ (?>.*?-->)$ +|<\?(?:php)?.*\b(if|for(each)?|while)\b.+: +|\{\{?(if|foreach|capture|literal|foreach|php|section|strip) +|\{\s*($|\?>\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/))) +) + foldingStopMarker + (?x) +(</(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl)> +|^(?!.*?<!--).*?--\s*> +|^<!--\ end\ tminclude\ -->$ +|<\?(?:php)?.*\bend(if|for(each)?|while)\b +|\{\{?/(if|foreach|capture|literal|foreach|php|section|strip) +|^[^{]*\} +) + keyEquivalent + ^~H + name + Astro + patterns + + + include + #astro-markdown + + + include + #astro-expressions + + + begin + (<)([a-zA-Z0-9:-]++)(?=[^>]*></\2>) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.html + + + end + (>)(<)(/)(\2)(>) + endCaptures + + 1 + + name + punctuation.definition.tag.end.html + + 2 + + name + punctuation.definition.tag.begin.html meta.scope.between-tag-pair.html + + 3 + + name + punctuation.definition.tag.begin.html + + 4 + + name + entity.name.tag.html + + 5 + + name + punctuation.definition.tag.end.html + + + name + meta.tag.any.html + patterns + + + include + #tag-stuff + + + + + begin + (<\?)(xml) + captures + + 1 + + name + punctuation.definition.tag.html + + 2 + + name + entity.name.tag.xml.html + + + end + (\?>) + name + meta.tag.preprocessor.xml.html + patterns + + + include + #tag-generic-attribute + + + include + #string-double-quoted + + + include + #string-single-quoted + + + + + begin + <!-- + captures + + + name + punctuation.definition.comment.html + + + end + --\s*> + name + comment.block.html + patterns + + + match + -- + name + invalid.illegal.bad-comments-or-CDATA.html + + + + + begin + <! + captures + + + name + punctuation.definition.tag.html + + + end + > + name + meta.tag.sgml.html + patterns + + + begin + (?i:DOCTYPE|doctype) + captures + + 1 + + name + entity.name.tag.doctype.html + + + end + (?=>) + name + meta.tag.sgml.doctype.html + patterns + + + match + "[^">]*" + name + string.quoted.double.doctype.identifiers-and-DTDs.html + + + + + begin + \[CDATA\[ + end + ]](?=>) + name + constant.other.inline-data.html + + + match + (\s*)(?!--|>)\S(\s*) + name + invalid.illegal.bad-comments-or-CDATA.html + + + + + begin + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])css\1?) + captures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.style.html + + 3 + + name + punctuation.definition.tag.html + + + end + (</)((?i:style))(>)(?:\s*\n)? + name + source.css.embedded.html + patterns + + + include + #tag-stuff + + + begin + (>) + beginCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + end + (?=</(?i:style)) + patterns + + + include + source.css + + + + + + + begin + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])sass\1?) + captures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.style.html + + 3 + + name + punctuation.definition.tag.html + + + end + (</)((?i:style))(>)(?:\s*\n)? + name + source.sass.embedded.html + patterns + + + include + #tag-stuff + + + begin + (>) + beginCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + end + (?=</(?i:style)) + patterns + + + include + source.sass + + + + + + + begin + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])scss\1?) + captures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.style.html + + 3 + + name + punctuation.definition.tag.html + + + end + (</)((?i:style))(>)(?:\s*\n)? + name + source.scss.embedded.html + patterns + + + include + #tag-stuff + + + begin + (>) + beginCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + end + (?=</(?i:style)) + patterns + + + include + source.css.scss + + + + + + + begin + (?:^\s+)?(<)((?i:style))\b(?![^>]*/>) + captures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.style.html + + 3 + + name + punctuation.definition.tag.html + + + end + (</)((?i:style))(>)(?:\s*\n)? + name + source.css.embedded.html + patterns + + + include + #tag-stuff + + + begin + (>) + beginCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + end + (?=</(?i:style)) + patterns + + + include + source.css + + + + + + + begin + (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])tsx\1?) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.script.html + + + end + (?<=</(script|SCRIPT))(>)(?:\s*\n)? + endCaptures + + 2 + + name + punctuation.definition.tag.html + + + name + source.tsx.embedded.html + patterns + + + include + #tag-stuff + + + begin + (?<!</(?:script|SCRIPT))(>) + captures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.script.html + + + end + (</)((?i:script)) + patterns + + + include + source.tsx + + + + + + + begin + (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])ts\1?) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.script.html + + + end + (?<=</(script|SCRIPT))(>)(?:\s*\n)? + endCaptures + + 2 + + name + punctuation.definition.tag.html + + + name + source.tsx.embedded.html + patterns + + + include + #tag-stuff + + + begin + (?<!</(?:script|SCRIPT))(>) + captures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.script.html + + + end + (</)((?i:script)) + patterns + + + include + source.tsx + + + + + + + begin + (<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript|babel|ecmascript).*))) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.script.html + + + end + (?<=</(script|SCRIPT))(>)(?:\s*\n)? + endCaptures + + 2 + + name + punctuation.definition.tag.html + + + name + source.tsx.embedded.html + patterns + + + include + #tag-stuff + + + begin + (?<!</(?:script|SCRIPT))(>) + captures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.script.html + + + end + (</)((?i:script)) + patterns + + + captures + + 1 + + name + punctuation.definition.comment.js + + + match + (//).*?((?=</script)|$\n?) + name + comment.line.double-slash.js + + + begin + /\* + captures + + + name + punctuation.definition.comment.js + + + end + \*/|(?=</script) + name + comment.block.js + + + include + source.tsx + + + + + + + begin + (</?)((?i:body|head|html)\b) + captures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.structure.any.html + + + end + (>) + endCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + name + meta.tag.structure.any.html + patterns + + + include + #tag-stuff + + + + + begin + (</?)((?i:address|blockquote|dd|div|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|menu|pre)\b) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.block.any.html + + + end + (>) + endCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + name + meta.tag.block.any.html + patterns + + + include + #tag-stuff + + + + + begin + (</?)((?i:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)\b) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.inline.any.html + + + end + ((?: ?/)?>) + endCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + name + meta.tag.inline.any.html + patterns + + + include + #tag-stuff + + + + + begin + (</?)([A-Z][a-zA-Z0-9-\.]*|[a-z]+\.[a-zA-Z0-9-]+)(\:(load|idle|visible))? + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.component.astro + + 3 + + name + keyword.control.loading.astro + + + end + (/?>) + endCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + name + meta.tag.component.astro + patterns + + + include + #tag-stuff + + + + + begin + (</?)([a-zA-Z0-9:-]+) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.other.html + + + end + (/?>) + endCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + name + meta.tag.other.html + patterns + + + include + #tag-stuff + + + + + include + #entities + + + include + #frontmatter + + + match + <> + name + invalid.illegal.incomplete.html + + + match + < + name + invalid.illegal.bad-angle-bracket.html + + + repository + + astro-expressions + + patterns + + + begin + \{ + beginCaptures + + + name + punctuation.definition.generic.begin.html + + + end + \} + endCaptures + + + name + punctuation.definition.generic.end.html + + + name + expression.embbeded.astro + patterns + + + include + source.tsx + + + + + + astro-markdown + + begin + (<)(Markdown)(>) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.html + + 3 + + name + punctuation.definition.tag.end.html + + + end + (</)(Markdown)(>) + endCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.html + + 3 + + name + punctuation.definition.tag.end.html + + + name + text.html.astro.markdown + patterns + + + include + text.html.markdown.astro + + + + entities + + patterns + + + captures + + 1 + + name + punctuation.definition.entity.html + + 3 + + name + punctuation.definition.entity.html + + + match + (&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;) + name + constant.character.entity.html + + + match + & + name + invalid.illegal.bad-ampersand.html + + + + frontmatter + + begin + \A(-{3})\s*$ + beginCaptures + + 1 + + name + comment.block.html + + + contentName + meta.embedded.block.frontmatter + end + (^|\G)(-{3})|\.{3}\s*$ + endCaptures + + 2 + + name + comment.block.html + + + patterns + + + include + source.tsx + + + + string-double-quoted + + begin + " + beginCaptures + + + name + punctuation.definition.string.begin.html + + + end + " + endCaptures + + + name + punctuation.definition.string.end.html + + + name + string.quoted.double.html + patterns + + + include + #entities + + + + string-single-quoted + + begin + ' + beginCaptures + + + name + punctuation.definition.string.begin.html + + + end + ' + endCaptures + + + name + punctuation.definition.string.end.html + + + name + string.quoted.single.html + patterns + + + include + #entities + + + + tag-generic-attribute + + match + \b([a-zA-Z\-:]+) + name + entity.other.attribute-name.html + + tag-id-attribute + + begin + \b(id)\b\s*(=) + captures + + 1 + + name + entity.other.attribute-name.id.html + + 2 + + name + punctuation.separator.key-value.html + + + end + (?<='|") + name + meta.attribute-with-value.id.html + patterns + + + begin + " + beginCaptures + + + name + punctuation.definition.string.begin.html + + + contentName + meta.toc-list.id.html + end + " + endCaptures + + + name + punctuation.definition.string.end.html + + + name + string.quoted.double.html + patterns + + + include + #astro-expressions + + + include + #entities + + + + + begin + ' + beginCaptures + + + name + punctuation.definition.string.begin.html + + + contentName + meta.toc-list.id.html + end + ' + endCaptures + + + name + punctuation.definition.string.end.html + + + name + string.quoted.single.html + patterns + + + include + #astro-expressions + + + include + #entities + + + + + + tag-stuff + + patterns + + + include + #tag-id-attribute + + + include + #tag-generic-attribute + + + include + #string-double-quoted + + + include + #string-single-quoted + + + include + #astro-load-directive + + + include + #astro-expressions + + + include + #astro-markdown + + + + + scopeName + text.html.astro + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/css.plist b/src/file-viewer/highlight-grammar/css.plist new file mode 100644 index 0000000..cb7fad4 --- /dev/null +++ b/src/file-viewer/highlight-grammar/css.plist @@ -0,0 +1,1036 @@ + + + + + fileTypes + + css + css.erb + + keyEquivalent + ^~C + name + CSS + patterns + + + include + #comment-block + + + include + #selector + + + begin + \s*((@)charset\b)\s* + captures + + 1 + + name + keyword.control.at-rule.charset.css + + 2 + + name + punctuation.definition.keyword.css + + + end + \s*((?=;|$)) + name + meta.at-rule.charset.css + patterns + + + include + #string-double + + + include + #string-single + + + + + begin + \s*((@)import\b)\s* + captures + + 1 + + name + keyword.control.at-rule.import.css + + 2 + + name + punctuation.definition.keyword.css + + + end + \s*((?=;|\})) + name + meta.at-rule.import.css + patterns + + + include + #string-double + + + include + #string-single + + + begin + \s*(url)\s*(\()\s* + beginCaptures + + 1 + + name + support.function.url.css + + 2 + + name + punctuation.section.function.css + + + end + \s*(\))\s* + endCaptures + + 1 + + name + punctuation.section.function.css + + + patterns + + + match + [^'") \t]+ + name + variable.parameter.url.css + + + include + #string-single + + + include + #string-double + + + + + include + #media-query-list + + + + + begin + ^\s*((@)font-face)\s*(?=\{) + beginCaptures + + 1 + + name + keyword.control.at-rule.font-face.css + + 2 + + name + punctuation.definition.keyword.css + + + end + (?!\G) + name + meta.at-rule.font-face.css + patterns + + + include + #rule-list + + + + + begin + (?=^\s*@media\s*.*?\{) + end + \s*(\}) + endCaptures + + 1 + + name + punctuation.section.property-list.end.css + + + patterns + + + begin + ^\s*((@)media)(?=.*?\{) + beginCaptures + + 1 + + name + keyword.control.at-rule.media.css + + 2 + + name + punctuation.definition.keyword.css + + 3 + + name + support.constant.media.css + + + end + \s*(?=\{) + name + meta.at-rule.media.css + patterns + + + include + #media-query-list + + + + + begin + \s*(\{) + beginCaptures + + 1 + + name + punctuation.section.property-list.begin.css + + + end + (?=\}) + patterns + + + include + $self + + + + + + + begin + (?=\{) + end + (?!\G) + patterns + + + include + #rule-list + + + + + repository + + color-values + + patterns + + + comment + http://www.w3.org/TR/CSS21/syndata.html#value-def-color + match + \b(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)\b + name + support.constant.color.w3c-standard-color-name.css + + + comment + These colours are mostly recognised but will not validate. ref: http://www.w3schools.com/css/css_colornames.asp + match + \b(aliceblue|antiquewhite|aquamarine|azure|beige|bisque|blanchedalmond|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|gainsboro|ghostwhite|gold|goldenrod|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|limegreen|linen|magenta|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|oldlace|olivedrab|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|thistle|tomato|turquoise|violet|wheat|whitesmoke|yellowgreen)\b + name + invalid.deprecated.color.w3c-non-standard-color-name.css + + + begin + (hsla?|rgba?)\s*(\() + beginCaptures + + 1 + + name + support.function.misc.css + + 2 + + name + punctuation.section.function.css + + + end + (\)) + endCaptures + + 1 + + name + punctuation.section.function.css + + + patterns + + + match + (?x)\b + (0*((1?[0-9]{1,2})|(2([0-4][0-9]|5[0-5])))\s*,\s*){2} + (0*((1?[0-9]{1,2})|(2([0-4][0-9]|5[0-5])))\b) + (\s*,\s*((0?\.[0-9]+)|[0-1]))? + + name + constant.other.color.rgb-value.css + + + match + \b([0-9]{1,2}|100)\s*%,\s*([0-9]{1,2}|100)\s*%,\s*([0-9]{1,2}|100)\s*% + name + constant.other.color.rgb-percentage.css + + + include + #numeric-values + + + + + + comment-block + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment.css + + + end + \*/ + name + comment.block.css + + media-query + + begin + (?i)\s*(only|not)?\s*(all|aural|braille|embossed|handheld|print|projection|screen|tty|tv)? + beginCaptures + + 1 + + name + keyword.operator.logic.media.css + + 2 + + name + support.constant.media.css + + + end + \s*(?:(,)|(?=[{;])) + endCaptures + + 1 + + name + punctuation.definition.arbitrary-repitition.css + + + patterns + + + begin + \s*(and)?\s*(\()\s* + beginCaptures + + 1 + + name + keyword.operator.logic.media.css + + + end + \) + patterns + + + begin + (?x) + ( + ((min|max)-)? + ( + ((device-)?(height|width|aspect-ratio))| + (color(-index)?)|monochrome|resolution + ) + )|grid|scan|orientation + \s*(?=[:)]) + beginCaptures + + 0 + + name + support.type.property-name.media.css + + + end + (:)|(?=\)) + endCaptures + + 1 + + name + punctuation.separator.key-value.css + + + + + match + \b(portrait|landscape|progressive|interlace) + name + support.constant.property-value.css + + + captures + + 1 + + name + constant.numeric.css + + 2 + + name + keyword.operator.arithmetic.css + + 3 + + name + constant.numeric.css + + + match + \s*(\d+)(/)(\d+) + + + include + #numeric-values + + + + + + media-query-list + + begin + \s*(?=[^{;]) + end + \s*(?=[{;]) + patterns + + + include + #media-query + + + + numeric-values + + patterns + + + captures + + 1 + + name + punctuation.definition.constant.css + + + match + (#)([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b + name + constant.other.color.rgb-value.css + + + captures + + 1 + + name + keyword.other.unit.css + + + match + (?x) + (?:-|\+)?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)) + ((?:px|pt|ch|cm|mm|in|r?em|ex|pc|deg|g?rad|dpi|dpcm|s)\b|%)? + + name + constant.numeric.css + + + + property-values + + patterns + + + match + \b(absolute|all(-scroll)?|always|armenian|auto|avoid|baseline|below|bidi-override|block|bold|bolder|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|flat|geometricPrecision|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|initial|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|optimize(Legibility|Quality|Speed)|outset|outside|overline|pointer|pre(-(wrap|line))?|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|sub|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical(-(ideographic|text))|visible(Painted|Fill|Stroke)?|w-resize|wait|whitespace|zero|smaller|larger|((xx?-)?(small|large))|painted|fill|stroke|column|column-reverse|contain|cover|fill|flex-end|flex-start|row|row-reverse|scale-down|space-around|space-between|stretch|wrap|wrap-reverse|reverse|alternate-reverse|alternate|forwards|backwards|infinite|ease|ease-in|ease-out|ease-in-out|linear|step-start|step-end|steps|cubic-bezier|running|paused|sticky|page|soft-light|screen|saturation|overlay|multiply|luminosity|lighten|hue|hard-light|exclusion|difference|darken|color-dodge|color-burn|color|view-box|stroke-box|fill-box|border-box|padding-box|content-box|round|space|currentColor|subgrid|auto-fill|min-content|max-content|row|column|dense|minmax|calc|translate|translateX|translateY|translateZ|scale|scaleX|scaleY|scaleZ|rotate|rotateX|rotateY|rotateZ|skew|skewX|skewY|skewZ|linear-gradient|repeating-linear-gradient|radial-gradient|repeating-radial-gradient|farthest-side|closest-side|farthest-corner|closest-corner|ellipse|circle)\b + name + support.constant.property-value.css + + + match + (\b(?i:arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace)\b) + name + support.constant.font-name.css + + + include + #numeric-values + + + include + #color-values + + + include + #string-double + + + include + #string-single + + + begin + (rect)\s*(\() + beginCaptures + + 1 + + name + support.function.misc.css + + 2 + + name + punctuation.section.function.css + + + end + (\)) + endCaptures + + 1 + + name + punctuation.section.function.css + + + patterns + + + include + #numeric-values + + + + + begin + (format|local|url|attr|counter|counters)\s*(\() + beginCaptures + + 1 + + name + support.function.misc.css + + 2 + + name + punctuation.section.function.css + + + end + (\)) + endCaptures + + 1 + + name + punctuation.section.function.css + + + patterns + + + include + #string-single + + + include + #string-double + + + match + [^'") \t]+ + name + variable.parameter.misc.css + + + + + begin + (matrix(3d)?|perspective|(rotate|scale|translate)([XYZ]|3d)?|skew[XY]?)\s*(\() + beginCaptures + + 1 + + name + support.function.transform.css + + 2 + + name + punctuation.section.function.css + + + end + (\)) + endCaptures + + 1 + + name + punctuation.section.function.css + + + patterns + + + include + #numeric-values + + + + + match + \!\s*important + name + keyword.other.important.css + + + + rule-list + + begin + \{ + beginCaptures + + 0 + + name + punctuation.section.property-list.begin.css + + + end + \} + endCaptures + + 0 + + name + punctuation.section.property-list.end.css + + + name + meta.property-list.css + patterns + + + include + #comment-block + + + begin + (?<![-a-z])(?=[-a-z]) + end + $|(?![-a-z]) + name + meta.property-name.css + patterns + + + match + -(webkit|moz|o|ms|khtml)(-[A-Za-z]+)+\b + name + support.type.property-name.css + + + match + \b(zoom|z-index|y|x|writing-mode|wrap-through|wrap-flow|wrap|word-wrap|word-spacing|word-break|word|will-change|width|widows|white-space-collapse|white-space|white|weight|volume|voice-volume|voice-stress|voice-rate|voice-range|voice-pitch-range|voice-pitch|voice-family|voice-duration|voice-balance|voice|visibility|vertical-align|variant|user-select|up|unicode-bidi|unicode|trim|transition-timing-function|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|timing-function|text-wrap|text-underline-position|text-transform|text-space-collapse|text-shadow|text-replace|text-overflow|text-outline|text-orientation|text-justify|text-indent|text-height|text-emphasis-style|text-emphasis-position|text-emphasis-color|text-emphasis|text-decoration-style|text-decoration-skip|text-decoration-line|text-decoration-color|text-decoration|text-combine-upright|text-align-last|text-align|text|target-position|target-new|target-name|target|table-layout|tab-size|style-type|style-position|style-image|style|stroke|string-set|stretch|stress|stacking-strategy|stacking-shift|stacking-ruby|stacking|src|speed|speech-rate|speech|speak-punctuation|speak-numeral|speak-header|speak-as|speak|span|spacing|space-collapse|space|sizing|size-adjust|size|shape-outside|shape-margin|shape-inside|shape-image-threshold|shadow|setting-named-strings-string-set-pro|scroll-snap-type|scroll-snap-stop|scroll-snap-margin-top|scroll-snap-margin-right|scroll-snap-margin-left|scroll-snap-margin-inline-start|scroll-snap-margin-inline-end|scroll-snap-margin-inline|scroll-snap-margin-bottom|scroll-snap-margin-block-start|scroll-snap-margin-block-end|scroll-snap-margin-block|scroll-snap-margin|scroll-snap-align|scroll-padding-top|scroll-padding-right|scroll-padding-left|scroll-padding-inline-start|scroll-padding-inline-end|scroll-padding-inline|scroll-padding-bottom|scroll-padding-block-start|scroll-padding-block-end|scroll-padding-block|scroll-padding|rule-width|rule-style|rule-color|rule|ruby-span|ruby-position|ruby-overhang|ruby-merge|ruby-align|ruby|rows|row-gap|rotation-point|rotation|rotating|role|right|richness|rest-before|rest-after|rest|respond-to|resource|resolution|resize|reset|replace|repeat|rendering-intent|region-fragment|rate|radius|quotes|punctuation-trim|punctuation|property|profile|presentation-level|presentation|position|polar-origin|polar-distance|polar-angle|polar-anchor|pointer-events|point|play-state|play-during|play-count|pitch-range|pitch|phonemes|perspective-origin|perspective|pause-before|pause-after|pause|page-policy|page-break-inside|page-break-before|page-break-after|page|padding-top|padding-right|padding-left|padding-bottom|padding|pack|overhang|overflow-y|overflow-x|overflow-wrap|overflow-style|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|origin|orientation|orient|ordinal-group|order|opacity|offset|object-position|object-fit|numeral|new|nav-up|nav-right|nav-left|nav-index|nav-down|nav-dir|nav|name|moving|move-to|model|min-width|min-height|min|max-width|max-lines|max-height|max|mask-type|mask-source-type|mask-size|mask-repeat|mask-position|mask-origin|mask-image|mask-clip|mask-box-width|mask-box-source|mask-box-slice|mask-box-repeat|mask-box-outset|mask-box|mask|marquee-style|marquee-speed|marquee-play-count|marquee-direction|marquee|marks|marker-side|mark-before|mark-after|mark|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|list|lines|line-stacking-strategy|line-stacking-shift|line-stacking-ruby|line-stacking|line-snap|line-height|line-grid|line-break|line|lighting-color|level|letter-spacing|length|left|label|justify-self|justify-items|justify-content|justify|iteration-count|input-method-editor|inline-box-align|initial-value|initial-size|initial-letter|initial-before-align|initial-before-adjust|initial-after-align|initial-after-adjust|index|indent|increment|image-resolution|image-rendering|image-orientation|image|icon|hyphens|hyphenate-resource|hyphenate-lines|hyphenate-character|hyphenate-before|hyphenate-after|hyphenate|height|header|hanging-punctuation|grid-template-rows|grid-template-columns|grid-template-areas|grid-template|grid-rows|grid-row-start|grid-row-end|grid-row|grid-columns|grid-column-start|grid-column-end|grid-column|grid-auto-rows|grid-auto-flow|grid-auto-columns|grid-area|grid|gap|font-weight|font-variant-position|font-variant-numeric|font-variant-ligatures|font-variant-east-asian|font-variant-caps|font-variant-alternates|font-variant|font-synthesis|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|flow-into|flow-from|flood-opacity|flood-color|float-offset|float|flex-wrap|flex-shrink|flex-grow|flex-group|flex-flow|flex-direction|flex-basis|flex|fit-position|fit|filter|fill|family|empty-cells|emphasis|elevation|duration|drop-initial-value|drop-initial-size|drop-initial-before-align|drop-initial-before-adjust|drop-initial-after-align|drop-initial-after-adjust|drop|down|dominant-baseline|display-role|display-outside|display-model|display-list|display-inside|display|direction|delay|decoration-break|decoration|cursor|cue-before|cue-after|cue|crop|counter-set|counter-reset|counter-increment|counter|count|content|contain|columns|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|column-break-before|column-break-after|column|color-profile|color-interpolation-filters|color|collapse|clip-rule|clip-path|clip|clear|character|chains|caption-side|break-inside|break-before|break-after|break|box-suppress|box-snap|box-sizing|box-shadow|box-pack|box-orient|box-ordinal-group|box-lines|box-flex-group|box-flex|box-direction|box-decoration-break|box-align|box|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-length|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-boundary|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|bookmark-target|bookmark-state|bookmark-level|bookmark-label|bookmark|bleed|binding|bidi|before|baseline-shift|baseline|balance|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-break|background-attachment|background|backface-visibility|azimuth|attachment|appearance|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|all|alignment-baseline|alignment-adjust|alignment|align-self|align-last|align-items|align-content|align|after|adjust)\b + name + support.type.property-name.css + + + + + begin + (:)\s* + beginCaptures + + 1 + + name + punctuation.separator.key-value.css + + + end + \s*(;|(?=\})) + endCaptures + + 1 + + name + punctuation.terminator.rule.css + + + name + meta.property-value.css + patterns + + + include + #property-values + + + + + + selector + + begin + \s*(?=[:.*#a-zA-Z]) + end + (?=[/@{)]) + name + meta.selector.css + patterns + + + match + \b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|datalist|dd|del|details|dfn|dialog|div|dl|dt|em|eventsource|fieldset|figure|figcaption|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|main|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\b + name + entity.name.tag.css + + + captures + + 1 + + name + punctuation.definition.entity.css + + + match + (\.)[a-zA-Z0-9_-]+ + name + entity.other.attribute-name.class.css + + + captures + + 1 + + name + punctuation.definition.entity.css + + + match + (#)[a-zA-Z][a-zA-Z0-9_-]* + name + entity.other.attribute-name.id.css + + + match + \* + name + entity.name.tag.wildcard.css + + + captures + + 1 + + name + punctuation.definition.entity.css + + + match + (:+)(after|before|first-letter|first-line|selection)\b + name + entity.other.attribute-name.pseudo-element.css + + + captures + + 1 + + name + punctuation.definition.entity.css + + + match + (:)((first|last)-child|(first|last|only)-of-type|empty|root|target|first|left|right)\b + name + entity.other.attribute-name.pseudo-class.css + + + captures + + 1 + + name + punctuation.definition.entity.css + + + match + (:)(checked|enabled|default|disabled|indeterminate|invalid|optional|required|valid)\b + name + entity.other.attribute-name.pseudo-class.ui-state.css + + + begin + ((:)not)(\() + beginCaptures + + 1 + + name + entity.other.attribute-name.pseudo-class.css + + 2 + + name + punctuation.definition.entity.css + + 3 + + name + punctuation.section.function.css + + + end + \) + endCaptures + + 0 + + name + punctuation.section.function.css + + + patterns + + + include + #selector + + + + + captures + + 1 + + name + entity.other.attribute-name.pseudo-class.css + + 2 + + name + punctuation.definition.entity.css + + 3 + + name + punctuation.section.function.css + + 4 + + name + constant.numeric.css + + 5 + + name + punctuation.section.function.css + + + match + ((:)nth-(?:(?:last-)?child|(?:last-)?of-type))(\()(\-?(?:\d+n?|n)(?:\+\d+)?|even|odd)(\)) + + + captures + + 1 + + name + punctuation.definition.entity.css + + + match + (:)(active|hover|link|visited|focus)\b + name + entity.other.attribute-name.pseudo-class.css + + + captures + + 1 + + name + punctuation.definition.entity.css + + 2 + + name + entity.other.attribute-name.attribute.css + + 3 + + name + punctuation.separator.operator.css + + 4 + + name + string.unquoted.attribute-value.css + + 5 + + name + string.quoted.double.attribute-value.css + + 6 + + name + punctuation.definition.string.begin.css + + 7 + + name + punctuation.definition.string.end.css + + + match + (?i)(\[)\s*(-?[_a-z\\[[:^ascii:]]][_a-z0-9\-\\[[:^ascii:]]]*)(?:\s*([~|^$*]?=)\s*(?:(-?[_a-z\\[[:^ascii:]]][_a-z0-9\-\\[[:^ascii:]]]*)|((?>(['"])(?:[^\\]|\\.)*?(\6)))))?\s*(\]) + name + meta.attribute-selector.css + + + + string-double + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.css + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.css + + + name + string.quoted.double.css + patterns + + + match + \\. + name + constant.character.escape.css + + + + string-single + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.css + + + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.css + + + name + string.quoted.single.css + patterns + + + match + \\. + name + constant.character.escape.css + + + + + scopeName + source.css + uuid + 69AA0917-B7BB-11D9-A7E2-000D93C8BE28 + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/diff.plist b/src/file-viewer/highlight-grammar/diff.plist new file mode 100644 index 0000000..1ca0ed7 --- /dev/null +++ b/src/file-viewer/highlight-grammar/diff.plist @@ -0,0 +1,268 @@ + + + + + fileTypes + + patch + diff + rej + + firstLineMatch + (?x)^ + (===\ modified\ file + |==== \s* // .+ \s - \s .+ \s+ ==== + |Index:\ + |---\ [^%\n] + |\*\*\*.*\d{4}\s*$ + |\d+(,\d+)* (a|d|c) \d+(,\d+)* $ + |diff\ --git\ + |commit\ [0-9a-f]{40}$ + ) + keyEquivalent + ^~D + name + Diff + patterns + + + captures + + 1 + + name + punctuation.definition.separator.diff + + + match + ^((\*{15})|(={67})|(-{3}))$\n? + name + meta.separator.diff + + + match + ^\d+(,\d+)*(a|d|c)\d+(,\d+)*$\n? + name + meta.diff.range.normal + + + captures + + 1 + + name + punctuation.definition.range.diff + + 2 + + name + meta.toc-list.line-number.diff + + 3 + + name + punctuation.definition.range.diff + + + match + ^(@@)\s*(.+?)\s*(@@.*)($\n?)? + name + meta.diff.range.unified + + + captures + + 3 + + name + punctuation.definition.range.diff + + 4 + + name + punctuation.definition.range.diff + + 6 + + name + punctuation.definition.range.diff + + 7 + + name + punctuation.definition.range.diff + + + match + ^(((\-{3}) .+ (\-{4}))|((\*{3}) .+ (\*{4})))$\n? + name + meta.diff.range.context + + + match + ^diff --git a/.*$\n? + name + meta.diff.header.git + + + match + ^diff (-|\S+\s+\S+).*$\n? + name + meta.diff.header.command + + + captures + + 4 + + name + punctuation.definition.from-file.diff + + 6 + + name + punctuation.definition.from-file.diff + + 7 + + name + punctuation.definition.from-file.diff + + + match + (^(((-{3}) .+)|((\*{3}) .+))$\n?|^(={4}) .+(?= - )) + name + meta.diff.header.from-file + + + captures + + 2 + + name + punctuation.definition.to-file.diff + + 3 + + name + punctuation.definition.to-file.diff + + 4 + + name + punctuation.definition.to-file.diff + + + match + (^(\+{3}) .+$\n?| (-) .* (={4})$\n?) + name + meta.diff.header.to-file + + + captures + + 3 + + name + punctuation.definition.inserted.diff + + 6 + + name + punctuation.definition.inserted.diff + + + match + ^(((>)( .*)?)|((\+).*))$\n? + name + markup.inserted.diff + + + captures + + 1 + + name + punctuation.definition.changed.diff + + + match + ^(!).*$\n? + name + markup.changed.diff + + + captures + + 3 + + name + punctuation.definition.deleted.diff + + 6 + + name + punctuation.definition.deleted.diff + + + match + ^(((<)( .*)?)|((-).*))$\n? + name + markup.deleted.diff + + + begin + ^(#) + captures + + 1 + + name + punctuation.definition.comment.diff + + + comment + Git produces unified diffs with embedded comments" + end + \n + name + comment.line.number-sign.diff + + + match + ^index [0-9a-f]{7,40}\.\.[0-9a-f]{7,40}.*$\n? + name + meta.diff.index.git + + + captures + + 1 + + name + punctuation.separator.key-value.diff + + 2 + + name + meta.toc-list.file-name.diff + + + match + ^Index(:) (.+)$\n? + name + meta.diff.index + + + match + ^Only in .*: .*$\n? + name + meta.diff.only-in + + + scopeName + source.diff + uuid + 7E848FF4-708E-11D9-97B4-0011242E4184 + + diff --git a/src/file-viewer/highlight-grammar/dosbatch.plist b/src/file-viewer/highlight-grammar/dosbatch.plist new file mode 100644 index 0000000..4990963 --- /dev/null +++ b/src/file-viewer/highlight-grammar/dosbatch.plist @@ -0,0 +1,169 @@ + + + + + uuid + E07EC438-7B75-4437-8AA1-DA94C1E6EACC + patterns + + + name + keyword.command.dosbatch + match + \b(?i)(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\b + + + name + keyword.control.statement.dosbatch + match + \b(?i)(?:goto|call|exit)\b + + + name + keyword.control.conditional.if.dosbatch + match + \b(?i)if\s+((not)\s+)(exist|defined|errorlevel|cmdextversion)\b + + + name + keyword.control.conditional.dosbatch + match + \b(?i)(?:if|else)\b + + + name + keyword.control.repeat.dosbatch + match + \b(?i)for\b + + + name + keyword.operator.dosbatch + match + \b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\b + + + name + comment.line.rem.dosbatch + match + \b(?i)rem(?:$|\s.*$) + + + name + comment.line.colons.dosbatch + match + \s*:\s*:.*$ + + + captures + + 1 + + name + variable.parameter.function.begin.shell + + + name + variable.parameter.function.dosbatch + match + (?i)(%)(~(?:f|d|p|n|x|s|a|t|z|\$[^:]*:)*)?\d + + + captures + + 1 + + name + variable.parameter.loop.begin.shell + + + name + variable.parameter.loop.dosbatch + match + (?i)(%%)(~(?:f|d|p|n|x|s|a|t|z|\$[^:]*:)*)?[a-z] + + + captures + + 1 + + name + variable.other.parsetime.begin.shell + + 2 + + name + variable.other.parsetime.end.shell + + + name + variable.other.parsetime.dosbatch + match + (%)[^%]+(%) + + + captures + + 1 + + name + variable.other.delayed.begin.shell + + 2 + + name + variable.other.delayed.end.shell + + + name + variable.other.delayed.dosbatch + match + (!)[^!]+(!) + + + begin + " + endCaptures + + 0 + + name + punctuation.definition.string.end.shell + + + beginCaptures + + 0 + + name + punctuation.definition.string.begin.shell + + + name + string.quoted.double.dosbatch + end + "|$ + + + name + keyword.operator.pipe.dosbatch + match + [|] + + + name + keyword.operator.redirect.shell + match + &>|\d*>&\d*|\d*(>>|>|<)|\d*<&|\d*<> + + + name + Batch File + scopeName + source.dosbatch + fileTypes + + bat + + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/json.plist b/src/file-viewer/highlight-grammar/json.plist new file mode 100644 index 0000000..29075b6 --- /dev/null +++ b/src/file-viewer/highlight-grammar/json.plist @@ -0,0 +1,386 @@ + + + + + fileTypes + + json + sublime-settings + sublime-menu + sublime-keymap + sublime-mousemap + sublime-theme + sublime-build + sublime-project + sublime-completions + + foldingStartMarker + (?x) # turn on extended mode + ^ # a line beginning with + \s* # some optional space + [{\[] # the start of an object or array + (?! # but not followed by + .* # whatever + [}\]] # and the close of an object or array + ,? # an optional comma + \s* # some optional space + $ # at the end of the line + ) + | # ...or... + [{\[] # the start of an object or array + \s* # some optional space + $ # at the end of the line + foldingStopMarker + (?x) # turn on extended mode + ^ # a line beginning with + \s* # some optional space + [}\]] # and the close of an object or array + keyEquivalent + ^~J + name + JSON (Javascript Next) + patterns + + + include + #value + + + repository + + array + + begin + \[ + beginCaptures + + 0 + + name + punctuation.definition.array.begin.json + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.array.end.json + + + name + meta.structure.array.json + patterns + + + include + #value + + + match + , + name + punctuation.separator.array.json + + + match + [^\s\]] + name + invalid.illegal.expected-array-separator.json + + + + comments + + patterns + + + begin + /\*\*(?!/) + captures + + 0 + + name + punctuation.definition.comment.json + + + end + \*/ + name + comment.block.documentation.json + + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment.json + + + end + \*/ + name + comment.block.json + + + captures + + 1 + + name + punctuation.definition.comment.json + + + match + (//).*$\n? + name + comment.line.double-slash.js + + + + constant + + match + \b(?:true|false|null)\b + name + constant.language.json + + number + + match + (?x) # turn on extended mode + -? # an optional minus + (?: + 0 # a zero + | # ...or... + [1-9] # a 1-9 character + \d* # followed by zero or more digits + ) + (?: + (?: + \. # a period + \d+ # followed by one or more digits + )? + (?: + [eE] # an e character + [+-]? # followed by an option +/- + \d+ # followed by one or more digits + )? # make exponent optional + )? # make decimal portion optional + name + constant.numeric.json + + object + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.dictionary.begin.json + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.dictionary.end.json + + + name + meta.structure.dictionary.json + patterns + + + comment + the JSON object key + include + #objectkey + + + include + #comments + + + begin + : + beginCaptures + + 0 + + name + punctuation.separator.dictionary.key-value.json + + + end + (,)|(?=\}) + endCaptures + + 1 + + name + punctuation.separator.dictionary.pair.json + + + name + meta.structure.dictionary.value.json + patterns + + + comment + the JSON object value + include + #value + + + match + [^\s,] + name + invalid.illegal.expected-dictionary-separator.json + + + + + match + [^\s\}] + name + invalid.illegal.expected-dictionary-separator.json + + + + string + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.json + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.json + + + name + string.quoted.double.json + patterns + + + include + #stringcontent + + + + objectkey + + begin + " + beginCaptures + + 0 + + name + punctuation.support.type.property-name.begin.json + + + end + " + endCaptures + + 0 + + name + punctuation.support.type.property-name.end.json + + + name + string.json support.type.property-name.json + patterns + + + include + #stringcontent + + + + stringcontent + + patterns + + + match + (?x) # turn on extended mode + \\ # a literal backslash + (?: # ...followed by... + ["\\/bfnrt] # one of these characters + | # ...or... + u # a u + [0-9a-fA-F]{4}) # and four hex digits + name + constant.character.escape.json + + + match + \\. + name + invalid.illegal.unrecognized-string-escape.json + + + + value + + patterns + + + include + #constant + + + include + #number + + + include + #string + + + include + #array + + + include + #object + + + include + #comments + + + + + scopeName + source.json + uuid + 8f97457b-516e-48ce-83c7-08ae12fb327a + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/lua.plist b/src/file-viewer/highlight-grammar/lua.plist new file mode 100644 index 0000000..e519492 --- /dev/null +++ b/src/file-viewer/highlight-grammar/lua.plist @@ -0,0 +1,1462 @@ + + + + + name + Lua + scopeName + source.lua + patterns + + + begin + \b(?:(local)\s+)?(function)\b(?![,:]) + beginCaptures + + 1 + + name + keyword.local.lua + + 2 + + name + keyword.control.lua + + + end + (?<=[\)\-{}\[\]"']) + name + meta.function.lua + patterns + + + include + #comment + + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.parameters.begin.lua + + + end + (\))|(?=[\-\.{}\[\]"']) + endCaptures + + 1 + + name + punctuation.definition.parameters.finish.lua + + + name + meta.parameter.lua + patterns + + + include + #comment + + + match + [a-zA-Z_][a-zA-Z0-9_]* + name + variable.parameter.function.lua + + + match + , + name + punctuation.separator.arguments.lua + + + begin + : + beginCaptures + + 0 + + name + punctuation.separator.arguments.lua + + + end + (?=[\),]) + patterns + + + include + #emmydoc.type + + + + + + + match + \b([a-zA-Z_][a-zA-Z0-9_]*)\b\s*(?=:) + name + entity.name.class.lua + + + match + \b([a-zA-Z_][a-zA-Z0-9_]*)\b + name + entity.name.function.lua + + + + + match + (?<![\w\d.])0[xX][0-9A-Fa-f]+(\.[0-9A-Fa-f]*)?([eE]-?\d*)?([pP][-+]\d+)? + name + constant.numeric.float.hexadecimal.lua + + + match + (?<![\w\d.])0[xX]\.[0-9A-Fa-f]+([eE]-?\d*)?([pP][-+]\d+)? + name + constant.numeric.float.hexadecimal.lua + + + match + (?<![\w\d.])0[xX][0-9A-Fa-f]+(?![pPeE.0-9]) + name + constant.numeric.integer.hexadecimal.lua + + + match + (?<![\w\d.])\d+(\.\d*)?([eE]-?\d*)? + name + constant.numeric.float.lua + + + match + (?<![\w\d.])\.\d+([eE]-?\d*)? + name + constant.numeric.float.lua + + + match + (?<![\w\d.])\d+(?![pPeE.0-9]) + name + constant.numeric.integer.lua + + + include + #string + + + captures + + 1 + + name + punctuation.definition.comment.lua + + + match + \A(#!).*$\n? + name + comment.line.shebang.lua + + + include + #comment + + + captures + + 1 + + name + keyword.control.goto.lua + + 2 + + name + string.tag.lua + + + match + \b(goto)\s+([a-zA-Z_][a-zA-Z0-9_]*) + + + captures + + 1 + + name + punctuation.section.embedded.begin.lua + + 2 + + name + punctuation.section.embedded.end.lua + + + match + (::)\s*[a-zA-Z_][a-zA-Z0-9_]*\s*(::) + name + string.tag.lua + + + match + <\s*(const|close)\s*> + captures + + 0 + + name + storage.type.attribute.lua + + + + + match + \<[a-zA-Z_\*][a-zA-Z0-9_\.\*\-]*\> + name + storage.type.generic.lua + + + match + \b(break|do|else|for|if|elseif|goto|return|then|repeat|while|until|end|in)\b + name + keyword.control.lua + + + match + \b(local)\b + name + keyword.local.lua + + + match + \b(function)\b(?![,:]) + name + keyword.control.lua + + + match + (?<![^.]\.|:)\b(false|nil(?!:)|true|_ENV|_G|_VERSION|math\.(pi|huge|maxinteger|mininteger)|utf8\.charpattern|io\.(stdin|stdout|stderr)|package\.(config|cpath|loaded|loaders|path|preload|searchers))\b|(?<![.])\.{3}(?!\.) + name + constant.language.lua + + + match + (?<![^.]\.|:)\b(self)\b + name + variable.language.self.lua + + + match + (?<![^.]\.|:)\b(assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|loadstring|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\b(?!\s*=(?!=)) + name + support.function.lua + + + match + (?<![^.]\.|:)\b(async)\b(?!\s*=(?!=)) + name + entity.name.tag.lua + + + match + (?<![^.]\.|:)\b(coroutine\.(create|isyieldable|close|resume|running|status|wrap|yield)|string\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)|table\.(concat|insert|maxn|move|pack|remove|sort|unpack)|math\.(abs|acos|asin|atan2?|ceil|cosh?|deg|exp|floor|fmod|frexp|ldexp|log|log10|max|min|modf|pow|rad|random|randomseed|sinh?|sqrt|tanh?|tointeger|type)|io\.(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)|os\.(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)|package\.(loadlib|seeall|searchpath)|debug\.(debug|[gs]etfenv|[gs]ethook|getinfo|[gs]etlocal|[gs]etmetatable|getregistry|[gs]etupvalue|[gs]etuservalue|set[Cc]stacklimit|traceback|upvalueid|upvaluejoin)|bit32\.(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)|utf8\.(char|codes|codepoint|len|offset))\b(?!\s*=(?!=)) + name + support.function.library.lua + + + match + \b(and|or|not|\|\||\&\&|\!)\b + name + keyword.operator.lua + + + match + \b([a-zA-Z_][a-zA-Z0-9_]*)\b(?=\s*(?:[({"']|\[\[)) + name + support.function.any-method.lua + + + match + \b([a-zA-Z_][a-zA-Z0-9_]*)\b(?=\s*\??:) + name + entity.name.class.lua + + + match + (?<=[^.]\.|:)\b([a-zA-Z_][a-zA-Z0-9_]*)\b(?!\s*=\s*\b(function)\b) + name + entity.other.attribute.lua + + + match + \b([a-zA-Z_][a-zA-Z0-9_]*)\b(?!\s*=\s*\b(function)\b) + name + variable.other.lua + + + match + \b([a-zA-Z_][a-zA-Z0-9_]*)\b(?=\s*=\s*\b(function)\b) + name + entity.name.function.lua + + + match + \+|-|%|#|\*|\/|\^|==?|~=|!=|<=?|>=?|(?<!\.)\.{2}(?!\.) + name + keyword.operator.lua + + + repository + + escaped_char + + patterns + + + match + \\[abfnrtv\\"'\n] + name + constant.character.escape.lua + + + match + \\z[\n\t ]* + name + constant.character.escape.lua + + + match + \\\d{1,3} + name + constant.character.escape.byte.lua + + + match + \\x[0-9A-Fa-f][0-9A-Fa-f] + name + constant.character.escape.byte.lua + + + match + \\u\{[0-9A-Fa-f]+\} + name + constant.character.escape.unicode.lua + + + match + \\. + name + invalid.illegal.character.escape.lua + + + + string + + patterns + + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.lua + + + end + '[ \t]*|(?=\n) + endCaptures + + 0 + + name + punctuation.definition.string.end.lua + + + name + string.quoted.single.lua + patterns + + + include + #escaped_char + + + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.lua + + + end + "[ \t]*|(?=\n) + endCaptures + + 0 + + name + punctuation.definition.string.end.lua + + + name + string.quoted.double.lua + patterns + + + include + #escaped_char + + + + + begin + ` + beginCaptures + + 0 + + name + punctuation.definition.string.begin.lua + + + end + `[ \t]*|(?=\n) + endCaptures + + 0 + + name + punctuation.definition.string.end.lua + + + name + string.quoted.double.lua + + + begin + (?<=\.cdef)\s*(\[(=*)\[) + beginCaptures + + 0 + + name + string.quoted.other.multiline.lua + + 1 + + name + punctuation.definition.string.begin.lua + + + contentName + meta.embedded.lua + end + (\]\2\])[ \t]* + endCaptures + + 0 + + name + string.quoted.other.multiline.lua + + 1 + + name + punctuation.definition.string.end.lua + + + patterns + + + include + source.c + + + + + begin + (?<!--)\[(=*)\[ + beginCaptures + + 0 + + name + punctuation.definition.string.begin.lua + + + end + \]\1\][ \t]* + endCaptures + + 0 + + name + punctuation.definition.string.end.lua + + + name + string.quoted.other.multiline.lua + + + + comment + + patterns + + + begin + (^[ \t]+)?(?=--) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.lua + + + end + (?!\G)((?!^)[ \t]+\n)? + endCaptures + + 1 + + name + punctuation.whitespace.comment.trailing.lua + + + patterns + + + begin + --\[(=*)\[@@@ + beginCaptures + + 0 + + name + punctuation.definition.comment.begin.lua + + + end + (--)?\]\1\] + endCaptures + + 0 + + name + punctuation.definition.comment.end.lua + + + name + + patterns + + + include + source.lua + + + + + begin + --\[(=*)\[ + beginCaptures + + 0 + + name + punctuation.definition.comment.begin.lua + + + end + (--)?\]\1\] + endCaptures + + 0 + + name + punctuation.definition.comment.end.lua + + + name + comment.block.lua + patterns + + + include + #emmydoc + + + include + #ldoc_tag + + + + + begin + ---- + beginCaptures + + 0 + + name + punctuation.definition.comment.lua + + + end + \n + name + comment.line.double-dash.lua + + + begin + --- + beginCaptures + + 0 + + name + punctuation.definition.comment.lua + + + end + \n + name + comment.line.double-dash.documentation.lua + patterns + + + include + #emmydoc + + + include + #ldoc_tag + + + + + begin + -- + beginCaptures + + 0 + + name + punctuation.definition.comment.lua + + + end + \n + name + comment.line.double-dash.lua + patterns + + + include + #ldoc_tag + + + + + + + begin + \/\* + beginCaptures + + 0 + + name + punctuation.definition.comment.begin.lua + + + end + \*\/ + endCaptures + + 0 + + name + punctuation.definition.comment.end.lua + + + name + comment.block.lua + patterns + + + include + #emmydoc + + + include + #ldoc_tag + + + + + + emmydoc + + patterns + + + begin + (?<=---)[ \t]*@class + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + match + \b([a-zA-Z_\*][a-zA-Z0-9_\.\*\-]*) + name + support.class.lua + + + match + :|, + name + keyword.operator.lua + + + + + begin + (?<=---)[ \t]*@enum + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + begin + \b([a-zA-Z_\*][a-zA-Z0-9_\.\*\-]*) + beginCaptures + + 0 + + name + variable.lua + + + end + (?=\n) + + + + + begin + (?<=---)[ \t]*@type + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + include + #emmydoc.type + + + + + begin + (?<=---)[ \t]*@alias + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + begin + \b([a-zA-Z_\*][a-zA-Z0-9_\.\*\-]*) + beginCaptures + + 0 + + name + variable.lua + + + end + (?=[\n#]) + patterns + + + include + #emmydoc.type + + + + + + + begin + (?<=---)[ \t]*(@operator)\s*(\b[a-z]+)? + beginCaptures + + 1 + + name + storage.type.annotation.lua + + 2 + + name + support.function.library.lua + + + end + (?=[\n@#]) + patterns + + + include + #emmydoc.type + + + + + begin + (?<=---)[ \t]*@cast + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + begin + \b([a-zA-Z_\*][a-zA-Z0-9_\.\*\-]*) + beginCaptures + + 0 + + name + variable.other.lua + + + end + (?=\n) + patterns + + + include + #emmydoc.type + + + match + ([+-|]) + name + keyword.operator.lua + + + + + + + begin + (?<=---)[ \t]*@param + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + begin + \b([a-zA-Z_][a-zA-Z0-9_]*)\b(\??) + beginCaptures + + 1 + + name + entity.name.variable.lua + + 2 + + name + keyword.operator.lua + + + end + (?=[\n#]) + patterns + + + include + #emmydoc.type + + + + + + + begin + (?<=---)[ \t]*@return + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + match + \? + name + keyword.operator.lua + + + include + #emmydoc.type + + + + + begin + (?<=---)[ \t]*@field + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + begin + (\b([a-zA-Z_][a-zA-Z0-9_]*)\b|(\[))(\??) + beginCaptures + + 2 + + name + entity.name.variable.lua + + 3 + + name + keyword.operator.lua + + + end + (?=[\n#]) + patterns + + + include + #string + + + include + #emmydoc.type + + + match + \] + name + keyword.operator.lua + + + + + + + begin + (?<=---)[ \t]*@generic + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + begin + \b([a-zA-Z_][a-zA-Z0-9_]*)\b + beginCaptures + + 0 + + name + storage.type.generic.lua + + + end + (?=\n)|(,) + endCaptures + + 0 + + name + keyword.operator.lua + + + patterns + + + match + : + name + keyword.operator.lua + + + include + #emmydoc.type + + + + + + + begin + (?<=---)[ \t]*@vararg + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + include + #emmydoc.type + + + + + begin + (?<=---)[ \t]*@overload + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + include + #emmydoc.type + + + + + begin + (?<=---)[ \t]*@deprecated + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + + + begin + (?<=---)[ \t]*@meta + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + + + begin + (?<=---)[ \t]*@private + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + + + begin + (?<=---)[ \t]*@protected + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + + + begin + (?<=---)[ \t]*@package + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + + + begin + (?<=---)[ \t]*@version + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + match + \b(5\.1|5\.2|5\.3|5\.4|JIT)\b + name + support.class.lua + + + match + ,|\>|\< + name + keyword.operator.lua + + + + + begin + (?<=---)[ \t]*@see + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + match + \b([a-zA-Z_\*][a-zA-Z0-9_\.\*\-]*) + name + support.class.lua + + + match + # + name + keyword.operator.lua + + + + + begin + (?<=---)[ \t]*@diagnostic + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + begin + ([a-zA-Z_\-0-9]+)[ \t]*(:)? + beginCaptures + + 1 + + name + keyword.other.unit + + 2 + + name + keyword.operator.unit + + + end + (?=\n) + patterns + + + match + \b([a-zA-Z_\*][a-zA-Z0-9_\-]*) + name + support.class.lua + + + match + , + name + keyword.operator.lua + + + + + + + begin + (?<=---)[ \t]*@module + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + include + #string + + + + + match + (?<=---)[ \t]*@(async|nodiscard) + name + storage.type.annotation.lua + + + begin + (?<=---)\|\s*[\>\+]? + beginCaptures + + 0 + + name + storage.type.annotation.lua + + + end + (?=[\n@#]) + patterns + + + include + #string + + + + + + emmydoc.type + + patterns + + + begin + \bfun\b + beginCaptures + + 0 + + name + keyword.control.lua + + + end + (?=[\s#]) + patterns + + + match + [\(\),:\?][ \t]* + name + keyword.operator.lua + + + match + ([a-zA-Z_][a-zA-Z0-9_\.\*\[\]\<\>\,\-]*)(?<!,)[ \t]*(?=\??:) + name + entity.name.variable.lua + + + include + #emmydoc.type + + + include + #string + + + + + match + \<[a-zA-Z_\*][a-zA-Z0-9_\.\*\-]*\> + name + storage.type.generic.lua + + + match + \basync\b + name + entity.name.tag.lua + + + match + [\{\}\:\,\?\|\`][ \t]* + name + keyword.operator.lua + + + begin + (?=[a-zA-Z_\.\*"'\[]) + end + (?=[\s\)\,\?\:\}\|#]) + patterns + + + match + ([a-zA-Z0-9_\.\*\[\]\<\>\,\-]+)(?<!,)[ \t]* + name + support.type.lua + + + match + (\.\.\.)[ \t]* + name + constant.language.lua + + + include + #string + + + + + + ldoc_tag + + match + \G[ \t]*(@)(alias|annotation|author|charset|class|classmod|comment|constructor|copyright|description|example|export|factory|field|file|fixme|function|include|lfunction|license|local|module|name|param|pragma|private|raise|release|return|script|section|see|set|static|submodule|summary|tfield|thread|tparam|treturn|todo|topic|type|usage|warning|within)\b + captures + + 1 + + name + punctuation.definition.block.tag.ldoc + + 2 + + name + storage.type.class.ldoc + + + + + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/mdx.plist b/src/file-viewer/highlight-grammar/mdx.plist new file mode 100644 index 0000000..bc24b8e --- /dev/null +++ b/src/file-viewer/highlight-grammar/mdx.plist @@ -0,0 +1,9527 @@ + + + + + fileTypes + + mdx + + name + MDX + patterns + + + include + #markdown-frontmatter + + + include + #markdown-sections + + + repository + + markdown-frontmatter + + patterns + + + include + #extension-toml + + + include + #extension-yaml + + + + markdown-sections + + patterns + + + include + #commonmark-block-quote + + + include + #commonmark-code-fenced + + + include + #extension-gfm-footnote-definition + + + include + #commonmark-definition + + + include + #commonmark-heading-atx + + + include + #commonmark-thematic-break + + + include + #commonmark-heading-setext + + + include + #commonmark-list-item + + + include + #extension-gfm-table + + + include + #extension-math-flow + + + include + #extension-mdx-esm + + + include + #extension-mdx-expression-flow + + + include + #extension-mdx-jsx-flow + + + include + #commonmark-paragraph + + + + markdown-string + + patterns + + + include + #commonmark-character-escape + + + include + #commonmark-character-reference + + + + markdown-text + + patterns + + + include + #commonmark-attention + + + include + #commonmark-character-escape + + + include + #commonmark-character-reference + + + include + #commonmark-code-text + + + include + #commonmark-hard-break-trailing + + + include + #commonmark-hard-break-escape + + + include + #commonmark-label-end + + + include + #extension-gfm-footnote-call + + + include + #commonmark-label-start + + + include + #extension-gfm-autolink-literal + + + include + #extension-gfm-strikethrough + + + include + #extension-github-gemoji + + + include + #extension-github-mention + + + include + #extension-github-reference + + + include + #extension-math-text + + + include + #extension-mdx-expression-text + + + include + #extension-mdx-jsx-text + + + + commonmark-attention + + patterns + + + match + (?<=\S)\*{3,}|\*{3,}(?=\S) + name + string.other.strong.emphasis.asterisk.mdx + + + match + (?<=[\p{L}\p{N}])_{3,}(?![\p{L}\p{N}])|(?<=\p{P})_{3,}|(?<![\p{L}\p{N}]|\p{P})_{3,}(?!\s) + name + string.other.strong.emphasis.underscore.mdx + + + match + (?<=\S)\*{2}|\*{2}(?=\S) + name + string.other.strong.asterisk.mdx + + + match + (?<=[\p{L}\p{N}])_{2}(?![\p{L}\p{N}])|(?<=\p{P})_{2}|(?<![\p{L}\p{N}]|\p{P})_{2}(?!\s) + name + string.other.strong.underscore.mdx + + + match + (?<=\S)\*|\*(?=\S) + name + string.other.emphasis.asterisk.mdx + + + match + (?<=[\p{L}\p{N}])_(?![\p{L}\p{N}])|(?<=\p{P})_|(?<![\p{L}\p{N}]|\p{P})_(?!\s) + name + string.other.emphasis.underscore.mdx + + + + commonmark-block-quote + + begin + (?:^|\G)[\t ]*(>)[ ]? + beginCaptures + + 0 + + name + markup.quote.mdx + + 1 + + name + punctuation.definition.quote.begin.mdx + + + patterns + + + include + #markdown-sections + + + name + markup.quote.mdx + while + (>)[ ]? + whileCaptures + + 0 + + name + markup.quote.mdx + + 1 + + name + punctuation.definition.quote.begin.mdx + + + + commonmark-character-escape + + match + \\(?:[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]) + name + constant.language.character-escape.mdx + + commonmark-character-reference + + patterns + + + include + #whatwg-html-data-character-reference-named-terminated + + + match + (&)(#)([Xx])([0-9A-Fa-f]{1,6})(;) + name + constant.language.character-reference.numeric.hexadecimal.html + captures + + 1 + + name + punctuation.definition.character-reference.begin.html + + 2 + + name + punctuation.definition.character-reference.numeric.html + + 3 + + name + punctuation.definition.character-reference.numeric.hexadecimal.html + + 4 + + name + constant.numeric.integer.hexadecimal.html + + 5 + + name + punctuation.definition.character-reference.end.html + + + + + match + (&)(#)([0-9]{1,7})(;) + name + constant.language.character-reference.numeric.decimal.html + captures + + 1 + + name + punctuation.definition.character-reference.begin.html + + 2 + + name + punctuation.definition.character-reference.numeric.html + + 3 + + name + constant.numeric.integer.decimal.html + + 4 + + name + punctuation.definition.character-reference.end.html + + + + + + commonmark-code-fenced + + patterns + + + include + #commonmark-code-fenced-apib + + + include + #commonmark-code-fenced-asciidoc + + + include + #commonmark-code-fenced-c + + + include + #commonmark-code-fenced-clojure + + + include + #commonmark-code-fenced-coffee + + + include + #commonmark-code-fenced-console + + + include + #commonmark-code-fenced-cpp + + + include + #commonmark-code-fenced-cs + + + include + #commonmark-code-fenced-css + + + include + #commonmark-code-fenced-diff + + + include + #commonmark-code-fenced-dockerfile + + + include + #commonmark-code-fenced-elixir + + + include + #commonmark-code-fenced-elm + + + include + #commonmark-code-fenced-erlang + + + include + #commonmark-code-fenced-gitconfig + + + include + #commonmark-code-fenced-go + + + include + #commonmark-code-fenced-graphql + + + include + #commonmark-code-fenced-haskell + + + include + #commonmark-code-fenced-html + + + include + #commonmark-code-fenced-ini + + + include + #commonmark-code-fenced-java + + + include + #commonmark-code-fenced-js + + + include + #commonmark-code-fenced-json + + + include + #commonmark-code-fenced-julia + + + include + #commonmark-code-fenced-kotlin + + + include + #commonmark-code-fenced-less + + + include + #commonmark-code-fenced-less + + + include + #commonmark-code-fenced-lua + + + include + #commonmark-code-fenced-makefile + + + include + #commonmark-code-fenced-md + + + include + #commonmark-code-fenced-mdx + + + include + #commonmark-code-fenced-objc + + + include + #commonmark-code-fenced-perl + + + include + #commonmark-code-fenced-php + + + include + #commonmark-code-fenced-php + + + include + #commonmark-code-fenced-python + + + include + #commonmark-code-fenced-r + + + include + #commonmark-code-fenced-raku + + + include + #commonmark-code-fenced-ruby + + + include + #commonmark-code-fenced-rust + + + include + #commonmark-code-fenced-scala + + + include + #commonmark-code-fenced-scss + + + include + #commonmark-code-fenced-shell + + + include + #commonmark-code-fenced-shell-session + + + include + #commonmark-code-fenced-sql + + + include + #commonmark-code-fenced-svg + + + include + #commonmark-code-fenced-swift + + + include + #commonmark-code-fenced-toml + + + include + #commonmark-code-fenced-ts + + + include + #commonmark-code-fenced-tsx + + + include + #commonmark-code-fenced-vbnet + + + include + #commonmark-code-fenced-xml + + + include + #commonmark-code-fenced-yaml + + + include + #commonmark-code-fenced-unknown + + + + commonmark-code-fenced-unknown + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?:[^\t\n\r` ])+)(?:[\t ]+((?:[^\n\r`])+))?)?(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + contentName + markup.raw.code.fenced.mdx + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.other.mdx + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?:[^\t\n\r ])+)(?:[\t ]+((?:[^\n\r])+))?)?(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + contentName + markup.raw.code.fenced.mdx + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.other.mdx + + + + commonmark-code-text + + match + (?<!`)(`+)(?!`)(.+?)(?<!`)(\1)(?!`) + name + markup.code.other.mdx + captures + + 1 + + name + string.other.begin.code.mdx + + 2 + + name + markup.raw.code.mdx markup.inline.raw.code.mdx + + 3 + + name + string.other.end.code.mdx + + + + commonmark-definition + + match + (?:^|\G)[\t ]*(\[)((?:[^\[\\\]]|\\[\[\\\]]?)+?)(\])(:)[ \t]*(?:(<)((?:[^\n<\\>]|\\[<\\>]?)*)(>)|(\g<destination_raw>))(?:[\t ]+(?:(")((?:[^"\\]|\\["\\]?)*)(")|(')((?:[^'\\]|\\['\\]?)*)(')|(\()((?:[^\)\\]|\\[\)\\]?)*)(\))))?$(?<destination_raw>(?!\<)(?:(?:[^\p{Cc}\ \\\(\)]|\\[\(\)\\]?)|\(\g<destination_raw>*\))+){0} + name + meta.link.reference.def.mdx + captures + + 1 + + name + string.other.begin.mdx + + 2 + + name + entity.name.identifier.mdx + patterns + + + include + #markdown-string + + + + 3 + + name + string.other.end.mdx + + 4 + + name + punctuation.separator.key-value.mdx + + 5 + + name + string.other.begin.destination.mdx + + 6 + + name + string.other.link.destination.mdx + patterns + + + include + #markdown-string + + + + 7 + + name + string.other.end.destination.mdx + + 8 + + name + string.other.link.destination.mdx + patterns + + + include + #markdown-string + + + + 9 + + name + string.other.begin.mdx + + 10 + + name + string.quoted.double.mdx + patterns + + + include + #markdown-string + + + + 11 + + name + string.other.end.mdx + + 12 + + name + string.other.begin.mdx + + 13 + + name + string.quoted.single.mdx + patterns + + + include + #markdown-string + + + + 14 + + name + string.other.end.mdx + + 15 + + name + string.other.begin.mdx + + 16 + + name + string.quoted.paren.mdx + patterns + + + include + #markdown-string + + + + 17 + + name + string.other.end.mdx + + + + commonmark-hard-break-escape + + match + \\$ + name + constant.language.character-escape.line-ending.mdx + + commonmark-hard-break-trailing + + match + ( ){2,}$ + name + carriage-return constant.language.character-escape.line-ending.mdx + + commonmark-heading-atx + + patterns + + + match + (?:^|\G)[\t ]*(#{1}(?!#))(?:[ \t]+([^\r\n]+?)(?:[ \t]+(#+?))?)?[ \t]*$ + name + markup.heading.atx.1.mdx + captures + + 1 + + name + punctuation.definition.heading.mdx + + 2 + + name + entity.name.section.mdx + patterns + + + include + #markdown-text + + + + 3 + + name + punctuation.definition.heading.mdx + + + + + match + (?:^|\G)[\t ]*(#{2}(?!#))(?:[ \t]+([^\r\n]+?)(?:[ \t]+(#+?))?)?[ \t]*$ + name + markup.heading.atx.2.mdx + captures + + 1 + + name + punctuation.definition.heading.mdx + + 2 + + name + entity.name.section.mdx + patterns + + + include + #markdown-text + + + + 3 + + name + punctuation.definition.heading.mdx + + + + + match + (?:^|\G)[\t ]*(#{3}(?!#))(?:[ \t]+([^\r\n]+?)(?:[ \t]+(#+?))?)?[ \t]*$ + name + markup.heading.atx.3.mdx + captures + + 1 + + name + punctuation.definition.heading.mdx + + 2 + + name + entity.name.section.mdx + patterns + + + include + #markdown-text + + + + 3 + + name + punctuation.definition.heading.mdx + + + + + match + (?:^|\G)[\t ]*(#{4}(?!#))(?:[ \t]+([^\r\n]+?)(?:[ \t]+(#+?))?)?[ \t]*$ + name + markup.heading.atx.4.mdx + captures + + 1 + + name + punctuation.definition.heading.mdx + + 2 + + name + entity.name.section.mdx + patterns + + + include + #markdown-text + + + + 3 + + name + punctuation.definition.heading.mdx + + + + + match + (?:^|\G)[\t ]*(#{5}(?!#))(?:[ \t]+([^\r\n]+?)(?:[ \t]+(#+?))?)?[ \t]*$ + name + markup.heading.atx.5.mdx + captures + + 1 + + name + punctuation.definition.heading.mdx + + 2 + + name + entity.name.section.mdx + patterns + + + include + #markdown-text + + + + 3 + + name + punctuation.definition.heading.mdx + + + + + match + (?:^|\G)[\t ]*(#{6}(?!#))(?:[ \t]+([^\r\n]+?)(?:[ \t]+(#+?))?)?[ \t]*$ + name + markup.heading.atx.6.mdx + captures + + 1 + + name + punctuation.definition.heading.mdx + + 2 + + name + entity.name.section.mdx + patterns + + + include + #markdown-text + + + + 3 + + name + punctuation.definition.heading.mdx + + + + + + commonmark-heading-setext + + patterns + + + match + (?:^|\G)[\t ]*(={1,})[ \t]*$ + name + markup.heading.setext.1.mdx + + + match + (?:^|\G)[\t ]*(-{1,})[ \t]*$ + name + markup.heading.setext.2.mdx + + + + commonmark-label-end + + patterns + + + match + (\])(\()[\t ]*(?:(?:(<)((?:[^\n<\\>]|\\[<\\>]?)*)(>)|(\g<destination_raw>))(?:[\t ]+(?:(")((?:[^"\\]|\\["\\]?)*)(")|(')((?:[^'\\]|\\['\\]?)*)(')|(\()((?:[^\)\\]|\\[\)\\]?)*)(\))))?)?[\t ]*(\))(?<destination_raw>(?!\<)(?:(?:[^\p{Cc}\ \\\(\)]|\\[\(\)\\]?)|\(\g<destination_raw>*\))+){0} + captures + + 1 + + name + string.other.end.mdx + + 2 + + name + string.other.begin.mdx + + 3 + + name + string.other.begin.destination.mdx + + 4 + + name + string.other.link.destination.mdx + patterns + + + include + #markdown-string + + + + 5 + + name + string.other.end.destination.mdx + + 6 + + name + string.other.link.destination.mdx + patterns + + + include + #markdown-string + + + + 7 + + name + string.other.begin.mdx + + 8 + + name + string.quoted.double.mdx + patterns + + + include + #markdown-string + + + + 9 + + name + string.other.end.mdx + + 10 + + name + string.other.begin.mdx + + 11 + + name + string.quoted.single.mdx + patterns + + + include + #markdown-string + + + + 12 + + name + string.other.end.mdx + + 13 + + name + string.other.begin.mdx + + 14 + + name + string.quoted.paren.mdx + patterns + + + include + #markdown-string + + + + 15 + + name + string.other.end.mdx + + 16 + + name + string.other.end.mdx + + + + + match + (\])(\[)((?:[^\[\\\]]|\\[\[\\\]]?)+?)(\]) + captures + + 1 + + name + string.other.end.mdx + + 2 + + name + string.other.begin.mdx + + 3 + + name + entity.name.identifier.mdx + patterns + + + include + #markdown-string + + + + 4 + + name + string.other.end.mdx + + + + + match + (\]) + captures + + 1 + + name + string.other.end.mdx + + + + + + commonmark-label-start + + patterns + + + match + \!\[(?!\^) + name + string.other.begin.image.mdx + + + match + \[ + name + string.other.begin.link.mdx + + + + commonmark-list-item + + patterns + + + begin + (?:^|\G)[\t ]*((?:[*+-]))(?:[ ]{4}(?![ ])|\t)(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + variable.unordered.list.mdx + + 2 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t)[ ]{1} + + + begin + (?:^|\G)[\t ]*((?:[*+-]))(?:[ ]{3}(?![ ]))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + variable.unordered.list.mdx + + 2 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t) + + + begin + (?:^|\G)[\t ]*((?:[*+-]))(?:[ ]{2}(?![ ]))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + variable.unordered.list.mdx + + 2 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)[ ]{3} + + + begin + (?:^|\G)[\t ]*((?:[*+-]))(?:[ ]{1}|(?=\n))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + variable.unordered.list.mdx + + 2 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)[ ]{2} + + + begin + (?:^|\G)[\t ]*([0-9]{9})((?:\.|\)))(?:[ ]{4}(?![ ])|\t(?![\t ]))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t){3}[ ]{2} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{9})((?:\.|\)))(?:[ ]{3}(?![ ]))|([0-9]{8})((?:\.|\)))(?:[ ]{4}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t){3}[ ]{1} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{9})((?:\.|\)))(?:[ ]{2}(?![ ]))|([0-9]{8})((?:\.|\)))(?:[ ]{3}(?![ ]))|([0-9]{7})((?:\.|\)))(?:[ ]{4}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + string.other.number.mdx + + 6 + + name + variable.ordered.list.mdx + + 7 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t){3} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{9})((?:\.|\)))(?:[ ]{1}|(?=[ \t]*\n))|([0-9]{8})((?:\.|\)))(?:[ ]{2}(?![ ]))|([0-9]{7})((?:\.|\)))(?:[ ]{3}(?![ ]))|([0-9]{6})((?:\.|\)))(?:[ ]{4}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + string.other.number.mdx + + 6 + + name + variable.ordered.list.mdx + + 7 + + name + string.other.number.mdx + + 8 + + name + variable.ordered.list.mdx + + 9 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t){2}[ ]{3} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{8})((?:\.|\)))(?:[ ]{1}|(?=[ \t]*\n))|([0-9]{7})((?:\.|\)))(?:[ ]{2}(?![ ]))|([0-9]{6})((?:\.|\)))(?:[ ]{3}(?![ ]))|([0-9]{5})((?:\.|\)))(?:[ ]{4}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + string.other.number.mdx + + 6 + + name + variable.ordered.list.mdx + + 7 + + name + string.other.number.mdx + + 8 + + name + variable.ordered.list.mdx + + 9 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t){2}[ ]{2} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{7})((?:\.|\)))(?:[ ]{1}|(?=[ \t]*\n))|([0-9]{6})((?:\.|\)))(?:[ ]{2}(?![ ]))|([0-9]{5})((?:\.|\)))(?:[ ]{3}(?![ ]))|([0-9]{4})((?:\.|\)))(?:[ ]{4}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + string.other.number.mdx + + 6 + + name + variable.ordered.list.mdx + + 7 + + name + string.other.number.mdx + + 8 + + name + variable.ordered.list.mdx + + 9 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t){2}[ ]{1} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{6})((?:\.|\)))(?:[ ]{1}|(?=[ \t]*\n))|([0-9]{5})((?:\.|\)))(?:[ ]{2}(?![ ]))|([0-9]{4})((?:\.|\)))(?:[ ]{3}(?![ ]))|([0-9]{3})((?:\.|\)))(?:[ ]{4}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + string.other.number.mdx + + 6 + + name + variable.ordered.list.mdx + + 7 + + name + string.other.number.mdx + + 8 + + name + variable.ordered.list.mdx + + 9 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t){2} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{5})((?:\.|\)))(?:[ ]{1}|(?=[ \t]*\n))|([0-9]{4})((?:\.|\)))(?:[ ]{2}(?![ ]))|([0-9]{3})((?:\.|\)))(?:[ ]{3}(?![ ]))|([0-9]{2})((?:\.|\)))(?:[ ]{4}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + string.other.number.mdx + + 6 + + name + variable.ordered.list.mdx + + 7 + + name + string.other.number.mdx + + 8 + + name + variable.ordered.list.mdx + + 9 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t)[ ]{3} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{4})((?:\.|\)))(?:[ ]{1}|(?=[ \t]*\n))|([0-9]{3})((?:\.|\)))(?:[ ]{2}(?![ ]))|([0-9]{2})((?:\.|\)))(?:[ ]{3}(?![ ]))|([0-9]{1})((?:\.|\)))(?:[ ]{4}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + string.other.number.mdx + + 6 + + name + variable.ordered.list.mdx + + 7 + + name + string.other.number.mdx + + 8 + + name + variable.ordered.list.mdx + + 9 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t)[ ]{2} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{3})((?:\.|\)))(?:[ ]{1}|(?=[ \t]*\n))|([0-9]{2})((?:\.|\)))(?:[ ]{2}(?![ ]))|([0-9]{1})((?:\.|\)))(?:[ ]{3}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + string.other.number.mdx + + 6 + + name + variable.ordered.list.mdx + + 7 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t)[ ]{1} + + + begin + (?:^|\G)[\t ]*(?:([0-9]{2})((?:\.|\)))(?:[ ]{1}|(?=[ \t]*\n))|([0-9])((?:\.|\)))(?:[ ]{2}(?![ ])))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + string.other.number.mdx + + 4 + + name + variable.ordered.list.mdx + + 5 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t) + + + begin + (?:^|\G)[\t ]*([0-9])((?:\.|\)))(?:[ ]{1}|(?=[ \t]*\n))(\[[\t Xx]\](?=[\t\n\r ]+(?:$|[^\t\n\r ])))? + beginCaptures + + 1 + + name + string.other.number.mdx + + 2 + + name + variable.ordered.list.mdx + + 3 + + name + keyword.other.tasklist.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)[ ]{3} + + + + commonmark-paragraph + + begin + (?![\t ]*$) + name + meta.paragraph.mdx + patterns + + + include + #markdown-text + + + while + (?:^|\G)(?:[ ]{4}|\t) + + commonmark-thematic-break + + match + (?:^|\G)[\t ]*([-*_])[ \t]*(?:\1[ \t]*){2,}$ + name + meta.separator.mdx + + extension-gfm-autolink-literal + + patterns + + + match + (?<=^|[\t\n\r \(\*\_\[\]~])(?=(?i:www)\.[^\n\r])(?:(?:[\p{L}\p{N}]|-|[\._](?!(?:[!"'\)\*,\.:;<\?_~]*(?:[\s<]|\][\t\n \(\[]))))+\g<path>?)?(?<path>(?:(?:[^\t\n\r !"&'\(\)\*,\.:;<\?\]_~]|&(?![A-Za-z]*;(?:[!"'\)\*,\.:;<\?_~]*(?:[\s<]|\][\t\n \(\[])))|[!"'\)\*,\.:;\?_~](?!(?:[!"'\)\*,\.:;<\?_~]*(?:[\s<]|\][\t\n \(\[]))))|\(\g<path>*\))+){0} + name + string.other.link.autolink.literal.www.mdx + + + match + (?<=^|[^A-Za-z])(?i:https?://)(?=[\p{L}\p{N}])(?:(?:[\p{L}\p{N}]|-|[\._](?!(?:[!"'\)\*,\.:;<\?_~]*(?:[\s<]|\][\t\n \(\[]))))+\g<path>?)?(?<path>(?:(?:[^\t\n\r !"&'\(\)\*,\.:;<\?\]_~]|&(?![A-Za-z]*;(?:[!"'\)\*,\.:;<\?_~]*(?:[\s<]|\][\t\n \(\[])))|[!"'\)\*,\.:;\?_~](?!(?:[!"'\)\*,\.:;<\?_~]*(?:[\s<]|\][\t\n \(\[]))))|\(\g<path>*\))+){0} + name + string.other.link.autolink.literal.http.mdx + + + match + (?<=^|[^A-Za-z/])(?i:mailto:|xmpp:)?(?:[0-9A-Za-z+\-\._])+@(?:(?:[0-9A-Za-z]|[-_](?!(?:[!"'\)\*,\.:;<\?_~]*(?:[\s<]|\][\t\n \(\[]))))+(?:\.(?!(?:[!"'\)\*,\.:;<\?_~]*(?:[\s<]|\][\t\n \(\[])))))+(?:[A-Za-z]|[-_](?!(?:[!"'\)\*,\.:;<\?_~]*(?:[\s<]|\][\t\n \(\[]))))+ + name + string.other.link.autolink.literal.email.mdx + + + + extension-gfm-footnote-call + + match + (\[)(\^)((?:[^\t\n\r \[\\\]]|\\[\[\\\]]?)+)(\]) + captures + + 1 + + name + string.other.begin.link.mdx + + 2 + + name + string.other.begin.footnote.mdx + + 3 + + name + entity.name.identifier.mdx + patterns + + + include + #markdown-string + + + + 4 + + name + string.other.end.footnote.mdx + + + + extension-gfm-footnote-definition + + begin + (?:^|\G)[\t ]*(\[)(\^)((?:[^\t\n\r \[\\\]]|\\[\[\\\]]?)+)(\])(:)[\t ]* + beginCaptures + + 1 + + name + string.other.begin.link.mdx + + 2 + + name + string.other.begin.footnote.mdx + + 3 + + name + entity.name.identifier.mdx + patterns + + + include + #markdown-string + + + + 4 + + name + string.other.end.footnote.mdx + + + patterns + + + include + #markdown-sections + + + while + ^(?=[\t ]*$)|(?:^|\G)(?:[ ]{4}|\t) + + extension-gfm-strikethrough + + match + (?<=\S)(?<!~)~{1,2}(?!~)|(?<!~)~{1,2}(?=\S)(?!~) + name + string.other.strikethrough.mdx + + extension-gfm-table + + begin + (?:^|\G)[\t ]*(?=\|[^\n\r]+\|[ \t]*$) + patterns + + + match + (?<=\||(?:^|\G))[\t ]*((?:[^\n\r\\\|]|\\[\\\|]?)+?)[\t ]*(?=\||$) + captures + + 1 + + patterns + + + include + #markdown-text + + + + + + + match + (?:\|) + name + markup.list.table-delimiter.mdx + + + end + ^(?=[\t ]*$)|$ + + extension-github-gemoji + + match + (:)((?:(?:(?:hand_with_index_finger_and_thumb_cros|mailbox_clo|fist_rai|confu)s|r(?:aised_hand_with_fingers_splay|e(?:gister|l(?:iev|ax)))|disappointed_reliev|confound|(?:a(?:ston|ngu)i|flu)sh|unamus|hush)e|(?:chart_with_(?:down|up)wards_tre|large_orange_diamo|small_(?:orang|blu)e_diamo|large_blue_diamo|parasol_on_grou|loud_sou|rewi)n|(?:rightwards_pushing_h|hourglass_flowing_s|leftwards_(?:pushing_)?h|(?:raised_back_of|palm_(?:down|up)|call_me)_h|(?:(?:(?:clippert|ascensi)on|norfolk)_is|christmas_is|desert_is|bouvet_is|new_zea|thai|eng|fin|ire)l|rightwards_h|pinching_h|writing_h|s(?:w(?:itzer|azi)|cot)l|magic_w|ok_h|icel)an|s(?:un_behind_(?:large|small|rain)_clou|hallow_pan_of_foo|tar_of_davi|leeping_be|kateboar|a(?:tisfie|uropo)|hiel|oun|qui)|(?:ear_with_hearing_a|pouring_liqu)i|(?:identification_c|(?:arrow_(?:back|for)|fast_for)w|credit_c|woman_be|biohaz|man_be|l(?:eop|iz))ar|m(?:usical_key|ortar_)boar|(?:drop_of_bl|canned_f)oo|c(?:apital_abc|upi)|person_bal|(?:black_bi|(?:cust|plac)a)r|(?:clip|key)boar|mermai|pea_po|worrie|po(?:la|u)n|threa|dv)d|(?:(?:(?:face_with_open_eyes_and_hand_over|face_with_diagonal|open|no)_mou|h(?:and_over_mou|yacin)|mammo)t|running_shirt_with_sas|(?:(?:fishing_pole_and_|blow)fi|(?:tropical_f|petri_d)i|(?:paint|tooth)bru|banglade|jellyfi)s|(?:camera_fl|wavy_d)as|triump|menora|pouc|blus|watc|das|has)h|(?:s(?:o(?:(?:uth_georgia_south_sandwich|lomon)_island|ck)|miling_face_with_three_heart|t_kitts_nevi|weat_drop|agittariu|c(?:orpiu|issor)|ymbol|hort)|twisted_rightwards_arrow|(?:northern_mariana|heard_mcdonald|(?:british_virgi|us_virgi|pitcair|cayma)n|turks_caicos|us_outlying|(?:falk|a)land|marshall|c(?:anary|ocos)|faroe)_island|(?:face_holding_back_tea|(?:c(?:ard_index_divid|rossed_fing)|pinched_fing)e|night_with_sta)r|(?:two_(?:wo)?men_holding|people_holding|heart|open)_hand|(?:sunrise_over_mountai|(?:congratul|united_n)atio|jea)n|(?:caribbean_)?netherland|(?:f(?:lower_playing_car|ace_in_clou)|crossed_swor|prayer_bea)d|(?:money_with_win|nest_with_eg|crossed_fla|hotsprin)g|revolving_heart|(?:high_brightne|(?:expression|wire)le|(?:tumbler|wine)_gla|milk_gla|compa|dre)s|performing_art|earth_america|orthodox_cros|l(?:ow_brightnes|a(?:tin_cros|o)|ung)|no_pedestrian|c(?:ontrol_kno|lu)b|b(?:ookmark_tab|rick|ean)|nesting_doll|cook_island|(?:fleur_de_l|tenn)i|(?:o(?:ncoming_b|phiuch|ctop)|hi(?:ppopotam|bisc)|trolleyb|m(?:(?:rs|x)_cla|auriti|inib)|belar|cact|abac|(?:cyp|tau)r)u|medal_sport|(?:chopstic|firewor)k|rhinocero|(?:p(?:aw_prin|eanu)|footprin)t|two_heart|princes|(?:hondur|baham)a|barbado|aquariu|c(?:ustom|hain)|maraca|comoro|flag|wale|hug|vh)s|(?:(?:diamond_shape_with_a_dot_ins|playground_sl)id|(?:(?:first_quarter|last_quarter|full|new)_moon_with|(?:zipper|money)_mouth|dotted_line|upside_down|c(?:rying_c|owboy_h)at|(?:disguis|nauseat)ed|neutral|monocle|panda|tired|woozy|clown|nerd|zany|fox)_fac|s(?:t(?:uck_out_tongue_winking_ey|eam_locomotiv)|(?:lightly_(?:frown|smil)|neez|h(?:ush|ak))ing_fac|(?:tudio_micropho|(?:hinto_shr|lot_mach)i|ierra_leo|axopho)n|mall_airplan|un_with_fac|a(?:luting_fac|tellit|k)|haved_ic|y(?:nagogu|ring)|n(?:owfl)?ak|urinam|pong)|(?:black_(?:medium_)?small|white_(?:(?:medium_)?small|large)|(?:black|white)_medium|black_large|orange|purple|yellow|b(?:rown|lue)|red)_squar|(?:(?:perso|woma)n_with_|man_with_)?probing_can|(?:p(?:ut_litter_in_its_pl|outing_f)|frowning_f|cold_f|wind_f|hot_f)ac|(?:arrows_c(?:ounterc)?lockwi|computer_mou|derelict_hou|carousel_hor|c(?:ity_sunri|hee)|heartpul|briefca|racehor|pig_no|lacros)s|(?:(?:face_with_head_band|ideograph_advant|adhesive_band|under|pack)a|currency_exchan|l(?:eft_l)?ugga|woman_jud|name_bad|man_jud|jud)g|face_with_peeking_ey|(?:(?:e(?:uropean_post_off|ar_of_r)|post_off)i|information_sour|ambulan)c|artificial_satellit|(?:busts?_in_silhouet|(?:vulcan_sal|parach)u|m(?:usical_no|ayot)|ro(?:ller_ska|set)|timor_les|ice_ska)t|(?:(?:incoming|red)_envelo|s(?:ao_tome_princi|tethosco)|(?:micro|tele)sco|citysca)p|(?:(?:(?:convenience|department)_st|musical_sc)o|f(?:light_depar|ramed_pic)tu|love_you_gestu|heart_on_fi|japanese_og|cote_divoi|perseve|singapo)r|b(?:ullettrain_sid|eliz|on)|(?:(?:female_|male_)?dete|radioa)ctiv|(?:christmas|deciduous|evergreen|tanabata|palm)_tre|(?:vibration_mo|cape_ver)d|(?:fortune_cook|neckt|self)i|(?:fork_and_)?knif|athletic_sho|(?:p(?:lead|arty)|drool|curs|melt|yawn|ly)ing_fac|vomiting_fac|(?:(?:c(?:urling_st|ycl)|meat_on_b|repeat_|headst)o|(?:fire_eng|tanger|ukra)i|rice_sce|(?:micro|i)pho|champag|pho)n|(?:cricket|video)_gam|(?:boxing_glo|oli)v|(?:d(?:ragon|izzy)|monkey)_fac|(?:m(?:artin|ozamb)iq|fond)u|wind_chim|test_tub|flat_sho|m(?:a(?:ns_sho|t)|icrob|oos|ut)|(?:handsh|fish_c|moon_c|cupc)ak|nail_car|zimbabw|ho(?:neybe|l)|ice_cub|airplan|pensiv|c(?:a(?:n(?:dl|o)|k)|o(?:ffe|oki))|tongu|purs|f(?:lut|iv)|d(?:at|ov)|n(?:iu|os)|kit|rag|ax)e|(?:(?:british_indian_ocean_territo|(?:plate_with_cutl|batt)e|medal_milita|low_batte|hunga|wea)r|family_(?:woman_(?:woman_(?:girl|boy)|girl|boy)|man_(?:woman_(?:girl|boy)|man_(?:girl|boy)|girl|boy))_bo|person_feeding_bab|woman_feeding_bab|s(?:u(?:spension_railwa|nn)|t(?:atue_of_libert|_barthelem|rawberr))|(?:m(?:ountain_cable|ilky_)|aerial_tram)wa|articulated_lorr|man_feeding_bab|mountain_railwa|partly_sunn|(?:vatican_c|infin)it|(?:outbox_tr|inbox_tr|birthd|motorw|paragu|urugu|norw|x_r)a|butterfl|ring_buo|t(?:urke|roph)|angr|fogg)y|(?:(?:perso|woma)n_in_motorized_wheelchai|(?:(?:notebook_with_decorative_c|four_leaf_cl)ov|(?:index_pointing_at_the_vie|white_flo)w|(?:face_with_thermome|non\-potable_wa|woman_firefigh|desktop_compu|m(?:an_firefigh|otor_scoo)|(?:ro(?:ller_coa|o)|oy)s|potable_wa|kick_scoo|thermome|firefigh|helicop|ot)t|(?:woman_factory_wor|(?:woman_office|woman_health|health)_wor|man_(?:factory|office|health)_wor|(?:factory|office)_wor|rice_crac|black_jo|firecrac)k|telephone_receiv|(?:palms_up_toget|f(?:ire_extinguis|eat)|teac)h|(?:(?:open_)?file_fol|level_sli)d|police_offic|f(?:lying_sauc|arm)|woman_teach|roll_of_pap|(?:m(?:iddle_f|an_s)in|woman_sin|hambur|plun|dag)g|do_not_litt|wilted_flow|woman_farm|man_(?:teach|farm)|(?:bell_pe|hot_pe|fli)pp|l(?:o(?:udspeak|ve_lett|bst)|edg|add)|tokyo_tow|c(?:ucumb|lapp|anc)|b(?:e(?:ginn|av)|adg)|print|hamst)e|(?:perso|woma)n_in_manual_wheelchai|m(?:an(?:_in_motorized|(?:_in_man)?ual)|otorized)_wheelchai|(?:person_(?:white|curly|red)_|wheelc)hai|triangular_rule|(?:film_project|e(?:l_salv|cu)ad|elevat|tract|anch)o|s(?:traight_rul|pace_invad|crewdriv|nowboard|unflow|peak|wimm|ing|occ|how|urf|ki)e|r(?:ed_ca|unne|azo)|d(?:o(?:lla|o)|ee)|barbe)r|(?:(?:cloud_with_(?:lightning_and_)?ra|japanese_gobl|round_pushp|liechtenste|mandar|pengu|dolph|bahra|pushp|viol)i|(?:couple(?:_with_heart_wo|kiss_)man|construction_worker|(?:mountain_bik|bow|row)ing|lotus_position|(?:w(?:eight_lift|alk)|climb)ing|white_haired|curly_haired|raising_hand|super(?:villain|hero)|red_haired|basketball|s(?:(?:wimm|urf)ing|assy)|haircut|no_good|(?:vampir|massag)e|b(?:iking|ald)|zombie|fairy|mage|elf|ng)_(?:wo)?ma|(?:(?:couple_with_heart_man|isle_of)_m|(?:couplekiss_woman_|(?:b(?:ouncing_ball|lond_haired)|tipping_hand|pregnant|kneeling|deaf)_|frowning_|s(?:tanding|auna)_|po(?:uting_|lice)|running_|blonde_|o(?:lder|k)_)wom|(?:perso|woma)n_with_turb|(?:b(?:ouncing_ball|lond_haired)|tipping_hand|pregnant|kneeling|deaf)_m|f(?:olding_hand_f|rowning_m)|man_with_turb|(?:turkmen|afghan|pak)ist|s(?:tanding_m|(?:outh_s)?ud|auna_m)|po(?:uting_|lice)m|running_m|azerbaij|k(?:yrgyz|azakh)st|tajikist|uzbekist|o(?:lder_m|k_m|ce)|(?:orang|bh)ut|taiw|jord)a|s(?:mall_red_triangle_dow|(?:valbard_jan_may|int_maart|ev)e|afety_pi|top_sig|t_marti|(?:corpi|po|o)o|wede)|(?:heavy_(?:d(?:ivision|ollar)|equals|minus|plus)|no_entry|female|male)_sig|(?:arrow_(?:heading|double)_d|p(?:erson_with_cr|oint_d)|arrow_up_d|thumbsd)ow|(?:house_with_gard|l(?:ock_with_ink_p|eafy_gre)|dancing_(?:wo)?m|fountain_p|keycap_t|chick|ali|yem|od)e|(?:izakaya|jack_o)_lanter|(?:funeral_u|(?:po(?:stal_h|pc)|capric)o|unico)r|chess_paw|b(?:a(?:llo|c)o|eni|rai)|l(?:anter|io)|c(?:o(?:ff)?i|row)|melo|rame|oma|yar)n|(?:s(?:t(?:uck_out_tongue_closed_ey|_vincent_grenadin)|kull_and_crossbon|unglass|pad)|(?:french_souther|palestinia)n_territori|(?:face_with_spiral|kissing_smiling)_ey|united_arab_emirat|kissing_closed_ey|(?:clinking_|dark_sun|eye)glass|(?:no_mobile_|head)phon|womans_cloth|b(?:allet_sho|lueberri)|philippin|(?:no_bicyc|seychel)l|roll_ey|(?:cher|a)ri|p(?:ancak|isc)|maldiv|leav)es|(?:f(?:amily_(?:woman_(?:woman_)?|man_(?:woman_|man_)?)girl_gir|earfu)|(?:woman_playing_hand|m(?:an_playing_hand|irror_)|c(?:onfetti|rystal)_|volley|track|base|8)bal|(?:(?:m(?:ailbox_with_(?:no_)?m|onor)|cockt|e\-m)a|(?:person|bride|woman)_with_ve|man_with_ve|light_ra|braz|ema)i|(?:transgender|baby)_symbo|passport_contro|(?:arrow_(?:down|up)_sm|rice_b|footb)al|(?:dromedary_cam|ferris_whe|love_hot|high_he|pretz|falaf|isra)e|page_with_cur|me(?:dical_symbo|ta)|(?:n(?:ewspaper_ro|o_be)|bellhop_be)l|rugby_footbal|s(?:chool_satche|(?:peak|ee)_no_evi|oftbal|crol|anda|nai|hel)|(?:peace|atom)_symbo|hear_no_evi|cora|hote|bage|labe|rof|ow)l|(?:(?:negative_squared_cross|heavy_exclamation|part_alternation)_mar|(?:eight_spoked_)?asteris|(?:ballot_box_with_che|(?:(?:mantelpiece|alarm|timer)_c|un)lo|(?:ha(?:(?:mmer_and|ir)_p|tch(?:ing|ed)_ch)|baby_ch|joyst)i|railway_tra|lipsti|peaco)c|heavy_check_mar|white_check_mar|tr(?:opical_drin|uc)|national_par|pickup_truc|diving_mas|floppy_dis|s(?:tar_struc|hamroc|kun|har)|chipmun|denmar|duc|hoo|lin)k|(?:leftwards_arrow_with_h|arrow_right_h|(?:o(?:range|pen)|closed|blue)_b)ook|(?:woman_playing_water_pol|m(?:an(?:_(?:playing_water_pol|with_gua_pi_ma|in_tuxed)|g)|ontenegr|o(?:roc|na)c|e(?:xic|tr|m))|(?:perso|woma)n_in_tuxed|(?:trinidad_toba|vir)g|water_buffal|b(?:urkina_fas|a(?:mbo|nj)|ent)|puerto_ric|water_pol|flaming|kangaro|(?:mosqu|burr)it|(?:avoc|torn)ad|curaca|lesoth|potat|ko(?:sov|k)|tomat|d(?:ang|od)|yo_y|hoch|t(?:ac|og)|zer)o|(?:c(?:entral_african|zech)|dominican)_republic|(?:eight_pointed_black_s|six_pointed_s|qa)tar|(?:business_suit_levitat|(?:classical_buil|breast_fee)d|(?:woman_cartwhee|m(?:an_(?:cartwhee|jugg)|en_wrest)|women_wrest|woman_jugg|face_exha|cartwhee|wrest|dump)l|c(?:hildren_cross|amp)|woman_facepalm|woman_shrugg|man_(?:facepalm|shrugg)|people_hugg|(?:person_fe|woman_da|man_da)nc|fist_oncom|horse_rac|(?:no_smo|thin)k|laugh|s(?:eedl|mok)|park|w(?:arn|edd))ing|f(?:a(?:mily(?:_(?:woman_(?:woman_(?:girl|boy)|girl|boy)|man_(?:woman_(?:girl|boy)|man_(?:girl|boy)|girl|boy)))?|ctory)|o(?:u(?:ntain|r)|ot|g)|r(?:owning)?|i(?:re|s[ht])|ly|u)|(?:(?:(?:information_desk|handball|bearded)_|(?:frowning|ok)_|juggling_|mer)pers|(?:previous_track|p(?:lay_or_p)?ause|black_square|white_square|next_track|r(?:ecord|adio)|eject)_butt|(?:wa[nx]ing_(?:crescent|gibbous)_m|bowl_with_sp|crescent_m|racc)o|(?:b(?:ouncing_ball|lond_haired)|tipping_hand|pregnant|kneeling|deaf)_pers|s(?:t(?:_pierre_miquel|op_butt|ati)|tanding_pers|peech_ballo|auna_pers)|r(?:eminder_r)?ibb|thought_ballo|watermel|badmint|c(?:amero|ray)|le(?:ban|m)|oni|bis)on|(?:heavy_heart_exclama|building_construc|heart_decora|exclama)tion|(?:(?:triangular_flag_on_po|(?:(?:woman_)?technolog|m(?:ountain_bicycl|an_technolog)|bicycl)i|(?:wo)?man_scienti|(?:wo)?man_arti|s(?:afety_ve|cienti)|empty_ne)s|(?:vertical_)?traffic_ligh|(?:rescue_worker_helm|military_helm|nazar_amul|city_suns|wastebask|dropl|t(?:rump|oil)|bouqu|buck|magn|secr)e|one_piece_swimsui|(?:(?:arrow_(?:low|upp)er|point)_r|bridge_at_n|copyr|mag_r)igh|(?:bullettrain_fro|(?:potted_pl|croiss|e(?:ggpl|leph))a)n|s(?:t(?:ar_and_cresc|ud)en|cream_ca|mi(?:ley?|rk)_ca|(?:peed|ail)boa|hir)|(?:arrow_(?:low|upp)er|point)_lef|woman_astronau|r(?:o(?:tating_ligh|cke)|eceip)|heart_eyes_ca|man_astronau|(?:woman_stud|circus_t|man_stud|trid)en|(?:ringed_pla|file_cabi)ne|nut_and_bol|(?:older_)?adul|k(?:i(?:ssing_ca|wi_frui)|uwai|no)|(?:pouting_c|c(?:ut_of_m|old_sw)e|womans_h|montserr|(?:(?:motor_|row)b|lab_c)o|heartbe|toph)a|(?:woman_pil|honey_p|man_pil|[cp]arr|teap|rob)o|hiking_boo|arrow_lef|fist_righ|flashligh|f(?:ist_lef|ee)|black_ca|astronau|(?:c(?:hest|oco)|dough)nu|innocen|joy_ca|artis|(?:acce|egy)p|co(?:me|a)|pilo)t|(?:heavy_multiplication_|t\-re)x|(?:s(?:miling_face_with_te|piral_calend)|oncoming_police_c|chocolate_b|ra(?:ilway|cing)_c|police_c|polar_be|teddy_be|madagasc|blue_c|calend|myanm)ar|c(?:l(?:o(?:ud(?:_with_lightning)?|ck(?:1[0-2]?|[2-9]))|ap)?|o(?:uple(?:_with_heart|kiss)?|nstruction|mputer|ok|p|w)|a(?:r(?:d_index)?|mera)|r(?:icket|y)|h(?:art|ild))|(?:m(?:artial_arts_unifo|echanical_a)r|(?:cherry_)?blosso|b(?:aggage_clai|roo)|ice_?crea|facepal|mushroo|restroo|vietna|dru|yu)m|(?:woman_with_headscar|m(?:obile_phone_of|aple_lea)|fallen_lea|wol)f|(?:(?:closed_lock_with|old)_|field_hoc|ice_hoc|han|don)key|g(?:lobe_with_meridians|r(?:e(?:y_(?:exclama|ques)tion|e(?:n(?:_(?:square|circle|salad|apple|heart|book)|land)|ce)|y_heart|nada)|i(?:mac|nn)ing|apes)|u(?:inea_bissau|ernsey|am|n)|(?:(?:olfing|enie)_(?:wo)?|uards(?:wo)?)man|(?:inger_roo|oal_ne|hos)t|(?:uadeloup|ame_di|iraff|oos)e|ift_heart|i(?:braltar|rl)|(?:uatemal|(?:eorg|amb)i|orill|uyan|han)a|uide_dog|(?:oggl|lov)es|arlic|emini|uitar|abon|oat|ear|b)|construction_worker|(?:(?:envelope_with|bow_and)_ar|left_right_ar|raised_eyeb)row|(?:(?:oncoming_automob|crocod)i|right_anger_bubb|l(?:eft_speech_bubb|otion_bott|ady_beet)|congo_brazzavil|eye_speech_bubb|(?:large_blue|orange|purple|yellow|brown)_circ|(?:(?:european|japanese)_cas|baby_bot)t|b(?:alance_sca|eet)|s(?:ewing_need|weat_smi)|(?:black|white|red)_circ|(?:motor|re)cyc|pood|turt|tama|waff|musc|eag)le|first_quarter_moon|s(?:m(?:all_red_triangle|i(?:ley?|rk))|t(?:uck_out_tongue|ar)|hopping|leeping|p(?:arkle|ider)|unrise|nowman|chool|cream|k(?:ull|i)|weat|ix|a)|(?:(?:b(?:osnia_herzegovi|ana)|wallis_futu|(?:french_gui|botsw)a|argenti|st_hele)n|(?:(?:equatorial|papua_new)_guin|north_kor|eritr)e|t(?:ristan_da_cunh|ad)|(?:(?:(?:french_poly|indo)ne|tuni)s|(?:new_caledo|ma(?:urita|cedo)|lithua|(?:tanz|alb|rom)a|arme|esto)n|diego_garc|s(?:audi_arab|t_luc|lov(?:ak|en)|omal|erb)|e(?:arth_as|thiop)|m(?:icrone|alay)s|(?:austra|mongo)l|c(?:ambod|roat)|(?:bulga|alge)r|(?:colom|nami|zam)b|boliv|l(?:iber|atv))i|(?:wheel_of_dhar|cine|pana)m|(?:(?:(?:closed|beach|open)_)?umbrel|ceuta_melil|venezue|ang(?:uil|o)|koa)l|c(?:ongo_kinshas|anad|ub)|(?:western_saha|a(?:mpho|ndor)|zeb)r|american_samo|video_camer|m(?:o(?:vie_camer|ldov)|alt|eg)|(?:earth_af|costa_)ric|s(?:outh_afric|ri_lank|a(?:mo|nt))|bubble_te|(?:antarct|jama)ic|ni(?:caragu|geri|nj)|austri|pi(?:nat|zz)|arub|k(?:eny|aab)|indi|u7a7|l(?:lam|ib[ry])|dn)a|l(?:ast_quarter_moon|o(?:tus|ck)|ips|eo)|(?:hammer_and_wren|c(?:ockroa|hur)|facepun|wren|crut|pun)ch|s(?:nowman_with_snow|ignal_strength|weet_potato|miling_imp|p(?:ider_web|arkle[rs])|w(?:im_brief|an)|a(?:n(?:_marino|dwich)|lt)|topwatch|t(?:a(?:dium|r[2s])|ew)|l(?:e(?:epy|d)|oth)|hrimp|yria|carf|(?:hee|oa)p|ea[lt]|h(?:oe|i[pt])|o[bs])|(?:s(?:tuffed_flatbre|p(?:iral_notep|eaking_he))|(?:exploding_h|baguette_br|flatbr)e)ad|(?:arrow_(?:heading|double)_u|(?:p(?:lace_of_wor|assenger_)sh|film_str|tul)i|page_facing_u|biting_li|(?:billed_c|world_m)a|mouse_tra|(?:curly_lo|busst)o|thumbsu|lo(?:llip)?o|clam|im)p|(?:anatomical|light_blue|sparkling|kissing|mending|orange|purple|yellow|broken|b(?:rown|l(?:ack|ue))|pink)_heart|(?:(?:transgender|black)_fla|mechanical_le|(?:checkered|pirate)_fla|electric_plu|rainbow_fla|poultry_le|service_do|white_fla|luxembour|fried_eg|moneyba|h(?:edgeh|otd)o|shru)g|(?:cloud_with|mountain)_snow|(?:(?:antigua_barb|berm)u|(?:kh|ug)an|rwan)da|(?:3r|2n)d_place_medal|1(?:st_place_medal|234|00)|lotus_position|(?:w(?:eight_lift|alk)|climb)ing|(?:(?:cup_with_str|auto_ricksh)a|carpentry_sa|windo|jigsa)w|(?:(?:couch_and|diya)_la|f(?:ried_shri|uelpu))mp|(?:woman_mechan|man_mechan|alemb)ic|(?:european_un|accord|collis|reun)ion|(?:flight_arriv|hospit|portug|seneg|nep)al|card_file_box|(?:(?:oncoming_)?tax|m(?:o(?:unt_fuj|ya)|alaw)|s(?:paghett|ush|ar)|b(?:r(?:occol|une)|urund)|(?:djibou|kiriba)t|hait|fij)i|(?:shopping_c|white_he|bar_ch)art|d(?:isappointed|ominica|e(?:sert)?)|raising_hand|super(?:villain|hero)|b(?:e(?:verage_box|ers|d)|u(?:bbles|lb|g)|i(?:k(?:ini|e)|rd)|o(?:o(?:ks|t)|a[rt]|y)|read|a[cn]k)|ra(?:ised_hands|bbit2|t)|(?:hindu_tem|ap)ple|thong_sandal|a(?:r(?:row_(?:right|down|up)|t)|bc?|nt)?|r(?:a(?:i(?:sed_hand|nbow)|bbit|dio|m)|u(?:nning)?|epeat|i(?:ng|ce)|o(?:ck|se))|takeout_box|(?:flying_|mini)disc|(?:(?:interrob|yin_y)a|b(?:o(?:omera|wli)|angba)|(?:ping_p|hong_k)o|calli|mahjo)ng|b(?:a(?:llot_box|sket|th?|by)|o(?:o(?:k(?:mark)?|m)|w)|u(?:tter|s)|e(?:ll|er?|ar))?|heart_eyes|basketball|(?:paperclip|dancer|ticket)s|point_up_2|(?:wo)?man_cook|n(?:ew(?:spaper)?|o(?:tebook|_entry)|iger)|t(?:e(?:lephone|a)|o(?:oth|p)|r(?:oll)?|wo)|h(?:o(?:u(?:rglass|se)|rse)|a(?:mmer|nd)|eart)|paperclip|full_moon|(?:b(?:lack_ni|athtu|om)|her)b|(?:long|oil)_drum|pineapple|(?:clock(?:1[0-2]?|[2-9])3|u6e8)0|p(?:o(?:int_up|ut)|r(?:ince|ay)|i(?:ck|g)|en)|e(?:nvelope|ight|u(?:ro)?|gg|ar|ye|s)|m(?:o(?:u(?:ntain|se)|nkey|on)|echanic|a(?:ilbox|g|n)|irror)?|new_moon|d(?:iamonds|olls|art)|question|k(?:iss(?:ing)?|ey)|haircut|no_good|(?:vampir|massag)e|g(?:olf(?:ing)?|u(?:inea|ard)|e(?:nie|m)|ift|rin)|h(?:a(?:ndbag|msa)|ouses|earts|ut)|postbox|toolbox|(?:pencil|t(?:rain|iger)|whale|cat|dog)2|belgium|(?:volca|kimo)no|(?:vanuat|tuval|pala|naur|maca)u|tokelau|o(?:range|ne?|m|k)?|office|dancer|ticket|dragon|pencil|zombie|w(?:o(?:mens|rm|od)|ave|in[gk]|c)|m(?:o(?:sque|use2)|e(?:rman|ns)|a(?:li|sk))|jersey|tshirt|w(?:heel|oman)|dizzy|j(?:apan|oy)|t(?:rain|iger)|whale|fairy|a(?:nge[lr]|bcd|tm)|c(?:h(?:a(?:ir|d)|ile)|a(?:ndy|mel)|urry|rab|o(?:rn|ol|w2)|[dn])|p(?:ager|e(?:a(?:ch|r)|ru)|i(?:g2|ll|e)|oop)|n(?:otes|ine)|t(?:onga|hree|ent|ram|[mv])|f(?:erry|r(?:ies|ee|og)|ax)|u(?:7(?:533|981|121)|5(?:5b6|408|272)|6(?:307|70[89]))|mage|e(?:yes|nd)|i(?:ra[nq]|t)|cat|dog|elf|z(?:zz|ap)|yen|j(?:ar|p)|leg|id|u[kps]|ng|o[2x]|vs|kr|[\+\x2D]1|x|v)(:) + name + string.emoji.mdx + captures + + 1 + + name + punctuation.definition.gemoji.begin.mdx + + 2 + + name + keyword.control.gemoji.mdx + + 3 + + name + punctuation.definition.gemoji.end.mdx + + + + extension-github-mention + + match + (?<![0-9A-Za-z_`])(@)((?:[0-9A-Za-z][0-9A-Za-z-]{0,38})(?:\/(?:[0-9A-Za-z][0-9A-Za-z-]{0,38}))?)(?![0-9A-Za-z_`]) + name + string.mention.mdx + captures + + 1 + + name + punctuation.definition.mention.begin.mdx + + 2 + + name + string.other.link.mention.mdx + + + + extension-github-reference + + patterns + + + match + (?<![0-9A-Za-z_])(?:((?i:ghsa-|cve-))([A-Za-z0-9]+)|((?i:gh-|#))([0-9]+))(?![0-9A-Za-z_]) + name + string.reference.mdx + captures + + 1 + + name + punctuation.definition.reference.begin.mdx + + 2 + + name + string.other.link.reference.security-advisory.mdx + + 3 + + name + punctuation.definition.reference.begin.mdx + + 4 + + name + string.other.link.reference.issue-or-pr.mdx + + + + + match + (?<![^\t\n\r \(@\[\{])((?:[0-9A-Za-z][0-9A-Za-z-]{0,38})(?:\/(?:(?:\.git[0-9A-Za-z_-]|\.(?!git)|[0-9A-Za-z_-])+))?)(#)([0-9]+)(?![0-9A-Za-z_]) + name + string.reference.mdx + captures + + 1 + + name + string.other.link.reference.user.mdx + + 2 + + name + punctuation.definition.reference.begin.mdx + + 3 + + name + string.other.link.reference.issue-or-pr.mdx + + + + + + extension-math-flow + + begin + (?:^|\G)[\t ]*(\${2,})([^\n\r\$]*)$ + beginCaptures + + 1 + + name + string.other.begin.math.flow.mdx + + 2 + + patterns + + + include + #markdown-string + + + + + contentName + markup.raw.math.flow.mdx + end + (\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.math.flow.mdx + + + name + markup.code.other.mdx + + extension-math-text + + match + (?<!\$)(\${2,})(?!\$)(.+?)(?<!\$)(\1)(?!\$) + captures + + 1 + + name + string.other.begin.math.mdx + + 2 + + name + markup.raw.math.mdx markup.inline.raw.math.mdx + + 3 + + name + string.other.end.math.mdx + + + + extension-mdx-esm + + name + meta.embedded.tsx + begin + (?:^|\G)(?=(?i:export|import)[ ]) + end + ^(?=[\t ]*$)|$ + patterns + + + include + source.tsx#statements + + + + extension-mdx-expression-flow + + begin + (?:^|\G)[\t ]*(\{)(?!.*\}[\t ]*.) + beginCaptures + + 1 + + name + string.other.begin.expression.mdx.js + + + contentName + meta.embedded.tsx + end + (\})(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.begin.expression.mdx.js + + + patterns + + + include + source.tsx#expression + + + + extension-mdx-expression-text + + begin + \{ + beginCaptures + + 0 + + name + string.other.begin.expression.mdx.js + + + contentName + meta.embedded.tsx + end + \} + endCaptures + + 0 + + name + string.other.begin.expression.mdx.js + + + patterns + + + include + source.tsx#expression + + + + extension-mdx-jsx-flow + + begin + (?<=^|\G|\>)[\t ]*(<)(?=(?![\t\n\r ]))(?:\s*(/))?(?:\s*(?:(?:((?:[_$[:alpha:]][-_$[:alnum:]]*))\s*(:)\s*((?:[_$[:alpha:]][-_$[:alnum:]]*)))|((?:(?:[_$[:alpha:]][_$[:alnum:]]*)(?:\s*\.\s*(?:[_$[:alpha:]][-_$[:alnum:]]*))+))|((?:[_$[:upper:]][_$[:alnum:]]*))|((?:[_$[:alpha:]][-_$[:alnum:]]*)))(?=[\s\/\>\{]))? + beginCaptures + + 1 + + name + punctuation.definition.tag.end.jsx + + 2 + + name + punctuation.definition.tag.closing.jsx + + 3 + + name + entity.name.tag.namespace.jsx + + 4 + + name + punctuation.separator.namespace.jsx + + 5 + + name + entity.name.tag.local.jsx + + 6 + + name + support.class.component.jsx + + 7 + + name + support.class.component.jsx + + 8 + + name + entity.name.tag.jsx + + + patterns + + + include + source.tsx#jsx-tag-attribute-name + + + include + source.tsx#jsx-tag-attribute-assignment + + + include + source.tsx#jsx-string-double-quoted + + + include + source.tsx#jsx-string-single-quoted + + + include + source.tsx#jsx-evaluated-code + + + include + source.tsx#jsx-tag-attributes-illegal + + + end + (?:(\/)\s*)?(>) + endCaptures + + 1 + + name + punctuation.definition.tag.self-closing.jsx + + 2 + + name + punctuation.definition.tag.end.jsx + + + + extension-mdx-jsx-text + + begin + (<)(?=(?![\t\n\r ]))(?:\s*(/))?(?:\s*(?:(?:((?:[_$[:alpha:]][-_$[:alnum:]]*))\s*(:)\s*((?:[_$[:alpha:]][-_$[:alnum:]]*)))|((?:(?:[_$[:alpha:]][_$[:alnum:]]*)(?:\s*\.\s*(?:[_$[:alpha:]][-_$[:alnum:]]*))+))|((?:[_$[:upper:]][_$[:alnum:]]*))|((?:[_$[:alpha:]][-_$[:alnum:]]*)))(?=[\s\/\>\{]))? + beginCaptures + + 1 + + name + punctuation.definition.tag.end.jsx + + 2 + + name + punctuation.definition.tag.closing.jsx + + 3 + + name + entity.name.tag.namespace.jsx + + 4 + + name + punctuation.separator.namespace.jsx + + 5 + + name + entity.name.tag.local.jsx + + 6 + + name + support.class.component.jsx + + 7 + + name + support.class.component.jsx + + 8 + + name + entity.name.tag.jsx + + + patterns + + + include + source.tsx#jsx-tag-attribute-name + + + include + source.tsx#jsx-tag-attribute-assignment + + + include + source.tsx#jsx-string-double-quoted + + + include + source.tsx#jsx-string-single-quoted + + + include + source.tsx#jsx-evaluated-code + + + include + source.tsx#jsx-tag-attributes-illegal + + + end + (?:(\/)\s*)?(>) + endCaptures + + 1 + + name + punctuation.definition.tag.self-closing.jsx + + 2 + + name + punctuation.definition.tag.end.jsx + + + + extension-toml + + begin + \A\+{3}$ + end + ^\+{3}$ + beginCaptures + + 0 + + name + string.other.begin.toml + + + endCaptures + + 0 + + name + string.other.end.toml + + + contentName + meta.embedded.toml + patterns + + + include + source.toml + + + + extension-yaml + + begin + \A-{3}$ + end + ^-{3}$ + beginCaptures + + 0 + + name + string.other.begin.yaml + + + endCaptures + + 0 + + name + string.other.end.yaml + + + contentName + meta.embedded.yaml + patterns + + + include + source.yaml + + + + whatwg-html-data-character-reference-named-terminated + + match + (&)((?:C(?:(?:o(?:unterClockwiseCo)?|lockwiseCo)ntourIntegra|cedi)|(?:(?:Not(?:S(?:quareSu(?:per|b)set|u(?:cceeds|(?:per|b)set))|Precedes|Greater|Tilde|Less)|Not(?:Righ|Lef)tTriangle|(?:Not(?:(?:Succeed|Precede|Les)s|Greater)|(?:Precede|Succeed)s|Less)Slant|SquareSu(?:per|b)set|(?:Not(?:Greater|Tilde)|Tilde|Less)Full|RightTriangle|LeftTriangle|Greater(?:Slant|Full)|Precedes|Succeeds|Superset|NotHump|Subset|Tilde|Hump)Equ|int(?:er)?c|DotEqu)a|DoubleContourIntegra|(?:n(?:short)?parall|shortparall|p(?:arall|rur))e|(?:rightarrowta|l(?:eftarrowta|ced|ata|Ata)|sced|rata|perm|rced|rAta|ced)i|Proportiona|smepars|e(?:qvpars|pars|xc|um)|Integra|suphso|rarr[pt]|n(?:pars|tg)|l(?:arr[pt]|cei)|Rarrt|(?:hybu|fora)l|ForAl|[GKLNR-Tcknt]cedi|rcei|iexc|gime|fras|[uy]um|oso|dso|ium|Ium)l|D(?:o(?:uble(?:(?:L(?:ong(?:Left)?R|eftR)ight|L(?:ongL)?eft|UpDown|Right|Up)Arrow|Do(?:wnArrow|t))|wn(?:ArrowUpA|TeeA|a)rrow)|iacriticalDot|strok|ashv|cy)|(?:(?:(?:N(?:(?:otN)?estedGreater|ot(?:Greater|Less))|Less(?:Equal)?)Great|GreaterGreat|l[lr]corn|mark|east)e|Not(?:Double)?VerticalBa|(?:Not(?:Righ|Lef)tTriangleB|(?:(?:Righ|Lef)tDown|Right(?:Up)?|Left(?:Up)?)VectorB|RightTriangleB|Left(?:Triangle|Arrow)B|RightArrowB|V(?:er(?:ticalB|b)|b)|UpArrowB|l(?:ur(?:ds|u)h|dr(?:us|d)h|trP|owb|H)|profal|r(?:ulu|dld)h|b(?:igst|rvb)|(?:wed|ve[er])b|s(?:wn|es)w|n(?:wne|ese|sp|hp)|gtlP|d(?:oll|uh|H)|(?:hor|ov)b|u(?:dh|H)|r(?:lh|H)|ohb|hb|St)a|D(?:o(?:wn(?:(?:Left(?:Right|Tee)|RightTee)Vecto|(?:(?:Righ|Lef)tVector|Arrow)Ba)|ubleVerticalBa)|a(?:gge|r)|sc|f)|(?:(?:(?:Righ|Lef)tDown|(?:Righ|Lef)tUp)Tee|(?:Righ|Lef)tUpDown)Vecto|VerticalSeparato|(?:Left(?:Right|Tee)|RightTee)Vecto|less(?:eqq?)?gt|e(?:qslantgt|sc)|(?:RightF|LeftF|[lr]f)loo|u(?:[lr]corne|ar)|timesba|(?:plusa|cirs|apa)ci|U(?:arroci|f)|(?:dzigr|s(?:u(?:pl|br)|imr|[lr])|zigr|angz|nvH|l(?:tl|B)|r[Br])ar|UnderBa|(?:plus|harr|top|mid|of)ci|O(?:verBa|sc|f)|dd?agge|s(?:olba|sc)|g(?:t(?:rar|ci)|sc|f)|c(?:opys|u(?:po|ep)|sc|f)|(?:n(?:(?:v[lr]|w|r)A|l[Aa]|h[Aa]|eA)|x[hlr][Aa]|u(?:ua|da|A)|s[ew]A|rla|o[lr]a|rba|rAa|l[Ablr]a|h(?:oa|A)|era|d(?:ua|A)|cra|vA)r|o(?:lci|sc|ro|pa)|ropa|roar|l(?:o(?:pa|ar)|sc|Ar)|i(?:ma|s)c|ltci|dd?ar|a(?:ma|s)c|R(?:Bar|sc|f)|I(?:mac|f)|(?:u(?:ma|s)|oma|ema|Oma|Ema|[wyz]s|qs|ks|fs|Zs|Ys|Xs|Ws|Vs|Us|Ss|Qs|Ns|Ms|Ks|Is|Gs|Fs|Cs|Bs)c|Umac|x(?:sc|f)|v(?:sc|f)|rsc|n(?:ld|f)|m(?:sc|ld|ac|f)|rAr|h(?:sc|f)|b(?:sc|f)|psc|P(?:sc|f)|L(?:sc|ar|f)|jsc|J(?:sc|f)|E(?:sc|f)|[HT]sc|[yz]f|wf|tf|qf|pf|kf|jf|Zf|Yf|Xf|Wf|Vf|Tf|Sf|Qf|Nf|Mf|Kf|Hf|Gf|Ff|Cf|Bf)r|(?:Diacritical(?:Double)?A|[EINOSYZaisz]a)cute|(?:(?:N(?:egative(?:VeryThin|Thi(?:ck|n))|onBreaking)|NegativeMedium|ZeroWidth|VeryThin|Medium|Thi(?:ck|n))Spac|Filled(?:Very)?SmallSquar|Empty(?:Very)?SmallSquar|(?:N(?:ot(?:Succeeds|Greater|Tilde|Less)T|t)|DiacriticalT|VerticalT|PrecedesT|SucceedsT|NotEqualT|GreaterT|TildeT|EqualT|LessT|at|Ut|It)ild|(?:(?:DiacriticalG|[EIOUaiu]g)ra|(?:u|U)?bre|(?:o|e)?gra)v|(?:doublebar|curly|big|x)wedg|H(?:orizontalLin|ilbertSpac)|Double(?:Righ|Lef)tTe|(?:(?:measured|uw)ang|exponentia|dwang|ssmi|fema)l|(?:Poincarepla|reali|pho|oli)n|(?:black)?lozeng|(?:VerticalL|(?:prof|imag)l)in|SmallCircl|(?:black|dot)squar|rmoustach|l(?:moustach|angl)|(?:b(?:ack)?pr|(?:tri|xo)t|[qt]pr)im|[Tt]herefor|(?:DownB|[Gag]b)rev|(?:infint|nv[lr]tr)i|b(?:arwedg|owti)|an(?:dslop|gl)|(?:cu(?:rly)?v|rthr|lthr|b(?:ig|ar)v|xv)e|n(?:s(?:qsu[bp]|ccu)|prcu)|orslop|NewLin|maltes|Becaus|rangl|incar|(?:otil|Otil|t(?:ra|il))d|[inu]tild|s(?:mil|imn)|(?:sc|pr)cu|Wedg|Prim|Brev)e|(?:CloseCurly(?:Double)?Quo|OpenCurly(?:Double)?Quo|[ry]?acu)te|(?:Reverse(?:Up)?|Up)Equilibrium|C(?:apitalDifferentialD|(?:oproduc|(?:ircleD|enterD|d)o)t|on(?:grue|i)nt|conint|upCap|o(?:lone|pf)|OPY|hi)|(?:(?:(?:left)?rightsquig|(?:longleftr|twoheadr|nleftr|nLeftr|longr|hookr|nR|Rr)ight|(?:twohead|hook)left|longleft|updown|Updown|nright|Right|nleft|nLeft|down|up|Up)a|L(?:(?:ong(?:left)?righ|(?:ong)?lef)ta|eft(?:(?:right)?a|RightA|TeeA))|RightTeeA|LongLeftA|UpTeeA)rrow|(?:(?:RightArrow|Short|Upper|Lower)Left|(?:L(?:eftArrow|o(?:wer|ng))|LongLeft|Short|Upper)Right|ShortUp)Arrow|(?:b(?:lacktriangle(?:righ|lef)|ulle|no)|RightDoubleBracke|RightAngleBracke|Left(?:Doub|Ang)leBracke|(?:vartriangle|downharpoon|c(?:ircl|urv)earrow|upharpoon|looparrow)righ|(?:vartriangle|downharpoon|c(?:ircl|urv)earrow|upharpoon|looparrow|mapsto)lef|(?:UnderBrack|OverBrack|emptys|targ|Sups)e|diamondsui|c(?:ircledas|lubsui|are)|(?:spade|heart)sui|(?:(?:c(?:enter|t)|lmi|ino)d|(?:Triple|mD)D|n(?:otin|e)d|(?:ncong|doteq|su[bp]e|e[gl]s)d|l(?:ess|t)d|isind|c(?:ong|up|ap)?d|b(?:igod|N)|t(?:(?:ri)?d|opb)|s(?:ub|im)d|midd|g(?:tr?)?d|Lmid|DotD|(?:xo|ut|z)d|e(?:s?d|rD|fD|DD)|dtd|Zd|Id|Gd|Ed)o|realpar|i(?:magpar|iin)|S(?:uchTha|qr)|su[bp]mul|(?:(?:lt|i)que|gtque|(?:mid|low)a|e(?:que|xi))s|Produc|s(?:updo|e[cx])|r(?:parg|ec)|lparl|vangr|hamil|(?:homt|[lr]fis|ufis|dfis)h|phmma|t(?:wix|in)|quo|o(?:do|as)|fla|eDo)t|(?:(?:Square)?Intersecti|(?:straight|back|var)epsil|SquareUni|expectati|upsil|epsil|Upsil|eq?col|Epsil|(?:omic|Omic|rca|lca|eca|Sca|[NRTt]ca|Lca|Eca|[Zdz]ca|Dca)r|scar|ncar|herc|ccar|Ccar|iog|Iog)on|Not(?:S(?:quareSu(?:per|b)set|u(?:cceeds|(?:per|b)set))|Precedes|Greater|Tilde|Less)?|(?:(?:(?:Not(?:Reverse)?|Reverse)E|comp|E)leme|NotCongrue|(?:n[gl]|l)eqsla|geqsla|q(?:uat)?i|perc|iiii|coni|cwi|awi|oi)nt|(?:(?:rightleftharpo|leftrightharpo|quaterni)on|(?:(?:N(?:ot(?:NestedLess|Greater|Less)|estedLess)L|(?:eqslant|gtr(?:eqq?)?)l|LessL)e|Greater(?:Equal)?Le|cro)s|(?:rightright|leftleft|upup)arrow|rightleftarrow|(?:(?:(?:righ|lef)tthree|divideon|b(?:igo|ox)|[lr]o)t|InvisibleT)ime|downdownarrow|(?:(?:smallset|tri|dot|box)m|PlusM)inu|(?:RoundImpli|complex|Impli|Otim)e|C(?:ircle(?:Time|Minu|Plu)|ayley|ros)|(?:rationa|mode)l|NotExist|(?:(?:UnionP|MinusP|(?:b(?:ig[ou]|ox)|tri|s(?:u[bp]|im)|dot|xu|mn)p)l|(?:xo|u)pl|o(?:min|pl)|ropl|lopl|epl)u|otimesa|integer|e(?:linter|qual)|setminu|rarrbf|larrb?f|olcros|rarrf|mstpo|lesge|gesle|Exist|[lr]time|strn|napo|fltn|ccap|apo)s|(?:b(?:(?:lack|ig)triangledow|etwee)|(?:righ|lef)tharpoondow|(?:triangle|mapsto)dow|(?:nv|i)infi|ssetm|plusm|lagra|d(?:[lr]cor|isi)|c(?:ompf|aro)|s?frow|(?:hyph|curr)e|kgree|thor|ogo|ye)n|Not(?:Righ|Lef)tTriangle|(?:Up(?:Arrow)?|Short)DownArrow|(?:(?:n(?:triangle(?:righ|lef)t|succ|prec)|(?:trianglerigh|trianglelef|sqsu[bp]se|ques)t|backsim)e|lvertneq|gvertneq|(?:suc|pre)cneq|a(?:pprox|symp)e|(?:succ|prec|vee)e|circe)q|(?:UnderParenthes|OverParenthes|xn)is|(?:(?:Righ|Lef)tDown|Right(?:Up)?|Left(?:Up)?)Vector|D(?:o(?:wn(?:RightVector|LeftVector|Arrow|Tee)|t)|el|D)|l(?:eftrightarrows|br(?:k(?:sl[du]|e)|ac[ek])|tri[ef]|s(?:im[eg]|qb|h)|hard|a(?:tes|ngd|p)|o[pz]f|rm|gE|fr|eg|cy)|(?:NotHumpDownHum|(?:righ|lef)tharpoonu|big(?:(?:triangle|sqc)u|c[au])|HumpDownHum|m(?:apstou|lc)|(?:capbr|xsq)cu|smash|rarr[al]|(?:weie|sha)r|larrl|velli|(?:thin|punc)s|h(?:elli|airs)|(?:u[lr]c|vp)ro|d[lr]cro|c(?:upc[au]|apc[au])|thka|scna|prn?a|oper|n(?:ums|va|cu|bs)|ens|xc[au]|Ma)p|l(?:eftrightarrow|e(?:ftarrow|s(?:dot)?)?|moust|a(?:rrb?|te?|ng)|t(?:ri)?|sim|par|oz|l|g)|n(?:triangle(?:righ|lef)t|succ|prec)|SquareSu(?:per|b)set|(?:I(?:nvisibleComm|ot)|(?:varthe|iio)t|varkapp|(?:vars|S)igm|(?:diga|mco)mm|Cedill|lambd|Lambd|delt|Thet|omeg|Omeg|Kapp|Delt|nabl|zet|to[es]|rdc|ldc|iot|Zet|Bet|Et)a|b(?:lacktriangle|arwed|u(?:mpe?|ll)|sol|o(?:x[HVhv]|t)|brk|ne)|(?:trianglerigh|trianglelef|sqsu[bp]se|ques)t|RightT(?:riangl|e)e|(?:(?:varsu[bp]setn|su(?:psetn?|bsetn?))eq|nsu[bp]seteq|colone|(?:wedg|sim)e|nsime|lneq|gneq)q|DifferentialD|(?:(?:fall|ris)ingdots|(?:suc|pre)ccurly|ddots)eq|A(?:pplyFunction|ssign|(?:tild|grav|brev)e|acute|o(?:gon|pf)|lpha|(?:mac|sc|f)r|c(?:irc|y)|ring|Elig|uml|nd|MP)|(?:varsu[bp]setn|su(?:psetn?|bsetn?))eq|L(?:eft(?:T(?:riangl|e)e|Arrow)|l)|G(?:reaterEqual|amma)|E(?:xponentialE|quilibrium|sim|cy|TH|NG)|(?:(?:RightCeil|LeftCeil|varnoth|ar|Ur)in|(?:b(?:ack)?co|uri)n|vzigza|roan|loan|ffli|amal|sun|rin|n(?:tl|an)|Ran|Lan)g|(?:thick|succn?|precn?|less|g(?:tr|n)|ln|n)approx|(?:s(?:traightph|em)|(?:rtril|xu|u[lr]|xd|v[lr])tr|varph|l[lr]tr|b(?:sem|eps)|Ph)i|(?:circledd|osl|n(?:v[Dd]|V[Dd]|d)|hsl|V(?:vd|D)|Osl|v[Dd]|md)ash|(?:(?:RuleDelay|imp|cuw)e|(?:n(?:s(?:hort)?)?|short|rn)mi|D(?:Dotrah|iamon)|(?:i(?:nt)?pr|peri)o|odsol|llhar|c(?:opro|irmi)|(?:capa|anda|pou)n|Barwe|napi|api)d|(?:cu(?:rlyeq(?:suc|pre)|es)|telre|[ou]dbla|Udbla|Odbla|radi|lesc|gesc|dbla)c|(?:circled|big|eq|[is]|c|x|a|S|[hw]|W|H|G|E|C)circ|rightarrow|R(?:ightArrow|arr|e)|Pr(?:oportion)?|(?:longmapst|varpropt|p(?:lustw|ropt)|varrh|numer|(?:rsa|lsa|sb)qu|m(?:icr|h)|[lr]aqu|bdqu|eur)o|UnderBrace|ImaginaryI|B(?:ernoullis|a(?:ckslash|rv)|umpeq|cy)|(?:(?:Laplace|Mellin|zee)tr|Fo(?:uriertr|p)|(?:profsu|ssta)r|ordero|origo|[ps]op|nop|mop|i(?:op|mo)|h(?:op|al)|f(?:op|no)|dop|bop|Rop|Pop|Nop|Lop|Iop|Hop|Dop|[GJKMOQSTV-Zgjkoqvwyz]op|Bop)f|nsu[bp]seteq|t(?:ri(?:angleq|e)|imesd|he(?:tav|re4)|au)|O(?:verBrace|r)|(?:(?:pitchfo|checkma|t(?:opfo|b)|rob|rbb|l[bo]b)r|intlarh|b(?:brktbr|l(?:oc|an))|perten|NoBrea|rarrh|s[ew]arh|n[ew]arh|l(?:arrh|hbl)|uhbl|Hace)k|(?:NotCupC|(?:mu(?:lti)?|x)m|cupbrc)ap|t(?:riangle|imes|heta|opf?)|Precedes|Succeeds|Superset|NotEqual|(?:n(?:atural|exist|les)|s(?:qc[au]p|mte)|prime)s|c(?:ir(?:cled[RS]|[Ee])|u(?:rarrm|larrp|darr[lr]|ps)|o(?:mmat|pf)|aps|hi)|b(?:sol(?:hsu)?b|ump(?:eq|E)|ox(?:box|[Vv][HLRhlr]|[Hh][DUdu]|[DUdu][LRlr])|e(?:rnou|t[ah])|lk(?:34|1[24])|cy)|(?:l(?:esdot|squ|dqu)o|rsquo|rdquo|ngt)r|a(?:n(?:g(?:msda[a-h]|st|e)|d[dv])|st|p[Ee]|mp|fr|c[Edy])|(?:g(?:esdoto|E)|[lr]haru)l|(?:angrtvb|lrhar|nis)d|(?:(?:th(?:ic)?k|succn?|p(?:r(?:ecn?|n)?|lus)|rarr|l(?:ess|arr)|su[bp]|par|scn|g(?:tr|n)|ne|sc|n[glv]|ln|eq?)si|thetasy|ccupss|alefsy|botto)m|trpezium|(?:hks[ew]|dr?bk|bk)arow|(?:(?:[lr]a|d|c)empty|b(?:nequi|empty)|plank|nequi|odi)v|(?:(?:sc|rp|n)pol|point|fpart)int|(?:c(?:irf|wco)|awco)nint|PartialD|n(?:s(?:u[bp](?:set)?|c)|rarr|ot(?:ni|in)?|warr|e(?:arr)?|a(?:tur|p)|vlt|p(?:re?|ar)|um?|l[et]|ge|i)|n(?:atural|exist|les)|d(?:i(?:am(?:ond)?|v(?:ide)?)|tri|ash|ot|d)|backsim|l(?:esdot|squ|dqu)o|g(?:esdoto|E)|U(?:p(?:Arrow|si)|nion|arr)|angrtvb|p(?:l(?:anckh|us(?:d[ou]|[be]))|ar(?:sl|t)|r(?:od|nE|E)|erp|iv|m)|n(?:ot(?:niv[a-c]|in(?:v[a-c]|E))|rarr[cw]|s(?:u[bp][Ee]|c[er])|part|v(?:le|g[et])|g(?:es|E)|c(?:ap|y)|apE|lE|iv|Ll|Gg)|m(?:inus(?:du|b)|ale|cy|p)|rbr(?:k(?:sl[du]|e)|ac[ek])|(?:suphsu|tris|rcu|lcu)b|supdsub|(?:s[ew]a|n[ew]a)rrow|(?:b(?:ecaus|sim)|n(?:[lr]tri|bump)|csu[bp])e|equivDD|u(?:rcorn|lcorn|psi)|timesb|s(?:u(?:p(?:set)?|b(?:set)?)|q(?:su[bp]|u)|i(?:gma|m)|olb?|dot|mt|fr|ce?)|p(?:l(?:anck|us)|r(?:op|ec?)?|ara?|i)|o(?:times|r(?:d(?:er)?)?)|m(?:i(?:nusd?|d)|a(?:p(?:sto)?|lt)|u)|rmoust|g(?:e(?:s(?:dot|l)?|q)?|sim|n(?:ap|e)|t|l|g)|(?:spade|heart)s|c(?:u(?:rarr|larr|p)|o(?:m(?:ma|p)|lon|py|ng)|lubs|heck|cups|irc?|ent|ap)|colone|a(?:p(?:prox)?|n(?:g(?:msd|rt)?|d)|symp|f|c)|S(?:quare|u[bp]|c)|Subset|b(?:ecaus|sim)|vsu[bp]n[Ee]|s(?:u(?:psu[bp]|b(?:su[bp]|n[Ee]|E)|pn[Ee]|p[1-3E]|m)|q(?:u(?:ar[ef]|f)|su[bp]e)|igma[fv]|etmn|dot[be]|par|mid|hc?y|c[Ey])|f(?:rac(?:78|5[68]|45|3[458]|2[35]|1[2-68])|fr)|e(?:m(?:sp1[34]|ptyv)|psiv|c(?:irc|y)|t[ah]|ng|ll|fr|e)|(?:kappa|isins|vBar|fork|rho|phi|n[GL]t)v|divonx|V(?:dashl|ee)|gammad|G(?:ammad|cy|[Tgt])|[Ldhlt]strok|[HT]strok|(?:c(?:ylct|hc)|(?:s(?:oft|hch)|hard|S(?:OFT|HCH)|jser|J(?:ser|uk)|HARD|tsh|TSH|juk|iuk|I(?:uk|[EO])|zh|yi|nj|lj|k[hj]|gj|dj|ZH|Y[AIU]|NJ|LJ|K[HJ]|GJ|D[JSZ])c|ubrc|Ubrc|(?:yu|i[eo]|dz|v|p|f)c|TSc|SHc|CHc|Vc|Pc|Mc|Fc)y|(?:(?:wre|jm)at|dalet|a(?:ngs|le)p|imat|[lr]ds)h|[CLRUceglnou]acute|ff?llig|(?:f(?:fi|[ij])|sz|oe|ij|ae|OE|IJ)lig|r(?:a(?:tio|rr|ng)|tri|par|eal)|s[ew]arr|s(?:qc[au]p|mte)|prime|rarrb|i(?:n(?:fin|t)?|sin|t|i|c)|e(?:quiv|m(?:pty|sp)|p(?:si|ar)|cir|l|g)|kappa|isins|ncong|doteq|(?:wedg|sim)e|nsime|rsquo|rdquo|[lr]haru|V(?:dash|ert)|Tilde|lrhar|gamma|Equal|UpTee|n(?:[lr]tri|bump)|C(?:olon|up|ap)|v(?:arpi|ert)|u(?:psih|ml)|vnsu[bp]|r(?:tri[ef]|e(?:als|g)|a(?:rr[cw]|ng[de]|ce)|sh|lm|x)|rhard|sim[gl]E|i(?:sin[Ev]|mage|f[fr]|cy)|harrw|(?:n[gl]|l)eqq|g(?:sim[el]|tcc|e(?:qq|l)|nE|l[Eaj]|gg|ap)|ocirc|starf|utrif|d(?:trif|i(?:ams|e)|ashv|sc[ry]|fr|eg)|[du]har[lr]|T(?:HORN|a[bu])|(?:TRAD|[gl]vn)E|odash|[EUaeu]o(?:gon|pf)|alpha|[IJOUYgjuy]c(?:irc|y)|v(?:arr|ee)|succ|sim[gl]|harr|ln(?:ap|e)|lesg|(?:n[gl]|l)eq|ocir|star|utri|vBar|fork|su[bp]e|nsim|lneq|gneq|csu[bp]|zwn?j|yacy|x(?:opf|i)|scnE|o(?:r(?:d[fm]|v)|mid|lt|hm|gt|fr|cy|S)|scap|rsqb|ropf|ltcc|tsc[ry]|QUOT|[EOUYao]uml|rho|phi|n[GL]t|e[gl]s|ngt|I(?:nt|m)|nis|rfr|rcy|lnE|lEg|ufr|S(?:um|cy)|R(?:sh|ho)|psi|Ps?i|[NRTt]cy|L(?:sh|cy|[Tt])|kcy|Kcy|Hat|REG|[Zdz]cy|wr|lE|wp|Xi|Nu|Mu)(;) + name + constant.language.character-reference.named.html + captures + + 1 + + name + punctuation.definition.character-reference.begin.html + + 2 + + name + keyword.control.character-reference.html + + 3 + + name + punctuation.definition.character-reference.end.html + + + + commonmark-code-fenced-apib + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:api\x2dblueprint|(?:.*\.)?apib))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.apib.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.apib + patterns + + + include + text.html.markdown.source.gfm.apib + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:api\x2dblueprint|(?:.*\.)?apib))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.apib.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.apib + patterns + + + include + text.html.markdown.source.gfm.apib + + + + + + + + commonmark-code-fenced-asciidoc + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?(?:adoc|asciidoc)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.asciidoc.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.asciidoc + patterns + + + include + text.html.asciidoc + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?(?:adoc|asciidoc)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.asciidoc.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.asciidoc + patterns + + + include + text.html.asciidoc + + + + + + + + commonmark-code-fenced-c + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:dtrace|dtrace\x2dscript|oncrpc|rpc|rpcgen|unified\x2dparallel\x2dc|x\x2dbitmap|x\x2dpixmap|xdr|(?:.*\.)?(?:c|cats|h|idc|opencl|upc|xbm|xpm|xs)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.c.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.c + patterns + + + include + source.c + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:dtrace|dtrace\x2dscript|oncrpc|rpc|rpcgen|unified\x2dparallel\x2dc|x\x2dbitmap|x\x2dpixmap|xdr|(?:.*\.)?(?:c|cats|h|idc|opencl|upc|xbm|xpm|xs)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.c.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.c + patterns + + + include + source.c + + + + + + + + commonmark-code-fenced-clojure + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:clojure|rouge|(?:.*\.)?(?:boot|cl2|clj|cljc|cljs|cljs\.hl|cljscm|cljx|edn|hic|rg|wisp)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.clojure.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.clojure + patterns + + + include + source.clojure + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:clojure|rouge|(?:.*\.)?(?:boot|cl2|clj|cljc|cljs|cljs\.hl|cljscm|cljx|edn|hic|rg|wisp)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.clojure.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.clojure + patterns + + + include + source.clojure + + + + + + + + commonmark-code-fenced-coffee + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:coffee\x2dscript|coffeescript|(?:.*\.)?(?:_coffee|cjsx|coffee|cson|em|emberscript|iced)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.coffee.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.coffee + patterns + + + include + source.coffee + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:coffee\x2dscript|coffeescript|(?:.*\.)?(?:_coffee|cjsx|coffee|cson|em|emberscript|iced)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.coffee.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.coffee + patterns + + + include + source.coffee + + + + + + + + commonmark-code-fenced-console + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:pycon|python\x2dconsole))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.console.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.console + patterns + + + include + text.python.console + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:pycon|python\x2dconsole))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.console.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.console + patterns + + + include + text.python.console + + + + + + + + commonmark-code-fenced-cpp + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:ags|ags\x2dscript|asymptote|c\+\+|edje\x2ddata\x2dcollection|game\x2dmaker\x2dlanguage|swig|(?:.*\.)?(?:asc|ash|asy|c\+\+|cc|cp|cpp|cppm|cxx|edc|gml|h\+\+|hh|hpp|hxx|inl|ino|ipp|ixx|metal|re|tcc|tpp|txx)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.cpp.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.cpp + patterns + + + include + source.c++ + + + include + source.cpp + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:ags|ags\x2dscript|asymptote|c\+\+|edje\x2ddata\x2dcollection|game\x2dmaker\x2dlanguage|swig|(?:.*\.)?(?:asc|ash|asy|c\+\+|cc|cp|cpp|cppm|cxx|edc|gml|h\+\+|hh|hpp|hxx|inl|ino|ipp|ixx|metal|re|tcc|tpp|txx)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.cpp.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.cpp + patterns + + + include + source.c++ + + + include + source.cpp + + + + + + + + commonmark-code-fenced-cs + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:beef|c#|cakescript|csharp|(?:.*\.)?(?:bf|cake|cs|cs\.pp|csx|eq|linq|uno)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.cs.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.cs + patterns + + + include + source.cs + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:beef|c#|cakescript|csharp|(?:.*\.)?(?:bf|cake|cs|cs\.pp|csx|eq|linq|uno)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.cs.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.cs + patterns + + + include + source.cs + + + + + + + + commonmark-code-fenced-css + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?css))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.css.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.css + patterns + + + include + source.css + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?css))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.css.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.css + patterns + + + include + source.css + + + + + + + + commonmark-code-fenced-diff + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:udiff|(?:.*\.)?(?:diff|patch)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.diff.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.diff + patterns + + + include + source.diff + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:udiff|(?:.*\.)?(?:diff|patch)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.diff.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.diff + patterns + + + include + source.diff + + + + + + + + commonmark-code-fenced-dockerfile + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:containerfile|(?:.*\.)?dockerfile))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.dockerfile.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.dockerfile + patterns + + + include + source.dockerfile + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:containerfile|(?:.*\.)?dockerfile))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.dockerfile.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.dockerfile + patterns + + + include + source.dockerfile + + + + + + + + commonmark-code-fenced-elixir + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:elixir|(?:.*\.)?(?:ex|exs)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.elixir.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.elixir + patterns + + + include + source.elixir + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:elixir|(?:.*\.)?(?:ex|exs)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.elixir.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.elixir + patterns + + + include + source.elixir + + + + + + + + commonmark-code-fenced-elm + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?elm))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.elm.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.elm + patterns + + + include + source.elm + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?elm))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.elm.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.elm + patterns + + + include + source.elm + + + + + + + + commonmark-code-fenced-erlang + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:erlang|(?:.*\.)?(?:app|app\.src|erl|es|escript|hrl|xrl|yrl)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.erlang.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.erlang + patterns + + + include + source.erlang + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:erlang|(?:.*\.)?(?:app|app\.src|erl|es|escript|hrl|xrl|yrl)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.erlang.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.erlang + patterns + + + include + source.erlang + + + + + + + + commonmark-code-fenced-gitconfig + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:git\x2dconfig|gitmodules|(?:.*\.)?gitconfig))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.gitconfig.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.gitconfig + patterns + + + include + source.gitconfig + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:git\x2dconfig|gitmodules|(?:.*\.)?gitconfig))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.gitconfig.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.gitconfig + patterns + + + include + source.gitconfig + + + + + + + + commonmark-code-fenced-go + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:golang|(?:.*\.)?go))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.go.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.go + patterns + + + include + source.go + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:golang|(?:.*\.)?go))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.go.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.go + patterns + + + include + source.go + + + + + + + + commonmark-code-fenced-graphql + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?(?:gql|graphql|graphqls)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.graphql.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.graphql + patterns + + + include + source.graphql + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?(?:gql|graphql|graphqls)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.graphql.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.graphql + patterns + + + include + source.graphql + + + + + + + + commonmark-code-fenced-haskell + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:c2hs|c2hs\x2dhaskell|frege|haskell|(?:.*\.)?(?:chs|dhall|hs|hs\x2dboot|hsc)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.haskell.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.haskell + patterns + + + include + source.haskell + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:c2hs|c2hs\x2dhaskell|frege|haskell|(?:.*\.)?(?:chs|dhall|hs|hs\x2dboot|hsc)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.haskell.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.haskell + patterns + + + include + source.haskell + + + + + + + + commonmark-code-fenced-html + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:html|(?:.*\.)?(?:hta|htm|html\.hl|kit|mtml|xht|xhtml)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.html.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.html + patterns + + + include + text.html.basic + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:html|(?:.*\.)?(?:hta|htm|html\.hl|kit|mtml|xht|xhtml)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.html.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.html + patterns + + + include + text.html.basic + + + + + + + + commonmark-code-fenced-ini + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:altium|altium\x2ddesigner|dosini|(?:.*\.)?(?:cnf|dof|ini|lektorproject|outjob|pcbdoc|prefs|prjpcb|properties|schdoc|url)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.ini.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.ini + patterns + + + include + source.ini + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:altium|altium\x2ddesigner|dosini|(?:.*\.)?(?:cnf|dof|ini|lektorproject|outjob|pcbdoc|prefs|prjpcb|properties|schdoc|url)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.ini.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.ini + patterns + + + include + source.ini + + + + + + + + commonmark-code-fenced-java + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:chuck|unrealscript|(?:.*\.)?(?:ck|jav|java|jsh|uc)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.java.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.java + patterns + + + include + source.java + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:chuck|unrealscript|(?:.*\.)?(?:ck|jav|java|jsh|uc)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.java.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.java + patterns + + + include + source.java + + + + + + + + commonmark-code-fenced-js + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:cycript|javascript\+erb|json\x2dwith\x2dcomments|node|qt\x2dscript|(?:.*\.)?(?:_js|bones|cjs|code\x2dsnippets|code\x2dworkspace|cy|es6|jake|javascript|js|js\.erb|jsb|jscad|jsfl|jslib|jsm|json5|jsonc|jsonld|jspre|jss|jsx|mjs|njs|pac|sjs|ssjs|sublime\x2dbuild|sublime\x2dcolor\x2dscheme|sublime\x2dcommands|sublime\x2dcompletions|sublime\x2dkeymap|sublime\x2dmacro|sublime\x2dmenu|sublime\x2dmousemap|sublime\x2dproject|sublime\x2dsettings|sublime\x2dtheme|sublime\x2dworkspace|sublime_metrics|sublime_session|xsjs|xsjslib)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.js.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.js + patterns + + + include + source.js + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:cycript|javascript\+erb|json\x2dwith\x2dcomments|node|qt\x2dscript|(?:.*\.)?(?:_js|bones|cjs|code\x2dsnippets|code\x2dworkspace|cy|es6|jake|javascript|js|js\.erb|jsb|jscad|jsfl|jslib|jsm|json5|jsonc|jsonld|jspre|jss|jsx|mjs|njs|pac|sjs|ssjs|sublime\x2dbuild|sublime\x2dcolor\x2dscheme|sublime\x2dcommands|sublime\x2dcompletions|sublime\x2dkeymap|sublime\x2dmacro|sublime\x2dmenu|sublime\x2dmousemap|sublime\x2dproject|sublime\x2dsettings|sublime\x2dtheme|sublime\x2dworkspace|sublime_metrics|sublime_session|xsjs|xsjslib)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.js.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.js + patterns + + + include + source.js + + + + + + + + commonmark-code-fenced-json + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:ecere\x2dprojects|ipython\x2dnotebook|jupyter\x2dnotebook|max|max/msp|maxmsp|oasv2\x2djson|oasv3\x2djson|(?:.*\.)?(?:4dform|4dproject|avsc|epj|geojson|gltf|har|ice|ipynb|json|json|json|json\x2dtmlanguage|jsonl|maxhelp|maxpat|maxproj|mcmeta|mxt|pat|sarif|tfstate|tfstate\.backup|topojson|webapp|webmanifest|yy|yyp)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.json.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.json + patterns + + + include + source.json + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:ecere\x2dprojects|ipython\x2dnotebook|jupyter\x2dnotebook|max|max/msp|maxmsp|oasv2\x2djson|oasv3\x2djson|(?:.*\.)?(?:4dform|4dproject|avsc|epj|geojson|gltf|har|ice|ipynb|json|json|json|json\x2dtmlanguage|jsonl|maxhelp|maxpat|maxproj|mcmeta|mxt|pat|sarif|tfstate|tfstate\.backup|topojson|webapp|webmanifest|yy|yyp)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.json.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.json + patterns + + + include + source.json + + + + + + + + commonmark-code-fenced-julia + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:julia|(?:.*\.)?jl))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.julia.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.julia + patterns + + + include + source.julia + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:julia|(?:.*\.)?jl))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.julia.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.julia + patterns + + + include + source.julia + + + + + + + + commonmark-code-fenced-kotlin + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:gradle\x2dkotlin\x2ddsl|kotlin|(?:.*\.)?(?:gradle\.kts|kt|ktm|kts)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.kotlin.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.kotlin + patterns + + + include + source.kotlin + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:gradle\x2dkotlin\x2ddsl|kotlin|(?:.*\.)?(?:gradle\.kts|kt|ktm|kts)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.kotlin.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.kotlin + patterns + + + include + source.kotlin + + + + + + + + commonmark-code-fenced-less + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:less\x2dcss|(?:.*\.)?less))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.less.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.less + patterns + + + include + source.css.less + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:less\x2dcss|(?:.*\.)?less))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.less.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.less + patterns + + + include + source.css.less + + + + + + + + commonmark-code-fenced-lua + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?(?:fcgi|lua|nse|p8|pd_lua|rbxs|rockspec|wlua)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.lua.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.lua + patterns + + + include + source.lua + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?(?:fcgi|lua|nse|p8|pd_lua|rbxs|rockspec|wlua)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.lua.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.lua + patterns + + + include + source.lua + + + + + + + + commonmark-code-fenced-makefile + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:bsdmake|mf|(?:.*\.)?(?:mak|make|makefile|mk|mkfile)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.makefile.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.makefile + patterns + + + include + source.makefile + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:bsdmake|mf|(?:.*\.)?(?:mak|make|makefile|mk|mkfile)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.makefile.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.makefile + patterns + + + include + source.makefile + + + + + + + + commonmark-code-fenced-md + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:md|pandoc|rmarkdown|(?:.*\.)?(?:livemd|markdown|mdown|mdwn|mkd|mkdn|mkdown|qmd|rmd|ronn|scd|workbook)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.md.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.md + patterns + + + include + text.md + + + include + source.gfm + + + include + text.html.markdown + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:md|pandoc|rmarkdown|(?:.*\.)?(?:livemd|markdown|mdown|mdwn|mkd|mkdn|mkdown|qmd|rmd|ronn|scd|workbook)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.md.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.md + patterns + + + include + text.md + + + include + source.gfm + + + include + text.html.markdown + + + + + + + + commonmark-code-fenced-mdx + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?mdx))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.mdx.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.mdx + patterns + + + include + source.mdx + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?mdx))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.mdx.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.mdx + patterns + + + include + source.mdx + + + + + + + + commonmark-code-fenced-objc + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:obj\x2dc|objc|objective\x2dc|objectivec))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.objc.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.objc + patterns + + + include + source.objc + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:obj\x2dc|objc|objective\x2dc|objectivec))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.objc.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.objc + patterns + + + include + source.objc + + + + + + + + commonmark-code-fenced-perl + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:cperl|(?:.*\.)?(?:cgi|perl|ph|pl|plx|pm|psgi|t)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.perl.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.perl + patterns + + + include + source.perl + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:cperl|(?:.*\.)?(?:cgi|perl|ph|pl|plx|pm|psgi|t)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.perl.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.perl + patterns + + + include + source.perl + + + + + + + + commonmark-code-fenced-php + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:html\+php|inc|php|(?:.*\.)?(?:aw|ctp|php3|php4|php5|phps|phpt|phtml)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.php.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.php + patterns + + + include + text.html.php + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:html\+php|inc|php|(?:.*\.)?(?:aw|ctp|php3|php4|php5|phps|phpt|phtml)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.php.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.php + patterns + + + include + text.html.php + + + + + + + + commonmark-code-fenced-python + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:bazel|easybuild|python|python3|rusthon|snakemake|starlark|xonsh|(?:.*\.)?(?:bzl|eb|gyp|gypi|lmi|py|py3|pyde|pyi|pyp|pyt|pyw|rpy|sage|sagews|smk|snakefile|spec|tac|wsgi|xpy|xsh)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.python.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.python + patterns + + + include + source.python + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:bazel|easybuild|python|python3|rusthon|snakemake|starlark|xonsh|(?:.*\.)?(?:bzl|eb|gyp|gypi|lmi|py|py3|pyde|pyi|pyp|pyt|pyw|rpy|sage|sagews|smk|snakefile|spec|tac|wsgi|xpy|xsh)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.python.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.python + patterns + + + include + source.python + + + + + + + + commonmark-code-fenced-r + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:rscript|splus|(?:.*\.)?(?:r|rd|rsx)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.r.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.r + patterns + + + include + source.r + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:rscript|splus|(?:.*\.)?(?:r|rd|rsx)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.r.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.r + patterns + + + include + source.r + + + + + + + + commonmark-code-fenced-raku + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:perl\x2d6|perl6|pod\x2d6|(?:.*\.)?(?:6pl|6pm|nqp|p6|p6l|p6m|pl6|pm6|pod|pod6|raku|rakumod)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.raku.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.raku + patterns + + + include + source.raku + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:perl\x2d6|perl6|pod\x2d6|(?:.*\.)?(?:6pl|6pm|nqp|p6|p6l|p6m|pl6|pm6|pod|pod6|raku|rakumod)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.raku.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.raku + patterns + + + include + source.raku + + + + + + + + commonmark-code-fenced-ruby + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:jruby|macruby|(?:.*\.)?(?:builder|druby|duby|eye|gemspec|god|jbuilder|mirah|mspec|pluginspec|podspec|prawn|rabl|rake|rb|rbi|rbuild|rbw|rbx|ru|ruby|thor|watchr)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.ruby.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.ruby + patterns + + + include + source.ruby + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:jruby|macruby|(?:.*\.)?(?:builder|druby|duby|eye|gemspec|god|jbuilder|mirah|mspec|pluginspec|podspec|prawn|rabl|rake|rb|rbi|rbuild|rbw|rbx|ru|ruby|thor|watchr)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.ruby.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.ruby + patterns + + + include + source.ruby + + + + + + + + commonmark-code-fenced-rust + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:rust|(?:.*\.)?(?:rs|rs\.in)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.rust.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.rust + patterns + + + include + source.rust + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:rust|(?:.*\.)?(?:rs|rs\.in)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.rust.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.rust + patterns + + + include + source.rust + + + + + + + + commonmark-code-fenced-scala + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?(?:kojo|sbt|sc|scala)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.scala.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.scala + patterns + + + include + source.scala + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?(?:kojo|sbt|sc|scala)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.scala.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.scala + patterns + + + include + source.scala + + + + + + + + commonmark-code-fenced-scss + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?scss))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.scss.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.scss + patterns + + + include + source.css.scss + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?scss))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.scss.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.scss + patterns + + + include + source.css.scss + + + + + + + + commonmark-code-fenced-shell + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:abuild|alpine\x2dabuild|apkbuild|envrc|gentoo\x2debuild|gentoo\x2declass|openrc|openrc\x2drunscript|shell|shell\x2dscript|(?:.*\.)?(?:bash|bats|command|csh|ebuild|eclass|ksh|sh|sh\.in|tcsh|tmux|tool|zsh|zsh\x2dtheme)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.shell.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.shell + patterns + + + include + source.shell + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:abuild|alpine\x2dabuild|apkbuild|envrc|gentoo\x2debuild|gentoo\x2declass|openrc|openrc\x2drunscript|shell|shell\x2dscript|(?:.*\.)?(?:bash|bats|command|csh|ebuild|eclass|ksh|sh|sh\.in|tcsh|tmux|tool|zsh|zsh\x2dtheme)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.shell.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.shell + patterns + + + include + source.shell + + + + + + + + commonmark-code-fenced-shell-session + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:bash\x2dsession|console|shellsession|(?:.*\.)?sh\x2dsession))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.shell-session.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.shell-session + patterns + + + include + text.shell-session + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:bash\x2dsession|console|shellsession|(?:.*\.)?sh\x2dsession))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.shell-session.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.shell-session + patterns + + + include + text.shell-session + + + + + + + + commonmark-code-fenced-sql + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:plpgsql|sqlpl|(?:.*\.)?(?:cql|db2|ddl|mysql|pgsql|prc|sql|sql|sql|tab|udf|viw)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.sql.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.sql + patterns + + + include + source.sql + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:plpgsql|sqlpl|(?:.*\.)?(?:cql|db2|ddl|mysql|pgsql|prc|sql|sql|sql|tab|udf|viw)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.sql.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.sql + patterns + + + include + source.sql + + + + + + + + commonmark-code-fenced-svg + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?svg))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.svg.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.svg + patterns + + + include + text.xml.svg + + + include + text.xml + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?svg))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.svg.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.svg + patterns + + + include + text.xml.svg + + + include + text.xml + + + + + + + + commonmark-code-fenced-swift + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?swift))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.swift.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.swift + patterns + + + include + source.swift + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?swift))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.swift.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.swift + patterns + + + include + source.swift + + + + + + + + commonmark-code-fenced-toml + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?toml))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.toml.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.toml + patterns + + + include + source.toml + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?toml))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.toml.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.toml + patterns + + + include + source.toml + + + + + + + + commonmark-code-fenced-ts + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:typescript|(?:.*\.)?(?:cts|mts|ts)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.ts.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.ts + patterns + + + include + source.ts + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:typescript|(?:.*\.)?(?:cts|mts|ts)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.ts.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.ts + patterns + + + include + source.ts + + + + + + + + commonmark-code-fenced-tsx + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:(?:.*\.)?tsx))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.tsx.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.tsx + patterns + + + include + source.tsx + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:(?:.*\.)?tsx))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.tsx.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.tsx + patterns + + + include + source.tsx + + + + + + + + commonmark-code-fenced-vbnet + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:fb|freebasic|realbasic|vb\x2d\.net|vb\.net|vbnet|vbscript|visual\x2dbasic|visual\x2dbasic\x2d\.net|(?:.*\.)?(?:bi|rbbas|rbfrm|rbmnu|rbres|rbtbar|rbuistate|vb|vbhtml|vbs)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.vbnet.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.vbnet + patterns + + + include + source.vbnet + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:fb|freebasic|realbasic|vb\x2d\.net|vb\.net|vbnet|vbscript|visual\x2dbasic|visual\x2dbasic\x2d\.net|(?:.*\.)?(?:bi|rbbas|rbfrm|rbmnu|rbres|rbtbar|rbuistate|vb|vbhtml|vbs)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.vbnet.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.vbnet + patterns + + + include + source.vbnet + + + + + + + + commonmark-code-fenced-xml + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:collada|eagle|labview|web\x2dontology\x2dlanguage|xpages|(?:.*\.)?(?:adml|admx|ant|axaml|axml|brd|builds|ccproj|ccxml|clixml|cproject|cscfg|csdef|csproj|ct|dae|depproj|dita|ditamap|ditaval|dll\.config|dotsettings|filters|fsproj|fxml|glade|gmx|grxml|hzp|iml|ivy|jelly|jsproj|kml|launch|lvclass|lvlib|lvproj|mdpolicy|mjml|mxml|natvis|ndproj|nproj|nuspec|odd|osm|owl|pkgproj|proj|props|ps1xml|psc1|pt|qhelp|rdf|resx|rss|sch|sch|scxml|sfproj|shproj|srdf|storyboard|sublime\x2dsnippet|targets|tml|ui|urdf|ux|vbproj|vcxproj|vsixmanifest|vssettings|vstemplate|vxml|wixproj|wsdl|wsf|wxi|wxl|wxs|x3d|xacro|xaml|xib|xlf|xliff|xmi|xml|xml\.dist|xmp|xpl|xproc|xproj|xsd|xsp\x2dconfig|xsp\.metadata|xspec|xul|zcml)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.xml.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.xml + patterns + + + include + text.xml + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:collada|eagle|labview|web\x2dontology\x2dlanguage|xpages|(?:.*\.)?(?:adml|admx|ant|axaml|axml|brd|builds|ccproj|ccxml|clixml|cproject|cscfg|csdef|csproj|ct|dae|depproj|dita|ditamap|ditaval|dll\.config|dotsettings|filters|fsproj|fxml|glade|gmx|grxml|hzp|iml|ivy|jelly|jsproj|kml|launch|lvclass|lvlib|lvproj|mdpolicy|mjml|mxml|natvis|ndproj|nproj|nuspec|odd|osm|owl|pkgproj|proj|props|ps1xml|psc1|pt|qhelp|rdf|resx|rss|sch|sch|scxml|sfproj|shproj|srdf|storyboard|sublime\x2dsnippet|targets|tml|ui|urdf|ux|vbproj|vcxproj|vsixmanifest|vssettings|vstemplate|vxml|wixproj|wsdl|wsf|wxi|wxl|wxs|x3d|xacro|xaml|xib|xlf|xliff|xmi|xml|xml\.dist|xmp|xpl|xproc|xproj|xsd|xsp\x2dconfig|xsp\.metadata|xspec|xul|zcml)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.xml.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.xml + patterns + + + include + text.xml + + + + + + + + commonmark-code-fenced-yaml + + patterns + + + begin + (?:^|\G)[\t ]*(`{3,})(?:[\t ]*((?i:jar\x2dmanifest|kaitai\x2dstruct|oasv2\x2dyaml|oasv3\x2dyaml|unity3d\x2dasset|yaml|yml|(?:.*\.)?(?:anim|asset|ksy|lkml|lookml|mat|meta|mir|prefab|raml|reek|rviz|sublime\x2dsyntax|syntax|unity|yaml\x2dtmlanguage|yaml\.sed|yml\.mysql)))(?:[\t ]+((?:[^\n\r`])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.yaml.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.yaml + patterns + + + include + source.yaml + + + + + + + begin + (?:^|\G)[\t ]*(~{3,})(?:[\t ]*((?i:jar\x2dmanifest|kaitai\x2dstruct|oasv2\x2dyaml|oasv3\x2dyaml|unity3d\x2dasset|yaml|yml|(?:.*\.)?(?:anim|asset|ksy|lkml|lookml|mat|meta|mir|prefab|raml|reek|rviz|sublime\x2dsyntax|syntax|unity|yaml\x2dtmlanguage|yaml\.sed|yml\.mysql)))(?:[\t ]+((?:[^\n\r])+))?)(?:[\t ]*$) + beginCaptures + + 1 + + name + string.other.begin.code.fenced.mdx + + 2 + + name + entity.name.function.mdx + patterns + + + include + #markdown-string + + + + 3 + + patterns + + + include + #markdown-string + + + + + end + (?:^|\G)[\t ]*(\1)(?:[\t ]*$) + endCaptures + + 1 + + name + string.other.end.code.fenced.mdx + + + name + markup.code.yaml.mdx + patterns + + + begin + (^|\G)(\s*)(.*) + while + (^|\G)(?![\t ]*([`~]{3,})[\t ]*$) + contentName + meta.embedded.yaml + patterns + + + include + source.yaml + + + + + + + + + scopeName + source.mdx + uuid + fe65e2cd-7c73-4a27-8b5e-5902893626aa + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/php.plist b/src/file-viewer/highlight-grammar/php.plist new file mode 100644 index 0000000..9882644 --- /dev/null +++ b/src/file-viewer/highlight-grammar/php.plist @@ -0,0 +1,4019 @@ + + + + + comment + TODO: +• Try to improve parameters list syntax – scope numbers, ‘=’, ‘,’ and possibly be intelligent about entity ordering +• Is meta.function-call the correct scope? I've added it to my theme but by default it's not highlighted + fileTypes + + php + php3 + php4 + php5 + phpt + phtml + aw + ctp + + firstLineMatch + ^#!.*(?<!-)php[0-9]{0,1}\b|<\?php + foldingStartMarker + (/\*|\{\s*$|<<<HTML) + foldingStopMarker + (\*/|^\s*\}|^HTML;) + injections + + ^text.html - (meta.embedded | meta.tag), L:^text.html meta.tag, L:text.html.php source.js + + patterns + + + begin + (^\s*)(?=<\?(?![^?]*\?>)) + beginCaptures + + 0 + + name + punctuation.whitespace.embedded.leading.php + + + end + (?!\G)(\s*$\n)? + endCaptures + + 0 + + name + punctuation.whitespace.embedded.trailing.php + + + patterns + + + begin + <\?(?i:php|=)? + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + + contentName + source.php + end + (\?)> + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + source.php + + + name + meta.embedded.block.php + patterns + + + include + #language + + + + + + + begin + <\?(?i:php|=)?(?![^?]*\?>) + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + + contentName + source.php + end + (\?)> + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + source.php + + + name + meta.embedded.block.php + patterns + + + include + #language + + + + + begin + <\?(?i:php|=)? + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + + end + > + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + + name + meta.embedded.line.php + patterns + + + captures + + 1 + + name + source.php + + 2 + + name + punctuation.section.embedded.end.php + + 3 + + name + source.php + + + match + \G(\s*)((\?))(?=>) + name + meta.special.empty-tag.php + + + begin + \G + contentName + source.php + end + (\?)(?=>) + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + source.php + + + patterns + + + include + #language + + + + + + + + + keyEquivalent + ^~P + name + PHP + patterns + + + include + text.html.basic + + + repository + + class-builtin + + patterns + + + captures + + 1 + + name + punctuation.separator.inheritance.php + + + match + (?ix) + (\\)?\b + (st(dClass|reamWrapper)|R(RD(Graph|Creator|Updater)|untimeException|e(sourceBundle|cursive(RegexIterator|Ca(chingIterator|llbackFilterIterator)|TreeIterator|Iterator(Iterator)?|DirectoryIterator|FilterIterator|ArrayIterator)|flect(ion(Generator|Method|Class|Type|ZendExtension|Object|P(arameter|roperty)|Extension|Function(Abstract)?)?|or)|gexIterator)|angeException)|G(ender\\Gender|lobIterator|magick(Draw|Pixel)?)|X(sltProcessor|ML(Reader|Diff\\(Memory|Base|DOM|File)|Writer)|SLTProcessor)|M(ysqlndUh(Connection|PreparedStatement)|ongo(Re(sultException|gex)|Grid(fsFile|FS(Cursor|File)?)|BinData|C(o(de|llection|mmandCursor)|ursor(Interface|Exception)?|lient)|Timestamp|I(n(sertBatch|t(32|64))|d)|D(B(Ref|\\(BSON\\(Regex|M(inKey|axKey)|Binary|Serializable|Timestamp|ObjectID|Decimal128|U(nserializable|TCDateTime)|Javascript)|Driver\\(Read(Concern|Preference)|Manager|BulkWrite|Server|C(ommand|ursor(Id)?)|Exception\\WriteException|Query|Write(Result|Concern(Error)?|Error))))?|eleteBatch|ate)|UpdateBatch|Pool|Write(Batch|ConcernException)|Log)?|u(tex|ltipleIterator)|e(ssageFormatter|mcache(d)?))|Bad(MethodCallException|FunctionCallException)|tidy(Node)?|S(ync(ReaderWriter|Mutex|S(haredMemory|emaphore)|Event)|impleXML(Iterator|Element)|oap(Server|Header|Client|Param|Var|Fault)|NMP|CA(_(SoapProxy|LocalProxy))?|p(hinxClient|oofchecker|l(M(inHeap|axHeap)|S(tack|ubject)|Heap|T(ype|empFileObject)|Ob(server|jectStorage)|DoublyLinkedList|PriorityQueue|Enum|Queue|Fi(le(Info|Object)|xedArray)))|e(ssionHandler(Interface)?|ekableIterator|rializable)|DO_(Model_(ReflectionDataObject|Type|Property)|Sequence|D(ata(Object|Factory)|AS_(Relational|XML(_Document)?|Setting|ChangeSummary|Data(Object|Factory)))|Exception|List)|wish(Result(s)?|Search)?|VM(Model)?|QLite(Result|3(Result|Stmt)?|Database|Unbuffered)|AM(Message|Connection))|H(RTime\\(StopWatch|PerformanceCounter)|aru(Image|Outline|D(oc|estination)|Page|Encoder|Font|Annotation)) + |Ya(f_(R(oute(_(Re(write|gex)|Map|S(tatic|imple|upervar)|Interface)|r)|e(sponse_Abstract|quest_(Simple|Http|Abstract)|gistry))|Session|Con(troller_Abstract|fig_(Simple|Ini|Abstract))|Dispatcher|Plugin_Abstract|Exception|View_(Simple|Interface)|Loader|A(ction_Abstract|pplication))|r_(Server(_Exception)?|C(oncurrent_Client|lient(_Exception)?)))|N(o(RewindIterator|rmalizer)|umberFormatter)|C(o(nd|untable|ll(ectable|ator))|URLFile|a(chingIterator|llbackFilterIterator))|T(hread(ed)?|okyoTyrant(Table|Iterator|Query)?|ra(nsliterator|versable))|I(n(tl(RuleBasedBreakIterator|BreakIterator|C(har|odePointBreakIterator|alendar)|TimeZone|Iterator|DateFormatter|PartsIterator)|validArgumentException|finiteIterator)|terator(Iterator|Aggregate)?|magick(Draw|Pixel(Iterator)?|Kernel)?)|php_user_filter|Z(MQ(Socket|Context|Device|Poll)?|ipArchive|ookeeper)|O(CI\-(Collection|Lob)|ut(erIterator|Of(RangeException|BoundsException))|verflowException)|D(s\\(Map|S(tack|e(t|quence))|Hashable|Collection|Deque|P(air|riorityQueue)|Vector|Queue)|irectory(Iterator)?|omainException|OM(XPath|N(ode(list)?|amedNodeMap)|C(haracterData|omment|dataSection)|Text|Implementation|Document(Fragment)?|ProcessingInstruction|E(ntityReference|lement)|Attr)|ate(Time(I(nterface|mmutable)|Zone)?|Interval|Period))|U(n(derflowException|expectedValueException)|Converter|I\\(Menu(Item)?|Size|Control(s\\(Radio|Gr(id|oup)|MultilineEntry|B(ox|utton)|S(pin|eparator|lider)|C(heck|o(lorButton|mbo))|Tab|P(icker|rogress)|E(ntry|ditableCombo)|Form|Label))?|Draw\\(Matrix|Brush(\\(RadialGradient|Gradient|LinearGradient))?|Stroke|Color|Text\\(Font(\\Descriptor)?|Layout)|P(en|ath))|Point|Executor|Window|Area))|JsonSerializable|finfo|P(har(Data|FileInfo)?|ool|DO(Statement)?|arentIterator)|E(v(S(tat|ignal)|Ch(ild|eck)|Timer|I(o|dle)|ent(B(uffer(Event)?|ase)|SslContext|Http(Request|Connection)?|Config|DnsBase|Util|Listener)?|P(eriodic|repare)|Embed|Fork|Watcher|Loop)?|rrorException|xception|mptyIterator)|V(8Js(Exception)?|arnish(Stat|Log|Admin))|KTaglib_(MPEG_(File|AudioProperties)|Tag|ID3v2_(Tag|Frame|AttachedPictureFrame))|QuickHash(StringIntHash|Int(S(tringHash|et)|Hash))|F(il(terIterator|esystemIterator)|ANNConnection)|mysqli(_(stmt|driver|warning|result))?|W(orker|eak(Map|ref))|L(imitIterator|o(cale|gicException)|ua(Closure)?|engthException|apack)|A(ppendIterator|PC(Iterator|UIterator)|rray(Iterator|Object|Access))) + \b + + name + support.class.builtin.php + + + + class-name + + patterns + + + begin + (?i)(?=\\?[a-z_0-9]+\\) + end + (?i)([a-z_][a-z_0-9]*)?(?=[^a-z0-9_\\]|\z) + endCaptures + + 1 + + name + support.class.php + + + patterns + + + include + #namespace + + + + + include + #class-builtin + + + begin + (?=[\\a-zA-Z_]) + end + (?i)([a-z_][a-z_0-9]*)?(?=[^a-z0-9_\\]|\z) + endCaptures + + 1 + + name + support.class.php + + + patterns + + + include + #namespace + + + + + + comments + + patterns + + + begin + /\*\*(?:#@\+)?\s*$ + captures + + 0 + + name + punctuation.definition.comment.php + + + comment + This now only highlights a docblock if the first line contains only /** + - this is to stop highlighting everything as invalid when people do comment banners with /******** ... + - Now matches /**#@+ too - used for docblock templates: http://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#basics.docblocktemplate + end + \*/ + name + comment.block.documentation.phpdoc.php + patterns + + + include + #php_doc + + + + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment.php + + + end + \*/ + name + comment.block.php + + + begin + (^[ \t]+)?(?=//) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.php + + + end + (?!\G) + patterns + + + begin + // + beginCaptures + + 0 + + name + punctuation.definition.comment.php + + + end + \n|(?=\?>) + name + comment.line.double-slash.php + + + + + begin + (^[ \t]+)?(?=#) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.php + + + end + (?!\G) + patterns + + + begin + # + beginCaptures + + 0 + + name + punctuation.definition.comment.php + + + end + \n|(?=\?>) + name + comment.line.number-sign.php + + + + + + constants + + patterns + + + begin + (?xi)(?= + ( + (\\[a-z_][a-z_0-9]*\\[a-z_][a-z_0-9\\]*)| + ([a-z_][a-z_0-9]*\\[a-z_][a-z_0-9\\]*) + ) + [^a-z_0-9\\]) + end + (?i)([a-z_][a-z_0-9]*)?(?=[^a-z0-9_\\]) + endCaptures + + 1 + + name + constant.other.php + + + patterns + + + include + #namespace + + + + + begin + (?=\\?[a-zA-Z_\x{7f}-\x{ff}]) + end + (?=[^\\a-zA-Z_\x{7f}-\x{ff}]) + patterns + + + match + (?i)\b(TRUE|FALSE|NULL|__(FILE|DIR|FUNCTION|CLASS|METHOD|LINE|NAMESPACE)__|ON|OFF|YES|NO|NL|BR|TAB)\b + name + constant.language.php + + + captures + + 1 + + name + punctuation.separator.inheritance.php + + + match + (\\)?\b(STD(IN|OUT|ERR)|ZEND_(THREAD_SAFE|DEBUG_BUILD)|DEFAULT_INCLUDE_PATH|P(HP_(R(OUND_HALF_(ODD|DOWN|UP|EVEN)|ELEASE_VERSION)|M(INOR_VERSION|A(XPATHLEN|JOR_VERSION))|BINDIR|S(HLIB_SUFFIX|YSCONFDIR|API)|CONFIG_FILE_(SCAN_DIR|PATH)|INT_(MAX|SIZE)|ZTS|O(S|UTPUT_HANDLER_(START|CONT|END))|D(EBUG|ATADIR)|URL_(SCHEME|HOST|USER|P(ORT|A(SS|TH))|QUERY|FRAGMENT)|PREFIX|E(XT(RA_VERSION|ENSION_DIR)|OL)|VERSION(_ID)?|WINDOWS_(NT_(SERVER|DOMAIN_CONTROLLER|WORKSTATION)|VERSION_(M(INOR|AJOR)|BUILD|S(UITEMASK|P_M(INOR|AJOR))|P(RODUCTTYPE|LATFORM)))|L(IBDIR|OCALSTATEDIR))|EAR_(INSTALL_DIR|EXTENSION_DIR))|E_(RECOVERABLE_ERROR|STRICT|NOTICE|CO(RE_(ERROR|WARNING)|MPILE_(ERROR|WARNING))|DEPRECATED|USER_(NOTICE|DEPRECATED|ERROR|WARNING)|PARSE|ERROR|WARNING|ALL))\b + name + support.constant.core.php + + + captures + + 1 + + name + punctuation.separator.inheritance.php + + + match + (\\)?\b(RADIXCHAR|GROUPING|M(_(1_PI|SQRT(1_2|2|3|PI)|2_(SQRTPI|PI)|PI(_(2|4))?|E(ULER)?|L(N(10|2|PI)|OG(10E|2E)))|ON_(GROUPING|1(1|2|0)?|7|2|8|THOUSANDS_SEP|3|DECIMAL_POINT|9|4|5|6))|S(TR_PAD_(RIGHT|BOTH|LEFT)|ORT_(REGULAR|STRING|NUMERIC|DESC|LOCALE_STRING|ASC)|EEK_(SET|CUR|END))|H(TML_(SPECIALCHARS|ENTITIES)|ASH_HMAC)|YES(STR|EXPR)|N(_(S(IGN_POSN|EP_BY_SPACE)|CS_PRECEDES)|O(STR|EXPR)|EGATIVE_SIGN|AN)|C(R(YPT_(MD5|BLOWFISH|S(HA(256|512)|TD_DES|ALT_LENGTH)|EXT_DES)|NCYSTR|EDITS_(G(ROUP|ENERAL)|MODULES|SAPI|DOCS|QA|FULLPAGE|ALL))|HAR_MAX|O(NNECTION_(NORMAL|TIMEOUT|ABORTED)|DESET|UNT_(RECURSIVE|NORMAL))|URRENCY_SYMBOL|ASE_(UPPER|LOWER))|__COMPILER_HALT_OFFSET__|T(HOUS(EP|ANDS_SEP)|_FMT(_AMPM)?)|IN(T_(CURR_SYMBOL|FRAC_DIGITS)|I_(S(YSTEM|CANNER_(RAW|NORMAL))|USER|PERDIR|ALL)|F(O_(GENERAL|MODULES|C(REDITS|ONFIGURATION)|ENVIRONMENT|VARIABLES|LICENSE|ALL))?)|D(_(T_FMT|FMT)|IRECTORY_SEPARATOR|ECIMAL_POINT|A(Y_(1|7|2|3|4|5|6)|TE_(R(SS|FC(1(123|036)|2822|8(22|50)|3339))|COOKIE|ISO8601|W3C|ATOM)))|UPLOAD_ERR_(NO_(TMP_DIR|FILE)|CANT_WRITE|INI_SIZE|OK|PARTIAL|EXTENSION|FORM_SIZE)|P(M_STR|_(S(IGN_POSN|EP_BY_SPACE)|CS_PRECEDES)|OSITIVE_SIGN|ATH(_SEPARATOR|INFO_(BASENAME|DIRNAME|EXTENSION|FILENAME)))|E(RA(_(YEAR|T_FMT|D_(T_FMT|FMT)))?|XTR_(REFS|SKIP|IF_EXISTS|OVERWRITE|PREFIX_(SAME|I(NVALID|F_EXISTS)|ALL))|NT_(NOQUOTES|COMPAT|IGNORE|QUOTES))|FRAC_DIGITS|L(C_(M(ONETARY|ESSAGES)|NUMERIC|C(TYPE|OLLATE)|TIME|ALL)|O(G_(MAIL|SYSLOG|N(O(TICE|WAIT)|DELAY|EWS)|C(R(IT|ON)|ONS)|INFO|ODELAY|D(EBUG|AEMON)|U(SER|UCP)|P(ID|ERROR)|E(RR|MERG)|KERN|WARNING|L(OCAL(1|7|2|3|4|5|0|6)|PR)|A(UTH(PRIV)?|LERT))|CK_(SH|NB|UN|EX)))|A(M_STR|B(MON_(1(1|2|0)?|7|2|8|3|9|4|5|6)|DAY_(1|7|2|3|4|5|6))|SSERT_(BAIL|CALLBACK|QUIET_EVAL|WARNING|ACTIVE)|LT_DIGITS))\b + name + support.constant.std.php + + + captures + + 1 + + name + punctuation.separator.inheritance.php + + + match + (?x) + (\\)?\b + (GLOB_(MARK|BRACE|NO(SORT|CHECK|ESCAPE)|ONLYDIR|ERR|AVAILABLE_FLAGS)|XML_(SAX_IMPL|HTML_DOCUMENT_NODE|N(OTATION_NODE|AMESPACE_DECL_NODE)|C(OMMENT_NODE|DATA_SECTION_NODE)|TEXT_NODE|OPTION_(SKIP_(TAGSTART|WHITE)|CASE_FOLDING|TARGET_ENCODING)|D(TD_NODE|OCUMENT_(NODE|TYPE_NODE|FRAG_NODE))|PI_NODE|E(RROR_(RECURSIVE_ENTITY_REF|MISPLACED_XML_PI|B(INARY_ENTITY_REF|AD_CHAR_REF)|SYNTAX|NO(NE|_(MEMORY|ELEMENTS))|TAG_MISMATCH|IN(CORRECT_ENCODING|VALID_TOKEN)|DUPLICATE_ATTRIBUTE|UN(CLOSED_(CDATA_SECTION|TOKEN)|DEFINED_ENTITY|KNOWN_ENCODING)|JUNK_AFTER_DOC_ELEMENT|PAR(TIAL_CHAR|AM_ENTITY_REF)|EXTERNAL_ENTITY_HANDLING|A(SYNC_ENTITY|TTRIBUTE_EXTERNAL_ENTITY_REF))|NTITY_(REF_NODE|NODE|DECL_NODE)|LEMENT_(NODE|DECL_NODE))|LOCAL_NAMESPACE|ATTRIBUTE_(N(MTOKEN(S)?|O(TATION|DE))|CDATA|ID(REF(S)?)?|DECL_NODE|EN(TITY|UMERATION)))|M(HASH_(RIPEMD(1(28|60)|256|320)|GOST|MD(2|4|5)|S(HA(1|2(24|56)|384|512)|NEFRU256)|HAVAL(1(28|92|60)|2(24|56))|CRC32(B)?|TIGER(1(28|60))?|WHIRLPOOL|ADLER32)|YSQL(_(BOTH|NUM|CLIENT_(SSL|COMPRESS|I(GNORE_SPACE|NTERACTIVE))|ASSOC)|I_(RE(PORT_(STRICT|INDEX|OFF|ERROR|ALL)|FRESH_(GRANT|MASTER|BACKUP_LOG|S(TATUS|LAVE)|HOSTS|T(HREADS|ABLES)|LOG)|AD_DEFAULT_(GROUP|FILE))|GROUP_FLAG|MULTIPLE_KEY_FLAG|B(INARY_FLAG|OTH|LOB_FLAG)|S(T(MT_ATTR_(CURSOR_TYPE|UPDATE_MAX_LENGTH|PREFETCH_ROWS)|ORE_RESULT)|E(RVER_QUERY_(NO_(GOOD_INDEX_USED|INDEX_USED)|WAS_SLOW)|T_(CHARSET_NAME|FLAG)))|N(O(_D(EFAULT_VALUE_FLAG|ATA)|T_NULL_FLAG)|UM(_FLAG)?)|C(URSOR_TYPE_(READ_ONLY|SCROLLABLE|NO_CURSOR|FOR_UPDATE)|LIENT_(SSL|NO_SCHEMA|COMPRESS|I(GNORE_SPACE|NTERACTIVE)|FOUND_ROWS))|T(YPE_(GEOMETRY|MEDIUM_BLOB|B(IT|LOB)|S(HORT|TRING|ET)|YEAR|N(ULL|EWD(ECIMAL|ATE))|CHAR|TI(ME(STAMP)?|NY(_BLOB)?)|INT(24|ERVAL)|D(OUBLE|ECIMAL|ATE(TIME)?)|ENUM|VAR_STRING|FLOAT|LONG(_BLOB|LONG)?)|IMESTAMP_FLAG)|INIT_COMMAND|ZEROFILL_FLAG|O(N_UPDATE_NOW_FLAG|PT_(NET_(READ_BUFFER_SIZE|CMD_BUFFER_SIZE)|CONNECT_TIMEOUT|INT_AND_FLOAT_NATIVE|LOCAL_INFILE))|D(EBUG_TRACE_ENABLED|ATA_TRUNCATED)|U(SE_RESULT|N(SIGNED_FLAG|IQUE_KEY_FLAG))|P(RI_KEY_FLAG|ART_KEY_FLAG)|ENUM_FLAG|A(S(SOC|YNC)|UTO_INCREMENT_FLAG)))|CRYPT_(R(C(2|6)|IJNDAEL_(1(28|92)|256)|AND)|GOST|XTEA|M(ODE_(STREAM|NOFB|C(BC|FB)|OFB|ECB)|ARS)|BLOWFISH(_COMPAT)?|S(ERPENT|KIPJACK|AFER(128|PLUS|64))|C(RYPT|AST_(128|256))|T(RIPLEDES|HREEWAY|WOFISH)|IDEA|3DES| + DE(S|CRYPT|V_(RANDOM|URANDOM))|PANAMA|EN(CRYPT|IGNA)|WAKE|LOKI97|ARCFOUR(_IV)?))|S(TREAM_(REPORT_ERRORS|M(UST_SEEK|KDIR_RECURSIVE)|BUFFER_(NONE|FULL|LINE)|S(HUT_(RD(WR)?|WR)|OCK_(R(DM|AW)|S(TREAM|EQPACKET)|DGRAM)|ERVER_(BIND|LISTEN))|NOTIFY_(RE(SOLVE|DIRECTED)|MIME_TYPE_IS|SEVERITY_(INFO|ERR|WARN)|CO(MPLETED|NNECT)|PROGRESS|F(ILE_SIZE_IS|AILURE)|AUTH_RE(SULT|QUIRED))|C(RYPTO_METHOD_(SSLv(2(_(SERVER|CLIENT)|3_(SERVER|CLIENT))|3_(SERVER|CLIENT))|TLS_(SERVER|CLIENT))|LIENT_(CONNECT|PERSISTENT|ASYNC_CONNECT)|AST_(FOR_SELECT|AS_STREAM))|I(GNORE_URL|S_URL|PPROTO_(RAW|TCP|I(CMP|P)|UDP))|O(OB|PTION_(READ_(BUFFER|TIMEOUT)|BLOCKING|WRITE_BUFFER))|U(RL_STAT_(QUIET|LINK)|SE_PATH)|P(EEK|F_(INET(6)?|UNIX))|ENFORCE_SAFE_MODE|FILTER_(READ|WRITE|ALL))|UNFUNCS_RET_(STRING|TIMESTAMP|DOUBLE)|QLITE(_(R(OW|EADONLY)|MIS(MATCH|USE)|B(OTH|USY)|SCHEMA|N(O(MEM|T(FOUND|ADB)|LFS)|UM)|C(O(RRUPT|NSTRAINT)|ANTOPEN)|TOOBIG|I(NTER(RUPT|NAL)|OERR)|OK|DONE|P(ROTOCOL|ERM)|E(RROR|MPTY)|F(ORMAT|ULL)|LOCKED|A(BORT|SSOC|UTH))|3_(B(OTH|LOB)|NU(M|LL)|TEXT|INTEGER|OPEN_(READ(ONLY|WRITE)|CREATE)|FLOAT|ASSOC)))|CURL(M(SG_DONE|_(BAD_(HANDLE|EASY_HANDLE)|CALL_MULTI_PERFORM|INTERNAL_ERROR|O(UT_OF_MEMORY|K)))|SSH_AUTH_(HOST|NONE|DEFAULT|P(UBLICKEY|ASSWORD)|KEYBOARD)|CLOSEPOLICY_(SLOWEST|CALLBACK|OLDEST|LEAST_(RECENTLY_USED|TRAFFIC))|_(HTTP_VERSION_(1_(1|0)|NONE)|NETRC_(REQUIRED|IGNORED|OPTIONAL)|TIMECOND_(IF(MODSINCE|UNMODSINCE)|LASTMOD)|IPRESOLVE_(V(4|6)|WHATEVER)|VERSION_(SSL|IPV6|KERBEROS4|LIBZ))|INFO_(RE(DIRECT_(COUNT|TIME)|QUEST_SIZE)|S(SL_VERIFYRESULT|TARTTRANSFER_TIME|IZE_(DOWNLOAD|UPLOAD)|PEED_(DOWNLOAD|UPLOAD))|H(TTP_CODE|EADER_(SIZE|OUT))|NAMELOOKUP_TIME|C(ON(NECT_TIME|TENT_(TYPE|LENGTH_(DOWNLOAD|UPLOAD)))|ERTINFO)|TOTAL_TIME|PR(IVATE|ETRANSFER_TIME)|EFFECTIVE_URL|FILETIME)|OPT_(R(E(SUME_FROM|TURNTRANSFER|DIR_PROTOCOLS|FERER|AD(DATA|FUNCTION))|AN(GE|DOM_FILE))|MAX(REDIRS|CONNECTS)|B(INARYTRANSFER|UFFERSIZE)|S(S(H_(HOST_PUBLIC_KEY_MD5|P(RIVATE_KEYFILE|UBLIC_KEYFILE)|AUTH_TYPES)|L(CERT(TYPE|PASSWD)?|_(CIPHER_LIST|VERIFY(HOST|PEER))|ENGINE(_DEFAULT)?|VERSION|KEY(TYPE|PASSWD)?))|TDERR)|H(TTP(GET|HEADER|200ALIASES|_VERSION|PROXYTUNNEL|AUTH)|EADER(FUNCTION)?) + |N(O(BODY|SIGNAL|PROGRESS)|ETRC)|C(RLF|O(NNECTTIMEOUT(_MS)?|OKIE(SESSION|JAR|FILE)?)|USTOMREQUEST|ERTINFO|LOSEPOLICY|A(INFO|PATH))|T(RANSFERTEXT|CP_NODELAY|IME(CONDITION|OUT(_MS)?|VALUE))|I(N(TERFACE|FILE(SIZE)?)|PRESOLVE)|DNS_(CACHE_TIMEOUT|USE_GLOBAL_CACHE)|U(RL|SER(PWD|AGENT)|NRESTRICTED_AUTH|PLOAD)|P(R(IVATE|O(GRESSFUNCTION|XY(TYPE|USERPWD|PORT|AUTH)?|TOCOLS))|O(RT|ST(REDIR|QUOTE|FIELDS)?)|UT)|E(GDSOCKET|NCODING)|VERBOSE|K(RB4LEVEL|EYPASSWD)|QUOTE|F(RESH_CONNECT|TP(SSLAUTH|_(S(SL|KIP_PASV_IP)|CREATE_MISSING_DIRS|USE_EP(RT|SV)|FILEMETHOD)|PORT|LISTONLY|APPEND)|ILE(TIME)?|O(RBID_REUSE|LLOWLOCATION)|AILONERROR)|WRITE(HEADER|FUNCTION)|LOW_SPEED_(TIME|LIMIT)|AUTOREFERER)|PRO(XY_(SOCKS(4|5)|HTTP)|TO_(S(CP|FTP)|HTTP(S)?|T(ELNET|FTP)|DICT|F(TP(S)?|ILE)|LDAP(S)?|ALL))|E_(RE(CV_ERROR|AD_ERROR)|GOT_NOTHING|MALFORMAT_USER|BAD_(C(ONTENT_ENCODING|ALLING_ORDER)|PASSWORD_ENTERED|FUNCTION_ARGUMENT)|S(S(H|L_(C(IPHER|ONNECT_ERROR|ERTPROBLEM|ACERT)|PEER_CERTIFICATE|ENGINE_(SETFAILED|NOTFOUND)))|HARE_IN_USE|END_ERROR)|HTTP_(RANGE_ERROR|NOT_FOUND|PO(RT_FAILED|ST_ERROR))|COULDNT_(RESOLVE_(HOST|PROXY)|CONNECT)|T(OO_MANY_REDIRECTS|ELNET_OPTION_SYNTAX)|O(BSOLETE|UT_OF_MEMORY|PERATION_TIMEOUTED|K)|U(RL_MALFORMAT(_USER)?|N(SUPPORTED_PROTOCOL|KNOWN_TELNET_OPTION))|PARTIAL_FILE|F(TP_(BAD_DOWNLOAD_RESUME|SSL_FAILED|C(OULDNT_(RETR_FILE|GET_SIZE|S(TOR_FILE|ET_(BINARY|ASCII))|USE_REST)|ANT_(RECONNECT|GET_HOST))|USER_PASSWORD_INCORRECT|PORT_FAILED|QUOTE_ERROR|W(RITE_ERROR|EIRD_(SERVER_REPLY|227_FORMAT|USER_REPLY|PAS(S_REPLY|V_REPLY)))|ACCESS_DENIED)|ILE(SIZE_EXCEEDED|_COULDNT_READ_FILE)|UNCTION_NOT_FOUND|AILED_INIT)|WRITE_ERROR|L(IBRARY_NOT_FOUND|DAP_(SEARCH_FAILED|CANNOT_BIND|INVALID_URL))|ABORTED_BY_CALLBACK)|VERSION_NOW|FTP(METHOD_(MULTICWD|SINGLECWD|NOCWD)|SSL_(NONE|CONTROL|TRY|ALL)|AUTH_(SSL|TLS|DEFAULT))|AUTH_(GSSNEGOTIATE|BASIC|NTLM|DIGEST|ANY(SAFE)?))|I(MAGETYPE_(GIF|XBM|BMP|SWF|COUNT|TIFF_(MM|II)|I(CO|FF)|UNKNOWN|J(B2|P(X|2|C|EG(2000)?))|P(SD|NG)|WBMP)|NPUT_(REQUEST|GET|SE(RVER|SSION)|COOKIE|POST|ENV)|CONV_(MIME_DECODE_(STRICT|CONTINUE_ON_ERROR)|IMPL|VERSION))|D(NS_(MX|S(RV|OA)|HINFO|N(S|APTR)|CNAME|TXT|PTR|A(NY|LL|AAA|6)?)|OM(STRING_SIZE_ERR|_(SYNTAX_ERR|HIERARCHY_REQUEST_ERR|N(O(_(MODIFICATION_ALLOWED_ERR|DATA_ALLOWED_ERR)|T_(SUPPORTED_ERR|FOUND_ERR))|AMESPACE_ERR)|IN(DEX_SIZE_ERR|USE_ATTRIBUTE_ERR|VALID_(MODIFICATION_ERR|STATE_ERR|CHARACTER_ERR|ACCESS_ERR))|PHP_ERR|VALIDATION_ERR|WRONG_DOCUMENT_ERR)))|JSON_(HEX_(TAG|QUOT|A(MP|POS))|NUMERIC_CHECK|ERROR_(S(YNTAX|TATE_MISMATCH)|NONE|CTRL_CHAR|DEPTH|UTF8)|FORCE_OBJECT)|P(REG_(RECURSION_LIMIT_ERROR|GREP_INVERT|BA(CKTRACK_LIMIT_ERROR|D_UTF8_(OFFSET_ERROR|ERROR))|S(PLIT_(NO_EMPTY|OFFSET_CAPTURE|DELIM_CAPTURE)|ET_ORDER)|NO_ERROR|INTERNAL_ERROR|OFFSET_CAPTURE|PATTERN_ORDER)|SFS_(PASS_ON|ERR_FATAL|F(EED_ME|LAG_(NORMAL|FLUSH_(CLOSE|INC))))|CRE_VERSION|OSIX_(R_OK|X_OK|S_IF(REG|BLK|SOCK|CHR|IFO)|F_OK|W_OK))|F(NM_(NOESCAPE|CASEFOLD|P(ERIOD|ATHNAME))|IL(TER_(REQUIRE_(SCALAR|ARRAY)|SANITIZE_(MAGIC_QUOTES|S(TRI(NG|PPED)|PECIAL_CHARS)|NUMBER_(INT|FLOAT)|URL|E(MAIL|NCODED)|FULL_SPECIAL_CHARS)|NULL_ON_FAILURE|CALLBACK|DEFAULT|UNSAFE_RAW|VALIDATE_(REGEXP|BOOLEAN|I(NT|P)|URL|EMAIL|FLOAT)|F(ORCE_ARRAY|LAG_(S(CHEME_REQUIRED|TRIP_(BACKTICK|HIGH|LOW))|HOST_REQUIRED|NO(NE|_(RES_RANGE|PRIV_RANGE|ENCODE_QUOTES))|IPV(4|6)|PATH_REQUIRED|E(MPTY_STRING_NULL|NCODE_(HIGH|LOW|AMP))|QUERY_REQUIRED|ALLOW_(SCIENTIFIC|HEX|THOUSAND|OCTAL|FRACTION))))|E(_(BINARY|SKIP_EMPTY_LINES|NO_DEFAULT_CONTEXT|TEXT|IGNORE_NEW_LINES|USE_INCLUDE_PATH|APPEND)|INFO_(RAW|MIME(_(TYPE|ENCODING))?|SYMLINK|NONE|CONTINUE|DEVICES|PRESERVE_ATIME)))|ORCE_(GZIP|DEFLATE))|LIBXML_(XINCLUDE|N(SCLEAN|O(XMLDECL|BLANKS|NET|CDATA|E(RROR|MPTYTAG|NT)|WARNING))|COMPACT|D(TD(VALID|LOAD|ATTR)|OTTED_VERSION)|PARSEHUGE|ERR_(NONE|ERROR|FATAL|WARNING)|VERSION|LOADED_VERSION)) + \b + + name + support.constant.ext.php + + + captures + + 1 + + name + punctuation.separator.inheritance.php + + + match + (\\)?\bT_(RE(TURN|QUIRE(_ONCE)?)|G(OTO|LOBAL)|XOR_EQUAL|M(INUS_EQUAL|OD_EQUAL|UL_EQUAL|ETHOD_C|L_COMMENT)|B(REAK|OOL(_CAST|EAN_(OR|AND))|AD_CHARACTER)|S(R(_EQUAL)?|T(RING(_(CAST|VARNAME))?|A(RT_HEREDOC|TIC))|WITCH|L(_EQUAL)?)|HALT_COMPILER|N(S_(SEPARATOR|C)|UM_STRING|EW|AMESPACE)|C(HARACTER|O(MMENT|N(ST(ANT_ENCAPSED_STRING)?|CAT_EQUAL|TINUE))|URLY_OPEN|L(O(SE_TAG|NE)|ASS(_C)?)|A(SE|TCH))|T(RY|HROW)|I(MPLEMENTS|S(SET|_(GREATER_OR_EQUAL|SMALLER_OR_EQUAL|NOT_(IDENTICAL|EQUAL)|IDENTICAL|EQUAL))|N(STANCEOF|C(LUDE(_ONCE)?)?|T(_CAST|ERFACE)|LINE_HTML)|F)|O(R_EQUAL|BJECT_(CAST|OPERATOR)|PEN_TAG(_WITH_ECHO)?|LD_FUNCTION)|D(NUMBER|I(R|V_EQUAL)|O(C_COMMENT|UBLE_(C(OLON|AST)|ARROW)|LLAR_OPEN_CURLY_BRACES)?|E(C(LARE)?|FAULT))|U(SE|NSET(_CAST)?)|P(R(I(NT|VATE)|OTECTED)|UBLIC|LUS_EQUAL|AAMAYIM_NEKUDOTAYIM)|E(X(TENDS|IT)|MPTY|N(CAPSED_AND_WHITESPACE|D(SWITCH|_HEREDOC|IF|DECLARE|FOR(EACH)?|WHILE))|CHO|VAL|LSE(IF)?)|VAR(IABLE)?|F(I(NAL|LE)|OR(EACH)?|UNC(_C|TION))|WHI(TESPACE|LE)|L(NUMBER|I(ST|NE)|OGICAL_(XOR|OR|AND))|A(RRAY(_CAST)?|BSTRACT|S|ND_EQUAL))\b + name + support.constant.parser-token.php + + + comment + In PHP, any identifier which is not a variable is taken to be a constant. + However, if there is no constant defined with the given name then a notice + is generated and the constant is assumed to have the value of its name. + match + [a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]* + name + constant.other.php + + + + + + function-arguments + + patterns + + + include + #comments + + + begin + (?ix) + (?: # Optional + (\?)? + (?: + (array|bool|float|int|string) # scalar-type + | (callable|iterable) # base-type-declaration + | ([a-z_0-9\\]*[a-z_][a-z_0-9]*) + ) + \s+ + )? + (?:(&)\s*)? # Reference + ((\$+)[a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}]*) # Variable name + + beginCaptures + + 1 + + name + storage.modifier.nullable.php + + 2 + + name + storage.type.$2.php + + 3 + + name + storage.modifier.$3.php + + 4 + + patterns + + + include + #class-name + + + + 5 + + name + storage.modifier.reference.php + + 6 + + name + variable.other.php + + 7 + + name + punctuation.definition.variable.php + + + end + (?=,|\)|/[/*]|\#) + name + meta.function.argment.php + patterns + + + begin + \s*(=) + beginCaptures + + 1 + + name + keyword.operator.assignment.php + + + end + (?=,|\)|/[/*]|\#) + patterns + + + include + #parameter-default-types + + + + + match + \S + name + invalid.illegal.character-not-allowed-here.php + + + + + + function-call + + patterns + + + begin + (?i)(?=\\?[a-z_0-9\\]+\\[a-z_][a-z0-9_]*\s*\() + comment + Functions in a user-defined namespace (overrides any built-ins) + end + (?=\s*\() + patterns + + + include + #user-function-call + + + + + match + (?i)\b(print|echo)\b + name + support.function.construct.php + + + begin + (?i)(\\)?(?=\b[a-z_][a-z_0-9]*\s*\() + beginCaptures + + 1 + + name + punctuation.separator.inheritance.php + + + comment + Root namespace function calls (built-in or user) + end + (?=\s*\() + patterns + + + match + (?i)\b(isset|unset|e(val|mpty)|list)(?=\s*\() + name + support.function.construct.php + + + include + #support + + + include + #user-function-call + + + + + + heredoc + + patterns + + + begin + (?=<<<\s*("?)([a-zA-Z_]+[a-zA-Z0-9_]*)(\1)\s*$) + end + (?!\G) + injections + + * + + patterns + + + include + #interpolation + + + + + name + string.unquoted.heredoc.php + patterns + + + include + #heredoc_interior + + + + + begin + (?=<<<\s*('?)([a-zA-Z_]+[a-zA-Z0-9_]*)(\1)\s*$) + end + (?!\G) + name + string.unquoted.heredoc.nowdoc.php + patterns + + + include + #heredoc_interior + + + + + repository + + heredoc_interior + + patterns + + + begin + (<<<)\s*(['"]?)(HTML)(\2)\s*$\n? + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + 1 + + name + punctuation.definition.string.php + + 3 + + name + keyword.operator.heredoc.php + + + contentName + text.html + end + ^(\3)\b + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + keyword.operator.heredoc.php + + + name + meta.embedded.html + patterns + + + include + text.html.basic + + + + + begin + (<<<)\s*(['"]?)(XML)(\2)\s*$\n? + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + 1 + + name + punctuation.definition.string.php + + 3 + + name + keyword.operator.heredoc.php + + + contentName + text.xml + end + ^(\3)\b + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + keyword.operator.heredoc.php + + + name + meta.embedded.xml + patterns + + + include + text.xml + + + + + begin + (<<<)\s*(['"]?)(SQL)(\2)\s*$\n? + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + 1 + + name + punctuation.definition.string.php + + 3 + + name + keyword.operator.heredoc.php + + + contentName + source.sql + end + ^(\3)\b + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + keyword.operator.heredoc.php + + + name + meta.embedded.sql + patterns + + + include + source.sql + + + + + begin + (<<<)\s*(['"]?)(JAVASCRIPT)(\2)\s*$\n? + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + 1 + + name + punctuation.definition.string.php + + 3 + + name + keyword.operator.heredoc.php + + + contentName + source.js + end + ^(\3)\b + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + keyword.operator.heredoc.php + + + name + meta.embedded.js + patterns + + + include + source.js + + + + + begin + (<<<)\s*(['"]?)(JSON)(\2)\s*$\n? + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + 1 + + name + punctuation.definition.string.php + + 3 + + name + keyword.operator.heredoc.php + + + contentName + source.json + end + ^(\3)\b + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + keyword.operator.heredoc.php + + + name + meta.embedded.json + patterns + + + include + source.json + + + + + begin + (<<<)\s*(['"]?)(CSS)(\2)\s*$\n? + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + 1 + + name + punctuation.definition.string.php + + 3 + + name + keyword.operator.heredoc.php + + + contentName + source.css + end + ^(\3)\b + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + keyword.operator.heredoc.php + + + name + meta.embedded.css + patterns + + + include + source.css + + + + + begin + (<<<)\s*(['"]?)(REGEX)(\2)\s*$\n? + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.php + + 1 + + name + punctuation.definition.string.php + + 3 + + name + keyword.operator.heredoc.php + + + contentName + string.regexp.heredoc.php + end + ^(\3)\b + endCaptures + + 0 + + name + punctuation.section.embedded.end.php + + 1 + + name + keyword.operator.heredoc.php + + + patterns + + + comment + Escaped from the regexp – there can also be 2 backslashes (since 1 will escape the first) + match + (\\){1,2}[.$^\[\]{}] + name + constant.character.escape.regex.php + + + captures + + 1 + + name + punctuation.definition.arbitrary-repitition.php + + 3 + + name + punctuation.definition.arbitrary-repitition.php + + + match + (\{)\d+(,\d+)?(\}) + name + string.regexp.arbitrary-repitition.php + + + begin + \[(?:\^?\])? + captures + + 0 + + name + punctuation.definition.character-class.php + + + end + \] + name + string.regexp.character-class.php + patterns + + + match + \\[\\'\[\]] + name + constant.character.escape.php + + + + + match + [$^+*] + name + keyword.operator.regexp.php + + + begin + (?<=^|\s)(#)\s(?=[[a-zA-Z0-9,. \t?!-][^\x{00}-\x{7F}]]*$) + beginCaptures + + 1 + + name + punctuation.definition.comment.php + + + comment + We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags. + end + $\n? + endCaptures + + 0 + + name + punctuation.definition.comment.php + + + name + comment.line.number-sign.php + + + + + begin + (<<<)\s*(['"]?)([a-zA-Z_]+[a-zA-Z0-9_]*)(\2) + beginCaptures + + 1 + + name + punctuation.definition.string.php + + 3 + + name + keyword.operator.heredoc.php + + + end + ^(\3)\b + endCaptures + + 1 + + name + keyword.operator.heredoc.php + + + + + + + + instantiation + + begin + (?i)(new)\s+ + beginCaptures + + 1 + + name + keyword.other.new.php + + + end + (?i)(?=[^$a-z0-9_\\]) + patterns + + + match + (parent|static|self)(?=[^a-z0-9_]) + name + storage.type.php + + + include + #class-name + + + include + #variable-name + + + + interpolation + + comment + http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing + patterns + + + match + \\[0-7]{1,3} + name + constant.numeric.octal.php + + + match + \\x[0-9A-Fa-f]{1,2} + name + constant.numeric.hex.php + + + match + \\[enrt\\\$\"] + name + constant.character.escape.php + + + begin + (\{)(?=\$.*?\}) + beginCaptures + + 1 + + name + punctuation.definition.variable.php + + + end + (\}) + endCaptures + + 1 + + name + punctuation.definition.variable.php + + + patterns + + + include + #language + + + + + include + #variable-name + + + + invoke-call + + captures + + 1 + + name + punctuation.definition.variable.php + + 2 + + name + variable.other.php + + + match + (?i)(\$+)([a-z_][a-z_0-9]*)(?=\s*\() + name + meta.function-call.invoke.php + + language + + patterns + + + include + #comments + + + match + \{ + name + punctuation.section.scope.begin.php + + + match + \} + name + punctuation.section.scope.end.php + + + begin + (?i)^\s*(interface)\s+([a-z0-9_]+)\s*(extends)?\s* + beginCaptures + + 1 + + name + storage.type.interface.php + + 2 + + name + entity.name.type.interface.php + + 3 + + name + storage.modifier.extends.php + + + end + ((?:[a-zA-Z0-9_]+\s*,\s*)*)([a-zA-Z0-9_]+)?\s*(?:(?=\{)|$) + endCaptures + + 1 + + patterns + + + match + [a-zA-Z0-9_]+ + name + entity.other.inherited-class.php + + + match + , + name + punctuation.separator.classes.php + + + + 2 + + name + entity.other.inherited-class.php + + + name + meta.interface.php + patterns + + + include + #namespace + + + + + begin + (?i)(?:^|(?<=<\?php))\s*(namespace)\b\s+(?=([a-z0-9_\\]+\s*($|[;{]|(\/[\/*])))|$) + beginCaptures + + 1 + + name + keyword.other.namespace.php + + + contentName + entity.name.type.namespace.php + end + (?i)(?=\s*$|[^a-z0-9_\\]) + name + meta.namespace.php + patterns + + + match + \\ + name + punctuation.separator.inheritance.php + + + + + begin + (?i)\s*\b(use)\s+(?:((const)|(function))\s+)? + beginCaptures + + 1 + + name + keyword.other.use.php + + 3 + + name + storage.type.const.php + + 4 + + name + storage.type.function.php + + + end + (?=;|(?:^\s*$)) + name + meta.use.php + patterns + + + include + #comments + + + begin + (?i)\s*(?=[a-z_0-9\\]) + end + (?xi)(?: + (?:\s*(as)\b\s*([a-z_0-9]*)\s*(?=,|;|$)) + |(?=,|;|$) + ) + endCaptures + + 1 + + name + keyword.other.use-as.php + + 2 + + name + support.other.namespace.use-as.php + + + patterns + + + include + #class-builtin + + + begin + (?i)\s*(?=[\\a-z_0-9]) + end + $|(?=[\s,;]) + name + support.other.namespace.use.php + patterns + + + match + \\ + name + punctuation.separator.inheritance.php + + + + + + + match + \s*,\s* + + + + + begin + (?i)^\s*(trait)\s+([a-zA-Z0-9_]+) + beginCaptures + + 1 + + name + storage.type.trait.php + + 2 + + name + entity.name.type.trait.php + + + end + (?=\{) + name + meta.trait.php + + + begin + (?i)^\s*(abstract|final)?\s*(class)\s+([a-z0-9_]+)\s* + beginCaptures + + 1 + + name + storage.modifier.abstract.php + + 2 + + name + storage.type.class.php + + 3 + + name + entity.name.type.class.php + + + end + (?=[;{]) + name + meta.class.php + patterns + + + include + #comments + + + begin + (?i)(extends)\s+ + beginCaptures + + 1 + + name + storage.modifier.extends.php + + + contentName + meta.other.inherited-class.php + end + (?i)(?=[^a-z_0-9\\]) + patterns + + + begin + (?i)(?=\\?[a-z_0-9]+\\) + end + (?i)([a-z_][a-z_0-9]*)?(?=[^a-z0-9_\\]) + endCaptures + + 1 + + name + entity.other.inherited-class.php + + + patterns + + + include + #namespace + + + + + include + #class-builtin + + + include + #namespace + + + match + (?i)[a-z_][a-z_0-9]* + name + entity.other.inherited-class.php + + + + + begin + (?i)(implements)\s+ + beginCaptures + + 1 + + name + storage.modifier.implements.php + + + end + (?i)(?=[;{]) + patterns + + + include + #comments + + + begin + (?i)(?=[a-z0-9_\\]+) + contentName + meta.other.inherited-class.php + end + (?i)(?:\s*(?:,|(?=[^a-z0-9_\\\s]))\s*) + patterns + + + begin + (?i)(?=\\?[a-z_0-9]+\\) + end + (?i)([a-z_][a-z_0-9]*)?(?=[^a-z0-9_\\]) + endCaptures + + 1 + + name + entity.other.inherited-class.php + + + patterns + + + include + #namespace + + + + + include + #class-builtin + + + include + #namespace + + + match + (?i)[a-z_][a-z_0-9]* + name + entity.other.inherited-class.php + + + + + + + + + captures + + 1 + + name + keyword.control.php + + + match + \s*\b((break|c(ase|ontinue)|d(e(clare|fault)|ie|o)|e(lse(if)?|nd(declare|for(each)?|if|switch|while)|xit)|for(each)?|if|return|switch|use|while|yield))\b + + + begin + (?i)\b((?:require|include)(?:_once)?)\b\s* + beginCaptures + + 1 + + name + keyword.control.import.include.php + + + end + (?=\s|;|$) + name + meta.include.php + patterns + + + include + #language + + + + + begin + \b(catch)\b\s*\(\s* + beginCaptures + + 1 + + name + keyword.control.exception.catch.php + + + end + ([A-Za-z_][A-Za-z_0-9]*)\s*((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)\s*\) + endCaptures + + 1 + + name + support.class.exception.php + + 2 + + name + variable.other.php + + 3 + + name + punctuation.definition.variable.php + + + name + meta.catch.php + patterns + + + include + #namespace + + + + + match + \b(catch|try|throw|exception|finally)\b + name + keyword.control.exception.php + + + begin + (?i)\b(function)\s*(&\s*)?(?=\() + beginCaptures + + 1 + + name + storage.type.function.php + + 2 + + name + storage.modifier.reference.php + + + end + \{ + name + meta.function.closure.php + patterns + + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.parameters.begin.php + + + contentName + meta.function.arguments.php + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.parameters.end.php + + + patterns + + + include + #function-arguments + + + + + begin + (?i)(use)\s*(\() + beginCaptures + + 1 + + name + keyword.other.function.use.php + + 2 + + name + punctuation.definition.parameters.begin.php + + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.parameters.end.php + + + patterns + + + captures + + 1 + + name + storage.modifier.reference.php + + 2 + + name + variable.other.php + + 3 + + name + punctuation.definition.variable.php + + + match + (?:\s*(&))?\s*((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)\s*(?=,|\)) + name + meta.function.closure.use.php + + + + + + + begin + (?x)\s* + ((?:(?:final|abstract|public|private|protected|static)\s+)*) + (function) + (?:\s+|(\s*&\s*)) + (?: + (__(?:call|construct|debugInfo|destruct|get|set|isset|unset|tostring|clone|set_state|sleep|wakeup|autoload|invoke|callStatic)) + |([a-zA-Z0-9_]+) + ) + \s* + (\() + beginCaptures + + 1 + + patterns + + + match + final|abstract|public|private|protected|static + name + storage.modifier.php + + + + 2 + + name + storage.type.function.php + + 3 + + name + storage.modifier.reference.php + + 4 + + name + support.function.magic.php + + 5 + + name + entity.name.function.php + + 6 + + name + punctuation.definition.parameters.begin.php + + + contentName + meta.function.arguments.php + end + (?ix) + (\)) # Close arguments + (?: # Optional return type + \s*(:)\s* + (\?)? + (?: + (array|bool|float|int|string) # scalar-type + | (callable|iterable) # base-type-declaration + | (void) + | ([a-z_0-9\\]*[a-z_][a-z_0-9]*) # qualified-name + ) + )? + + endCaptures + + 1 + + name + punctuation.definition.parameters.end.php + + 2 + + name + punctuation.separator.return-type.php + + 3 + + name + storage.modifier.nullable.php + + 4 + + name + storage.type.$4.php + + 5 + + name + storage.modifier.$5.php + + 6 + + name + storage.type.void.php + + 7 + + patterns + + + include + #class-name + + + + + name + meta.function.php + patterns + + + include + #function-arguments + + + + + include + #invoke-call + + + begin + (?xi)\s*(?= + [a-z_0-9$\\]+(::) + (?: + ([a-z_][a-z_0-9]*)\s*\( + | + ((\$+)[a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}]*) + | + ([a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}]*) + )? + ) + end + (?x)(::) + (?: + ([A-Za-z_][A-Za-z_0-9]*)\s*\( + | + ((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*) + | + ([a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*) + )? + endCaptures + + 1 + + name + keyword.operator.class.php + + 2 + + name + meta.function-call.static.php + + 3 + + name + variable.other.class.php + + 4 + + name + punctuation.definition.variable.php + + 5 + + name + constant.other.class.php + + + patterns + + + match + (self|static|parent)\b + name + storage.type.php + + + include + #class-name + + + include + #variable-name + + + + + include + #variables + + + include + #strings + + + captures + + 1 + + name + support.function.construct.php + + 2 + + name + punctuation.definition.array.begin.php + + 3 + + name + punctuation.definition.array.end.php + + + match + (array)(\()(\)) + name + meta.array.empty.php + + + begin + (array)(\() + beginCaptures + + 1 + + name + support.function.construct.php + + 2 + + name + punctuation.definition.array.begin.php + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.array.end.php + + + name + meta.array.php + patterns + + + include + #language + + + + + captures + + 1 + + name + storage.type.php + + + match + (?i)\s*\(\s*(array|real|double|float|int(eger)?|bool(ean)?|string|object|binary|unset)\s*\) + + + match + (?i)\b(array|real|double|float|int(eger)?|bool(ean)?|string|class|clone|var|function|interface|parent|self|object)\b + name + storage.type.php + + + match + (?i)\b(global|abstract|const|extends|implements|final|p(r(ivate|otected)|ublic)|static)\b + name + storage.modifier.php + + + include + #object + + + match + ; + name + punctuation.terminator.expression.php + + + include + #heredoc + + + match + \.=? + name + keyword.operator.string.php + + + match + => + name + keyword.operator.key.php + + + captures + + 1 + + name + keyword.operator.assignment.php + + 2 + + name + storage.modifier.reference.php + + 3 + + name + storage.modifier.reference.php + + + match + (?:(\=)(&))|(&(?=[$A-Za-z_])) + + + match + (@) + name + keyword.operator.error-control.php + + + match + (\-\-|\+\+) + name + keyword.operator.increment-decrement.php + + + match + (\-|\+|\*|/|%) + name + keyword.operator.arithmetic.php + + + match + (?i)(!|&&|\|\|)|\b(and|or|xor|as)\b + name + keyword.operator.logical.php + + + include + #function-call + + + match + <<|>>|~|\^|&|\| + name + keyword.operator.bitwise.php + + + match + (===|==|!==|!=|<=|>=|<>|<|>) + name + keyword.operator.comparison.php + + + match + = + name + keyword.operator.assignment.php + + + begin + (?i)\b(instanceof)\b\s+(?=[\\$a-z_]) + beginCaptures + + 1 + + name + keyword.operator.type.php + + + end + (?=[^\\$A-Za-z_0-9]) + patterns + + + include + #class-name + + + include + #variable-name + + + + + include + #numbers + + + include + #instantiation + + + captures + + 1 + + name + keyword.control.goto.php + + 2 + + name + support.other.php + + + match + (?i)(goto)\s+([a-z_][a-z_0-9]*) + + + captures + + 1 + + name + entity.name.goto-label.php + + + match + (?i)^\s*([a-z_][a-z_0-9]*)\s*: + + + include + #string-backtick + + + begin + \[ + beginCaptures + + 0 + + name + punctuation.section.array.begin.php + + + end + \] + endCaptures + + 0 + + name + punctuation.section.array.end.php + + + patterns + + + include + #language + + + + + include + #constants + + + + namespace + + begin + (?i)(?:(namespace)|[a-z0-9_]+)?(\\)(?=.*?([^a-z0-9_\\]|\z)) + beginCaptures + + 1 + + name + variable.language.namespace.php + + 2 + + name + punctuation.separator.inheritance.php + + + end + (?i)(?=[a-z0-9_]*([^a-z0-9_\\]|\z)) + name + support.other.namespace.php + patterns + + + captures + + 1 + + name + punctuation.separator.inheritance.php + + + match + (?i)(\\) + + + + numbers + + match + \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b + name + constant.numeric.php + + object + + patterns + + + begin + (->)(\$?\{) + beginCaptures + + 1 + + name + keyword.operator.class.php + + 2 + + name + punctuation.definition.variable.php + + + end + (\}) + endCaptures + + 1 + + name + punctuation.definition.variable.php + + + patterns + + + include + #language + + + + + captures + + 1 + + name + keyword.operator.class.php + + 2 + + name + meta.function-call.object.php + + 3 + + name + variable.other.property.php + + 4 + + name + punctuation.definition.variable.php + + + match + (?x)(->) + (?: + ([A-Za-z_][A-Za-z_0-9]*)\s*\( + | + ((\$+)?[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*) + )? + + + + parameter-default-types + + patterns + + + include + #strings + + + include + #numbers + + + include + #string-backtick + + + include + #variables + + + match + => + name + keyword.operator.key.php + + + match + = + name + keyword.operator.assignment.php + + + match + &(?=\s*\$) + name + storage.modifier.reference.php + + + begin + (array)\s*(\() + beginCaptures + + 1 + + name + support.function.construct.php + + 2 + + name + punctuation.definition.array.begin.php + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.array.end.php + + + name + meta.array.php + patterns + + + include + #parameter-default-types + + + + + include + #instantiation + + + begin + (?xi)\s*(?= + [a-z_0-9\\]+(::) + ([a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}]*)? + ) + end + (?i)(::)([a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}]*)? + endCaptures + + 1 + + name + keyword.operator.class.php + + 2 + + name + constant.other.class.php + + + patterns + + + include + #class-name + + + + + include + #constants + + + + php_doc + + patterns + + + comment + PHPDocumentor only recognises lines with an asterisk as the first non-whitespaces character + match + ^(?!\s*\*).*$\n? + name + invalid.illegal.missing-asterisk.phpdoc.php + + + captures + + 1 + + name + keyword.other.phpdoc.php + + 3 + + name + storage.modifier.php + + 4 + + name + invalid.illegal.wrong-access-type.phpdoc.php + + + match + ^\s*\*\s*(@access)\s+((public|private|protected)|(.+))\s*$ + + + captures + + 1 + + name + keyword.other.phpdoc.php + + 2 + + name + markup.underline.link.php + + + match + (@xlink)\s+(.+)\s*$ + + + match + \@(a(bstract|uthor)|c(ategory|opyright)|example|global|internal|li(cense|nk)|pa(ckage|ram)|return|s(ee|ince|tatic|ubpackage)|t(hrows|odo)|v(ar|ersion)|uses|deprecated|final|ignore)\b + name + keyword.other.phpdoc.php + + + captures + + 1 + + name + keyword.other.phpdoc.php + + + match + \{(@(link)).+?\} + name + meta.tag.inline.phpdoc.php + + + + regex-double-quoted + + begin + (?x)"/ (?= (\\.|[^"/])++/[imsxeADSUXu]*" ) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.php + + + end + (/)([imsxeADSUXu]*)(") + endCaptures + + 0 + + name + punctuation.definition.string.end.php + + + name + string.regexp.double-quoted.php + patterns + + + comment + Escaped from the regexp – there can also be 2 backslashes (since 1 will escape the first) + match + (\\){1,2}[.$^\[\]{}] + name + constant.character.escape.regex.php + + + include + #interpolation + + + captures + + 1 + + name + punctuation.definition.arbitrary-repitition.php + + 3 + + name + punctuation.definition.arbitrary-repitition.php + + + match + (\{)\d+(,\d+)?(\}) + name + string.regexp.arbitrary-repitition.php + + + begin + \[(?:\^?\])? + captures + + 0 + + name + punctuation.definition.character-class.php + + + end + \] + name + string.regexp.character-class.php + patterns + + + include + #interpolation + + + + + match + [$^+*] + name + keyword.operator.regexp.php + + + + regex-single-quoted + + begin + (?x)'/ (?= ( \\ (?: \\ (?: \\ [\\']? | [^'] ) | . ) | [^'/] )++/[imsxeADSUXu]*' ) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.php + + + end + (/)([imsxeADSUXu]*)(') + endCaptures + + 0 + + name + punctuation.definition.string.end.php + + + name + string.regexp.single-quoted.php + patterns + + + captures + + 1 + + name + punctuation.definition.arbitrary-repitition.php + + 3 + + name + punctuation.definition.arbitrary-repitition.php + + + match + (\{)\d+(,\d+)?(\}) + name + string.regexp.arbitrary-repitition.php + + + begin + \[(?:\^?\])? + captures + + 0 + + name + punctuation.definition.character-class.php + + + end + \] + name + string.regexp.character-class.php + patterns + + + include + #single_quote_regex_escape + + + + + match + [$^+*] + name + keyword.operator.regexp.php + + + include + #single_quote_regex_escape + + + repository + + single_quote_regex_escape + + comment + Support both PHP string and regex escaping + match + (?x) \\ (?: \\ (?: \\ [\\']? | [^'] ) | . ) + name + constant.character.escape.php + + + + sql-string-double-quoted + + begin + "\s*(?=(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER)\b) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.php + + + contentName + source.sql.embedded.php + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.php + + + name + string.quoted.double.sql.php + patterns + + + match + #(\\"|[^"])*(?="|$\n?) + name + comment.line.number-sign.sql + + + match + --(\\"|[^"])*(?="|$\n?) + name + comment.line.double-dash.sql + + + match + \\[\\"`'] + name + constant.character.escape.php + + + comment + Unclosed strings must be captured to avoid them eating the remainder of the PHP script + Sample case: $sql = "SELECT * FROM bar WHERE foo = '" . $variable . "'" + match + '(?=((\\')|[^'"])*("|$)) + name + string.quoted.single.unclosed.sql + + + comment + Unclosed strings must be captured to avoid them eating the remainder of the PHP script + Sample case: $sql = "SELECT * FROM bar WHERE foo = '" . $variable . "'" + match + `(?=((\\`)|[^`"])*("|$)) + name + string.quoted.other.backtick.unclosed.sql + + + begin + ' + end + ' + name + string.quoted.single.sql + patterns + + + include + #interpolation + + + + + begin + ` + end + ` + name + string.quoted.other.backtick.sql + patterns + + + include + #interpolation + + + + + include + #interpolation + + + include + source.sql + + + + sql-string-single-quoted + + begin + '\s*(?=(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER)\b) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.php + + + contentName + source.sql.embedded.php + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.php + + + name + string.quoted.single.sql.php + patterns + + + match + #(\\'|[^'])*(?='|$\n?) + name + comment.line.number-sign.sql + + + match + --(\\'|[^'])*(?='|$\n?) + name + comment.line.double-dash.sql + + + match + \\[\\'`"] + name + constant.character.escape.php + + + comment + Unclosed strings must be captured to avoid them eating the remainder of the PHP script + Sample case: $sql = "SELECT * FROM bar WHERE foo = '" . $variable . "'" + match + `(?=((\\`)|[^`'])*('|$)) + name + string.quoted.other.backtick.unclosed.sql + + + comment + Unclosed strings must be captured to avoid them eating the remainder of the PHP script + Sample case: $sql = "SELECT * FROM bar WHERE foo = '" . $variable . "'" + match + "(?=((\\")|[^"'])*('|$)) + name + string.quoted.double.unclosed.sql + + + include + source.sql + + + + string-backtick + + begin + ` + beginCaptures + + 0 + + name + punctuation.definition.string.begin.php + + + end + ` + endCaptures + + 0 + + name + punctuation.definition.string.end.php + + + name + string.interpolated.php + patterns + + + match + \\. + name + constant.character.escape.php + + + include + #interpolation + + + + string-double-quoted + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.php + + + comment + This contentName is just to allow the usage of “select scope” to select the string contents first, then the string with quotes + contentName + meta.string-contents.quoted.double.php + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.php + + + name + string.quoted.double.php + patterns + + + include + #interpolation + + + + string-single-quoted + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.php + + + contentName + meta.string-contents.quoted.single.php + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.php + + + name + string.quoted.single.php + patterns + + + match + \\[\\'] + name + constant.character.escape.php + + + + strings + + patterns + + + include + #regex-double-quoted + + + include + #sql-string-double-quoted + + + include + #string-double-quoted + + + include + #regex-single-quoted + + + include + #sql-string-single-quoted + + + include + #string-single-quoted + + + + support + + patterns + + + match + (?i)\bapc_(s(tore|ma_info)|c(ompile_file|lear_cache|a(s|che_info))|inc|de(c|fine_constants|lete(_file)?)|exists|fetch|load_constants|add|bin_(dump(file)?|load(file)?))\b + name + support.function.apc.php + + + match + (?i)\bapcu_(s(tore|ma_info)|c(lear_cache|a(s|che_info))|inc|de(c|lete)|e(ntry|xists)|fetch|add)\b + name + support.function.apcu.php + + + match + (?i)\b(s(huffle|izeof|ort)|n(ext|at(sort|casesort))|c(o(unt|mpact)|urrent)|in_array|u(sort|ksort|asort)|p(os|rev)|e(nd|ach|xtract)|k(sort|ey(_exists)?|rsort)|list|a(sort|r(sort|ray(_(s(hift|um|plice|earch|lice)|c(h(unk|ange_key_case)|o(unt_values|lumn|mbine))|intersect(_(u(key|assoc)|key|assoc))?|diff(_(u(key|assoc)|key|assoc))?|u(n(shift|ique)|intersect(_(uassoc|assoc))?|diff(_(uassoc|assoc))?)|p(op|ush|ad|roduct)|values|key(s|_exists)|f(il(ter|l(_keys)?)|lip)|walk(_recursive)?|r(e(duce|place(_recursive)?|verse)|and)|m(ultisort|erge(_recursive)?|ap)))?))|r(sort|eset|ange))\b + name + support.function.array.php + + + match + (?i)\b(s(how_source|ys_getloadavg|leep)|highlight_(string|file)|con(stant|nection_(status|aborted))|time_(sleep_until|nanosleep)|ignore_user_abort|d(ie|efine(d)?)|u(sleep|n(iqid|pack))|__halt_compiler|p(hp_(strip_whitespace|check_syntax)|ack)|e(val|xit)|get_browser)\b + name + support.function.basic_functions.php + + + match + (?i)\bbc(s(cale|ub|qrt)|comp|div|pow(mod)?|add|m(od|ul))\b + name + support.function.bcmath.php + + + match + (?i)\bblenc_encrypt\b + name + support.function.blenc.php + + + match + (?i)\bMongoDB\\BSON\\(to(JSON|PHP)|from(JSON|PHP))\b + name + support.function.bson.php + + + match + (?i)\bbz(c(ompress|lose)|open|decompress|err(str|no|or)|flush|write|read)\b + name + support.function.bz2.php + + + match + (?i)\b(cal_(to_jd|info|days_in_month|from_jd)|unixtojd|j(d(to(unix|j(ulian|ewish)|french|gregorian)|dayofweek|monthname)|uliantojd|ewishtojd)|easter_da(ys|te)|frenchtojd|gregoriantojd)\b + name + support.function.calendar.php + + + match + (?i)\b(c(lass_(exists|alias)|all_user_method(_array)?)|trait_exists|i(s_(subclass_of|a)|nterface_exists)|__autoload|property_exists|get_(c(lass(_(vars|methods))?|alled_class)|object_vars|declared_(classes|traits|interfaces)|parent_class)|method_exists)\b + name + support.function.classobj.php + + + match + (?i)\b(com_(create_guid|print_typeinfo|event_sink|load_typelib|get_active_object|message_pump)|variant_(s(ub|et(_type)?)|n(ot|eg)|c(a(st|t)|mp)|i(nt|div|mp)|or|d(iv|ate_(to_timestamp|from_timestamp))|pow|eqv|fix|a(nd|dd|bs)|round|get_type|xor|m(od|ul)))\b + name + support.function.com.php + + + match + (?i)\brandom_(int|bytes)\b + name + support.function.csprng.php + + + match + (?i)\bctype_(space|cntrl|digit|upper|p(unct|rint)|lower|al(num|pha)|graph|xdigit)\b + name + support.function.ctype.php + + + match + (?i)\bcurl_(s(hare_(setopt|close|init)|trerror|etopt(_array)?)|c(opy_handle|lose)|init|unescape|pause|e(scape|rr(no|or)|xec)|version|file_create|reset|getinfo|multi_(s(trerror|e(topt|lect))|close|in(it|fo_read)|exec|add_handle|remove_handle|getcontent))\b + name + support.function.curl.php + + + match + (?i)\b(str(totime|ptime|ftime)|checkdate|time(zone_(name_(from_abbr|get)|transitions_get|identifiers_list|o(pen|ffset_get)|version_get|location_get|abbreviations_list))?|idate|date(_(su(n(set|_info|rise)|b)|create(_(immutable(_from_format)?|from_format))?|time(stamp_(set|get)|zone_(set|get)|_set)|i(sodate_set|nterval_(create_from_date_string|format))|offset_get|d(iff|efault_timezone_(set|get)|ate_set)|parse(_from_format)?|format|add|get_last_errors|modify))?|localtime|g(et(timeofday|date)|m(strftime|date|mktime))|m(icrotime|ktime))\b + name + support.function.datetime.php + + + match + (?i)\bdba_(sync|handlers|nextkey|close|insert|op(timize|en)|delete|popen|exists|key_split|f(irstkey|etch)|list|replace)\b + name + support.function.dba.php + + + match + (?i)\bdbx_(sort|c(o(nnect|mpare)|lose)|e(scape_string|rror)|query|fetch_row)\b + name + support.function.dbx.php + + + match + (?i)\b(scandir|c(h(dir|root)|losedir)|opendir|dir|re(winddir|addir)|getcwd)\b + name + support.function.dir.php + + + match + (?i)\beio_(s(y(nc(_file_range|fs)?|mlink)|tat(vfs)?|e(ndfile|t_m(in_parallel|ax_(idle|p(oll_(time|reqs)|arallel)))|ek))|n(threads|op|pending|re(qs|ady))|c(h(own|mod)|ustom|lose|ancel)|truncate|init|open|dup2|u(nlink|time)|poll|event_loop|f(s(ync|tat(vfs)?)|ch(own|mod)|truncate|datasync|utime|allocate)|write|l(stat|ink)|r(e(name|a(d(dir|link|ahead)?|lpath))|mdir)|g(et_(event_stream|last_error)|rp(_(cancel|limit|add))?)|mk(nod|dir)|busy)\b + name + support.function.eio.php + + + match + (?i)\benchant_(dict_(s(tore_replacement|uggest)|check|is_in_session|describe|quick_check|add_to_(session|personal)|get_error)|broker_(set_(ordering|dict_path)|init|d(ict_exists|escribe)|free(_dict)?|list_dicts|request_(dict|pwl_dict)|get_(dict_path|error)))\b + name + support.function.enchant.php + + + match + (?i)\b(s(plit(i)?|ql_regcase)|ereg(i(_replace)?|_replace)?)\b + name + support.function.ereg.php + + + match + (?i)\b(set_e(rror_handler|xception_handler)|trigger_error|debug_(print_backtrace|backtrace)|user_error|error_(clear_last|log|reporting|get_last)|restore_e(rror_handler|xception_handler))\b + name + support.function.errorfunc.php + + + match + (?i)\b(s(hell_exec|ystem)|p(assthru|roc_(nice|close|terminate|open|get_status))|e(scapeshell(cmd|arg)|xec))\b + name + support.function.exec.php + + + match + (?i)\b(exif_(t(humbnail|agname)|imagetype|read_data)|read_exif_data)\b + name + support.function.exif.php + + + match + (?i)\bfann_(s(huffle_train_data|cale_(train(_data)?|input(_train_data)?|output(_train_data)?)|ubset_train_data|et_(s(caling_params|arprop_(step_error_(shift|threshold_factor)|temperature|weight_decay_shift))|ca(scade_(num_candidate_groups|candidate_(stagnation_epochs|change_fraction|limit)|output_(stagnation_epochs|change_fraction)|weight_multiplier|activation_(steepnesses|functions)|m(in_(cand_epochs|out_epochs)|ax_(cand_epochs|out_epochs)))|llback)|train(ing_algorithm|_(stop_function|error_function))|input_scaling_params|output_scaling_params|error_log|quickprop_(decay|mu)|weight(_array)?|learning_(rate|momentum)|activation_(steepness(_(hidden|output|layer))?|function(_(hidden|output|layer))?)|rprop_(increase_factor|de(crease_factor|lta_(zero|m(in|ax))))|bit_fail_limit)|ave(_train)?)|num_(input_train_data|output_train_data)|c(opy|lear_scaling_params|ascadetrain_on_(data|file)|reate_(s(hortcut(_array)?|tandard(_array)?|parse(_array)?)|train(_from_callback)?|from_file))|t(est(_data)?|rain(_(on_(data|file)|epoch))?)|init_weights|d(uplicate_train_data|es(cale_(train|input|output)|troy(_train)?))|print_error|length_train_data|r(un|e(set_(MSE|err(str|no))|ad_train_from_file)|andomize_weights)|get_(sarprop_(step_error_(shift|threshold_factor)|temperature|weight_decay_shift)|n(um_(input|output|layers)|etwork_type)|MSE|c(onnection_(array|rate)|ascade_(num_candidate(s|_groups)|candidate_(stagnation_epochs|change_fraction|limit)|output_(stagnation_epochs|change_fraction)|weight_multiplier|activation_(steepnesses(_count)?|functions(_count)?)|m(in_(cand_epochs|out_epochs)|ax_(cand_epochs|out_epochs))))|t(otal_(neurons|connections)|rain(ing_algorithm|_(stop_function|error_function)))|err(str|no)|quickprop_(decay|mu)|l(earning_(rate|momentum)|ayer_array)|activation_(steepness|function)|rprop_(increase_factor|de(crease_factor|lta_(zero|m(in|ax))))|bi(t_fail(_limit)?|as_array))|merge_train_data)\b + name + support.function.fann.php + + + match + (?i)\b(s(ymlink|tat|et_file_buffer)|c(h(own|grp|mod)|opy|learstatcache)|t(ouch|empnam|mpfile)|is_(dir|uploaded_file|executable|file|writ(eable|able)|link|readable)|d(i(sk(_(total_space|free_space)|freespace)|rname)|elete)|u(nlink|mask)|p(close|open|a(thinfo|rse_ini_(string|file)))|f(s(canf|tat|eek)|nmatch|close|t(ell|runcate)|ile(size|ctime|type|inode|owner|_(put_contents|exists|get_contents)|perms|atime|group|mtime)?|open|p(ut(s|csv)|assthru)|eof|flush|write|lock|read|get(s(s)?|c(sv)?))|l(stat|ch(own|grp)|ink(info)?)|r(e(name|wind|a(d(file|link)|lpath(_cache_(size|get))?))|mdir)|glob|m(ove_uploaded_file|kdir)|basename)\b + name + support.function.file.php + + + match + (?i)\b(finfo_(set_flags|close|open|file|buffer)|mime_content_type)\b + name + support.function.fileinfo.php + + + match + (?i)\bfilter_(has_var|i(nput(_array)?|d)|var(_array)?|list)\b + name + support.function.filter.php + + + match + (?i)\bfastcgi_finish_request\b + name + support.function.fpm.php + + + match + (?i)\b(c(all_user_func(_array)?|reate_function)|unregister_tick_function|f(orward_static_call(_array)?|unc(tion_exists|_(num_args|get_arg(s)?)))|register_(shutdown_function|tick_function)|get_defined_functions)\b + name + support.function.funchand.php + + + match + (?i)\b(ngettext|textdomain|d(ngettext|c(ngettext|gettext)|gettext)|gettext|bind(textdomain|_textdomain_codeset))\b + name + support.function.gettext.php + + + match + (?i)\bgmp_(s(can(1|0)|trval|ign|ub|etbit|qrt(rem)?)|hamdist|ne(g|xtprime)|c(om|lrbit|mp)|testbit|i(n(tval|it|vert)|mport)|or|div(_(q(r)?|r)|exact)?|jacobi|p(o(pcount|w(m)?)|erfect_square|rob_prime)|export|fact|legendre|a(nd|dd|bs)|r(oot(rem)?|andom(_(seed|range|bits))?)|gcd(ext)?|xor|m(od|ul))\b + name + support.function.gmp.php + + + match + (?i)\bhash(_(h(kdf|mac(_file)?)|copy|init|update(_(stream|file))?|pbkdf2|equals|fi(nal|le)|algos))?\b + name + support.function.hash.php + + + match + (?i)\b(iconv(_(s(tr(pos|len|rpos)|ubstr|et_encoding)|get_encoding|mime_(decode(_headers)?|encode)))?|ob_iconv_handler)\b + name + support.function.iconv.php + + + match + (?i)\biis_(s(t(op_serv(ice|er)|art_serv(ice|er))|et_(s(cript_map|erver_rights)|dir_security|app_settings))|add_server|remove_server|get_(s(cript_map|erv(ice_state|er_(rights|by_(comment|path))))|dir_security))\b + name + support.function.iisfunc.php + + + match + (?i)\b(i(ptc(parse|embed)|mage(s(y|cale|tring(up)?|et(style|clip|t(hickness|ile)|interpolation|pixel|brush)|avealpha|x)|c(har(up)?|o(nvolution|py(res(ized|ampled)|merge(gray)?)?|lor(s(total|et|forindex)|closest(hwb|alpha)?|transparent|deallocate|exact(alpha)?|a(t|llocate(alpha)?)|resolve(alpha)?|match))|r(op(auto)?|eate(truecolor|from(string|jpeg|png|w(ebp|bmp)|g(if|d(2(part)?)?)|x(pm|bm)|bmp))?))|t(ypes|tf(text|bbox)|ruecolortopalette)|i(struecolor|nterlace)|2wbmp|openpolygon|d(estroy|ashedline)|jpeg|_type_to_(extension|mime_type)|p(s(slantfont|text|e(ncodefont|xtendfont)|freefont|loadfont|bbox)|ng|olygon|alette(copy|totruecolor))|ellipse|f(t(text|bbox)|il(ter|l(toborder|ed(polygon|ellipse|arc|rectangle))?)|ont(height|width)|lip)|w(ebp|bmp)|l(ine|oadfont|ayereffect)|a(ntialias|ffine(matrix(concat|get))?|lphablending|rc)|r(otate|e(solution|ctangle))|g(if|d(2)?|etclip|ammacorrect|rab(screen|window))|xbm|bmp))|jpeg2wbmp|png2wbmp|g(d_info|etimagesize(fromstring)?))\b + name + support.function.image.php + + + match + (?i)\b(s(ys_get_temp_dir|et_(time_limit|include_path|magic_quotes_runtime))|cli_(set_process_title|get_process_title)|ini_(set|alter|restore|get(_all)?)|zend_(thread_id|version|logo_guid)|dl|p(hp(credits|info|_(sapi_name|ini_(scanned_files|loaded_file)|uname|logo_guid)|version)|utenv)|extension_loaded|version_compare|assert(_options)?|restore_include_path|g(c_(collect_cycles|disable|enable(d)?|mem_caches)|et(opt|_(c(urrent_user|fg_var)|include(d_files|_path)|defined_constants|extension_funcs|loaded_extensions|re(sources|quired_files)|magic_quotes_(runtime|gpc))|env|lastmod|rusage|my(inode|uid|pid|gid)))|m(emory_get_(usage|peak_usage)|a(in|gic_quotes_runtime)))\b + name + support.function.info.php + + + match + (?i)\bibase_(se(t_event_handler|rv(ice_(detach|attach)|er_info))|n(um_(params|fields)|ame_result)|c(o(nnect|mmit(_ret)?)|lose)|trans|d(elete_user|rop_db|b_info)|p(connect|aram_info|repare)|e(rr(code|msg)|xecute)|query|f(ield_info|etch_(object|assoc|row)|ree_(event_handler|query|result))|wait_event|a(dd_user|ffected_rows)|r(ollback(_ret)?|estore)|gen_id|m(odify_user|aintain_db)|b(lob_(c(lose|ancel|reate)|i(nfo|mport)|open|echo|add|get)|ackup))\b + name + support.function.interbase.php + + + match + (?i)\b(n(ormalizer_(normalize|is_normalized)|umfmt_(set_(symbol|text_attribute|pattern|attribute)|create|parse(_currency)?|format(_currency)?|get_(symbol|text_attribute|pattern|error_(code|message)|locale|attribute)))|collator_(s(ort(_with_sort_keys)?|et_(strength|attribute))|c(ompare|reate)|asort|get_(s(trength|ort_key)|error_(code|message)|locale|attribute))|transliterator_(create(_(inverse|from_rules))?|transliterate|list_ids|get_error_(code|message))|i(ntl(cal_get_error_(code|message)|tz_get_error_(code|message)|_(is_failure|error_name|get_error_(code|message)))|dn_to_(utf8|ascii))|datefmt_(set_(calendar|timezone(_id)?|pattern|lenient)|create|is_lenient|parse|format(_object)?|localtime|get_(calendar(_object)?|time(type|zone(_id)?)|datetype|pattern|error_(code|message)|locale))|locale_(set_default|c(ompose|anonicalize)|parse|filter_matches|lookup|accept_from_http|get_(script|d(isplay_(script|name|variant|language|region)|efault)|primary_language|keywords|all_variants|region))|resourcebundle_(c(ount|reate)|locales|get(_error_(code|message))?)|grapheme_(s(tr(str|i(str|pos)|pos|len|r(ipos|pos))|ubstr)|extract)|msgfmt_(set_pattern|create|parse(_message)?|format(_message)?|get_(pattern|error_(code|message)|locale)))\b + name + support.function.intl.php + + + match + (?i)\bjson_(decode|encode|last_error(_msg)?)\b + name + support.function.json.php + + + match + (?i)\bldap_(s(tart_tls|ort|e(t_(option|rebind_proc)|arch)|asl_bind)|next_(entry|attribute|reference)|c(o(n(nect|trol_paged_result(_response)?)|unt_entries|mpare)|lose)|t61_to_8859|d(n2ufn|elete)|8859_to_t61|unbind|parse_re(sult|ference)|e(scape|rr(no|2str|or)|xplode_dn)|f(irst_(entry|attribute|reference)|ree_result)|list|add|re(name|ad)|get_(option|dn|entries|values(_len)?|attributes)|mod(ify(_batch)?|_(del|add|replace))|bind)\b + name + support.function.ldap.php + + + match + (?i)\blibxml_(set_(streams_context|external_entity_loader)|clear_errors|disable_entity_loader|use_internal_errors|get_(errors|last_error))\b + name + support.function.libxml.php + + + match + (?i)\b(ezmlm_hash|mail)\b + name + support.function.mail.php + + + match + (?i)\b(s(in(h)?|qrt|rand)|h(ypot|exdec)|c(os(h)?|eil)|tan(h)?|i(s_(nan|infinite|finite)|ntdiv)|octdec|de(c(hex|oct|bin)|g2rad)|p(i|ow)|exp(m1)?|f(loor|mod)|l(cg_value|og(1(p|0))?)|a(sin(h)?|cos(h)?|tan(h|2)?|bs)|r(ound|a(nd|d2deg))|getrandmax|m(t_(srand|rand|getrandmax)|in|ax)|b(indec|ase_convert))\b + name + support.function.math.php + + + match + (?i)\bmb_(s(tr(str|cut|to(upper|lower)|i(str|pos|mwidth)|pos|width|len|r(chr|i(chr|pos)|pos))|ubst(itute_character|r(_count)?)|plit|end_mail)|http_(input|output)|c(heck_encoding|onvert_(case|encoding|variables|kana))|internal_encoding|output_handler|de(code_(numericentity|mimeheader)|tect_(order|encoding))|p(arse_str|referred_mime_name)|e(ncod(ing_aliases|e_(numericentity|mimeheader))|reg(i(_replace)?|_(search(_(setpos|init|pos|regs|get(pos|regs)))?|replace(_callback)?|match))?)|l(ist_encodings|anguage)|regex_(set_options|encoding)|get_info)\b + name + support.function.mbstring.php + + + match + (?i)\bm(crypt_(c(fb|reate_iv|bc)|ofb|decrypt|e(nc(_(self_test|is_block_(algorithm(_mode)?|mode)|get_(supported_key_sizes|iv_size|key_size|algorithms_name|modes_name|block_size))|rypt)|cb)|list_(algorithms|modes)|ge(neric(_(init|deinit|end))?|t_(cipher_name|iv_size|key_size|block_size))|module_(self_test|close|is_block_(algorithm(_mode)?|mode)|open|get_(supported_key_sizes|algo_(key_size|block_size))))|decrypt_generic)\b + name + support.function.mcrypt.php + + + match + (?i)\bmemcache_debug\b + name + support.function.memcache.php + + + match + (?i)\bmhash(_(count|keygen_s2k|get_(hash_name|block_size)))?\b + name + support.function.mhash.php + + + match + (?i)\b(log_(cmd_(insert|delete|update)|killcursor|write_batch|reply|getmore)|bson_(decode|encode))\b + name + support.function.mongo.php + + + match + (?i)\bmysql_(s(tat|e(t_charset|lect_db))|num_(fields|rows)|c(onnect|l(ient_encoding|ose)|reate_db)|t(hread_id|ablename)|in(sert_id|fo)|d(ata_seek|rop_db|b_(name|query))|unbuffered_query|p(connect|ing)|e(scape_string|rr(no|or))|query|f(ield_(seek|name|t(ype|able)|flags|len)|etch_(object|field|lengths|a(ssoc|rray)|row)|ree_result)|list_(tables|dbs|processes|fields)|affected_rows|re(sult|al_escape_string)|get_(server_info|host_info|client_info|proto_info))\b + name + support.function.mysql.php + + + match + (?i)\bmysqli_(s(sl_set|t(ore_result|at|mt_(s(tore_result|end_long_data)|next_result|close|init|data_seek|prepare|execute|f(etch|ree_result)|attr_(set|get)|res(ult_metadata|et)|get_(warnings|result)|more_results|bind_(param|result)))|e(nd_(query|long_data)|t_(charset|opt|local_infile_(handler|default))|lect_db)|lave_query|avepoint)|next_result|c(ha(nge_user|racter_set_name)|o(nnect|mmit)|l(ient_encoding|ose))|thread_safe|init|options|d(isable_r(pl_parse|eads_from_master)|ump_debug_info|ebug|ata_seek)|use_result|p(ing|oll|aram_count|repare)|e(scape_string|nable_r(pl_parse|eads_from_master)|xecute|mbedded_server_(start|end))|kill|query|f(ield_seek|etch(_(object|field(s|_direct)?|a(ssoc|ll|rray)|row))?|ree_result)|autocommit|r(ollback|pl_(p(arse_enabled|robe)|query_type)|e(port|fresh|lease_savepoint|a(p_async_query|l_(connect|escape_string|query))))|get_(c(harset|onnection_stats|lient_(stats|info|version)|ache_stats)|warnings|links_stats|metadata)|m(ore_results|ulti_query|aster_query)|b(ind_(param|result)|egin_transaction))\b + name + support.function.mysqli.php + + + match + (?i)\bmysqlnd_memcache_(set|get_config)\b + name + support.function.mysqlnd-memcache.php + + + match + (?i)\bmysqlnd_ms_(set_(user_pick_server|qos)|dump_servers|query_is_select|fabric_select_(shard|global)|get_(stats|last_(used_connection|gtid))|xa_(commit|rollback|gc|begin)|match_wild)\b + name + support.function.mysqlnd-ms.php + + + match + (?i)\bmysqlnd_qc_(set_(storage_handler|cache_condition|is_select|user_handlers)|clear_cache|get_(normalized_query_trace_log|c(ore_stats|ache_info)|query_trace_log|available_handlers))\b + name + support.function.mysqlnd-qc.php + + + match + (?i)\bmysqlnd_uh_(set_(statement_proxy|connection_proxy)|convert_to_mysqlnd)\b + name + support.function.mysqlnd-uh.php + + + match + (?i)\b(s(yslog|ocket_(set_(timeout|blocking)|get_status)|et(cookie|rawcookie))|h(ttp_response_code|eader(s_(sent|list)|_re(gister_callback|move))?)|c(heckdnsrr|loselog)|i(net_(ntop|pton)|p2long)|openlog|d(ns_(check_record|get_(record|mx))|efine_syslog_variables)|pfsockopen|fsockopen|long2ip|get(servby(name|port)|host(name|by(name(l)?|addr))|protobyn(umber|ame)|mxrr))\b + name + support.function.network.php + + + match + (?i)\bnsapi_(virtual|re(sponse_headers|quest_headers))\b + name + support.function.nsapi.php + + + match + (?i)\boci(s(tatementtype|e(tprefetch|rverversion)|avelob(file)?)|n(umcols|ew(c(ollection|ursor)|descriptor)|logon)|c(o(l(umn(s(cale|ize)|name|type(raw)?|isnull|precision)|l(size|trim|a(ssign(elem)?|ppend)|getelem|max))|mmit)|loselob|ancel)|internaldebug|definebyname|_(s(tatement_type|e(t_(client_i(nfo|dentifier)|prefetch|edition|action|module_name)|rver_version))|n(um_(fields|rows)|ew_(c(o(nnect|llection)|ursor)|descriptor))|c(o(nnect|mmit)|l(ient_version|ose)|ancel)|internal_debug|d(isable_taf_callback|efine_by_name)|p(connect|a(ssword_change|rse))|e(rror|xecute)|f(ield_(s(cale|ize)|name|type(_raw)?|is_null|precision)|etch(_(object|a(ssoc|ll|rray)|row))?|ree_(statement|descriptor))|lob_(copy|is_equal)|r(ollback|e(sult|gister_taf_callback))|get_implicit_resultset|bind_(array_by_name|by_name))|p(logon|arse)|e(rror|xecute)|f(etch(statement|into)?|ree(statement|c(ollection|ursor)|desc))|write(temporarylob|lobtofile)|lo(adlob|go(n|ff))|r(o(wcount|llback)|esult)|bindbyname)\b + name + support.function.oci8.php + + + match + (?i)\bopcache_(compile_file|i(s_script_cached|nvalidate)|reset|get_(status|configuration))\b + name + support.function.opcache.php + + + match + (?i)\bopenssl_(s(ign|pki_(new|export(_challenge)?|verify)|eal)|c(sr_(sign|new|export(_to_file)?|get_(subject|public_key))|ipher_iv_length)|open|d(h_compute_key|igest|ecrypt)|p(ublic_(decrypt|encrypt)|k(cs(12_(export(_to_file)?|read)|7_(sign|decrypt|encrypt|verify))|ey_(new|export(_to_file)?|free|get_(details|p(ublic|rivate))))|rivate_(decrypt|encrypt)|bkdf2)|e(ncrypt|rror_string)|verify|free_key|random_pseudo_bytes|get_(c(ipher_methods|ert_locations)|p(ublickey|rivatekey)|md_methods)|x509_(check(_private_key|purpose)|parse|export(_to_file)?|f(ingerprint|ree)|read))\b + name + support.function.openssl.php + + + match + (?i)\b(o(utput_(add_rewrite_var|reset_rewrite_vars)|b_(start|clean|implicit_flush|end_(clean|flush)|flush|list_handlers|g(zhandler|et_(status|c(ontents|lean)|flush|le(ngth|vel)))))|flush)\b + name + support.function.output.php + + + match + (?i)\bpassword_(hash|needs_rehash|verify|get_info)\b + name + support.function.password.php + + + match + (?i)\bpcntl_(s(trerror|ig(nal(_(dispatch|get_handler))?|timedwait|procmask|waitinfo)|etpriority)|e(rrno|xec)|fork|w(stopsig|termsig|if(s(topped|ignaled)|exited)|exitstatus|ait(pid)?)|alarm|get(_last_error|priority))\b + name + support.function.pcntl.php + + + match + (?i)\bpg_(s(ocket|e(nd_(prepare|execute|query(_params)?)|t_(client_encoding|error_verbosity)|lect))|host|num_(fields|rows)|c(o(n(sume_input|nect(ion_(status|reset|busy)|_poll)?|vert)|py_(to|from))|l(ient_encoding|ose)|ancel_query)|t(ty|ra(nsaction_status|ce))|insert|options|d(elete|bname)|u(n(trace|escape_bytea)|pdate)|p(connect|ing|ort|ut_line|arameter_status|repare)|e(scape_(string|identifier|literal|bytea)|nd_copy|xecute)|version|query(_params)?|f(ield_(size|n(um|ame)|t(ype(_oid)?|able)|is_null|prtlen)|etch_(object|a(ssoc|ll(_columns)?|rray)|r(ow|esult))|lush|ree_result)|l(o_(seek|c(lose|reate)|t(ell|runcate)|import|open|unlink|export|write|read(_all)?)|ast_(notice|oid|error))|affected_rows|result_(s(tatus|eek)|error(_field)?)|get_(notify|pid|result)|meta_data)\b + name + support.function.pgsql.php + + + match + (?i)\b(virtual|apache_(setenv|note|child_terminate|lookup_uri|re(s(ponse_headers|et_timeout)|quest_headers)|get(_(version|modules)|env))|getallheaders)\b + name + support.function.php_apache.php + + + match + (?i)\bdom_import_simplexml\b + name + support.function.php_dom.php + + + match + (?i)\bftp_(s(sl_connect|ystype|i(te|ze)|et_option)|n(list|b_(continue|put|f(put|get)|get))|c(h(dir|mod)|onnect|dup|lose)|delete|p(ut|wd|asv)|exec|quit|f(put|get)|login|alloc|r(ename|aw(list)?|mdir)|get(_option)?|m(dtm|kdir))\b + name + support.function.php_ftp.php + + + match + (?i)\bimap_(s(can(mailbox)?|tatus|ort|ubscribe|e(t(_quota|flag_full|acl)|arch)|avebody)|header(s|info)?|num_(recent|msg)|c(heck|l(ose|earflag_full)|reate(mailbox)?)|t(hread|imeout)|open|delete(mailbox)?|8bit|u(n(subscribe|delete)|tf(7_(decode|encode)|8)|id)|ping|e(rrors|xpunge)|qprint|fetch(structure|header|text|_overview|mime|body)|l(sub|ist(s(can|ubscribed)|mailbox)?|ast_error)|a(ppend|lerts)|r(e(name(mailbox)?|open)|fc822_(parse_(headers|adrlist)|write_address))|g(c|et(subscribed|_quota(root)?|acl|mailboxes))|m(sgno|ime_header_decode|ail(_(co(py|mpose)|move)|boxmsginfo)?)|b(inary|ody(struct)?|ase64))\b + name + support.function.php_imap.php + + + match + (?i)\bmssql_(select_db|n(um_(fields|rows)|ext_result)|c(onnect|lose)|init|data_seek|pconnect|execute|query|f(ield_(seek|name|type|length)|etch_(object|field|a(ssoc|rray)|row|batch)|ree_(statement|result))|r(ows_affected|esult)|g(uid_string|et_last_message)|min_(error_severity|message_severity)|bind)\b + name + support.function.php_mssql.php + + + match + (?i)\bodbc_(s(tatistics|pecialcolumns|etoption)|n(um_(fields|rows)|ext_result)|c(o(nnect|lumn(s|privileges)|mmit)|ursor|lose(_all)?)|table(s|privileges)|d(o|ata_source)|p(connect|r(imarykeys|ocedure(s|columns)|epare))|e(rror(msg)?|xec(ute)?)|f(ield_(scale|n(um|ame)|type|precision|len)|oreignkeys|etch_(into|object|array|row)|ree_result)|longreadlen|autocommit|r(ollback|esult(_all)?)|gettypeinfo|binmode)\b + name + support.function.php_odbc.php + + + match + (?i)\bpreg_(split|quote|filter|last_error|replace(_callback(_array)?)?|grep|match(_all)?)\b + name + support.function.php_pcre.php + + + match + (?i)\b(spl_(classes|object_hash|autoload(_(call|unregister|extensions|functions|register))?)|class_(implements|uses|parents)|iterator_(count|to_array|apply))\b + name + support.function.php_spl.php + + + match + (?i)\bzip_(close|open|entry_(name|c(ompress(ionmethod|edsize)|lose)|open|filesize|read)|read)\b + name + support.function.php_zip.php + + + match + (?i)\bposix_(s(trerror|et(sid|uid|pgid|e(uid|gid)|rlimit|gid))|ctermid|t(tyname|imes)|i(satty|nitgroups)|uname|errno|kill|access|get(sid|cwd|uid|_last_error|p(id|pid|w(nam|uid)|g(id|rp))|e(uid|gid)|login|rlimit|g(id|r(nam|oups|gid)))|mk(nod|fifo))\b + name + support.function.posix.php + + + match + (?i)\bset(threadtitle|proctitle)\b + name + support.function.proctitle.php + + + match + (?i)\bpspell_(s(tore_replacement|uggest|ave_wordlist)|new(_(config|personal))?|c(heck|onfig_(save_repl|create|ignore|d(ict_dir|ata_dir)|personal|r(untogether|epl)|mode)|lear_session)|add_to_(session|personal))\b + name + support.function.pspell.php + + + match + (?i)\breadline(_(c(ompletion_function|lear_history|allback_(handler_(install|remove)|read_char))|info|on_new_line|write_history|list_history|add_history|re(display|ad_history)))?\b + name + support.function.readline.php + + + match + (?i)\brecode(_(string|file))?\b + name + support.function.recode.php + + + match + (?i)\brrd(c_disconnect|_(create|tune|info|update|error|version|f(irst|etch)|last(update)?|restore|graph|xport))\b + name + support.function.rrd.php + + + match + (?i)\b(s(hm_(has_var|detach|put_var|attach|remove(_var)?|get_var)|em_(acquire|re(lease|move)|get))|ftok|msg_(s(tat_queue|e(nd|t_queue))|queue_exists|re(ceive|move_queue)|get_queue))\b + name + support.function.sem.php + + + match + (?i)\bsession_(s(ta(tus|rt)|et_(save_handler|cookie_params)|ave_path)|name|c(ommit|ache_(expire|limiter)|reate_id)|i(s_registered|d)|de(stroy|code)|un(set|register)|encode|write_close|abort|re(set|g(ister(_shutdown)?|enerate_id))|g(c|et_cookie_params)|module_name)\b + name + support.function.session.php + + + match + (?i)\bshmop_(size|close|open|delete|write|read)\b + name + support.function.shmop.php + + + match + (?i)\bsimplexml_(import_dom|load_(string|file))\b + name + support.function.simplexml.php + + + match + (?i)\bsnmp(set|2_(set|walk|real_walk|get(next)?)|_(set_(oid_(numeric_print|output_format)|enum_print|valueretrieval|quick_print)|read_mib|get_(valueretrieval|quick_print))|3_(set|walk|real_walk|get(next)?)|walk(oid)?|realwalk|get(next)?)\b + name + support.function.snmp.php + + + match + (?i)\b(is_soap_fault|use_soap_error_handler)\b + name + support.function.soap.php + + + match + (?i)\bsocket_(s(hutdown|trerror|e(nd(to|msg)?|t(opt|_(nonblock|option|block))|lect))|c(onnect|l(ose|ear_error)|reate(_(pair|listen))?|msg_space)|import_stream|write|l(isten|ast_error)|accept|re(cv(from|msg)?|ad)|get(sockname|opt|_option|peername)|bind)\b + name + support.function.sockets.php + + + match + (?i)\bsqlite_(s(ingle_query|eek)|has_(prev|more)|n(um_(fields|rows)|ext)|c(hanges|olumn|urrent|lose|reate_(function|aggregate))|open|u(nbuffered_query|df_(decode_binary|encode_binary))|p(open|rev)|e(scape_string|rror_string|xec)|valid|key|query|f(ield_name|etch_(s(tring|ingle)|column_types|object|a(ll|rray))|actory)|l(ib(encoding|version)|ast_(insert_rowid|error))|array_query|rewind|busy_timeout)\b + name + support.function.sqlite.php + + + match + (?i)\bsqlsrv_(se(nd_stream_data|rver_info)|has_rows|n(um_(fields|rows)|ext_result)|c(o(n(nect|figure)|mmit)|l(ient_info|ose)|ancel)|prepare|e(rrors|xecute)|query|f(ield_metadata|etch(_(object|array))?|ree_stmt)|ro(ws_affected|llback)|get_(config|field)|begin_transaction)\b + name + support.function.sqlsrv.php + + + match + (?i)\bstats_(s(ta(ndard_deviation|t_(noncentral_t|correlation|in(nerproduct|dependent_t)|p(owersum|ercentile|aired_t)|gennch|binomial_coef))|kew)|harmonic_mean|c(ovariance|df_(n(oncentral_(chisquare|f)|egative_binomial)|c(hisquare|auchy)|t|uniform|poisson|exponential|f|weibull|l(ogistic|aplace)|gamma|b(inomial|eta)))|den(s_(n(ormal|egative_binomial)|c(hisquare|auchy)|t|pmf_(hypergeometric|poisson|binomial)|exponential|f|weibull|l(ogistic|aplace)|gamma|beta)|_uniform)|variance|kurtosis|absolute_deviation|rand_(setall|phrase_to_seeds|ranf|ge(n_(no(ncen(tral_(t|f)|ral_chisquare)|rmal)|chisquare|t|i(nt|uniform|poisson|binomial(_negative)?)|exponential|f(uniform)?|gamma|beta)|t_seeds)))\b + name + support.function.stats.php + + + match + (?i)\bs(tream_(s(ocket_(s(hutdown|e(ndto|rver))|client|pair|enable_crypto|accept|recvfrom|get_name)|upports_lock|e(t_(chunk_size|timeout|write_buffer|read_buffer|blocking)|lect))|notification_callback|co(ntext_(set_(option|default|params)|create|get_(options|default|params))|py_to_stream)|is_local|encoding|filter_(prepend|append|re(gister|move))|wrapper_(unregister|re(store|gister))|re(solve_include_path|gister_wrapper)|get_(contents|transports|filters|wrappers|line|meta_data)|bucket_(new|prepend|append|make_writeable))|et_socket_blocking)\b + name + support.function.streamsfuncs.php + + + match + (?i)\b(s(scanf|ha1(_file)?|tr(s(tr|pn)|n(c(asecmp|mp)|atc(asecmp|mp))|c(spn|hr|oll|asecmp|mp)|t(o(upper|k|lower)|r)|i(str|p(slashes|cslashes|os|_tags))|_(s(huffle|plit)|ireplace|pad|word_count|r(ot13|ep(eat|lace))|getcsv)|p(os|brk)|len|r(chr|ipos|pos|ev))|imilar_text|oundex|ubstr(_(co(unt|mpare)|replace))?|printf|etlocale)|h(tml(specialchars(_decode)?|_entity_decode|entities)|e(x2bin|brev(c)?))|n(umber_format|l(2br|_langinfo))|c(h(op|unk_split|r)|o(nvert_(cyr_string|uu(decode|encode))|unt_chars)|r(ypt|c32))|trim|implode|ord|uc(first|words)|join|p(arse_str|rint(f)?)|e(cho|xplode)|v(sprintf|printf|fprintf)|quote(d_printable_(decode|encode)|meta)|fprintf|wordwrap|l(cfirst|trim|ocaleconv|evenshtein)|add(slashes|cslashes)|rtrim|get_html_translation_table|m(oney_format|d5(_file)?|etaphone)|bin2hex)\b + name + support.function.string.php + + + match + (?i)\bsybase_(se(t_message_handler|lect_db)|num_(fields|rows)|c(onnect|lose)|d(eadlock_retry_count|ata_seek)|unbuffered_query|pconnect|query|f(ield_seek|etch_(object|field|a(ssoc|rray)|row)|ree_result)|affected_rows|result|get_last_message|min_(server_severity|client_severity|error_severity|message_severity))\b + name + support.function.sybase.php + + + match + (?i)\b(taint|is_tainted|untaint)\b + name + support.function.taint.php + + + match + (?i)\b(tidy_(s(et(opt|_encoding)|ave_config)|c(onfig_count|lean_repair)|is_x(html|ml)|diagnose|parse_(string|file)|error_count|warning_count|load_config|access_count|re(set_config|pair_(string|file))|get(opt|_(status|h(tml(_ver)?|ead)|config|o(utput|pt_doc)|r(oot|elease)|body)))|ob_tidyhandler)\b + name + support.function.tidy.php + + + match + (?i)\btoken_(name|get_all)\b + name + support.function.tokenizer.php + + + match + (?i)\btrader_(s(t(och(f|rsi)?|ddev)|in(h)?|u(m|b)|et_(compat|unstable_period)|qrt|ar(ext)?|ma)|ht_(sine|trend(line|mode)|dcp(hase|eriod)|phasor)|natr|c(ci|o(s(h)?|rrel)|dl(s(ho(otingstar|rtline)|t(icksandwich|alledpattern)|pinningtop|eparatinglines)|h(i(kkake(mod)?|ghwave)|omingpigeon|a(ngingman|rami(cross)?|mmer))|c(o(ncealbabyswall|unterattack)|losingmarubozu)|t(hrusting|a(sukigap|kuri)|ristar)|i(n(neck|vertedhammer)|dentical3crows)|2crows|onneck|d(oji(star)?|arkcloudcover|ragonflydoji)|u(nique3river|psidegap2crows)|3(starsinsouth|inside|outside|whitesoldiers|linestrike|blackcrows)|piercing|e(ngulfing|vening(star|dojistar))|kicking(bylength)?|l(ongl(ine|eggeddoji)|adderbottom)|a(dvanceblock|bandonedbaby)|ri(sefall3methods|ckshawman)|g(apsidesidewhite|ravestonedoji)|xsidegap3methods|m(orning(star|dojistar)|a(t(hold|chinglow)|rubozu))|b(elthold|reakaway))|eil|mo)|t(sf|ypprice|3|ema|an(h)?|r(i(x|ma)|ange))|obv|d(iv|ema|x)|ultosc|p(po|lus_d(i|m))|e(rrno|xp|ma)|var|kama|floor|w(clprice|illr|ma)|l(n|inearreg(_(slope|intercept|angle))?|og10)|a(sin|cos|t(an|r)|d(osc|d|x(r)?)?|po|vgprice|roon(osc)?)|r(si|oc(p|r(100)?)?)|get_(compat|unstable_period)|m(i(n(index|us_d(i|m)|max(index)?)?|dp(oint|rice))|om|ult|edprice|fi|a(cd(ext|fix)?|vp|x(index)?|ma)?)|b(op|eta|bands))\b + name + support.function.trader.php + + + match + (?i)\bUI\\(Draw\\Text\\Font\\fontFamilies|quit|run)\b + name + support.function.ui.php + + + match + (?i)\buopz_(co(py|mpose)|implement|overload|delete|undefine|extend|f(unction|lags)|re(store|name|define)|backup)\b + name + support.function.uopz.php + + + match + (?i)\b(http_build_query|url(decode|encode)|parse_url|rawurl(decode|encode)|get_(headers|meta_tags)|base64_(decode|encode))\b + name + support.function.url.php + + + match + (?i)\b(s(trval|e(ttype|rialize))|i(s(set|_(s(calar|tring)|nu(ll|meric)|callable|i(nt(eger)?|terable)|object|double|float|long|array|re(source|al)|bool))|ntval|mport_request_variables)|d(oubleval|ebug_zval_dump)|unse(t|rialize)|print_r|empty|var_(dump|export)|floatval|get(type|_(defined_vars|resource_type))|boolval)\b + name + support.function.var.php + + + match + (?i)\bwddx_(serialize_va(lue|rs)|deserialize|packet_(start|end)|add_vars)\b + name + support.function.wddx.php + + + match + (?i)\bxhprof_(sample_(disable|enable)|disable|enable)\b + name + support.function.xhprof.php + + + match + (?i)\b(utf8_(decode|encode)|xml_(set_(start_namespace_decl_handler|notation_decl_handler|character_data_handler|object|default_handler|unparsed_entity_decl_handler|processing_instruction_handler|e(nd_namespace_decl_handler|lement_handler|xternal_entity_ref_handler))|parse(_into_struct|r_(set_option|create(_ns)?|free|get_option))?|error_string|get_(current_(column_number|line_number|byte_index)|error_code)))\b + name + support.function.xml.php + + + match + (?i)\bxmlrpc_(se(t_type|rver_(c(all_method|reate)|destroy|add_introspection_data|register_(introspection_callback|method)))|is_fault|decode(_request)?|parse_method_descriptions|encode(_request)?|get_type)\b + name + support.function.xmlrpc.php + + + match + (?i)\bxmlwriter_(s(tart_(c(omment|data)|d(td(_(e(ntity|lement)|attlist))?|ocument)|pi|element(_ns)?|attribute(_ns)?)|et_indent(_string)?)|text|o(utput_memory|pen_(uri|memory))|end_(c(omment|data)|d(td(_(e(ntity|lement)|attlist))?|ocument)|pi|element|attribute)|f(ull_end_element|lush)|write_(c(omment|data)|dtd(_(e(ntity|lement)|attlist))?|pi|element(_ns)?|attribute(_ns)?|raw))\b + name + support.function.xmlwriter.php + + + match + (?i)\b(inflate_(init|add)|zlib_(decode|encode|get_coding_type)|deflate_(init|add)|readgzfile|gz(seek|c(ompress|lose)|tell|inflate|open|de(code|flate)|uncompress|p(uts|assthru)|e(ncode|of)|file|write|re(wind|ad)|get(s(s)?|c)))\b + name + support.function.zlib.php + + + match + (?i)\bis_int(eger)?\b + name + support.function.alias.php + + + + user-function-call + + begin + (?i)(?=[a-z_0-9\\]*[a-z_][a-z0-9_]*\s*\() + end + (?i)[a-z_][a-z_0-9]*(?=\s*\() + name + meta.function-call.php + patterns + + + include + #namespace + + + + var_basic + + patterns + + + captures + + 1 + + name + punctuation.definition.variable.php + + + match + (?x) + (\$+)[a-zA-Z_\x{7f}-\x{ff}] + [a-zA-Z0-9_\x{7f}-\x{ff}]*?\b + name + variable.other.php + + + + var_global + + captures + + 1 + + name + punctuation.definition.variable.php + + + match + (\$)((_(COOKIE|FILES|GET|POST|REQUEST))|arg(v|c))\b + name + variable.other.global.php + + var_global_safer + + captures + + 1 + + name + punctuation.definition.variable.php + + + match + (\$)((GLOBALS|_(ENV|SERVER|SESSION))) + name + variable.other.global.safer.php + + variable-name + + patterns + + + include + #var_global + + + include + #var_global_safer + + + captures + + 1 + + name + variable.other.php + + 10 + + name + string.unquoted.index.php + + 11 + + name + punctuation.section.array.end.php + + 2 + + name + punctuation.definition.variable.php + + 4 + + name + keyword.operator.class.php + + 5 + + name + variable.other.property.php + + 6 + + name + punctuation.section.array.begin.php + + 7 + + name + constant.numeric.index.php + + 8 + + name + variable.other.index.php + + 9 + + name + punctuation.definition.variable.php + + + comment + Simple syntax: $foo, $foo[0], $foo[$bar], $foo->bar + match + (?x) + ((\$)(?<name>[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)) + (?: + (->)(\g<name>) + | + (\[) + (?:(\d+)|((\$)\g<name>)|(\w+)) + (\]) + )? + + + + captures + + 1 + + name + variable.other.php + + 2 + + name + punctuation.definition.variable.php + + 4 + + name + punctuation.definition.variable.php + + + comment + Simple syntax with braces: "foo${bar}baz" + match + (?x) + ((\$\{)(?<name>[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)(\})) + + + + + variables + + patterns + + + include + #var_global + + + include + #var_global_safer + + + include + #var_basic + + + begin + (\$\{)(?=.*?\}) + beginCaptures + + 1 + + name + punctuation.definition.variable.php + + + end + (\}) + endCaptures + + 1 + + name + punctuation.definition.variable.php + + + patterns + + + include + #language + + + + + + + scopeName + text.html.php + uuid + 22986475-8CA5-11D9-AEDD-000D93C8BE28 + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/powershell.plist b/src/file-viewer/highlight-grammar/powershell.plist new file mode 100644 index 0000000..b7b4a06 --- /dev/null +++ b/src/file-viewer/highlight-grammar/powershell.plist @@ -0,0 +1,1614 @@ + + + + + fileTypes + + ps1 + psm1 + psd1 + + name + PowerShell + patterns + + + begin + <# + beginCaptures + + 0 + + name + punctuation.definition.comment.block.begin.powershell + + + end + #> + endCaptures + + 0 + + name + punctuation.definition.comment.block.end.powershell + + + name + comment.block.powershell + patterns + + + include + #commentEmbeddedDocs + + + + + match + [2-6]>&1|>>|>|<<|<|>|>\||[1-6]>|[1-6]>> + name + keyword.operator.redirection.powershell + + + include + #commands + + + include + #commentLine + + + include + #variable + + + include + #subexpression + + + include + #function + + + include + #attribute + + + include + #UsingDirective + + + include + #type + + + include + #hashtable + + + include + #doubleQuotedString + + + include + #scriptblock + + + comment + Needed to parse stuff correctly in 'argument mode'. (See about_parsing.) + include + #doubleQuotedStringEscapes + + + begin + ['\x{2018}-\x{201B}] + beginCaptures + + 0 + + name + punctuation.definition.string.begin.powershell + + + end + ['\x{2018}-\x{201B}] + applyEndPatternLast + + endCaptures + + 0 + + name + punctuation.definition.string.end.powershell + + + name + string.quoted.single.powershell + patterns + + + match + ['\x{2018}-\x{201B}]{2} + name + constant.character.escape.powershell + + + + + begin + (@["\x{201C}-\x{201E}])\s*$ + beginCaptures + + 1 + + name + punctuation.definition.string.begin.powershell + + + end + ^["\x{201C}-\x{201E}]@ + endCaptures + + 0 + + name + punctuation.definition.string.end.powershell + + + name + string.quoted.double.heredoc.powershell + patterns + + + include + #variableNoProperty + + + include + #doubleQuotedStringEscapes + + + include + #interpolation + + + + + begin + (@['\x{2018}-\x{201B}])\s*$ + beginCaptures + + 1 + + name + punctuation.definition.string.begin.powershell + + + end + ^['\x{2018}-\x{201B}]@ + endCaptures + + 0 + + name + punctuation.definition.string.end.powershell + + + name + string.quoted.single.heredoc.powershell + + + include + #numericConstant + + + begin + (@)(\() + beginCaptures + + 1 + + name + keyword.other.array.begin.powershell + + 2 + + name + punctuation.section.group.begin.powershell + + + end + \) + endCaptures + + 0 + + name + punctuation.section.group.end.powershell + + + name + meta.group.array-expression.powershell + patterns + + + include + $self + + + + + begin + ((\$))(\() + beginCaptures + + 1 + + name + keyword.other.substatement.powershell + + 2 + + name + punctuation.definition.subexpression.powershell + + 3 + + name + punctuation.section.group.begin.powershell + + + comment + TODO: move to repo; make recursive. + end + \) + endCaptures + + 0 + + name + punctuation.section.group.end.powershell + + + name + meta.group.complex.subexpression.powershell + patterns + + + include + $self + + + + + match + (\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b) + name + support.function.powershell + + + match + (?<!\w|-|\.)((?i:begin|break|catch|clean|continue|data|default|define|do|dynamicparam|else|elseif|end|exit|finally|for|from|if|in|inlinescript|parallel|param|process|return|sequence|switch|throw|trap|try|until|var|while)|%|\?)(?!\w) + name + keyword.control.powershell + + + match + (?<!\w|-|[^\)]\.)((?i:(foreach|where)(?!-object))|%|\?)(?!\w) + name + keyword.control.powershell + + + begin + (?<!\w)(--%)(?!\w) + beginCaptures + + 1 + + name + keyword.control.powershell + + + end + $ + patterns + + + match + .+ + name + string.unquoted.powershell + + + comment + This should be moved to the repository at some point. + + + comment + This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix. + match + (?<!\w)((?i:hidden|static))(?!\w) + name + storage.modifier.powershell + + + captures + + 1 + + name + storage.type.powershell + + 2 + + name + entity.name.function + + + comment + capture should be entity.name.type, but it doesn't provide a good color in the default schema. + match + (?<!\w|-)((?i:class)|%|\?)(?:\s)+((?:\p{L}|\d|_|-|)+)\b + + + match + (?<!\w)-(?i:is(?:not)?|as)\b + name + keyword.operator.comparison.powershell + + + match + (?<!\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|replace))(?!\p{L}) + name + keyword.operator.comparison.powershell + + + match + (?<!\w)-(?i:join|split)(?!\p{L})|! + name + keyword.operator.unary.powershell + + + match + (?<!\w)-(?i:and|or|not|xor)(?!\p{L})|! + name + keyword.operator.logical.powershell + + + match + (?<!\w)-(?i:band|bor|bnot|bxor|shl|shr)(?!\p{L}) + name + keyword.operator.bitwise.powershell + + + match + (?<!\w)-(?i:f)(?!\p{L}) + name + keyword.operator.string-format.powershell + + + match + [+%*/-]?=|[+/*%-] + name + keyword.operator.assignment.powershell + + + match + \|{2}|&{2}|; + name + punctuation.terminator.statement.powershell + + + match + &|(?<!\w)\.(?= )|`|,|\| + name + keyword.operator.other.powershell + + + comment + This is very imprecise, is there a syntax for 'must come after...' + match + (?<!\s|^)\.\.(?=\-?\d|\(|\$) + name + keyword.operator.range.powershell + + + repository + + commentLine + + begin + (?<![`\\-])(#)#* + captures + + 1 + + name + punctuation.definition.comment.powershell + + + end + $\n? + name + comment.line.powershell + patterns + + + include + #commentEmbeddedDocs + + + include + #RequiresDirective + + + + attribute + + begin + (\[)\s*\b(?i)(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength|supportswildcards)\b + beginCaptures + + 1 + + name + punctuation.section.bracket.begin.powershell + + 2 + + name + support.function.attribute.powershell + + + end + (\]) + endCaptures + + 1 + + name + punctuation.section.bracket.end.powershell + + + name + meta.attribute.powershell + patterns + + + begin + \( + beginCaptures + + 0 + + name + punctuation.section.group.begin.powershell + + + end + \) + endCaptures + + 0 + + name + punctuation.section.group.end.powershell + + + patterns + + + include + $self + + + match + (?i)\b(mandatory|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|position|parametersetname|defaultparametersetname|supportsshouldprocess|supportspaging|positionalbinding|helpuri|confirmimpact|helpmessage)\b(?:\s+)?(=)? + captures + + 1 + + name + variable.parameter.attribute.powershell + + 2 + + name + keyword.operator.assignment.powershell + + + + + + + + commands + + patterns + + + comment + Verb-Noun pattern: + match + (?:(\p{L}|\d|_|-|\\|\:)*\\)?\b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)\-.+?(?:\.(?i:exe|cmd|bat|ps1))?\b + name + support.function.powershell + + + comment + Builtin cmdlets with reserved verbs + match + (?<!\w)(?i:foreach-object)(?!\w) + name + support.function.powershell + + + comment + Builtin cmdlets with reserved verbs + match + (?<!\w)(?i:where-object)(?!\w) + name + support.function.powershell + + + comment + Builtin cmdlets with reserved verbs + match + (?<!\w)(?i:sort-object)(?!\w) + name + support.function.powershell + + + comment + Builtin cmdlets with reserved verbs + match + (?<!\w)(?i:tee-object)(?!\w) + name + support.function.powershell + + + + commentEmbeddedDocs + + patterns + + + captures + + 1 + + name + constant.string.documentation.powershell + + 2 + + name + keyword.operator.documentation.powershell + + + comment + these embedded doc keywords do not support arguments, must be the only thing on the line + match + (?:^|\G)(?i:\s*(\.)(COMPONENT|DESCRIPTION|EXAMPLE|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|ROLE|SYNOPSIS))\s*$ + name + comment.documentation.embedded.powershell + + + captures + + 1 + + name + constant.string.documentation.powershell + + 2 + + name + keyword.operator.documentation.powershell + + 3 + + name + keyword.operator.documentation.powershell + + + comment + these embedded doc keywords require arguments though the type required may be inconsistent, they may not all be able to use the same argument match + match + (?:^|\G)(?i:\s*(\.)(EXTERNALHELP|FORWARDHELP(?:CATEGORY|TARGETNAME)|PARAMETER|REMOTEHELPRUNSPACE))\s+(.+?)\s*$ + name + comment.documentation.embedded.powershell + + + + doubleQuotedStringEscapes + + patterns + + + match + `[`0abefnrtv'"\x{2018}-\x{201E}$] + name + constant.character.escape.powershell + + + include + #unicodeEscape + + + + unicodeEscape + + comment + `u{xxxx} added in PowerShell 6.0 + patterns + + + match + `u\{(?:(?:10)?([0-9a-fA-F]){1,4}|0?\g<1>{1,5})} + name + constant.character.escape.powershell + + + match + `u(?:\{[0-9a-fA-F]{,6}.)? + name + invalid.character.escape.powershell + + + + function + + begin + ^(?:\s*+)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+) + beginCaptures + + 0 + + name + meta.function.powershell + + 1 + + name + storage.type.powershell + + 2 + + name + storage.modifier.scope.powershell + + 3 + + name + entity.name.function.powershell + + + end + (?=\{|\() + patterns + + + include + #commentLine + + + + subexpression + + begin + \( + beginCaptures + + 0 + + name + punctuation.section.group.begin.powershell + + + end + \) + endCaptures + + 0 + + name + punctuation.section.group.end.powershell + + + name + meta.group.simple.subexpression.powershell + patterns + + + include + $self + + + + interpolation + + begin + (((\$)))((\()) + beginCaptures + + 1 + + name + keyword.other.substatement.powershell + + 2 + + name + punctuation.definition.substatement.powershell + + 3 + + name + punctuation.section.embedded.substatement.begin.powershell + + 4 + + name + punctuation.section.group.begin.powershell + + 5 + + name + punctuation.section.embedded.substatement.begin.powershell + + + contentName + interpolated.complex.source.powershell + end + (\)) + endCaptures + + 0 + + name + punctuation.section.group.end.powershell + + 1 + + name + punctuation.section.embedded.substatement.end.powershell + + + name + meta.embedded.substatement.powershell + patterns + + + include + $self + + + + numericConstant + + patterns + + + captures + + 1 + + name + constant.numeric.hex.powershell + + 2 + + name + keyword.other.powershell + + + match + (?<!\w)([-+]?0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b + + + captures + + 1 + + name + constant.numeric.integer.powershell + + 2 + + name + keyword.other.powershell + + + match + (?<!\w)([-+]?(?:[0-9_]+)?\.[0-9_]+(?:(?:e|E)[0-9]+)?(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b + + + captures + + 1 + + name + constant.numeric.octal.powershell + + 2 + + name + keyword.other.powershell + + + match + (?<!\w)([-+]?0(?:b|B)[01_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b + + + captures + + 1 + + name + constant.numeric.integer.powershell + + 2 + + name + keyword.other.powershell + + + match + (?<!\w)([-+]?[0-9_]+(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b + + + captures + + 1 + + name + constant.numeric.integer.powershell + + 2 + + name + keyword.other.powershell + + + match + (?<!\w)([-+]?[0-9_]+\.(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b + + + captures + + 1 + + name + constant.numeric.integer.powershell + + 2 + + name + keyword.other.powershell + + + match + (?<!\w)([-+]?[0-9_]+[\.]?(?:F|f|D|d|M|m))((?i:[kmgtp]b)?)\b + + + captures + + 1 + + name + constant.numeric.integer.powershell + + 2 + + name + keyword.other.powershell + + + match + (?<!\w)([-+]?[0-9_]+[\.]?(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b + + + + scriptblock + + begin + \{ + beginCaptures + + 0 + + name + punctuation.section.braces.begin.powershell + + + end + \} + endCaptures + + 0 + + name + punctuation.section.braces.end.powershell + + + name + meta.scriptblock.powershell + patterns + + + include + $self + + + + type + + begin + \[ + beginCaptures + + 0 + + name + punctuation.section.bracket.begin.powershell + + + end + \] + endCaptures + + 0 + + name + punctuation.section.bracket.end.powershell + + + patterns + + + match + (?!\d+|\.)(?:\p{L}|\p{N}|\.)+ + name + storage.type.powershell + + + include + $self + + + + variable + + patterns + + + captures + + 0 + + name + constant.language.powershell + + 1 + + name + punctuation.definition.variable.powershell + + + comment + These are special constants. + match + (\$)(?i:(False|Null|True))\b + + + captures + + 0 + + name + support.constant.variable.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 3 + + name + variable.other.member.powershell + + + comment + These are the other built-in constants. + match + (\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))((?:\.(?:\p{L}|\d|_)+)*\b)?\b + + + captures + + 0 + + name + support.variable.automatic.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 3 + + name + variable.other.member.powershell + + + comment + Automatic variables are not constants, but they are read-only. In monokai (default) color schema support.variable doesn't have color, so we use constant. + match + (\$)((?:[$^?])|(?i:_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This)\b)((?:\.(?:\p{L}|\d|_)+)*\b)? + + + captures + + 0 + + name + variable.language.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 3 + + name + variable.other.member.powershell + + + comment + Style preference variables as language variables so that they stand out. + match + (\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|InformationPreference|LogCommandHealthEvent|LogCommandLifecycleEvent|LogEngineHealthEvent|LogEngineLifecycleEvent|LogProviderHealthEvent|LogProviderLifecycleEvent|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|PSCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoLoadingPreference|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|ProgressPreference|VerbosePreference|WarningPreference|WhatIfPreference))((?:\.(?:\p{L}|\d|_)+)*\b)?\b + + + captures + + 0 + + name + variable.other.readwrite.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 2 + + name + storage.modifier.scope.powershell + + 4 + + name + variable.other.member.powershell + + + match + (?i:(\$|@)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+))((?:\.(?:\p{L}|\d|_)+)*\b)? + + + captures + + 0 + + name + variable.other.readwrite.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 2 + + name + punctuation.section.braces.begin.powershell + + 3 + + name + storage.modifier.scope.powershell + + 5 + + name + punctuation.section.braces.end.powershell + + 6 + + name + variable.other.member.powershell + + + match + (?i:(\$)(\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\}))((?:\.(?:\p{L}|\d|_)+)*\b)? + + + captures + + 0 + + name + variable.other.readwrite.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 2 + + name + support.variable.drive.powershell + + 4 + + name + variable.other.member.powershell + + + match + (?i:(\$|@)((?:\p{L}|\d|_)+:)?((?:\p{L}|\d|_)+))((?:\.(?:\p{L}|\d|_)+)*\b)? + + + captures + + 0 + + name + variable.other.readwrite.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 2 + + name + punctuation.section.braces.begin.powershell + + 3 + + name + support.variable.drive.powershell + + 5 + + name + punctuation.section.braces.end.powershell + + 6 + + name + variable.other.member.powershell + + + match + (?i:(\$)(\{)((?:\p{L}|\d|_)+:)?([^}]*[^}`])(\}))((?:\.(?:\p{L}|\d|_)+)*\b)? + + + + UsingDirective + + match + (?<!\w)(?i:(using))\s+(?i:(namespace|module))\s+(?i:((?:\w+(?:\.)?)+)) + captures + + 1 + + name + keyword.control.using.powershell + + 2 + + name + keyword.other.powershell + + 3 + + name + variable.parameter.powershell + + + + RequiresDirective + + begin + (?<=#)(?i:(requires))\s + beginCaptures + + 0 + + name + keyword.control.requires.powershell + + + end + $ + name + meta.requires.powershell + patterns + + + match + \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version|Assembly|PSEdition) + name + keyword.other.powershell + + + match + (?<!-)\b\p{L}+|\d+(?:\.\d+)* + name + variable.parameter.powershell + + + include + #hashtable + + + + variableNoProperty + + patterns + + + captures + + 0 + + name + constant.language.powershell + + 1 + + name + punctuation.definition.variable.powershell + + + comment + These are special constants. + match + (\$)(?i:(False|Null|True))\b + + + captures + + 0 + + name + support.constant.variable.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 3 + + name + variable.other.member.powershell + + + comment + These are the other built-in constants. + match + (\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))\b + + + captures + + 0 + + name + support.variable.automatic.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 3 + + name + variable.other.member.powershell + + + comment + Automatic variables are not constants, but they are read-only... + match + (\$)((?:[$^?])|(?i:_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This)\b) + + + captures + + 0 + + name + variable.language.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 3 + + name + variable.other.member.powershell + + + comment + Style preference variables as language variables so that they stand out. + match + (\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|InformationPreference|LogCommandHealthEvent|LogCommandLifecycleEvent|LogEngineHealthEvent|LogEngineLifecycleEvent|LogProviderHealthEvent|LogProviderLifecycleEvent|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|PSCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoLoadingPreference|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|ProgressPreference|VerbosePreference|WarningPreference|WhatIfPreference))\b + + + captures + + 0 + + name + variable.other.readwrite.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 2 + + name + storage.modifier.scope.powershell + + 4 + + name + variable.other.member.powershell + + + match + (?i:(\$)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+)) + + + captures + + 0 + + name + variable.other.readwrite.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 2 + + name + storage.modifier.scope.powershell + + 4 + + name + keyword.other.powershell + + 5 + + name + variable.other.member.powershell + + + match + (?i:(\$)(\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\})) + + + captures + + 0 + + name + variable.other.readwrite.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 2 + + name + support.variable.drive.powershell + + 4 + + name + variable.other.member.powershell + + + match + (?i:(\$)((?:\p{L}|\d|_)+:)?((?:\p{L}|\d|_)+)) + + + captures + + 0 + + name + variable.other.readwrite.powershell + + 1 + + name + punctuation.definition.variable.powershell + + 2 + + name + punctuation.section.braces.begin + + 3 + + name + support.variable.drive.powershell + + 5 + + name + punctuation.section.braces.end + + + match + (?i:(\$)(\{)((?:\p{L}|\d|_)+:)?([^}]*[^}`])(\})) + + + + hashtable + + begin + (@)(\{) + beginCaptures + + 1 + + name + keyword.other.hashtable.begin.powershell + + 2 + + name + punctuation.section.braces.begin.powershell + + + end + (\}) + endCaptures + + 1 + + name + punctuation.section.braces.end.powershell + + + name + meta.hashtable.powershell + patterns + + + captures + + 1 + + name + punctuation.definition.string.begin.powershell + + 2 + + name + variable.other.readwrite.powershell + + 3 + + name + punctuation.definition.string.end.powershell + + 4 + + name + keyword.operator.assignment.powershell + + + match + \b((?:\'|\")?)(\w+)((?:\'|\")?)(?:\s+)?(=)(?:\s+)? + name + meta.hashtable.assignment.powershell + + + include + #scriptblock + + + include + $self + + + + doubleQuotedString + + begin + ["\x{201C}-\x{201E}] + beginCaptures + + 0 + + name + punctuation.definition.string.begin.powershell + + + end + ["\x{201C}-\x{201E}] + applyEndPatternLast + + endCaptures + + 0 + + name + punctuation.definition.string.end.powershell + + + name + string.quoted.double.powershell + patterns + + + match + (?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b + + + include + #variableNoProperty + + + include + #doubleQuotedStringEscapes + + + match + ["\x{201C}-\x{201E}]{2} + name + constant.character.escape.powershell + + + include + #interpolation + + + match + `\s*$ + name + keyword.other.powershell + + + + + scopeName + source.powershell + uuid + f8f5ffb0-503e-11df-9879-0800200c9a66 + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/python.plist b/src/file-viewer/highlight-grammar/python.plist new file mode 100644 index 0000000..8eb1254 --- /dev/null +++ b/src/file-viewer/highlight-grammar/python.plist @@ -0,0 +1,4009 @@ + + + + + fileTypes + + py + py3 + rpy + pyw + cpy + SConstruct + Sconstruct + sconstruct + SConscript + gyp + gypi + + firstLineMatch + ^#!/.*\bpython[\d\.]*\b + keyEquivalent + ^~P + name + Python + patterns + + + match + (?<!^from\s|^import\s)(\.{3}) + name + support.type.ellipsis.python + + + include + #comment + + + comment + Match identifiers in ALL_CAPS as constants, except when followed by `.`, `(`, `'`, or `"`. + match + \b([[:upper:]_][[:upper:][:digit:]_]*)\b(?![\.\(\'\"]) + name + constant.other.allcaps.python + + + match + \b(?i:(0x\h+)L) + name + constant.numeric.integer.hexadecimal.long.python + + + match + \b(?i:(0x\h+)) + name + constant.numeric.integer.hexadecimal.python + + + match + \b(?i:(0b[01]+)L) + name + constant.numeric.integer.binary.long.python + + + match + \b(?i:(0b[01]+)) + name + constant.numeric.integer.binary.python + + + match + \b(?i:(0[o]?[0-7]+)L) + name + constant.numeric.integer.octal.long.python + + + match + \b(?i:(0[o]?[0-7]+)) + name + constant.numeric.integer.octal.python + + + match + \b(?i:(((\d+(\.(?=[^[:alpha:]_])\d*)?|(?<=[^[:alnum:]_])\.\d+)(e[\-\+]?\d+)?))J) + name + constant.numeric.complex.python + + + match + \b(?i:(\d+\.\d*(e[\-\+]?\d+)?))(?=[^[:alpha:]_]) + name + constant.numeric.float.python + + + match + (?<=[^[:alnum:]_])(?i:(\.\d+(e[\-\+]?\d+)?)) + name + constant.numeric.float.python + + + match + \b(?i:(\d+e[\-\+]?\d+)) + name + constant.numeric.float.python + + + match + \b(?i:([1-9]+[0-9]*|0)L) + name + constant.numeric.integer.decimal.long.python + + + match + \b([1-9]+[0-9]*|0) + name + constant.numeric.integer.decimal.python + + + match + \b(None|True|False|Ellipsis|NotImplemented|__debug__)\b + name + constant.language.python + + + match + \b(global|nonlocal)\b + name + storage.modifier.$1.python + + + match + \b(?:(import|from|as))\b + name + keyword.control.import.$1.python + + + comment + keyword operators that evaluate to True or False + match + \b(and|in|is|not|or)\b + name + keyword.operator.logical.python + + + comment + keywords that do not fit into other groups. + match + \b(assert|del)\b + name + keyword.other.python + + + match + <> + name + invalid.deprecated.operator.python + + + match + (?<!\.)(apply|buffer|coerce|intern)\s*(?=\() + name + invalid.deprecated.function.python + + + match + <\=|>\=|\=\=|<|>|\!\= + name + keyword.operator.comparison.python + + + match + \+\=|-\=|\*\=|/\=|//\=|%\=|&\=|\|\=|\^\=|>>\=|<<\=|\*\*\=|@\= + name + keyword.operator.assignment.augmented.python + + + match + \+|\-|\*|\*\*|/|//|%|<<|>>|&|\||\^|~|(?!^)@ + name + keyword.operator.arithmetic.python + + + match + \= + name + keyword.operator.assignment.python + + + begin + ^\s*(class)\s+(?=[[:alpha:]_][[:alnum:]_]*\s*\:) + beginCaptures + + 1 + + name + storage.type.class.python + + + contentName + entity.name.type.class.python + end + \s*(:) + endCaptures + + 1 + + name + punctuation.section.class.begin.python + + + name + meta.class.old-style.python + patterns + + + include + #entity_name_class + + + + + begin + ^\s*(class)\s+(?=[[:alpha:]_][[:alnum:]_]*\s*\() + beginCaptures + + 1 + + name + storage.type.class.python + + + end + (\))\s*(?:(\:)|(.*$\n?)) + endCaptures + + 1 + + name + punctuation.definition.inheritance.end.python + + 2 + + name + punctuation.section.class.begin.python + + 3 + + name + invalid.illegal.missing-section-begin.python + + + name + meta.class.python + patterns + + + begin + (?=[[:alpha:]_][[:alnum:]_]*) + contentName + entity.name.type.class.python + end + (?![[:alnum:]_]) + patterns + + + include + #entity_name_class + + + + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.inheritance.begin.python + + + contentName + meta.class.inheritance.python + end + (?=\)|:) + patterns + + + begin + (?<=\(|,)\s* + contentName + entity.other.inherited-class.python + end + \s*(?:(,)|(?=\))) + endCaptures + + 1 + + name + punctuation.separator.inheritance.python + + + patterns + + + include + $self + + + + + + + + + begin + ^\s*(class)\s+(?=[[:alpha:]_][[:alnum:]_]*) + beginCaptures + + 1 + + name + storage.type.class.python + + + end + (\()|(\s*$\n?|#.*$\n?) + endCaptures + + 1 + + name + punctuation.definition.inheritance.begin.python + + 2 + + name + invalid.illegal.missing-inheritance.python + + + name + meta.class.python + patterns + + + begin + (?=[[:alpha:]_][[:alnum:]_]*) + contentName + entity.name.type.class.python + end + (?![[:alnum:]_]) + patterns + + + include + #entity_name_function + + + + + + + begin + \s*(?:(async)\s+)?(def)\s+(?=[[:alpha:]_][[:alnum:]_]*\s*\() + beginCaptures + + 1 + + name + storage.modifier.async.python + + 2 + + name + storage.type.function.python + + + end + (\:) + endCaptures + + 1 + + name + punctuation.section.function.begin.python + + + name + meta.function.python + patterns + + + begin + (?=[[:alpha:]_][[:alnum:]_]*) + contentName + entity.name.function.python + end + (?![[:alnum:]_]) + patterns + + + include + #entity_name_function + + + + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.parameters.begin.python + + + contentName + meta.function.parameters.python + end + (?=\)\s*(?:\:|-\>)) + patterns + + + include + #annotated_arguments + + + include + #keyword_arguments + + + include + #comment + + + captures + + 1 + + name + variable.parameter.function.language.python + + 2 + + name + variable.parameter.function.python + + 3 + + name + punctuation.separator.parameters.python + + + match + \b(?:(self|cls)|([[:alpha:]_][[:alnum:]_]*))\s*(?:(,)|(?=[\n\)])) + + + + + begin + (\))\s*(\->) + beginCaptures + + 1 + + name + punctuation.definition.parameters.end.python + + 2 + + name + punctuation.separator.annotation.result.python + + + end + (?=\:) + patterns + + + include + $self + + + + + + + begin + \s*(?:(async)\s+)?(def)\s+(?=[[:alpha:]_][[:alnum:]_]*) + beginCaptures + + 1 + + name + storage.modifier.async.python + + 2 + + name + storage.type.function.python + + + end + (\()|\s*($\n?|#.*$\n?) + endCaptures + + 1 + + name + punctuation.definition.parameters.begin.python + + 2 + + name + invalid.illegal.missing-parameters.python + + + name + meta.function.python + patterns + + + begin + (?=[[:alpha:]_][[:alnum:]_]*) + contentName + entity.name.function.python + end + (?![[:alnum:]_]) + patterns + + + include + #entity_name_function + + + + + + + captures + + 1 + + name + storage.modifier.async.python + + 2 + + name + storage.type.function.python + + 3 + + name + storage.type.function.python + + + match + \b(?:(?:(async)\s+)?(def)|(lambda))\b + + + comment + Keywords that delimit flow blocks or alter flow from within a + block. + + This block should be matched *after* meta.function.python to + let 'async def' be matched *first*. + + match + (?x) \b( + async | await | break | continue | elif | else | except | finally | for | + if | pass | raise | return | try | while | with | + (yield(?:\s+from)?) + )\b + + name + keyword.control.flow.python + + + begin + (lambda)(?=\s+|:) + beginCaptures + + 1 + + name + storage.type.function.inline.python + + + end + (\:) + endCaptures + + 1 + + name + punctuation.definition.parameters.end.python + + 2 + + name + punctuation.section.function.begin.python + + 3 + + name + invalid.illegal.missing-section-begin.python + + + name + meta.function.inline.python + patterns + + + begin + \s+ + contentName + meta.function.inline.parameters.python + end + (?=\:) + patterns + + + include + #keyword_arguments + + + captures + + 1 + + name + variable.parameter.function.python + + 2 + + name + punctuation.separator.parameters.python + + + match + \b([[:alpha:]_][[:alnum:]_]*)\s*(?:(,)|(?=[\n\)\:])) + + + + + + + begin + ^\s*(?=@\s*[[:alpha:]_][[:alnum:]_]*(?:\s*\.\s*[[:alpha:]_][[:alnum:]_]*)*\s*\() + comment + a decorator may be a function call which returns a decorator. + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.arguments.end.python + + + name + meta.function.decorator.python + patterns + + + begin + (?=(@)\s*[[:alpha:]_][[:alnum:]_]*(?:\s*\.\s*[[:alpha:]_][[:alnum:]_]*)*\s*\() + beginCaptures + + 1 + + name + punctuation.definition.decorator.python + + + contentName + entity.name.function.decorator.python + end + (?=\s*\() + patterns + + + include + #dotted_name + + + + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.arguments.begin.python + + + contentName + meta.function.decorator.arguments.python + end + (?=\)) + patterns + + + include + #keyword_arguments + + + include + $self + + + + + + + begin + ^\s*(?=@\s*[[:alpha:]_][[:alnum:]_]*(?:\s*\.\s*[[:alpha:]_][[:alnum:]_]*)*) + contentName + entity.name.function.decorator.python + end + (?=\s|$\n?|#) + name + meta.function.decorator.python + patterns + + + begin + (?=(@)\s*[[:alpha:]_][[:alnum:]_]*(\s*\.\s*[[:alpha:]_][[:alnum:]_]*)*) + beginCaptures + + 1 + + name + punctuation.definition.decorator.python + + + end + (?=\s|$\n?|#) + patterns + + + include + #dotted_name + + + + + + + begin + (?<=\)|\])\s*(\() + beginCaptures + + 1 + + name + punctuation.definition.arguments.begin.python + + + contentName + meta.function-call.arguments.python + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.arguments.end.python + + + name + meta.function-call.python + patterns + + + include + #keyword_arguments + + + include + $self + + + + + include + #builtin_types + + + include + #builtin_functions_name + + + include + #builtin_functions_call + + + include + #errors_warnings_exceptions + + + include + #magic_function_names + + + include + #magic_function_calls + + + include + #docstrings + + + include + #magic_variable_names + + + begin + \b(self|cls)\b\s*(?=(\()) + beginCaptures + + 1 + + name + variable.language.python + + 2 + + name + punctuation.definition.arguments.begin.python + + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.arguments.end.python + + + name + meta.function-call.python + patterns + + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.arguments.begin.python + + + contentName + meta.function-call.arguments.python + end + (?=(\))) + endCaptures + + 1 + + name + punctuation.definition.arguments.end.python + + + patterns + + + include + #keyword_arguments + + + include + $self + + + + + + + include + #language_variables + + + include + #generic_object_names + + + begin + (?:\.)?([[:alpha:]_][[:alnum:]_]*)\s*(?=(\()) + beginCaptures + + 1 + + name + meta.function-call.generic.python + + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.arguments.end.python + + + name + meta.function-call.python + patterns + + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.arguments.begin.python + + + contentName + meta.function-call.arguments.python + end + (?=\)) + patterns + + + include + #keyword_arguments + + + include + $self + + + + + + + comment + Py2 print statement that should only be matched after function calls + match + (?<!\.)\b(print)(?=\s|$) + name + keyword.other.print.python + + + begin + (?=[[:alpha:]_][[:alnum:]_]*(?:\s*\.\s*[[:alpha:]_][[:alnum:]_]*)*\s*\[) + end + (\]) + endCaptures + + 1 + + name + punctuation.definition.arguments.end.python + + + name + meta.item-access.python + patterns + + + begin + (?=[[:alpha:]_][[:alnum:]_]*(?:\s*\.\s*[[:alpha:]_][[:alnum:]_]*)*\s*\[) + end + (?=\s*\[) + patterns + + + include + #dotted_name + + + + + begin + (\[) + beginCaptures + + 1 + + name + punctuation.definition.arguments.begin.python + + + contentName + meta.item-access.arguments.python + end + (?=\]) + patterns + + + include + $self + + + + + begin + \G + end + (?=\[) + patterns + + + include + #dotted_name + + + + + + + captures + + 1 + + name + storage.type.class.python + + + match + \b(class)\b + + + include + #line_continuation + + + include + #string_quoted_single + + + include + #string_quoted_double + + + include + #dotted_name + + + begin + (\() + end + (\)) + patterns + + + include + $self + + + + + captures + + 1 + + name + punctuation.definition.list.begin.python + + 2 + + name + meta.empty-list.python + + 3 + + name + punctuation.definition.list.end.python + + + match + (\[)(\s*(\]))\b + + + begin + (\[) + beginCaptures + + 1 + + name + punctuation.definition.list.begin.python + + + end + (\]) + endCaptures + + 1 + + name + punctuation.definition.list.end.python + + + name + meta.structure.list.python + patterns + + + begin + (?<=\[|\,)\s*(?![\],]) + contentName + meta.structure.list.item.python + end + \s*(?:(,)|(?=\])) + endCaptures + + 1 + + name + punctuation.separator.list.python + + + patterns + + + include + $self + + + + + + + captures + + 1 + + name + punctuation.definition.tuple.begin.python + + 2 + + name + meta.empty-tuple.python + + 3 + + name + punctuation.definition.tuple.end.python + + + match + (\()(\s*(\))) + name + meta.structure.tuple.python + + + captures + + 1 + + name + punctuation.definition.dictionary.begin.python + + 2 + + name + meta.empty-dictionary.python + + 3 + + name + punctuation.definition.dictionary.end.python + + + match + (\{)(\s*(\})) + name + meta.structure.dictionary.python + + + begin + (\{) + beginCaptures + + 1 + + name + punctuation.definition.dictionary.begin.python + + + end + (\}) + endCaptures + + 1 + + name + punctuation.definition.dictionary.end.python + + + name + meta.structure.dictionary.python + patterns + + + begin + (?<=\{|\,|^)\s*(?![\},]) + contentName + meta.structure.dictionary.key.python + end + \s*(?:(?=\})|(\:)) + endCaptures + + 1 + + name + punctuation.separator.valuepair.dictionary.python + + + patterns + + + include + $self + + + + + begin + (?<=\:|^)\s* + contentName + meta.structure.dictionary.value.python + end + \s*(?:(?=\})|(,)) + endCaptures + + 1 + + name + punctuation.separator.dictionary.python + + + patterns + + + include + $self + + + + + + + repository + + annotated_arguments + + begin + \b([[:alpha:]_][[:alnum:]_]*)\s*(:)|(?=\() + beginCaptures + + 1 + + name + variable.parameter.function.python + + 2 + + name + punctuation.separator.annotation.python + + + end + \s*(?:(,)|(?=$\n?|[\)\:])) + endCaptures + + 1 + + name + punctuation.separator.parameters.python + + + patterns + + + include + #annotated_group + + + match + = + name + keyword.operator.assignment.python + + + include + $self + + + + annotated_group + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.parameters-group.begin.python + + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.parameters-group.end.python + + + patterns + + + begin + \b([[:alpha:]_][[:alnum:]_]*)\s*(:) + beginCaptures + + 1 + + name + variable.parameter.function.python + + 2 + + name + punctuation.separator.annotation.python + + + end + \s*(?:(,)|(?=$\n?|\))) + endCaptures + + 1 + + name + punctuation.separator.parameters.python + + + patterns + + + include + $self + + + + + begin + \b([[:alpha:]_][[:alnum:]_]*) + beginCaptures + + 1 + + name + variable.parameter.function.python + + + end + \s*(?:(,)|(?=$\n?|\))) + endCaptures + + 1 + + name + punctuation.separator.parameters.python + + + + + include + #comment + + + + builtin_functions_call + + patterns + + + begin + (?x) + (?<!\.)\b( + __import__ | abs | all | any | ascii | basestring | bin | bool | + bytearray | bytes | callable | chr | classmethod | cmp | compile | + complex | delattr | dict | dir | divmod | enumerate | eval | exec | + execfile | file | filter | float | format | frozenset | getattr | + globals | hasattr | hash | help | hex | id | input | int | + isinstance | issubclass | iter | len | list | locals | long | map | + max | memoryview | min | next | object | oct | open | ord | pow | + print | property | range | raw_input | reduce | reload | repr | + reversed | round | set | setattr | slice | sorted | staticmethod | + str | sum | super | tuple | type | unichr | unicode | vars | + xrange | zip) + \b\s*(?=\() + + beginCaptures + + 1 + + name + support.function.builtin.call.python + + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.arguments.end.python + + + name + meta.function-call.python + patterns + + + begin + (?=[[:alpha:]_][[:alnum:]_]*(?:\s*\.\s*[[:alpha:]_][[:alnum:]_]*)*\s*\() + end + (?=\s*\() + patterns + + + include + #dotted_name + + + + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.arguments.begin.python + + + contentName + meta.function-call.arguments.python + end + (?=\)) + patterns + + + include + #keyword_arguments + + + include + $self + + + + + + + + builtin_functions_name + + match + (?x) + (?<!\.|@) + \b( + __import__ | abs | all | any | ascii | basestring | bin | bool | + bytearray | bytes | callable | chr | classmethod | cmp | compile | + complex | delattr | dict | dir | divmod | enumerate | eval | exec | + execfile | file | filter | float | format | frozenset | getattr | + globals | hasattr | hash | help | hex | id | input | int | + isinstance | issubclass | iter | len | list | locals | long | map | + max | memoryview | min | next | object | oct | open | ord | pow | + property | range | raw_input | reduce | reload | repr | + reversed | round | set | setattr | slice | sorted | staticmethod | + str | sum | super | tuple | type | unichr | unicode | vars | + xrange | zip) + \b\s*(?!(\()) + name + support.function.builtin.name.python + + builtin_types + + comment + These are from https://docs.python.org/X/library/stdtypes.html + where X is 2.7 or 3.5. + match + (?x) + (?<!\.) + \b( + bool | buffer | bytearray | bytes | complex | dict | float | + frozenset | int | list | long | memoryview | object | property | + range | set | slice | str | tuple | type | unicode | xrange) + \b(?!(\s*\()) + name + support.type.python + + comment + + begin + (^[ \t]+)?(?=#) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.python + + + end + (?!\G) + patterns + + + begin + # + beginCaptures + + 0 + + name + punctuation.definition.comment.python + + + end + \n + name + comment.line.number-sign.python + + + + constant_placeholder + + match + (?i:(%(\([[:lower:]_]+\))?#?0?\-?[ ]?\+?([0-9]*|\*)(\.([0-9]*|\*))?[hL]?[[:lower:]%])|(\{([!\[\].:\w ]+)?\})) + name + constant.other.placeholder.python + + docstrings + + patterns + + + begin + ^\s*(?=[uU]?[rR]?""") + end + (?<=""") + name + comment.block.python + patterns + + + include + #string_quoted_double + + + + + begin + ^\s*(?=[uU]?[rR]?''') + end + (?<=''') + name + comment.block.python + patterns + + + include + #string_quoted_single + + + + + + dotted_name + + begin + (?=(?:\.(?!\s+import)\s*)?[[:alpha:]_][[:alnum:]_]*(?:\s*\.\s*[[:alpha:]_][[:alnum:]_]*)*) + end + (?![[:alnum:]_\.\s])|(?=(?<!\.)\s+[^.])|$ + patterns + + + begin + (\.)(?=[[:alpha:]_][[:alnum:]_]*) + beginCaptures + + 1 + + name + meta.dot.python + + + end + (?![[:alnum:]_]) + patterns + + + include + #builtin_functions_name + + + include + #magic_function_names + + + include + #magic_variable_names + + + include + #generic_names + + + include + #illegal_names + + + + + begin + (?<!\.)(?=[[:alpha:]_][[:alnum:]_]*) + end + (?![[:alnum:]_]) + patterns + + + include + #builtin_types + + + include + #builtin_functions_name + + + include + #builtin_functions_call + + + include + #errors_warnings_exceptions + + + include + #magic_function_names + + + include + #magic_function_calls + + + include + #magic_variable_names + + + include + #language_variables + + + include + #generic_names + + + include + #illegal_names + + + + + + entity_name_class + + patterns + + + include + #generic_names + + + include + #illegal_names + + + + entity_name_function + + patterns + + + include + #builtin_functions_name + + + include + #magic_function_names + + + include + #illegal_names + + + + errors_warnings_exceptions + + match + (?x) + \b( + ( + Arithmetic | Assertion | Attribute | Buffer | BlockingIO | + BrokenPipe | ChildProcess | (Connection(Aborted | Refused | Reset)?) | + EOF | Environment | FileExists | FileNotFound | FloatingPoint | IO | + Import | Indentation | Index | Interrupted | IsADirectory | + NotADirectory | Permission | ProcessLookup | Timeout | Key | Lookup | + Memory | Name | NotImplemented | OS | Overflow | Reference | Runtime | + Recursion | Standard | Syntax | System | Tab | Type | UnboundLocal | + Unicode(Encode | Decode | Translate)? | Value | VMS | Windows | + ZeroDivision | ([[:alpha:]_][[:alnum:]_]*)) + ?Error + | + ( + (Pending)?Deprecation | Bytes | Future | Import | Resource | + Runtime | Syntax | Unicode | User | [[:alpha:]_][[:alnum:]_]*) + ?Warning + | + SystemExit | Stop(Async)?Iteration | NotImplemented | + KeyboardInterrupt | GeneratorExit + | + ([[:alpha:]_][[:alnum:]_]*) + ?Exception + ) + \b + name + support.type.exception.python + + escaped_char + + captures + + 1 + + name + constant.character.escape.hex.python + + 10 + + name + constant.character.escape.linefeed.python + + 11 + + name + constant.character.escape.return.python + + 12 + + name + constant.character.escape.tab.python + + 13 + + name + constant.character.escape.vertical-tab.python + + 2 + + name + constant.character.escape.octal.python + + 3 + + name + constant.character.escape.newline.python + + 4 + + name + constant.character.escape.backslash.python + + 5 + + name + constant.character.escape.double-quote.python + + 6 + + name + constant.character.escape.single-quote.python + + 7 + + name + constant.character.escape.bell.python + + 8 + + name + constant.character.escape.backspace.python + + 9 + + name + constant.character.escape.formfeed.python + + + match + (\\x[\h]{2})|(\\[0-7]{3})|(\\\n)|(\\\\)|(\\\")|(\\')|(\\a)|(\\b)|(\\f)|(\\n)|(\\r)|(\\t)|(\\v) + + escaped_char_raw_double + + match + \\" + name + constant.character.escape.quote.python + + escaped_char_raw_single + + match + \\' + name + constant.character.escape.quote.python + + escaped_unicode_char + + captures + + 1 + + name + constant.character.escape.unicode.32-bit-hex.python + + 2 + + name + constant.character.escape.unicode.16-bit-hex.python + + 3 + + name + constant.character.escape.unicode.name.python + + + match + (\\U[\h]{8})|(\\u[\h]{4})|(\\N\{[a-zA-Z0-9\, ]+\}) + + generic_names + + match + [[:alpha:]_][[:alnum:]_]* + name + meta.identifier.python + + generic_object_names + + match + (\.\b([[:alpha:]_][[:alnum:]_]*)\b(?!\(|\[)|\b([[:alpha:]_][[:alnum:]_]*)\b\.) + + illegal_names + + comment + from Lib/keyword.py, in kwlist. `async` and `await` not keywords until Python 3.7 (according to PEP-0492) + match + (?x) + \b ( + False | None | True | and | as | assert | break | class | continue | def | + del | elif | else | except | exec | finally | for | from | global | if | + import | in | is | lambda | nonlocal | not | or | pass | print | raise | + return | try | while | with | yield | __debug__ ) + \b + name + invalid.illegal.name.python + + keyword_arguments + + begin + \b([[:alpha:]_][[:alnum:]_]*)\s*(=)(?!=) + beginCaptures + + 1 + + name + variable.parameter.function.keyword.python + + 2 + + name + keyword.operator.assignment.python + + + end + \s*(?:(,)|(?=[\)\:])) + endCaptures + + 1 + + name + punctuation.separator.parameters.python + + + patterns + + + include + $self + + + + language_variables + + captures + + 1 + + name + variable.language.python + + + match + (?<!\.)\b(self|cls)\b(?:\.|\()? + + line_continuation + + captures + + 1 + + name + punctuation.separator.continuation.line.python + + 2 + + name + invalid.illegal.unexpected-text.python + + + match + (\\)(.*)$\n? + + magic_function_calls + + patterns + + + begin + (?x) + (\.)? + \b( + __(?: + abs | add | aenter | aexit | aiter | and | anext | await | bool | + bytes | call | ceil | cmp | class_getitem | coerce | complex | contains | + copy | deepcopy | del | delattr | delete | delitem | delslice | dir | div | + divmod | enter | eq | execute | exit | float | floor | floordiv | format | + fspath | ge | get | getattr | getattribute | getinitargs | getitem | + getnewargs | getnewargs_ex | getslice | getstate | gt | hash | hex | iadd | + iand | idiv | idivmod | ifloordiv | ilshift | imatmul | imod | imul | index | + init | init_subclass | instancecheck | int | invert | iop | ior | ipow | + irshift | isub | iter | itruediv | ixor | le | len | length_hint | long | + lshift | lt | main | matmul | missing | mod | mro_entries | mul | ne | neg | + new | next | nonzero | oct | op | or | pos | pow | prepare | radd | rand | + rcmp | rdiv | rdivmod | reduce | reduce_ex | repr | reversed | rfloordiv | + rlshift | rmatmul | rmod | rmul | rop | ror | round | rpow | rrshift | + rshift | rsub | rtruediv | rxor | set | set_name | setattr | setitem | + setslice | setstate | sizeof | str | sub | subclasscheck | subclasshook | + truediv | trunc | unicode | xor) + __) + \s*(?=(\()) + beginCaptures + + 2 + + name + support.function.magic.call.python + + 4 + + name + punctuation.definition.arguments.begin.python + + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.arguments.end.python + + + name + meta.function-call.python + patterns + + + begin + (?=[[:alpha:]_][[:alnum:]_]*(?:\s*\.\s*[[:alpha:]_][[:alnum:]_]*)*\s*\() + end + (?=\s*\() + patterns + + + include + #dotted_name + + + + + begin + (\() + beginCaptures + + 1 + + name + punctuation.definition.arguments.begin.python + + + contentName + meta.function-call.arguments.python + end + (?=\)) + patterns + + + include + #keyword_arguments + + + include + $self + + + + + + + + magic_function_names + + captures + + 2 + + name + support.function.magic.name.python + + + comment + These methods have magic interpretation by python and are generally + called indirectly through syntactic constructs. Names are from + https://docs.python.org/X/reference/datamodel.html where X is 2.7 and 3.5 + See also http://www.rafekettler.com/magicmethods.html + match + (?x) + (def|\.)? + \s*\b( + __(?: + abs | add | aenter | aexit | aiter | and | anext | await | bool | + bytes | call | ceil | cmp | class_getitem | coerce | complex | contains | + copy | deepcopy | del | delattr | delete | delitem | delslice | dir | div | + divmod | enter | eq | execute | exit | float | floor | floordiv | format | + fspath | ge | get | getattr | getattribute | getinitargs | getitem | + getnewargs | getnewargs_ex | getslice | getstate | gt | hash | hex | iadd | + iand | idiv | idivmod | ifloordiv | ilshift | imatmul | imod | imul | index | + init | init_subclass | instancecheck | int | invert | iop | ior | ipow | + irshift | isub | iter | itruediv | ixor | le | len | length_hint | long | + lshift | lt | main | matmul | missing | mod | mro_entries | mul | ne | neg | + new | next | nonzero | oct | op | or | pos | pow | prepare | radd | rand | + rcmp | rdiv | rdivmod | reduce | reduce_ex | repr | reversed | rfloordiv | + rlshift | rmatmul | rmod | rmul | rop | ror | round | rpow | rrshift | + rshift | rsub | rtruediv | rxor | set | set_name | setattr | setitem | + setslice | setstate | sizeof | str | sub | subclasscheck | subclasshook | + truediv | trunc | unicode | xor) + __) + \b + + magic_variable_names + + captures + + 2 + + name + support.variable.magic.python + + + comment + magic attributes which a class/module may have. + match + (?x) + (\.)? + \b( + __(?: + all | annotations | bases | cached | class | closure | code | debug | + defaults | dict | doc | file | func | future | globals | kwdefaults | + loader | members | metaclass | methods | module | mro | name | origin | + package | path | qualname | self | slots | spec | subclasses | version | + weakref | wrapped) + __) \b + + regular_expressions + + comment + Changed disabled to 1 to turn off syntax highlighting in “r” strings. + disabled + 0 + patterns + + + include + source.regexp.python + + + + string_quoted_double + + patterns + + + begin + ([uU]r)(""") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted unicode-raw string + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.double.block.unicode-raw-regex.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + include + #regular_expressions + + + + + begin + ([uU]R)(""") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted unicode-raw string without regular expression highlighting + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.double.block.unicode-raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + + + begin + ([bB]r)(""") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted bytes-raw string + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.double.block.bytes-raw-regex.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + include + #regular_expressions + + + + + begin + ([bB]R)(""") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted bytes-raw string without regular expression highlighting + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.double.block.bytes-raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + + + begin + (r)(""") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double quoted raw string + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.double.block.raw-regex.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + include + #regular_expressions + + + + + begin + (R)(""") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double quoted raw string + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.double.block.raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + + + begin + ([uU])(""") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double quoted unicode string + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.double.block.unicode.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + begin + ([bB])(""") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double quoted bytes string + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.double.block.bytes.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + captures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + 3 + + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + include + #regular_expressions + + + + 4 + + name + punctuation.definition.string.end.python + + + comment + double-quoted raw string + match + ([uU]r)(")((?:[^"\\]|\\.)*)(") + name + string.quoted.double.single-line.unicode-raw-regex.python + + + begin + ([uU]R)(") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double-quoted raw string + end + (")|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.double.single-line.unicode-raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + + + begin + ([bB]r)(") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double-quoted raw string + end + (")|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.double.single-line.bytes-raw-regex.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + include + #regular_expressions + + + + + begin + ([bB]R)(") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double-quoted raw string + end + (")|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.double.single-line.bytes-raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + + + captures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + 3 + + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + include + #regular_expressions + + + + 4 + + name + punctuation.definition.string.end.python + + + comment + double-quoted raw string + match + (r)(")((?:[^"\\]|\\.)*)(") + name + string.quoted.double.single-line.raw-regex.python + + + begin + (R)(") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double-quoted raw string + end + (")|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.double.single-line.raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_double + + + + + begin + ([uU])(") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double quoted unicode string + end + (")|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.double.single-line.unicode.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + begin + ([bB])(") + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + double quoted bytes string + end + (")|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.double.single-line.bytes.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + begin + (")(?=\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER)) + beginCaptures + + 1 + + name + punctuation.definition.string.begin.python + + + comment + double quoted string + end + (")|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.double.single-line.sql.python + patterns + + + captures + + 0 + + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + include + source.sql + + + + + match + (\G|^)([^"\\]|\\(.|\n))*(?="|$) + + + + + begin + (""") + beginCaptures + + 1 + + name + punctuation.definition.string.begin.python + + + comment + double quoted string + end + """ + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.double.block.python + patterns + + + begin + (?=(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER)) + end + (?=""") + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + include + source.sql + + + + + begin + (?=\S) + end + (?=""") + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + + + begin + (") + beginCaptures + + 1 + + name + punctuation.definition.string.begin.python + + + comment + double quoted string + end + (")|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.double.single-line.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + + string_quoted_single + + patterns + + + begin + ([uU]r)(''') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted unicode-raw string + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.single.block.unicode-raw-regex.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + include + #regular_expressions + + + + + begin + ([uU]R)(''') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted unicode-raw string + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.single.block.unicode-raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + + + begin + ([bB]r)(''') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted bytes-raw string + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.single.block.bytes-raw-regex.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + include + #regular_expressions + + + + + begin + ([bB]R)(''') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted bytes-raw string + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.single.block.bytes-raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + + + begin + (r)(''') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted raw string + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.single.block.raw-regex.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + include + #regular_expressions + + + + + begin + (R)(''') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted raw string + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.single.block.raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + + + begin + ([uU])(''') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted unicode string + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.single.block.unicode.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + begin + ([bB])(''') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted bytes string + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.single.block.bytes.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + captures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + 3 + + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + include + #regular_expressions + + + + 4 + + name + punctuation.definition.string.end.python + + + comment + single quoted raw string + match + ([uU]r)(')((?:[^'\\]|\\.)*)(') + name + string.quoted.single.single-line.unicode-raw-regex.python + + + begin + ([uU]R)(') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted unicode-raw string + end + (')|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.single.single-line.unicode-raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + + + begin + ([bB]r)(') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted bytes-raw string + end + (')|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.single.single-line.bytes-raw-regex.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + include + #regular_expressions + + + + + begin + ([bB]R)(') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted bytes-raw string + end + (')|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.single.single-line.bytes-raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + + + captures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + 3 + + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + include + #regular_expressions + + + + 4 + + name + punctuation.definition.string.end.python + + + match + (r)(')((?:[^'\\]|\\.)*)(') + name + string.quoted.single.single-line.raw-regex.python + + + begin + (R)(') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted raw string + end + (')|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.single.single-line.raw.python + patterns + + + include + #constant_placeholder + + + include + #escaped_char_raw_single + + + + + begin + ([uU])(') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted unicode string + end + (')|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.single.single-line.unicode.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + begin + ([bB])(') + beginCaptures + + 1 + + name + storage.type.string.python + + 2 + + name + punctuation.definition.string.begin.python + + + comment + single quoted bytes string + end + (')|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.single.single-line.bytes.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + begin + (')(?=\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER)) + beginCaptures + + 1 + + name + punctuation.definition.string.begin.python + + + comment + single quoted string + end + (')|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.single.single-line.python + patterns + + + captures + + 0 + + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + include + source.sql + + + + + match + (\G|^)([^'\\]|\\(.|\n))*(?='|$) + + + + + begin + (''') + beginCaptures + + 1 + + name + punctuation.definition.string.begin.python + + + comment + single quoted string + end + ''' + endCaptures + + 0 + + name + punctuation.definition.string.end.python + + + name + string.quoted.single.block.python + patterns + + + begin + (?=(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER)) + end + (?=''') + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + include + source.sql + + + + + begin + (?=\S) + end + (?=''') + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + + + begin + (') + beginCaptures + + 1 + + name + punctuation.definition.string.begin.python + + + comment + single quoted string + end + (')|(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.python + + 2 + + name + invalid.illegal.unclosed-string.python + + + name + string.quoted.single.single-line.python + patterns + + + include + #constant_placeholder + + + include + #escaped_unicode_char + + + include + #escaped_char + + + + + + strings + + patterns + + + include + #string_quoted_double + + + include + #string_quoted_single + + + + + scopeName + source.python + uuid + F23DB5B2-7D08-11D9-A709-000D93B6E43C + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/shell.plist b/src/file-viewer/highlight-grammar/shell.plist new file mode 100644 index 0000000..b705179 --- /dev/null +++ b/src/file-viewer/highlight-grammar/shell.plist @@ -0,0 +1,1889 @@ + + + + + fileTypes + + sh + bash + zsh + bashrc + bash_profile + bash_login + profile + bash_logout + .textmate_init + + firstLineMatch + ^#!.*\b(bash|zsh|sh|tcsh)|^#.*-\*-.*\bshell-script\b.*-\*- + keyEquivalent + ^~S + name + Shell Script (Bash) + patterns + + + include + #comment + + + include + #pipeline + + + include + #list + + + include + #compound-command + + + include + #loop + + + include + #string + + + include + #function-definition + + + include + #variable + + + include + #interpolation + + + include + #heredoc + + + include + #herestring + + + include + #redirection + + + include + #pathname + + + include + #keyword + + + include + #support + + + include + #lines + + + repository + + case-clause + + patterns + + + begin + (?=\S) + end + ;; + endCaptures + + 0 + + name + punctuation.terminator.case-clause.shell + + + name + meta.scope.case-clause.shell + patterns + + + begin + (\(|(?=\S)) + captures + + 0 + + name + punctuation.definition.case-pattern.shell + + + end + \) + name + meta.scope.case-pattern.shell + patterns + + + match + \| + name + punctuation.separator.pipe-sign.shell + + + include + #string + + + include + #variable + + + include + #interpolation + + + include + #pathname + + + + + begin + (?<=\)) + end + (?=;;) + name + meta.scope.case-clause-body.shell + patterns + + + include + $self + + + + + + + + comment + + begin + (^[ \t]+)?(?<!\S)(?=#)(?!#\{) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.shell + + + end + (?!\G) + patterns + + + begin + ^(#!) + beginCaptures + + 1 + + name + punctuation.definition.comment.line.shebang.shell + + + end + \n + name + comment.line.shebang.shell + + + begin + # + beginCaptures + + 0 + + name + punctuation.definition.comment.shell + + + end + \n + name + comment.line.number-sign.shell + + + + compound-command + + patterns + + + begin + (\[{2}) + captures + + 1 + + name + punctuation.definition.logical-expression.shell + + + end + (\]{2}) + name + meta.scope.logical-expression.shell + patterns + + + include + #logical-expression + + + include + $self + + + + + begin + (\({2}) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.shell + + + end + (\){2}) + endCaptures + + 0 + + name + punctuation.definition.string.end.shell + + + name + string.other.math.shell + patterns + + + include + #math + + + + + begin + (\() + captures + + 1 + + name + punctuation.definition.subshell.shell + + + end + (\)) + name + meta.scope.subshell.shell + patterns + + + include + $self + + + + + begin + (?<=\s|^)(\{)(?=\s|$) + captures + + 1 + + name + punctuation.definition.group.shell + + + end + (?<=^|;)\s*(\}) + name + meta.scope.group.shell + patterns + + + include + $self + + + + + + function-definition + + patterns + + + begin + (?<=^|;|&)\s*(function)\s+([^\s<>;'"\\|$&()]+)(?:\s*(\(\)))? + beginCaptures + + 1 + + name + storage.type.function.shell + + 2 + + name + entity.name.function.shell + + 3 + + name + punctuation.definition.arguments.shell + + + end + ;|&|\n + endCaptures + + 0 + + name + punctuation.definition.function.shell + + + name + meta.function.shell + patterns + + + include + $self + + + + + begin + (?<=^|;|&)\s*([^\s<>;'"\\|$&()]+)\s*(\(\)) + beginCaptures + + 1 + + name + entity.name.function.shell + + 2 + + name + punctuation.definition.arguments.shell + + + end + ;|&|\n + endCaptures + + 0 + + name + punctuation.definition.function.shell + + + name + meta.function.shell + patterns + + + include + $self + + + + + + heredoc + + patterns + + + begin + (<<)-\s*("|'|)(RUBY)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + source.ruby.embedded.shell + end + ^\t*(RUBY)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.no-indent.ruby.shell + patterns + + + include + source.ruby + + + + + begin + (<<)\s*("|'|)(RUBY)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + source.ruby.embedded.shell + end + ^(RUBY)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.ruby.shell + patterns + + + include + source.ruby + + + + + begin + (<<)-\s*("|'|)(PYTHON)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + source.python.embedded.shell + end + ^\t*(PYTHON)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.no-indent.python.shell + patterns + + + include + source.python + + + + + begin + (<<)\s*("|'|)(PYTHON)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + source.python.embedded.shell + end + ^(PYTHON)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.python.shell + patterns + + + include + source.python + + + + + begin + (<<)-\s*("|'|)(APPLESCRIPT)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + source.applescript.embedded.shell + end + ^\t*(APPLESCRIPT)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.no-indent.applescript.shell + patterns + + + include + source.applescript + + + + + begin + (<<)\s*("|'|)(APPLESCRIPT)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + source.applescript.embedded.shell + end + ^(APPLESCRIPT)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.applescript.shell + patterns + + + include + source.applescript + + + + + begin + (<<)-\s*("|'|)(HTML)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + text.html.embedded.shell + end + ^\t*(HTML)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.no-indent.html.shell + patterns + + + include + text.html.basic + + + + + begin + (<<)\s*("|'|)(HTML)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + text.html.embedded.shell + end + ^(HTML)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.html.shell + patterns + + + include + text.html.basic + + + + + begin + (<<)-\s*("|'|)(MARKDOWN)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + text.html.markdown.embedded.shell + end + ^\t*(MARKDOWN)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.no-indent.markdown.shell + patterns + + + include + text.html.markdown + + + + + begin + (<<)\s*("|'|)(MARKDOWN)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + text.html.markdown.embedded.shell + end + ^(MARKDOWN)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.markdown.shell + patterns + + + include + text.html.markdown + + + + + begin + (<<)-\s*("|'|)(TEXTILE)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + text.html.textile.embedded.shell + end + ^\t*(TEXTILE)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.no-indent.textile.shell + patterns + + + include + text.html.textile + + + + + begin + (<<)\s*("|'|)(TEXTILE)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + contentName + text.html.textile.embedded.shell + end + ^(TEXTILE)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.textile.shell + patterns + + + include + text.html.textile + + + + + begin + (<<)-\s*("|'|)\\?(\w+)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + end + ^\t*(\3)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.no-indent.shell + + + begin + (<<)\s*("|'|)\\?(\w+)\2 + beginCaptures + + 1 + + name + keyword.operator.heredoc.shell + + 3 + + name + keyword.control.heredoc-token.shell + + + captures + + 0 + + name + punctuation.definition.string.shell + + + end + ^(\3)(?=\s|;|&|$) + endCaptures + + 1 + + name + keyword.control.heredoc-token.shell + + + name + string.unquoted.heredoc.shell + + + + herestring + + patterns + + + captures + + 1 + + name + keyword.operator.herestring.shell + + + match + (<<<) + name + meta.herestring.shell + + + + interpolation + + patterns + + + begin + \$\({2} + beginCaptures + + 0 + + name + punctuation.definition.string.begin.shell + + + end + \){2} + endCaptures + + 0 + + name + punctuation.definition.string.end.shell + + + name + string.other.math.shell + patterns + + + include + #math + + + + + begin + ` + beginCaptures + + 0 + + name + punctuation.definition.string.begin.shell + + + end + ` + endCaptures + + 0 + + name + punctuation.definition.string.end.shell + + + name + string.interpolated.backtick.shell + patterns + + + match + \\[`\\$] + name + constant.character.escape.shell + + + begin + (?<=^|;|&|\s|`)(#)(?!\{) + beginCaptures + + 1 + + name + punctuation.definition.comment.shell + + + end + (?=`)|\n + name + comment.line.number-sign.shell + + + include + $self + + + + + begin + \$\( + beginCaptures + + 0 + + name + punctuation.definition.string.begin.shell + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.string.end.shell + + + name + string.interpolated.dollar.shell + patterns + + + begin + (?<=^|;|&|\s|\()(#)(?!\{) + beginCaptures + + 1 + + name + punctuation.definition.comment.shell + + + end + (?=\))|\n + name + comment.line.number-sign.shell + + + include + $self + + + + + + keyword + + patterns + + + match + (?<=^|;|&|\s)(?:if|then|else|elif|fi|for|in|do|done|select|case|continue|esac|while|until|return|coproc)(?=\s|;|&|$) + name + keyword.control.shell + + + match + (?<=^|;|&|\s)(?:export|declare|typeset|local|readonly)(?=\s|;|&|$) + name + storage.modifier.shell + + + + lines + + patterns + + + match + \\\n + name + constant.character.escape.newline.shell + + + + list + + patterns + + + match + ;|&&|&|\|\| + name + keyword.operator.list.shell + + + + logical-expression + + patterns + + + comment + do we want a special rule for ( expr )? + match + =[=~]?|!=?|<|>|&&|\|\| + name + keyword.operator.logical.shell + + + match + (?<!\S)-(nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN]) + name + keyword.operator.logical.shell + + + + loop + + patterns + + + begin + (?<=^|;|&|\s)(for)\s+(?=\({2}) + captures + + 1 + + name + keyword.control.shell + + + end + (?<=^|;|&|\s)(done)(?=\s|;|&|$|\)) + name + meta.scope.for-loop.shell + patterns + + + include + $self + + + + + begin + (?<=^|;|&|\s)(for)\s+([^\s\\]+)(?=\s|;|&|$) + beginCaptures + + 1 + + name + keyword.control.shell + + 2 + + name + variable.other.loop.shell + + + end + (?<=^|;|&|\s)(done)(?=\s|;|&|$|\)) + endCaptures + + 1 + + name + keyword.control.shell + + + name + meta.scope.for-in-loop.shell + patterns + + + include + $self + + + + + begin + (?<=^|;|&|\s)(while|until)(?=\s|;|&|$) + captures + + 1 + + name + keyword.control.shell + + + end + (?<=^|;|&|\s)(done)(?=\s|;|&|$|\)) + name + meta.scope.while-loop.shell + patterns + + + include + $self + + + + + begin + (?<=^|;|&|\s)(select)\s+([^\s\\]+)(?=\s|;|&|$) + beginCaptures + + 1 + + name + keyword.control.shell + + 2 + + name + variable.other.loop.shell + + + end + (?<=^|;|&|\s)(done)(?=\s|;|&|$|\)) + endCaptures + + 1 + + name + keyword.control.shell + + + name + meta.scope.select-block.shell + patterns + + + include + $self + + + + + begin + (?<=^|;|&|\s)(case)(?=\s|;|&|$) + captures + + 1 + + name + keyword.control.shell + + + end + (?<=^|;|&|\s)(esac)(?=\s|;|&|$|\)) + name + meta.scope.case-block.shell + patterns + + + begin + (?<=^|;|&|\s)(?:in)(?=\s|;|&|$) + beginCaptures + + 1 + + name + keyword.control.shell + + + end + (?<=^|;|&|\s)(?=(?:esac)(?:\s|;|&|$|\))) + name + meta.scope.case-body.shell + patterns + + + include + #comment + + + include + #case-clause + + + include + $self + + + + + include + $self + + + + + begin + (^|(?<=[&;|]))\s*(if)(?=\s|;|&|$) + beginCaptures + + 2 + + name + keyword.control.shell + + + comment + Restrict match to avoid matching in lines like `dd if=/dev/sda1 …` + end + (?<=^|;|&|\s)(fi)(?=\s|;|&|$|\)) + endCaptures + + 1 + + name + keyword.control.shell + + + name + meta.scope.if-block.shell + patterns + + + include + $self + + + + + + math + + patterns + + + include + #variable + + + match + \+{1,2}|-{1,2}|!|~|\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|\^|\|{1,2}|&{1,2}|\?|\:|,|=|[*/%+\-&^|]=|<<=|>>= + name + keyword.operator.arithmetic.shell + + + match + 0[xX]\h+ + name + constant.numeric.hex.shell + + + match + 0\d+ + name + constant.numeric.octal.shell + + + match + \d{1,2}#[0-9a-zA-Z@_]+ + name + constant.numeric.other.shell + + + match + \d+ + name + constant.numeric.integer.shell + + + + pathname + + patterns + + + match + (?<=\s|:|=|^)~ + name + keyword.operator.tilde.shell + + + match + \*|\? + name + keyword.operator.glob.shell + + + begin + ([?*+@!])(\() + beginCaptures + + 1 + + name + keyword.operator.extglob.shell + + 2 + + name + punctuation.definition.extglob.shell + + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.extglob.shell + + + name + meta.structure.extglob.shell + patterns + + + include + $self + + + + + + pipeline + + patterns + + + match + (?<=^|;|&|\s)(time)(?=\s|;|&|$) + name + keyword.other.shell + + + match + [|!] + name + keyword.operator.pipe.shell + + + + redirection + + patterns + + + begin + [><]\( + beginCaptures + + 0 + + name + punctuation.definition.string.begin.shell + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.string.end.shell + + + name + string.interpolated.process-substitution.shell + patterns + + + include + $self + + + + + comment + valid: &>word >&word >word [n]>&[n] [n]<word [n]>word [n]>>word [n]<&word (last one is duplicate) + match + &>|\d*>&\d*|\d*(>>|>|<)|\d*<&|\d*<> + name + keyword.operator.redirect.shell + + + + string + + patterns + + + match + \\. + name + constant.character.escape.shell + + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.shell + + + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.shell + + + name + string.quoted.single.shell + + + begin + \$?" + beginCaptures + + 0 + + name + punctuation.definition.string.begin.shell + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.shell + + + name + string.quoted.double.shell + patterns + + + match + \\[\$`"\\\n] + name + constant.character.escape.shell + + + include + #variable + + + include + #interpolation + + + + + begin + \$' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.shell + + + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.shell + + + name + string.quoted.single.dollar.shell + patterns + + + match + \\(a|b|e|f|n|r|t|v|\\|') + name + constant.character.escape.ansi-c.shell + + + match + \\[0-9]{3} + name + constant.character.escape.octal.shell + + + match + \\x[0-9a-fA-F]{2} + name + constant.character.escape.hex.shell + + + match + \\c. + name + constant.character.escape.control-char.shell + + + + + + support + + patterns + + + match + (?<=^|;|&|\s)(?::|\.)(?=\s|;|&|$) + name + support.function.builtin.shell + + + match + (?<=^|;|&|\s)(?:alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|dirs|disown|echo|enable|eval|exec|exit|false|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|mapfile|popd|printf|pushd|pwd|read(array)?|readonly|set|shift|shopt|source|suspend|test|times|trap|true|type|ulimit|umask|unalias|unset|wait)(?=\s|;|&|$) + name + support.function.builtin.shell + + + + variable + + patterns + + + captures + + 1 + + name + punctuation.definition.variable.shell + + + match + (\$)[a-zA-Z_][a-zA-Z0-9_]* + name + variable.other.normal.shell + + + captures + + 1 + + name + punctuation.definition.variable.shell + + + match + (\$)[-*@#?$!0_] + name + variable.other.special.shell + + + captures + + 1 + + name + punctuation.definition.variable.shell + + + match + (\$)[1-9] + name + variable.other.positional.shell + + + begin + \$\{ + captures + + 0 + + name + punctuation.definition.variable.shell + + + end + \} + name + variable.other.bracket.shell + patterns + + + match + !|:[-=?+]?|\*|@|#{1,2}|%{1,2}|/ + name + keyword.operator.expansion.shell + + + captures + + 1 + + name + punctuation.section.array.shell + + 3 + + name + punctuation.section.array.shell + + + match + (\[)([^\]]+)(\]) + + + include + #string + + + include + #variable + + + include + #interpolation + + + + + + + scopeName + source.shell + uuid + DDEEA3ED-6B1C-11D9-8B10-000D93589AF6 + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/toml.plist b/src/file-viewer/highlight-grammar/toml.plist new file mode 100644 index 0000000..68b3b82 --- /dev/null +++ b/src/file-viewer/highlight-grammar/toml.plist @@ -0,0 +1,736 @@ + + + + + fileTypes + + toml + + keyEquivalent + ^~T + name + TOML + patterns + + + include + #comments + + + include + #groups + + + include + #key_pair + + + include + #invalid + + + repository + + comments + + begin + (^[ \t]+)?(?=#) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.toml + + + end + (?!\G) + patterns + + + begin + # + beginCaptures + + 0 + + name + punctuation.definition.comment.toml + + + end + \n + name + comment.line.number-sign.toml + + + + groups + + patterns + + + captures + + 1 + + name + punctuation.definition.section.begin.toml + + 2 + + patterns + + + match + [^\s.]+ + name + entity.name.section.toml + + + + 3 + + name + punctuation.definition.section.begin.toml + + + match + ^\s*(\[)([^\[\]]*)(\]) + name + meta.group.toml + + + captures + + 1 + + name + punctuation.definition.section.begin.toml + + 2 + + patterns + + + match + [^\s.]+ + name + entity.name.section.toml + + + + 3 + + name + punctuation.definition.section.begin.toml + + + match + ^\s*(\[\[)([^\[\]]*)(\]\]) + name + meta.group.double.toml + + + + invalid + + match + \S+(\s*(?=\S))? + name + invalid.illegal.not-allowed-here.toml + + key_pair + + patterns + + + begin + ([A-Za-z0-9_-]+)\s*(=)\s* + captures + + 1 + + name + variable.other.key.toml + + 2 + + name + punctuation.separator.key-value.toml + + + end + (?<=\S)(?<!=)|$ + patterns + + + include + #primatives + + + + + begin + ((")(.*?)("))\s*(=)\s* + captures + + 1 + + name + variable.other.key.toml + + 2 + + name + punctuation.definition.variable.begin.toml + + 3 + + patterns + + + match + \\([btnfr"\\]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape.toml + + + match + \\[^btnfr"\\] + name + invalid.illegal.escape.toml + + + match + " + name + invalid.illegal.not-allowed-here.toml + + + + 4 + + name + punctuation.definition.variable.end.toml + + 5 + + name + punctuation.separator.key-value.toml + + + end + (?<=\S)(?<!=)|$ + patterns + + + include + #primatives + + + + + begin + ((')([^']*)('))\s*(=)\s* + captures + + 1 + + name + variable.other.key.toml + + 2 + + name + punctuation.definition.variable.begin.toml + + 4 + + name + punctuation.definition.variable.end.toml + + 5 + + name + punctuation.separator.key-value.toml + + + end + (?<=\S)(?<!=)|$ + patterns + + + include + #primatives + + + + + begin + (?x) + ( + ( + (?: + [A-Za-z0-9_-]+ # Bare key + | " (?:[^"\\]|\\.)* " # Double quoted key + | ' [^']* ' # Sindle quoted key + ) + (?: + \s* \. \s* # Dot + | (?= \s* =) # or look-ahead for equals + ) + ){2,} # Ensure at least one dot + ) + \s*(=)\s* + + captures + + 1 + + name + variable.other.key.toml + patterns + + + match + \. + name + punctuation.separator.variable.toml + + + captures + + 1 + + name + punctuation.definition.variable.begin.toml + + 2 + + patterns + + + match + \\([btnfr"\\]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape.toml + + + match + \\[^btnfr"\\] + name + invalid.illegal.escape.toml + + + + 3 + + name + punctuation.definition.variable.end.toml + + + match + (")((?:[^"\\]|\\.)*)(") + + + captures + + 1 + + name + punctuation.definition.variable.begin.toml + + 2 + + name + punctuation.definition.variable.end.toml + + + match + (')[^']*(') + + + + 3 + + name + punctuation.separator.key-value.toml + + + comment + Dotted key + end + (?<=\S)(?<!=)|$ + patterns + + + include + #primatives + + + + + + primatives + + patterns + + + begin + \G""" + beginCaptures + + 0 + + name + punctuation.definition.string.begin.toml + + + end + "{3,5} + endCaptures + + 0 + + name + punctuation.definition.string.end.toml + + + name + string.quoted.triple.double.toml + patterns + + + match + \\([btnfr"\\]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape.toml + + + match + \\[^btnfr"\\\n] + name + invalid.illegal.escape.toml + + + + + begin + \G" + beginCaptures + + 0 + + name + punctuation.definition.string.begin.toml + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.toml + + + name + string.quoted.double.toml + patterns + + + match + \\([btnfr"\\]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}) + name + constant.character.escape.toml + + + match + \\[^btnfr"\\] + name + invalid.illegal.escape.toml + + + + + begin + \G''' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.toml + + + end + '{3,5} + endCaptures + + 0 + + name + punctuation.definition.string.end.toml + + + name + string.quoted.triple.single.toml + + + begin + \G' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.toml + + + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.toml + + + name + string.quoted.single.toml + + + match + \G(?x) + [0-9]{4} + - + (0[1-9]|1[012]) + - + (?!00|3[2-9])[0-3][0-9] + ( + [Tt ] + (?!2[5-9])[0-2][0-9] + : + [0-5][0-9] + : + (?!6[1-9])[0-6][0-9] + (\.[0-9]+)? + ( + Z + | [+-](?!2[5-9])[0-2][0-9]:[0-5][0-9] + )? + )? + + name + constant.other.date.toml + + + match + \G(?x) + (?!2[5-9])[0-2][0-9] + : + [0-5][0-9] + : + (?!6[1-9])[0-6][0-9] + (\.[0-9]+)? + + name + constant.other.time.toml + + + match + \G(true|false) + name + constant.language.boolean.toml + + + match + \G0x\h(\h|_\h)* + name + constant.numeric.hex.toml + + + match + \G0o[0-7]([0-7]|_[0-7])* + name + constant.numeric.octal.toml + + + match + \G0b[01]([01]|_[01])* + name + constant.numeric.binary.toml + + + match + \G[+-]?(inf|nan) + name + constant.numeric.toml + + + match + (?x) + \G + ( + [+-]? + ( + 0 + | ([1-9](([0-9]|_[0-9])+)?) + ) + ) + (?=[.eE]) + ( + \. + ([0-9](([0-9]|_[0-9])+)?) + )? + ( + [eE] + ([+-]?[0-9](([0-9]|_[0-9])+)?) + )? + + name + constant.numeric.float.toml + + + match + (?x) + \G + ( + [+-]? + ( + 0 + | ([1-9](([0-9]|_[0-9])+)?) + ) + ) + + name + constant.numeric.integer.toml + + + begin + \G\[ + beginCaptures + + 0 + + name + punctuation.definition.array.begin.toml + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.array.end.toml + + + name + meta.array.toml + patterns + + + begin + (?=["'']|[+-]?[0-9]|[+-]?(inf|nan)|true|false|\[|\{) + end + ,|(?=]) + endCaptures + + 0 + + name + punctuation.separator.array.toml + + + patterns + + + include + #primatives + + + include + #comments + + + include + #invalid + + + + + include + #comments + + + include + #invalid + + + + + begin + \G\{ + beginCaptures + + 0 + + name + punctuation.definition.inline-table.begin.toml + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.inline-table.end.toml + + + name + meta.inline-table.toml + patterns + + + begin + (?=\S) + end + ,|(?=}) + endCaptures + + 0 + + name + punctuation.separator.inline-table.toml + + + patterns + + + include + #key_pair + + + + + include + #comments + + + + + + + scopeName + source.toml + uuid + 7DEF2EDB-5BB7-4DD2-9E78-3541A26B7923 + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/ts.plist b/src/file-viewer/highlight-grammar/ts.plist new file mode 100644 index 0000000..4d91f6a --- /dev/null +++ b/src/file-viewer/highlight-grammar/ts.plist @@ -0,0 +1,9858 @@ + + + + + name + TypeScript + scopeName + source.ts + fileTypes + + ts + + uuid + ef98eb90-bf9b-11e4-bb52-0800200c9a66 + patterns + + + include + #directives + + + include + #statements + + + include + #shebang + + + repository + + shebang + + name + comment.line.shebang.ts + match + \A(#!).*(?=$) + captures + + 1 + + name + punctuation.definition.comment.ts + + + + statements + + patterns + + + include + #declaration + + + include + #control-statement + + + include + #after-operator-block-as-object-literal + + + include + #decl-block + + + include + #label + + + include + #expression + + + include + #punctuation-semicolon + + + include + #string + + + include + #comment + + + + declaration + + patterns + + + include + #decorator + + + include + #var-expr + + + include + #function-declaration + + + include + #class-declaration + + + include + #interface-declaration + + + include + #enum-declaration + + + include + #namespace-declaration + + + include + #type-alias-declaration + + + include + #import-equals-declaration + + + include + #import-declaration + + + include + #export-declaration + + + name + storage.modifier.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(declare|export)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + control-statement + + patterns + + + include + #switch-statement + + + include + #for-loop + + + name + keyword.control.trycatch.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(catch|finally|throw|try)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|goto)\s+([_$[:alpha:]][_$[:alnum:]]*)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + captures + + 1 + + name + keyword.control.loop.ts + + 2 + + name + entity.name.label.ts + + + + + name + keyword.control.loop.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 0 + + name + keyword.control.flow.ts + + + end + (?=[;}]|$|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #expression + + + + + name + keyword.control.switch.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + include + #if-statement + + + name + keyword.control.conditional.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(else|if)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.control.with.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(with)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.control.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(package)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.other.debugger.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(debugger)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + label + + patterns + + + begin + ([_$[:alpha:]][_$[:alnum:]]*)\s*(:)(?=\s*\{) + beginCaptures + + 1 + + name + entity.name.label.ts + + 2 + + name + punctuation.separator.label.ts + + + end + (?<=\}) + patterns + + + include + #decl-block + + + + + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(:) + captures + + 1 + + name + entity.name.label.ts + + 2 + + name + punctuation.separator.label.ts + + + + + + expression + + patterns + + + include + #expressionWithoutIdentifiers + + + include + #identifiers + + + include + #expressionPunctuations + + + + expressionWithoutIdentifiers + + patterns + + + include + #string + + + include + #regex + + + include + #comment + + + include + #function-expression + + + include + #class-expression + + + include + #arrow-function + + + include + #paren-expression-possibly-arrow + + + include + #cast + + + include + #ternary-expression + + + include + #new-expr + + + include + #instanceof-expr + + + include + #object-literal + + + include + #expression-operators + + + include + #function-call + + + include + #literal + + + include + #support-objects + + + include + #paren-expression + + + + expressionPunctuations + + patterns + + + include + #punctuation-comma + + + include + #punctuation-accessor + + + + decorator + + name + meta.decorator.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))\@ + beginCaptures + + 0 + + name + punctuation.decorator.ts + + + end + (?=\s) + patterns + + + include + #expression + + + + var-expr + + patterns + + + name + meta.var.expr.ts + begin + (?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) + end + (?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=^|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))|((?<!^let|[^\._$[:alnum:]]let|^var|[^\._$[:alnum:]]var)(?=\s*$))) + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s* + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.type.ts + + + end + (?=\S) + + + include + #destructuring-variable + + + include + #var-single-variable + + + include + #variable-initializer + + + include + #comment + + + begin + (,)\s*(?=$|\/\/) + beginCaptures + + 1 + + name + punctuation.separator.comma.ts + + + end + (?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$))) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + include + #destructuring-variable + + + include + #var-single-variable + + + include + #punctuation-comma + + + + + include + #punctuation-comma + + + + + name + meta.var.expr.ts + begin + (?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.type.ts + + + end + (?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=^|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))|((?<!^const|[^\._$[:alnum:]]const)(?=\s*$))) + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s* + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.type.ts + + + end + (?=\S) + + + include + #destructuring-const + + + include + #var-single-const + + + include + #variable-initializer + + + include + #comment + + + begin + (,)\s*(?=$|\/\/) + beginCaptures + + 1 + + name + punctuation.separator.comma.ts + + + end + (?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$))) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + include + #destructuring-const + + + include + #var-single-const + + + include + #punctuation-comma + + + + + include + #punctuation-comma + + + + + name + meta.var.expr.ts + begin + (?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b((?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.type.ts + + + end + (?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b((?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))|((?<!^using|[^\._$[:alnum:]]using|^await\s+using|[^\._$[:alnum:]]await\s+using)(?=\s*$))) + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b((?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s* + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.type.ts + + + end + (?=\S) + + + include + #var-single-const + + + include + #variable-initializer + + + include + #comment + + + begin + (,)\s*((?!\S)|(?=\/\/)) + beginCaptures + + 1 + + name + punctuation.separator.comma.ts + + + end + (?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$))) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + include + #var-single-const + + + include + #punctuation-comma + + + + + include + #punctuation-comma + + + + + + var-single-variable + + patterns + + + name + meta.var-single-variable.expr.ts + begin + (?x)([_$[:alpha:]][_$[:alnum:]]*)(\!)?(?=\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + beginCaptures + + 1 + + name + meta.definition.variable.ts entity.name.function.ts + + 2 + + name + keyword.operator.definiteassignment.ts + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + name + meta.var-single-variable.expr.ts + begin + ([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])(\!)? + beginCaptures + + 1 + + name + meta.definition.variable.ts variable.other.constant.ts + + 2 + + name + keyword.operator.definiteassignment.ts + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + name + meta.var-single-variable.expr.ts + begin + ([_$[:alpha:]][_$[:alnum:]]*)(\!)? + beginCaptures + + 1 + + name + meta.definition.variable.ts variable.other.readwrite.ts + + 2 + + name + keyword.operator.definiteassignment.ts + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + + var-single-const + + patterns + + + name + meta.var-single-variable.expr.ts + begin + (?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + beginCaptures + + 1 + + name + meta.definition.variable.ts variable.other.constant.ts entity.name.function.ts + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + name + meta.var-single-variable.expr.ts + begin + ([_$[:alpha:]][_$[:alnum:]]*) + beginCaptures + + 1 + + name + meta.definition.variable.ts variable.other.constant.ts + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + + var-single-variable-type-annotation + + patterns + + + include + #type-annotation + + + include + #string + + + include + #comment + + + + destructuring-variable + + patterns + + + name + meta.object-binding-pattern-variable.ts + begin + (?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{) + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #object-binding-pattern + + + include + #type-annotation + + + include + #comment + + + + + name + meta.array-binding-pattern-variable.ts + begin + (?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[) + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #array-binding-pattern + + + include + #type-annotation + + + include + #comment + + + + + + destructuring-const + + patterns + + + name + meta.object-binding-pattern-variable.ts + begin + (?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{) + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #object-binding-pattern-const + + + include + #type-annotation + + + include + #comment + + + + + name + meta.array-binding-pattern-variable.ts + begin + (?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[) + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #array-binding-pattern-const + + + include + #type-annotation + + + include + #comment + + + + + + object-binding-element + + patterns + + + include + #comment + + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) + end + (?=,|\}) + patterns + + + include + #object-binding-element-propertyName + + + include + #binding-element + + + + + include + #object-binding-pattern + + + include + #destructuring-variable-rest + + + include + #variable-initializer + + + include + #punctuation-comma + + + + object-binding-element-const + + patterns + + + include + #comment + + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) + end + (?=,|\}) + patterns + + + include + #object-binding-element-propertyName + + + include + #binding-element-const + + + + + include + #object-binding-pattern-const + + + include + #destructuring-variable-rest-const + + + include + #variable-initializer + + + include + #punctuation-comma + + + + object-binding-element-propertyName + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) + end + (:) + endCaptures + + 0 + + name + punctuation.destructuring.ts + + + patterns + + + include + #string + + + include + #array-literal + + + include + #numeric-literal + + + name + variable.object.property.ts + match + ([_$[:alpha:]][_$[:alnum:]]*) + + + + binding-element + + patterns + + + include + #comment + + + include + #string + + + include + #numeric-literal + + + include + #regex + + + include + #object-binding-pattern + + + include + #array-binding-pattern + + + include + #destructuring-variable-rest + + + include + #variable-initializer + + + + binding-element-const + + patterns + + + include + #comment + + + include + #string + + + include + #numeric-literal + + + include + #regex + + + include + #object-binding-pattern-const + + + include + #array-binding-pattern-const + + + include + #destructuring-variable-rest-const + + + include + #variable-initializer + + + + destructuring-variable-rest + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + meta.definition.variable.ts variable.other.readwrite.ts + + + + destructuring-variable-rest-const + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + meta.definition.variable.ts variable.other.constant.ts + + + + object-binding-pattern + + begin + (?:(\.\.\.)\s*)?(\{) + beginCaptures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + punctuation.definition.binding-pattern.object.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.object.ts + + + patterns + + + include + #object-binding-element + + + + object-binding-pattern-const + + begin + (?:(\.\.\.)\s*)?(\{) + beginCaptures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + punctuation.definition.binding-pattern.object.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.object.ts + + + patterns + + + include + #object-binding-element-const + + + + array-binding-pattern + + begin + (?:(\.\.\.)\s*)?(\[) + beginCaptures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + punctuation.definition.binding-pattern.array.ts + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.array.ts + + + patterns + + + include + #binding-element + + + include + #punctuation-comma + + + + array-binding-pattern-const + + begin + (?:(\.\.\.)\s*)?(\[) + beginCaptures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + punctuation.definition.binding-pattern.array.ts + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.array.ts + + + patterns + + + include + #binding-element-const + + + include + #punctuation-comma + + + + parameter-name + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+) + captures + + 1 + + name + storage.modifier.ts + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + captures + + 1 + + name + storage.modifier.ts + + 2 + + name + keyword.operator.rest.ts + + 3 + + name + entity.name.function.ts variable.language.this.ts + + 4 + + name + entity.name.function.ts + + 5 + + name + keyword.operator.optional.ts + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??) + captures + + 1 + + name + storage.modifier.ts + + 2 + + name + keyword.operator.rest.ts + + 3 + + name + variable.parameter.ts variable.language.this.ts + + 4 + + name + variable.parameter.ts + + 5 + + name + keyword.operator.optional.ts + + + + + + destructuring-parameter + + patterns + + + name + meta.parameter.object-binding-pattern.ts + begin + (?<!=|:)\s*(?:(\.\.\.)\s*)?(\{) + beginCaptures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + punctuation.definition.binding-pattern.object.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.object.ts + + + patterns + + + include + #parameter-object-binding-element + + + + + name + meta.paramter.array-binding-pattern.ts + begin + (?<!=|:)\s*(?:(\.\.\.)\s*)?(\[) + beginCaptures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + punctuation.definition.binding-pattern.array.ts + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.array.ts + + + patterns + + + include + #parameter-binding-element + + + include + #punctuation-comma + + + + + + parameter-object-binding-element + + patterns + + + include + #comment + + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) + end + (?=,|\}) + patterns + + + include + #object-binding-element-propertyName + + + include + #parameter-binding-element + + + include + #paren-expression + + + + + include + #parameter-object-binding-pattern + + + include + #destructuring-parameter-rest + + + include + #variable-initializer + + + include + #punctuation-comma + + + + parameter-binding-element + + patterns + + + include + #comment + + + include + #string + + + include + #numeric-literal + + + include + #regex + + + include + #parameter-object-binding-pattern + + + include + #parameter-array-binding-pattern + + + include + #destructuring-parameter-rest + + + include + #variable-initializer + + + + destructuring-parameter-rest + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + variable.parameter.ts + + + + parameter-object-binding-pattern + + begin + (?:(\.\.\.)\s*)?(\{) + beginCaptures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + punctuation.definition.binding-pattern.object.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.object.ts + + + patterns + + + include + #parameter-object-binding-element + + + + parameter-array-binding-pattern + + begin + (?:(\.\.\.)\s*)?(\[) + beginCaptures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + punctuation.definition.binding-pattern.array.ts + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.array.ts + + + patterns + + + include + #parameter-binding-element + + + include + #punctuation-comma + + + + field-declaration + + name + meta.field.declaration.ts + begin + (?x)(?<!\()(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s+)?(?=\s*((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|(\#?[_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|\}|$)) + beginCaptures + + 1 + + name + storage.modifier.ts + + + end + (?x)(?=\}|;|,|$|(^(?!\s*((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|(\#?[_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|$))))|(?<=\}) + patterns + + + include + #variable-initializer + + + include + #type-annotation + + + include + #string + + + include + #array-literal + + + include + #numeric-literal + + + include + #comment + + + match + (?x)(\#?[_$[:alpha:]][_$[:alnum:]]*)(?:(\?)|(\!))?(?=\s*\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + captures + + 1 + + name + meta.definition.property.ts entity.name.function.ts + + 2 + + name + keyword.operator.optional.ts + + 3 + + name + keyword.operator.definiteassignment.ts + + + + + name + meta.definition.property.ts variable.object.property.ts + match + \#?[_$[:alpha:]][_$[:alnum:]]* + + + name + keyword.operator.optional.ts + match + \? + + + name + keyword.operator.definiteassignment.ts + match + \! + + + + variable-initializer + + patterns + + + begin + (?<!=|!)(=)(?!=)(?=\s*\S)(?!\s*.*=>\s*$) + beginCaptures + + 1 + + name + keyword.operator.assignment.ts + + + end + (?=$|^|[,);}\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #expression + + + + + begin + (?<!=|!)(=)(?!=) + beginCaptures + + 1 + + name + keyword.operator.assignment.ts + + + end + (?=[,);}\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))|(?=^\s*$)|(?<![\|\&\+\-\*\/])(?<=\S)(?<!=)(?=\s*$) + patterns + + + include + #expression + + + + + + function-declaration + + name + meta.function.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s* + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.modifier.async.ts + + 4 + + name + storage.type.function.ts + + 5 + + name + keyword.generator.asterisk.ts + + 6 + + name + meta.definition.function.ts entity.name.function.ts + + + end + (?=;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))|(?<=\}) + patterns + + + include + #function-name + + + include + #function-body + + + + function-expression + + name + meta.function.expression.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s* + beginCaptures + + 1 + + name + storage.modifier.async.ts + + 2 + + name + storage.type.function.ts + + 3 + + name + keyword.generator.asterisk.ts + + 4 + + name + meta.definition.function.ts entity.name.function.ts + + + end + (?=;)|(?<=\}) + patterns + + + include + #function-name + + + include + #single-line-comment-consuming-line-ending + + + include + #function-body + + + + function-name + + name + meta.definition.function.ts entity.name.function.ts + match + [_$[:alpha:]][_$[:alnum:]]* + + function-body + + patterns + + + include + #comment + + + include + #type-parameters + + + include + #function-parameters + + + include + #return-type + + + include + #type-function-return-type + + + include + #decl-block + + + name + keyword.generator.asterisk.ts + match + \* + + + + method-declaration + + patterns + + + name + meta.method.declaration.ts + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + storage.modifier.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.modifier.ts + + 4 + + name + storage.modifier.async.ts + + 5 + + name + storage.type.ts + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #method-declaration-name + + + include + #function-body + + + + + name + meta.method.declaration.ts + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\s*\b(new)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(?:(\*)\s*)?)(?=\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + beginCaptures + + 1 + + name + storage.modifier.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.modifier.ts + + 4 + + name + storage.modifier.async.ts + + 5 + + name + keyword.operator.new.ts + + 6 + + name + keyword.generator.asterisk.ts + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #method-declaration-name + + + include + #function-body + + + + + name + meta.method.declaration.ts + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + beginCaptures + + 1 + + name + storage.modifier.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.modifier.ts + + 4 + + name + storage.modifier.async.ts + + 5 + + name + storage.type.property.ts + + 6 + + name + keyword.generator.asterisk.ts + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #method-declaration-name + + + include + #function-body + + + + + + object-literal-method-declaration + + name + meta.method.declaration.ts + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + beginCaptures + + 1 + + name + storage.modifier.async.ts + + 2 + + name + storage.type.property.ts + + 3 + + name + keyword.generator.asterisk.ts + + + end + (?=\}|;|,)|(?<=\}) + patterns + + + include + #method-declaration-name + + + include + #function-body + + + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + beginCaptures + + 1 + + name + storage.modifier.async.ts + + 2 + + name + storage.type.property.ts + + 3 + + name + keyword.generator.asterisk.ts + + + end + (?=\(|\<) + patterns + + + include + #method-declaration-name + + + + + + method-declaration-name + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<]) + end + (?=\(|\<) + patterns + + + include + #string + + + include + #array-literal + + + include + #numeric-literal + + + name + meta.definition.method.ts entity.name.function.ts + match + [_$[:alpha:]][_$[:alnum:]]* + + + name + keyword.operator.optional.ts + match + \? + + + + arrow-function + + patterns + + + name + meta.arrow.ts + match + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync)\s+)?([_$[:alpha:]][_$[:alnum:]]*)\s*(?==>) + captures + + 1 + + name + storage.modifier.async.ts + + 2 + + name + variable.parameter.ts + + + + + name + meta.arrow.ts + begin + (?x) (?: + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync) +)? ((?<![})!\]])\s* + (?= + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + ) +) + beginCaptures + + 1 + + name + storage.modifier.async.ts + + + end + (?==>|\{|(^\s*(export|function|class|interface|let|var|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|const|import|enum|namespace|module|type|abstract|declare)\s+)) + patterns + + + include + #comment + + + include + #type-parameters + + + include + #function-parameters + + + include + #arrow-return-type + + + include + #possibly-arrow-return-type + + + + + name + meta.arrow.ts + begin + => + beginCaptures + + 0 + + name + storage.type.function.arrow.ts + + + end + ((?<=\}|\S)(?<!=>)|((?!\{)(?=\S)))(?!\/[\/\*]) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #decl-block + + + include + #expression + + + + + + indexer-declaration + + name + meta.indexer.declaration.ts + begin + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s*)?\s*(\[)\s*([_$[:alpha:]][_$[:alnum:]]*)\s*(?=:) + beginCaptures + + 1 + + name + storage.modifier.ts + + 2 + + name + meta.brace.square.ts + + 3 + + name + variable.parameter.ts + + + end + (\])\s*(\?\s*)?|$ + endCaptures + + 1 + + name + meta.brace.square.ts + + 2 + + name + keyword.operator.optional.ts + + + patterns + + + include + #type-annotation + + + + indexer-mapped-type-declaration + + name + meta.indexer.mappedtype.declaration.ts + begin + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))([+-])?(readonly)\s*)?\s*(\[)\s*([_$[:alpha:]][_$[:alnum:]]*)\s+(in)\s+ + beginCaptures + + 1 + + name + keyword.operator.type.modifier.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + meta.brace.square.ts + + 4 + + name + entity.name.type.ts + + 5 + + name + keyword.operator.expression.in.ts + + + end + (\])([+-])?\s*(\?\s*)?|$ + endCaptures + + 1 + + name + meta.brace.square.ts + + 2 + + name + keyword.operator.type.modifier.ts + + 3 + + name + keyword.operator.optional.ts + + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+ + captures + + 1 + + name + keyword.control.as.ts + + + + + include + #type + + + + function-parameters + + name + meta.parameters.ts + begin + \( + beginCaptures + + 0 + + name + punctuation.definition.parameters.begin.ts + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.parameters.end.ts + + + patterns + + + include + #function-parameters-body + + + + function-parameters-body + + patterns + + + include + #comment + + + include + #string + + + include + #decorator + + + include + #destructuring-parameter + + + include + #parameter-name + + + include + #parameter-type-annotation + + + include + #variable-initializer + + + name + punctuation.separator.parameter.ts + match + , + + + + class-declaration + + name + meta.class.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(?:(abstract)\s+)?\b(class)\b(?=\s+|/[/*]) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.modifier.ts + + 4 + + name + storage.type.class.ts + + + end + (?<=\}) + patterns + + + include + #class-declaration-or-expression-patterns + + + + class-expression + + name + meta.class.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(class)\b(?=\s+|[<{]|\/[\/*]) + beginCaptures + + 1 + + name + storage.modifier.ts + + 2 + + name + storage.type.class.ts + + + end + (?<=\}) + patterns + + + include + #class-declaration-or-expression-patterns + + + + class-declaration-or-expression-patterns + + patterns + + + include + #comment + + + include + #class-or-interface-heritage + + + match + [_$[:alpha:]][_$[:alnum:]]* + captures + + 0 + + name + entity.name.type.class.ts + + + + + include + #type-parameters + + + include + #class-or-interface-body + + + + interface-declaration + + name + meta.interface.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(?:(abstract)\s+)?\b(interface)\b(?=\s+|/[/*]) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.modifier.ts + + 4 + + name + storage.type.interface.ts + + + end + (?<=\}) + patterns + + + include + #comment + + + include + #class-or-interface-heritage + + + match + [_$[:alpha:]][_$[:alnum:]]* + captures + + 0 + + name + entity.name.type.interface.ts + + + + + include + #type-parameters + + + include + #class-or-interface-body + + + + class-or-interface-heritage + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(extends|implements)\b)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + storage.modifier.ts + + + end + (?=\{) + patterns + + + include + #comment + + + include + #class-or-interface-heritage + + + include + #type-parameters + + + include + #expressionWithoutIdentifiers + + + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\??\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*) + captures + + 1 + + name + entity.name.type.module.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + + + + match + ([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + entity.other.inherited-class.ts + + + + + include + #expressionPunctuations + + + + class-or-interface-body + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.ts + + + patterns + + + include + #comment + + + include + #decorator + + + begin + (?<=:)\s* + end + (?=\s|[;),}\]:\-\+]|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #expression + + + + + include + #method-declaration + + + include + #indexer-declaration + + + include + #field-declaration + + + include + #string + + + include + #type-annotation + + + include + #variable-initializer + + + include + #access-modifier + + + include + #property-accessor + + + include + #async-modifier + + + include + #after-operator-block-as-object-literal + + + include + #decl-block + + + include + #expression + + + include + #punctuation-comma + + + include + #punctuation-semicolon + + + + access-modifier + + name + storage.modifier.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|declare|override|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + property-accessor + + name + storage.type.property.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(accessor|get|set)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + async-modifier + + name + storage.modifier.async.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(async)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + enum-declaration + + name + meta.enum.declaration.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:\b(const)\s+)?\b(enum)\s+([_$[:alpha:]][_$[:alnum:]]*) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.modifier.ts + + 4 + + name + storage.type.enum.ts + + 5 + + name + entity.name.type.enum.ts + + + end + (?<=\}) + patterns + + + include + #comment + + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.ts + + + patterns + + + include + #comment + + + begin + ([_$[:alpha:]][_$[:alnum:]]*) + beginCaptures + + 0 + + name + variable.other.enummember.ts + + + end + (?=,|\}|$) + patterns + + + include + #comment + + + include + #variable-initializer + + + + + begin + (?=((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))) + end + (?=,|\}|$) + patterns + + + include + #string + + + include + #array-literal + + + include + #comment + + + include + #variable-initializer + + + + + include + #punctuation-comma + + + + + + namespace-declaration + + name + meta.namespace.declaration.ts + begin + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(namespace|module)\s+(?=[_$[:alpha:]"'`])) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.type.namespace.ts + + + end + (?<=\})|(?=;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #comment + + + include + #string + + + name + entity.name.type.module.ts + match + ([_$[:alpha:]][_$[:alnum:]]*) + + + include + #punctuation-accessor + + + include + #decl-block + + + + type-alias-declaration + + name + meta.type.declaration.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(type)\b\s+([_$[:alpha:]][_$[:alnum:]]*)\s* + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + storage.type.type.ts + + 4 + + name + entity.name.type.alias.ts + + + end + (?=\}|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #comment + + + include + #type-parameters + + + begin + (=)\s*(intrinsic)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.operator.assignment.ts + + 2 + + name + keyword.control.intrinsic.ts + + + end + (?=\}|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #type + + + + + begin + (=)\s* + beginCaptures + + 1 + + name + keyword.operator.assignment.ts + + + end + (?=\}|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #type + + + + + + import-equals-declaration + + patterns + + + name + meta.import-equals.external.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type))?\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(require)\s*(\() + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + keyword.control.import.ts + + 4 + + name + keyword.control.type.ts + + 5 + + name + variable.other.readwrite.alias.ts + + 6 + + name + keyword.operator.assignment.ts + + 7 + + name + keyword.control.require.ts + + 8 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + include + #comment + + + include + #string + + + + + name + meta.import-equals.internal.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type))?\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(?!require\b) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + keyword.control.import.ts + + 4 + + name + keyword.control.type.ts + + 5 + + name + variable.other.readwrite.alias.ts + + 6 + + name + keyword.operator.assignment.ts + + + end + (?=;|$|^) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]]))) + captures + + 1 + + name + entity.name.type.module.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + + + + name + variable.other.readwrite.ts + match + ([_$[:alpha:]][_$[:alnum:]]*) + + + + + + import-declaration + + name + meta.import.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type)(?!\s+from))?(?!\s*[:\(])(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + keyword.control.import.ts + + 4 + + name + keyword.control.type.ts + + + end + (?<!^import|[^\._$[:alnum:]]import)(?=;|$|^) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + include + #string + + + begin + (?<=^import|[^\._$[:alnum:]]import)(?!\s*["']) + end + \bfrom\b + endCaptures + + 0 + + name + keyword.control.from.ts + + + patterns + + + include + #import-export-declaration + + + + + include + #import-export-declaration + + + + export-declaration + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)\s+(as)\s+(namespace)\s+([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.control.export.ts + + 2 + + name + keyword.control.as.ts + + 3 + + name + storage.type.namespace.ts + + 4 + + name + entity.name.type.module.ts + + + + + name + meta.export.default.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:\s+(type))?(?:(?:\s*(=))|(?:\s+(default)(?=\s+))) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + keyword.control.type.ts + + 3 + + name + keyword.operator.assignment.ts + + 4 + + name + keyword.control.default.ts + + + end + (?=$|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #interface-declaration + + + include + #expression + + + + + name + meta.export.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:\s+(type))?\b(?!(\$)|(\s*:))((?=\s*[\{*])|((?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s|,))(?!\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + beginCaptures + + 1 + + name + keyword.control.export.ts + + 2 + + name + keyword.control.type.ts + + + end + (?=$|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #import-export-declaration + + + + + + import-export-declaration + + patterns + + + include + #comment + + + include + #string + + + include + #import-export-block + + + name + keyword.control.from.ts + match + \bfrom\b + + + include + #import-export-assert-clause + + + include + #import-export-clause + + + + import-export-assert-clause + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(with)|(assert))\s*(\{) + beginCaptures + + 1 + + name + keyword.control.with.ts + + 2 + + name + keyword.control.assert.ts + + 3 + + name + punctuation.definition.block.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.ts + + + patterns + + + include + #comment + + + include + #string + + + name + meta.object-literal.key.ts + match + (?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:) + + + name + punctuation.separator.key-value.ts + match + : + + + + import-export-block + + name + meta.block.ts + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.ts + + + patterns + + + include + #import-export-clause + + + + import-export-clause + + patterns + + + include + #comment + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(?:(\btype)\s+)?(?:(\bdefault)|(\*)|(\b[_$[:alpha:]][_$[:alnum:]]*)|((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))))\s+(as)\s+(?:(default(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|([_$[:alpha:]][_$[:alnum:]]*)|((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))) + captures + + 1 + + name + keyword.control.type.ts + + 2 + + name + keyword.control.default.ts + + 3 + + name + constant.language.import-export-all.ts + + 4 + + name + variable.other.readwrite.ts + + 5 + + name + string.quoted.alias.ts + + 12 + + name + keyword.control.as.ts + + 13 + + name + keyword.control.default.ts + + 14 + + name + variable.other.readwrite.alias.ts + + 15 + + name + string.quoted.alias.ts + + + + + include + #punctuation-comma + + + name + constant.language.import-export-all.ts + match + \* + + + name + keyword.control.default.ts + match + \b(default)\b + + + match + (?:(\btype)\s+)?(?:([_$[:alpha:]][_$[:alnum:]]*)|((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))) + captures + + 1 + + name + keyword.control.type.ts + + 2 + + name + variable.other.readwrite.alias.ts + + 3 + + name + string.quoted.alias.ts + + + + + + switch-statement + + name + switch-statement.expr.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bswitch\s*\() + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.ts + + + patterns + + + include + #comment + + + name + switch-expression.expr.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(switch)\s*(\() + beginCaptures + + 1 + + name + keyword.control.switch.ts + + 2 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + include + #expression + + + + + name + switch-block.expr.ts + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.ts + + + end + (?=\}) + patterns + + + name + case-clause.expr.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default(?=:))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.control.switch.ts + + + end + (?=:) + patterns + + + include + #expression + + + + + begin + (:)\s*(\{) + beginCaptures + + 1 + + name + case-clause.expr.ts punctuation.definition.section.case-statement.ts + + 2 + + name + meta.block.ts punctuation.definition.block.ts + + + end + \} + endCaptures + + 0 + + name + meta.block.ts punctuation.definition.block.ts + + + contentName + meta.block.ts + patterns + + + include + #statements + + + + + match + (:) + captures + + 0 + + name + case-clause.expr.ts punctuation.definition.section.case-statement.ts + + + + + include + #statements + + + + + + for-loop + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))for(?=((\s+|(\s*\/\*([^\*]|(\*[^\/]))*\*\/\s*))await)?\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)?(\()) + beginCaptures + + 0 + + name + keyword.control.loop.ts + + + end + (?<=\)) + patterns + + + include + #comment + + + name + keyword.control.loop.ts + match + await + + + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + include + #var-expr + + + include + #expression + + + include + #punctuation-semicolon + + + + + + if-statement + + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))\s*(?!\{)) + end + (?=;|$|\}) + patterns + + + include + #comment + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(if)\s*(\() + beginCaptures + + 1 + + name + keyword.control.conditional.ts + + 2 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + include + #expression + + + + + name + string.regexp.ts + begin + (?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuvy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ts + + + end + (/)([dgimsuvy]*) + endCaptures + + 1 + + name + punctuation.definition.string.end.ts + + 2 + + name + keyword.other.ts + + + patterns + + + include + #regexp + + + + + include + #statements + + + + + + decl-block + + name + meta.block.ts + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.ts + + + patterns + + + include + #statements + + + + after-operator-block-as-object-literal + + name + meta.objectliteral.ts + begin + (?<!\+\+|--)(?<=[:=(,\[?+!>]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{) + beginCaptures + + 1 + + name + punctuation.definition.block.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.ts + + + patterns + + + include + #object-member + + + + object-literal + + name + meta.objectliteral.ts + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.ts + + + patterns + + + include + #object-member + + + + object-member + + patterns + + + include + #comment + + + include + #object-literal-method-declaration + + + name + meta.object.member.ts meta.object-literal.key.ts + begin + (?=\[) + end + (?=:)|((?<=[\]])(?=\s*[\(\<])) + patterns + + + include + #comment + + + include + #array-literal + + + + + name + meta.object.member.ts meta.object-literal.key.ts + begin + (?=[\'\"\`]) + end + (?=:)|((?<=[\'\"\`])(?=((\s*[\(\<,}])|(\s+(as|satisifies)\s+)))) + patterns + + + include + #comment + + + include + #string + + + + + name + meta.object.member.ts meta.object-literal.key.ts + begin + (?x)(?=(\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))) + end + (?=:)|(?=\s*([\(\<,}])|(\s+as|satisifies\s+)) + patterns + + + include + #comment + + + include + #numeric-literal + + + + + name + meta.method.declaration.ts + begin + (?<=[\]\'\"\`])(?=\s*[\(\<]) + end + (?=\}|;|,)|(?<=\}) + patterns + + + include + #function-body + + + + + name + meta.object.member.ts + match + (?![_$[:alpha:]])([[:digit:]]+)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:) + captures + + 0 + + name + meta.object-literal.key.ts + + 1 + + name + constant.numeric.decimal.ts + + + + + name + meta.object.member.ts + match + (?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:(\s*\/\*([^\*]|(\*[^\/]))*\*\/)*\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + captures + + 0 + + name + meta.object-literal.key.ts + + 1 + + name + entity.name.function.ts + + + + + name + meta.object.member.ts + match + (?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:) + captures + + 0 + + name + meta.object-literal.key.ts + + + + + name + meta.object.member.ts + begin + \.\.\. + beginCaptures + + 0 + + name + keyword.operator.spread.ts + + + end + (?=,|\}) + patterns + + + include + #expression + + + + + name + meta.object.member.ts + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$|\/\/|\/\*) + captures + + 1 + + name + variable.other.readwrite.ts + + + + + name + meta.object.member.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+(const)(?=\s*([,}]|$)) + captures + + 1 + + name + keyword.control.as.ts + + 2 + + name + storage.modifier.ts + + + + + name + meta.object.member.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(as)|(satisfies))\s+ + beginCaptures + + 1 + + name + keyword.control.as.ts + + 2 + + name + keyword.control.satisfies.ts + + + end + (?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|^|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as|satisifies)\s+)) + patterns + + + include + #type + + + + + name + meta.object.member.ts + begin + (?=[_$[:alpha:]][_$[:alnum:]]*\s*=) + end + (?=,|\}|$|\/\/|\/\*) + patterns + + + include + #expression + + + + + name + meta.object.member.ts + begin + : + beginCaptures + + 0 + + name + meta.object-literal.key.ts punctuation.separator.key-value.ts + + + end + (?=,|\}) + patterns + + + begin + (?<=:)\s*(async)?(?=\s*(<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))) + beginCaptures + + 1 + + name + storage.modifier.async.ts + + + end + (?<=\)) + patterns + + + include + #type-parameters + + + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + include + #expression-inside-possibly-arrow-parens + + + + + + + begin + (?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))) + beginCaptures + + 1 + + name + storage.modifier.async.ts + + 2 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + include + #expression-inside-possibly-arrow-parens + + + + + begin + (?<=:)\s*(async)?\s*(?=\<\s*$) + beginCaptures + + 1 + + name + storage.modifier.async.ts + + + end + (?<=\>) + patterns + + + include + #type-parameters + + + + + begin + (?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))) + beginCaptures + + 1 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + include + #expression-inside-possibly-arrow-parens + + + + + include + #possibly-arrow-return-type + + + include + #expression + + + + + include + #punctuation-comma + + + include + #decl-block + + + + ternary-expression + + begin + (?!\?\.\s*[^[:digit:]])(\?)(?!\?) + beginCaptures + + 1 + + name + keyword.operator.ternary.ts + + + end + \s*(:) + endCaptures + + 1 + + name + keyword.operator.ternary.ts + + + patterns + + + include + #expression + + + + function-call + + patterns + + + begin + (?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()) + end + (?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()) + patterns + + + name + meta.function-call.ts + begin + (?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*)) + end + (?=\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()) + patterns + + + include + #function-call-target + + + + + include + #comment + + + include + #function-call-optionals + + + include + #type-arguments + + + include + #paren-expression + + + + + begin + (?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$)) + end + (?<=\>)(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$)) + patterns + + + name + meta.function-call.ts + begin + (?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*)) + end + (?=(<\s*[\{\[\(]\s*$)) + patterns + + + include + #function-call-target + + + + + include + #comment + + + include + #function-call-optionals + + + include + #type-arguments + + + + + + function-call-target + + patterns + + + include + #support-function-call-identifiers + + + name + entity.name.function.ts + match + (\#?[_$[:alpha:]][_$[:alnum:]]*) + + + + function-call-optionals + + patterns + + + name + meta.function-call.ts punctuation.accessor.optional.ts + match + \?\. + + + name + meta.function-call.ts keyword.operator.definiteassignment.ts + match + \! + + + + support-function-call-identifiers + + patterns + + + include + #literal + + + include + #support-objects + + + include + #object-identifiers + + + include + #punctuation-accessor + + + name + keyword.operator.expression.import.ts + match + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*[\(]\s*[\"\'\`])) + + + + new-expr + + name + new.expr.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.operator.new.ts + + + end + (?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(])))) + patterns + + + include + #expression + + + + instanceof-expr + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(instanceof)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.operator.expression.instanceof.ts + + + end + (?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|(===|!==|==|!=)|(([\&\~\^\|]\s*)?[_$[:alpha:]][_$[:alnum:]]*\s+instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(])))) + patterns + + + include + #type + + + + paren-expression-possibly-arrow + + patterns + + + begin + (?<=[(=,])\s*(async)?(?=\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))) + beginCaptures + + 1 + + name + storage.modifier.async.ts + + + end + (?<=\)) + patterns + + + include + #paren-expression-possibly-arrow-with-typeparameters + + + + + begin + (?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)))\s*$) + beginCaptures + + 1 + + name + storage.modifier.async.ts + + + end + (?<=\)) + patterns + + + include + #paren-expression-possibly-arrow-with-typeparameters + + + + + include + #possibly-arrow-return-type + + + + paren-expression-possibly-arrow-with-typeparameters + + patterns + + + include + #type-parameters + + + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + include + #expression-inside-possibly-arrow-parens + + + + + + expression-inside-possibly-arrow-parens + + patterns + + + include + #expressionWithoutIdentifiers + + + include + #comment + + + include + #string + + + include + #decorator + + + include + #destructuring-parameter + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+) + captures + + 1 + + name + storage.modifier.ts + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + captures + + 1 + + name + storage.modifier.ts + + 2 + + name + keyword.operator.rest.ts + + 3 + + name + entity.name.function.ts variable.language.this.ts + + 4 + + name + entity.name.function.ts + + 5 + + name + keyword.operator.optional.ts + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$) + captures + + 1 + + name + storage.modifier.ts + + 2 + + name + keyword.operator.rest.ts + + 3 + + name + variable.parameter.ts variable.language.this.ts + + 4 + + name + variable.parameter.ts + + 5 + + name + keyword.operator.optional.ts + + + + + include + #type-annotation + + + include + #variable-initializer + + + name + punctuation.separator.parameter.ts + match + , + + + include + #identifiers + + + include + #expressionPunctuations + + + + paren-expression + + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + include + #expression + + + + cast + + patterns + + + name + cast.expr.ts + match + \s*(<)\s*(const)\s*(>) + captures + + 1 + + name + meta.brace.angle.ts + + 2 + + name + storage.modifier.ts + + 3 + + name + meta.brace.angle.ts + + + + + name + cast.expr.ts + begin + (?:(?<!\+\+|--)(?<=^return|[^\._$[:alnum:]]return|^throw|[^\._$[:alnum:]]throw|^yield|[^\._$[:alnum:]]yield|^await|[^\._$[:alnum:]]await|^default|[^\._$[:alnum:]]default|[=(,:>*?\&\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(<)(?!<?\=)(?!\s*$) + beginCaptures + + 1 + + name + meta.brace.angle.ts + + + end + (\>) + endCaptures + + 1 + + name + meta.brace.angle.ts + + + patterns + + + include + #type + + + + + name + cast.expr.ts + begin + (?:(?<=^))\s*(<)(?=[_$[:alpha:]][_$[:alnum:]]*\s*>) + beginCaptures + + 1 + + name + meta.brace.angle.ts + + + end + (\>) + endCaptures + + 1 + + name + meta.brace.angle.ts + + + patterns + + + include + #type + + + + + + expression-operators + + patterns + + + name + keyword.control.flow.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(await)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(yield)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?=\s*\/\*([^\*]|(\*[^\/]))*\*\/\s*\*) + beginCaptures + + 1 + + name + keyword.control.flow.ts + + + end + \* + endCaptures + + 0 + + name + keyword.generator.asterisk.ts + + + patterns + + + include + #comment + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(yield)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?:\s*(\*))? + captures + + 1 + + name + keyword.control.flow.ts + + 2 + + name + keyword.generator.asterisk.ts + + + + + name + keyword.operator.expression.delete.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))delete(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.operator.expression.in.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))in(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?!\() + + + name + keyword.operator.expression.of.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))of(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?!\() + + + name + keyword.operator.expression.instanceof.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.operator.new.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + include + #typeof-operator + + + name + keyword.operator.expression.void.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))void(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+(const)(?=\s*($|[;,:})\]])) + captures + + 1 + + name + keyword.control.as.ts + + 2 + + name + storage.modifier.ts + + + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(as)|(satisfies))\s+ + beginCaptures + + 1 + + name + keyword.control.as.ts + + 2 + + name + keyword.control.satisfies.ts + + + end + (?=^|[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as|satisfies)\s+)|(\s+\<)) + patterns + + + include + #type + + + + + name + keyword.operator.spread.ts + match + \.\.\. + + + name + keyword.operator.assignment.compound.ts + match + \*=|(?<!\()/=|%=|\+=|\-= + + + name + keyword.operator.assignment.compound.bitwise.ts + match + \&=|\^=|<<=|>>=|>>>=|\|= + + + name + keyword.operator.bitwise.shift.ts + match + <<|>>>|>> + + + name + keyword.operator.comparison.ts + match + ===|!==|==|!= + + + name + keyword.operator.relational.ts + match + <=|>=|<>|<|> + + + match + (?<=[_$[:alnum:]])(\!)\s*(?:(/=)|(?:(/)(?![/*]))) + captures + + 1 + + name + keyword.operator.logical.ts + + 2 + + name + keyword.operator.assignment.compound.ts + + 3 + + name + keyword.operator.arithmetic.ts + + + + + name + keyword.operator.logical.ts + match + \!|&&|\|\||\?\? + + + name + keyword.operator.bitwise.ts + match + \&|~|\^|\| + + + name + keyword.operator.assignment.ts + match + \= + + + name + keyword.operator.decrement.ts + match + -- + + + name + keyword.operator.increment.ts + match + \+\+ + + + name + keyword.operator.arithmetic.ts + match + %|\*|/|-|\+ + + + begin + (?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(?:(/=)|(?:(/)(?![/*])))) + end + (?:(/=)|(?:(/)(?!\*([^\*]|(\*[^\/]))*\*\/))) + endCaptures + + 1 + + name + keyword.operator.assignment.compound.ts + + 2 + + name + keyword.operator.arithmetic.ts + + + patterns + + + include + #comment + + + + + match + (?<=[_$[:alnum:])\]])\s*(?:(/=)|(?:(/)(?![/*]))) + captures + + 1 + + name + keyword.operator.assignment.compound.ts + + 2 + + name + keyword.operator.arithmetic.ts + + + + + + typeof-operator + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 0 + + name + keyword.operator.expression.typeof.ts + + + end + (?=[,);}\]=>:&|{\?]|(extends\s+)|$|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #type-arguments + + + include + #expression + + + + literal + + patterns + + + include + #numeric-literal + + + include + #boolean-literal + + + include + #null-literal + + + include + #undefined-literal + + + include + #numericConstant-literal + + + include + #array-literal + + + include + #this-literal + + + include + #super-literal + + + + array-literal + + name + meta.array.literal.ts + begin + \s*(\[) + beginCaptures + + 1 + + name + meta.brace.square.ts + + + end + \] + endCaptures + + 0 + + name + meta.brace.square.ts + + + patterns + + + include + #expression + + + include + #punctuation-comma + + + + numeric-literal + + patterns + + + name + constant.numeric.hex.ts + match + \b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$) + captures + + 1 + + name + storage.type.numeric.bigint.ts + + + + + name + constant.numeric.binary.ts + match + \b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$) + captures + + 1 + + name + storage.type.numeric.bigint.ts + + + + + name + constant.numeric.octal.ts + match + \b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$) + captures + + 1 + + name + storage.type.numeric.bigint.ts + + + + + match + (?x) +(?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$) + captures + + 0 + + name + constant.numeric.decimal.ts + + 1 + + name + meta.delimiter.decimal.period.ts + + 2 + + name + storage.type.numeric.bigint.ts + + 3 + + name + meta.delimiter.decimal.period.ts + + 4 + + name + storage.type.numeric.bigint.ts + + 5 + + name + meta.delimiter.decimal.period.ts + + 6 + + name + storage.type.numeric.bigint.ts + + 7 + + name + storage.type.numeric.bigint.ts + + 8 + + name + meta.delimiter.decimal.period.ts + + 9 + + name + storage.type.numeric.bigint.ts + + 10 + + name + meta.delimiter.decimal.period.ts + + 11 + + name + storage.type.numeric.bigint.ts + + 12 + + name + meta.delimiter.decimal.period.ts + + 13 + + name + storage.type.numeric.bigint.ts + + 14 + + name + storage.type.numeric.bigint.ts + + + + + + boolean-literal + + patterns + + + name + constant.language.boolean.true.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))true(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + constant.language.boolean.false.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))false(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + null-literal + + name + constant.language.null.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + this-literal + + name + variable.language.this.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))this\b(?!\$) + + super-literal + + name + variable.language.super.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))super\b(?!\$) + + undefined-literal + + name + constant.language.undefined.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + numericConstant-literal + + patterns + + + name + constant.language.nan.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))NaN(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + constant.language.infinity.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Infinity(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + support-objects + + patterns + + + name + variable.language.arguments.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(arguments)\b(?!\$) + + + name + support.class.builtin.ts + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Array|ArrayBuffer|Atomics|BigInt|BigInt64Array|BigUint64Array|Boolean|DataView|Date|Float32Array + |Float64Array|Function|Generator|GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Proxy + |Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|TypedArray + |Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray|WeakMap|WeakSet)\b(?!\$) + + + name + support.class.error.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))((Eval|Internal|Range|Reference|Syntax|Type|URI)?Error)\b(?!\$) + + + name + support.class.promise.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Promise)\b(?!\$) + + + name + support.function.ts + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(clear(Interval|Timeout)|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval| + isFinite|isNaN|parseFloat|parseInt|require|set(Interval|Timeout)|super|unescape|uneval)(?=\s*\() + + + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Math)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(?: + (abs|acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|clz32|cos|cosh|exp| + expm1|floor|fround|hypot|imul|log|log10|log1p|log2|max|min|pow|random| + round|sign|sin|sinh|sqrt|tan|tanh|trunc) + | + (E|LN10|LN2|LOG10E|LOG2E|PI|SQRT1_2|SQRT2)))?\b(?!\$) + captures + + 1 + + name + support.constant.math.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + 4 + + name + support.function.math.ts + + 5 + + name + support.constant.property.math.ts + + + + + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(console)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*( + assert|clear|count|debug|dir|error|group|groupCollapsed|groupEnd|info|log + |profile|profileEnd|table|time|timeEnd|timeStamp|trace|warn))?\b(?!\$) + captures + + 1 + + name + support.class.console.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + 4 + + name + support.function.console.ts + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(JSON)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(parse|stringify))?\b(?!\$) + captures + + 1 + + name + support.constant.json.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + 4 + + name + support.function.json.ts + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(import)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(meta)\b(?!\$) + captures + + 1 + + name + keyword.control.import.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + 4 + + name + support.variable.property.importmeta.ts + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(target)\b(?!\$) + captures + + 1 + + name + keyword.operator.new.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + 4 + + name + support.variable.property.target.ts + + + + + match + (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?: + (?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()) + | + (?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$))) + captures + + 1 + + name + punctuation.accessor.ts + + 2 + + name + punctuation.accessor.optional.ts + + 3 + + name + support.variable.property.ts + + 4 + + name + support.constant.ts + + + + + match + (?x) (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.)) \b (?: + (document|event|navigator|performance|screen|window) + | + (AnalyserNode|ArrayBufferView|Attr|AudioBuffer|AudioBufferSourceNode|AudioContext|AudioDestinationNode|AudioListener + |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule + |CSSCounterStyleRule|CSSGroupingRule|CSSMatrix|CSSMediaRule|CSSPageRule|CSSPrimitiveValue|CSSRule|CSSRuleList|CSSStyleDeclaration + |CSSStyleRule|CSSStyleSheet|CSSSupportsRule|CSSValue|CSSValueList|CanvasGradient|CanvasImageSource|CanvasPattern + |CanvasRenderingContext2D|ChannelMergerNode|ChannelSplitterNode|CharacterData|ChromeWorker|CloseEvent|Comment|CompositionEvent + |Console|ConvolverNode|Coordinates|Credential|CredentialsContainer|Crypto|CryptoKey|CustomEvent|DOMError|DOMException + |DOMHighResTimeStamp|DOMImplementation|DOMString|DOMStringList|DOMStringMap|DOMTimeStamp|DOMTokenList|DataTransfer + |DataTransferItem|DataTransferItemList|DedicatedWorkerGlobalScope|DelayNode|DeviceProximityEvent|DirectoryEntry + |DirectoryEntrySync|DirectoryReader|DirectoryReaderSync|Document|DocumentFragment|DocumentTouch|DocumentType|DragEvent + |DynamicsCompressorNode|Element|Entry|EntrySync|ErrorEvent|Event|EventListener|EventSource|EventTarget|FederatedCredential + |FetchEvent|File|FileEntry|FileEntrySync|FileException|FileList|FileReader|FileReaderSync|FileSystem|FileSystemSync + |FontFace|FormData|GainNode|Gamepad|GamepadButton|GamepadEvent|Geolocation|GlobalEventHandlers|HTMLAnchorElement + |HTMLAreaElement|HTMLAudioElement|HTMLBRElement|HTMLBaseElement|HTMLBodyElement|HTMLButtonElement|HTMLCanvasElement + |HTMLCollection|HTMLContentElement|HTMLDListElement|HTMLDataElement|HTMLDataListElement|HTMLDialogElement|HTMLDivElement + |HTMLDocument|HTMLElement|HTMLEmbedElement|HTMLFieldSetElement|HTMLFontElement|HTMLFormControlsCollection|HTMLFormElement + |HTMLHRElement|HTMLHeadElement|HTMLHeadingElement|HTMLHtmlElement|HTMLIFrameElement|HTMLImageElement|HTMLInputElement + |HTMLKeygenElement|HTMLLIElement|HTMLLabelElement|HTMLLegendElement|HTMLLinkElement|HTMLMapElement|HTMLMediaElement + |HTMLMetaElement|HTMLMeterElement|HTMLModElement|HTMLOListElement|HTMLObjectElement|HTMLOptGroupElement|HTMLOptionElement + |HTMLOptionsCollection|HTMLOutputElement|HTMLParagraphElement|HTMLParamElement|HTMLPreElement|HTMLProgressElement + |HTMLQuoteElement|HTMLScriptElement|HTMLSelectElement|HTMLShadowElement|HTMLSourceElement|HTMLSpanElement|HTMLStyleElement + |HTMLTableCaptionElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableDataCellElement|HTMLTableElement|HTMLTableHeaderCellElement + |HTMLTableRowElement|HTMLTableSectionElement|HTMLTextAreaElement|HTMLTimeElement|HTMLTitleElement|HTMLTrackElement + |HTMLUListElement|HTMLUnknownElement|HTMLVideoElement|HashChangeEvent|History|IDBCursor|IDBCursorWithValue|IDBDatabase + |IDBEnvironment|IDBFactory|IDBIndex|IDBKeyRange|IDBMutableFile|IDBObjectStore|IDBOpenDBRequest|IDBRequest|IDBTransaction + |IDBVersionChangeEvent|IIRFilterNode|IdentityManager|ImageBitmap|ImageBitmapFactories|ImageData|Index|InputDeviceCapabilities + |InputEvent|InstallEvent|InstallTrigger|KeyboardEvent|LinkStyle|LocalFileSystem|LocalFileSystemSync|Location|MIDIAccess + |MIDIConnectionEvent|MIDIInput|MIDIInputMap|MIDIOutputMap|MediaElementAudioSourceNode|MediaError|MediaKeyMessageEvent + |MediaKeySession|MediaKeyStatusMap|MediaKeySystemAccess|MediaKeySystemConfiguration|MediaKeys|MediaRecorder|MediaStream + |MediaStreamAudioDestinationNode|MediaStreamAudioSourceNode|MessageChannel|MessageEvent|MessagePort|MouseEvent + |MutationObserver|MutationRecord|NamedNodeMap|Navigator|NavigatorConcurrentHardware|NavigatorGeolocation|NavigatorID + |NavigatorLanguage|NavigatorOnLine|Node|NodeFilter|NodeIterator|NodeList|NonDocumentTypeChildNode|Notification + |OfflineAudioCompletionEvent|OfflineAudioContext|OscillatorNode|PageTransitionEvent|PannerNode|ParentNode|PasswordCredential + |Path2D|PaymentAddress|PaymentRequest|PaymentResponse|Performance|PerformanceEntry|PerformanceFrameTiming|PerformanceMark + |PerformanceMeasure|PerformanceNavigation|PerformanceNavigationTiming|PerformanceObserver|PerformanceObserverEntryList + |PerformanceResourceTiming|PerformanceTiming|PeriodicSyncEvent|PeriodicWave|Plugin|Point|PointerEvent|PopStateEvent + |PortCollection|Position|PositionError|PositionOptions|PresentationConnectionClosedEvent|PresentationConnectionList + |PresentationReceiver|ProcessingInstruction|ProgressEvent|PromiseRejectionEvent|PushEvent|PushRegistrationManager + |RTCCertificate|RTCConfiguration|RTCPeerConnection|RTCSessionDescriptionCallback|RTCStatsReport|RadioNodeList|RandomSource + |Range|ReadableByteStream|RenderingContext|SVGAElement|SVGAngle|SVGAnimateColorElement|SVGAnimateElement|SVGAnimateMotionElement + |SVGAnimateTransformElement|SVGAnimatedAngle|SVGAnimatedBoolean|SVGAnimatedEnumeration|SVGAnimatedInteger|SVGAnimatedLength + |SVGAnimatedLengthList|SVGAnimatedNumber|SVGAnimatedNumberList|SVGAnimatedPoints|SVGAnimatedPreserveAspectRatio + |SVGAnimatedRect|SVGAnimatedString|SVGAnimatedTransformList|SVGAnimationElement|SVGCircleElement|SVGClipPathElement + |SVGCursorElement|SVGDefsElement|SVGDescElement|SVGElement|SVGEllipseElement|SVGEvent|SVGFilterElement|SVGFontElement + |SVGFontFaceElement|SVGFontFaceFormatElement|SVGFontFaceNameElement|SVGFontFaceSrcElement|SVGFontFaceUriElement + |SVGForeignObjectElement|SVGGElement|SVGGlyphElement|SVGGradientElement|SVGHKernElement|SVGImageElement|SVGLength + |SVGLengthList|SVGLineElement|SVGLinearGradientElement|SVGMPathElement|SVGMaskElement|SVGMatrix|SVGMissingGlyphElement + |SVGNumber|SVGNumberList|SVGPathElement|SVGPatternElement|SVGPoint|SVGPolygonElement|SVGPolylineElement|SVGPreserveAspectRatio + |SVGRadialGradientElement|SVGRect|SVGRectElement|SVGSVGElement|SVGScriptElement|SVGSetElement|SVGStopElement|SVGStringList + |SVGStylable|SVGStyleElement|SVGSwitchElement|SVGSymbolElement|SVGTRefElement|SVGTSpanElement|SVGTests|SVGTextElement + |SVGTextPositioningElement|SVGTitleElement|SVGTransform|SVGTransformList|SVGTransformable|SVGUseElement|SVGVKernElement + |SVGViewElement|ServiceWorker|ServiceWorkerContainer|ServiceWorkerGlobalScope|ServiceWorkerRegistration|ServiceWorkerState + |ShadowRoot|SharedWorker|SharedWorkerGlobalScope|SourceBufferList|StereoPannerNode|Storage|StorageEvent|StyleSheet + |StyleSheetList|SubtleCrypto|SyncEvent|Text|TextMetrics|TimeEvent|TimeRanges|Touch|TouchEvent|TouchList|Transferable + |TreeWalker|UIEvent|USVString|VRDisplayCapabilities|ValidityState|WaveShaperNode|WebGL|WebGLActiveInfo|WebGLBuffer + |WebGLContextEvent|WebGLFramebuffer|WebGLProgram|WebGLRenderbuffer|WebGLRenderingContext|WebGLShader|WebGLShaderPrecisionFormat + |WebGLTexture|WebGLTimerQueryEXT|WebGLTransformFeedback|WebGLUniformLocation|WebGLVertexArrayObject|WebGLVertexArrayObjectOES + |WebSocket|WebSockets|WebVTT|WheelEvent|Window|WindowBase64|WindowEventHandlers|WindowTimers|Worker|WorkerGlobalScope + |WorkerLocation|WorkerNavigator|XMLHttpRequest|XMLHttpRequestEventTarget|XMLSerializer|XPathExpression|XPathResult + |XSLTProcessor))\b(?!\$) + captures + + 1 + + name + support.variable.dom.ts + + 2 + + name + support.class.dom.ts + + + + + match + (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?: + (ATTRIBUTE_NODE|CDATA_SECTION_NODE|COMMENT_NODE|DOCUMENT_FRAGMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE + |DOMSTRING_SIZE_ERR|ELEMENT_NODE|ENTITY_NODE|ENTITY_REFERENCE_NODE|HIERARCHY_REQUEST_ERR|INDEX_SIZE_ERR + |INUSE_ATTRIBUTE_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR + |NOT_SUPPORTED_ERR|NOTATION_NODE|PROCESSING_INSTRUCTION_NODE|TEXT_NODE|WRONG_DOCUMENT_ERR) + | + (_content|[xyz]|abbr|above|accept|acceptCharset|accessKey|action|align|[av]Link(?:color)?|all|alt|anchors|appCodeName + |appCore|applets|appMinorVersion|appName|appVersion|archive|areas|arguments|attributes|availHeight|availLeft|availTop + |availWidth|axis|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor + |borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|borderWidth|bottom|bufferDepth|callee|caller|caption + |cellPadding|cells|cellSpacing|ch|characterSet|charset|checked|childNodes|chOff|cite|classes|className|clear + |clientInformation|clip|clipBoardData|closed|code|codeBase|codeType|color|colorDepth|cols|colSpan|compact|complete + |components|content|controllers|cookie|cookieEnabled|cords|cpuClass|crypto|current|data|dateTime|declare|defaultCharset + |defaultChecked|defaultSelected|defaultStatus|defaultValue|defaultView|defer|description|dialogArguments|dialogHeight + |dialogLeft|dialogTop|dialogWidth|dir|directories|disabled|display|docmain|doctype|documentElement|elements|embeds + |enabledPlugin|encoding|enctype|entities|event|expando|external|face|fgColor|filename|firstChild|fontFamily|fontSize + |fontWeight|form|formName|forms|frame|frameBorder|frameElement|frames|hasFocus|hash|headers|height|history|host + |hostname|href|hreflang|hspace|htmlFor|httpEquiv|id|ids|ignoreCase|images|implementation|index|innerHeight|innerWidth + |input|isMap|label|lang|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layer[sXY]|left|leftContext + |lineHeight|link|linkColor|links|listStyleType|localName|location|locationbar|longDesc|lowsrc|lowSrc|marginBottom + |marginHeight|marginLeft|marginRight|marginTop|marginWidth|maxLength|media|menubar|method|mimeTypes|multiline|multiple + |name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|noHref|noResize|noShade|notationName + |notations|noWrap|object|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|options|oscpu|outerHeight + |outerWidth|ownerDocument|paddingBottom|paddingLeft|paddingRight|paddingTop|page[XY]|page[XY]Offset|parent|parentLayer + |parentNode|parentWindow|pathname|personalbar|pixelDepth|pkcs11|platform|plugins|port|prefix|previous|previousDibling + |product|productSub|profile|profileend|prompt|prompter|protocol|publicId|readOnly|readyState|referrer|rel|responseText + |responseXML|rev|right|rightContext|rowIndex|rows|rowSpan|rules|scheme|scope|screen[XY]|screenLeft|screenTop|scripts + |scrollbars|scrolling|sectionRowIndex|security|securityPolicy|selected|selectedIndex|selection|self|shape|siblingAbove + |siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary + |systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead + |title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile + |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\() + captures + + 1 + + name + punctuation.accessor.ts + + 2 + + name + punctuation.accessor.optional.ts + + 3 + + name + support.constant.dom.ts + + 4 + + name + support.variable.property.dom.ts + + + + + name + support.class.node.ts + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Buffer|EventEmitter|Server|Pipe|Socket|REPLServer|ReadStream|WriteStream|Stream + |Inflate|Deflate|InflateRaw|DeflateRaw|GZip|GUnzip|Unzip|Zip)\b(?!\$) + + + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(process)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))(?: + (arch|argv|config|connected|env|execArgv|execPath|exitCode|mainModule|pid|platform|release|stderr|stdin|stdout|title|version|versions) + | + (abort|chdir|cwd|disconnect|exit|[sg]ete?[gu]id|send|[sg]etgroups|initgroups|kill|memoryUsage|nextTick|umask|uptime|hrtime) +))?\b(?!\$) + captures + + 1 + + name + support.variable.object.process.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + 4 + + name + support.variable.property.process.ts + + 5 + + name + support.function.process.ts + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(exports)|(module)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))(exports|id|filename|loaded|parent|children))?)\b(?!\$) + captures + + 1 + + name + support.type.object.module.ts + + 2 + + name + support.type.object.module.ts + + 3 + + name + punctuation.accessor.ts + + 4 + + name + punctuation.accessor.optional.ts + + 5 + + name + support.type.object.module.ts + + + + + name + support.variable.object.node.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(global|GLOBAL|root|__dirname|__filename)\b(?!\$) + + + match + (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* +(?: + (on(?:Rowsinserted|Rowsdelete|Rowenter|Rowexit|Resize|Resizestart|Resizeend|Reset| + Readystatechange|Mouseout|Mouseover|Mousedown|Mouseup|Mousemove| + Before(?:cut|deactivate|unload|update|paste|print|editfocus|activate)| + Blur|Scrolltop|Submit|Select|Selectstart|Selectionchange|Hover|Help| + Change|Contextmenu|Controlselect|Cut|Cellchange|Clock|Close|Deactivate| + Datasetchanged|Datasetcomplete|Dataavailable|Drop|Drag|Dragstart|Dragover| + Dragdrop|Dragenter|Dragend|Dragleave|Dblclick|Unload|Paste|Propertychange|Error| + Errorupdate|Keydown|Keyup|Keypress|Focus|Load|Activate|Afterupdate|Afterprint|Abort) + ) | + (shift|showModelessDialog|showModalDialog|showHelp|scroll|scrollX|scrollByPages| + scrollByLines|scrollY|scrollTo|stop|strike|sizeToContent|sidebar|signText|sort| + sup|sub|substr|substring|splice|split|send|set(?:Milliseconds|Seconds|Minutes|Hours| + Month|Year|FullYear|Date|UTC(?:Milliseconds|Seconds|Minutes|Hours|Month|FullYear|Date)| + Time|Hotkeys|Cursor|ZOptions|Active|Resizable|RequestHeader)|search|slice| + savePreferences|small|home|handleEvent|navigate|char|charCodeAt|charAt|concat| + contextual|confirm|compile|clear|captureEvents|call|createStyleSheet|createPopup| + createEventObject|to(?:GMTString|UTCString|String|Source|UpperCase|LowerCase|LocaleString)| + test|taint|taintEnabled|indexOf|italics|disableExternalCapture|dump|detachEvent|unshift| + untaint|unwatch|updateCommands|join|javaEnabled|pop|push|plugins.refresh|paddings|parse| + print|prompt|preference|enableExternalCapture|exec|execScript|valueOf|UTC|find|file| + fileModifiedDate|fileSize|fileCreatedDate|fileUpdatedDate|fixed|fontsize|fontcolor| + forward|fromCharCode|watch|link|load|lastIndexOf|anchor|attachEvent|atob|apply|alert| + abort|routeEvents|resize|resizeBy|resizeTo|recalc|returnValue|replace|reverse|reload| + releaseCapture|releaseEvents|go|get(?:Milliseconds|Seconds|Minutes|Hours|Month|Day|Year|FullYear| + Time|Date|TimezoneOffset|UTC(?:Milliseconds|Seconds|Minutes|Hours|Day|Month|FullYear|Date)| + Attention|Selection|ResponseHeader|AllResponseHeaders)|moveBy|moveBelow|moveTo| + moveToAbsolute|moveAbove|mergeAttributes|match|margins|btoa|big|bold|borderWidths|blink|back + ) | + (acceptNode|add|addEventListener|addTextTrack|adoptNode|after|animate|append| + appendChild|appendData|before|blur|canPlayType|captureStream| + caretPositionFromPoint|caretRangeFromPoint|checkValidity|clear|click| + cloneContents|cloneNode|cloneRange|close|closest|collapse| + compareBoundaryPoints|compareDocumentPosition|comparePoint|contains| + convertPointFromNode|convertQuadFromNode|convertRectFromNode|createAttribute| + createAttributeNS|createCaption|createCDATASection|createComment| + createContextualFragment|createDocument|createDocumentFragment| + createDocumentType|createElement|createElementNS|createEntityReference| + createEvent|createExpression|createHTMLDocument|createNodeIterator| + createNSResolver|createProcessingInstruction|createRange|createShadowRoot| + createTBody|createTextNode|createTFoot|createTHead|createTreeWalker|delete| + deleteCaption|deleteCell|deleteContents|deleteData|deleteRow|deleteTFoot| + deleteTHead|detach|disconnect|dispatchEvent|elementFromPoint|elementsFromPoint| + enableStyleSheetsForSet|entries|evaluate|execCommand|exitFullscreen| + exitPointerLock|expand|extractContents|fastSeek|firstChild|focus|forEach|get| + getAll|getAnimations|getAttribute|getAttributeNames|getAttributeNode| + getAttributeNodeNS|getAttributeNS|getBoundingClientRect|getBoxQuads| + getClientRects|getContext|getDestinationInsertionPoints|getElementById| + getElementsByClassName|getElementsByName|getElementsByTagName| + getElementsByTagNameNS|getItem|getNamedItem|getSelection|getStartDate| + getVideoPlaybackQuality|has|hasAttribute|hasAttributeNS|hasAttributes| + hasChildNodes|hasFeature|hasFocus|importNode|initEvent|insertAdjacentElement| + insertAdjacentHTML|insertAdjacentText|insertBefore|insertCell|insertData| + insertNode|insertRow|intersectsNode|isDefaultNamespace|isEqualNode| + isPointInRange|isSameNode|item|key|keys|lastChild|load|lookupNamespaceURI| + lookupPrefix|matches|move|moveAttribute|moveAttributeNode|moveChild| + moveNamedItem|namedItem|nextNode|nextSibling|normalize|observe|open| + parentNode|pause|play|postMessage|prepend|preventDefault|previousNode| + previousSibling|probablySupportsContext|queryCommandEnabled| + queryCommandIndeterm|queryCommandState|queryCommandSupported|queryCommandValue| + querySelector|querySelectorAll|registerContentHandler|registerElement| + registerProtocolHandler|releaseCapture|releaseEvents|remove|removeAttribute| + removeAttributeNode|removeAttributeNS|removeChild|removeEventListener| + removeItem|replace|replaceChild|replaceData|replaceWith|reportValidity| + requestFullscreen|requestPointerLock|reset|scroll|scrollBy|scrollIntoView| + scrollTo|seekToNextFrame|select|selectNode|selectNodeContents|set|setAttribute| + setAttributeNode|setAttributeNodeNS|setAttributeNS|setCapture| + setCustomValidity|setEnd|setEndAfter|setEndBefore|setItem|setNamedItem| + setRangeText|setSelectionRange|setSinkId|setStart|setStartAfter|setStartBefore| + slice|splitText|stepDown|stepUp|stopImmediatePropagation|stopPropagation| + submit|substringData|supports|surroundContents|takeRecords|terminate|toBlob| + toDataURL|toggle|toString|values|write|writeln + ) | + (all|catch|finally|race|reject|resolve|then + ) +)(?=\s*\() + captures + + 1 + + name + punctuation.accessor.ts + + 2 + + name + punctuation.accessor.optional.ts + + 3 + + name + support.function.event-handler.ts + + 4 + + name + support.function.ts + + 5 + + name + support.function.dom.ts + + 6 + + name + support.function.promise.ts + + + + + + identifiers + + patterns + + + include + #object-identifiers + + + match + (?x)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\s*=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | + +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) + captures + + 1 + + name + punctuation.accessor.ts + + 2 + + name + punctuation.accessor.optional.ts + + 3 + + name + entity.name.function.ts + + + + + match + (?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]]) + captures + + 1 + + name + punctuation.accessor.ts + + 2 + + name + punctuation.accessor.optional.ts + + 3 + + name + variable.other.constant.property.ts + + + + + match + (?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + punctuation.accessor.ts + + 2 + + name + punctuation.accessor.optional.ts + + 3 + + name + variable.other.property.ts + + + + + name + variable.other.constant.ts + match + ([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]]) + + + name + variable.other.readwrite.ts + match + [_$[:alpha:]][_$[:alnum:]]* + + + + object-identifiers + + patterns + + + name + support.class.ts + match + ([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\??\.\s*prototype\b(?!\$)) + + + match + (?x)(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(?: + (\#?[[:upper:]][_$[:digit:][:upper:]]*) | + (\#?[_$[:alpha:]][_$[:alnum:]]*) +)(?=\s*\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + punctuation.accessor.ts + + 2 + + name + punctuation.accessor.optional.ts + + 3 + + name + variable.other.constant.object.property.ts + + 4 + + name + variable.other.object.property.ts + + + + + match + (?x)(?: + ([[:upper:]][_$[:digit:][:upper:]]*) | + ([_$[:alpha:]][_$[:alnum:]]*) +)(?=\s*\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + variable.other.constant.object.ts + + 2 + + name + variable.other.object.ts + + + + + + type-annotation + + patterns + + + name + meta.type.annotation.ts + begin + (:)(?=\s*\S) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.ts + + + end + (?<![:|&])(?!\s*[|&]\s+)((?=^|[,);\}\]]|//)|(?==[^>])|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{))) + patterns + + + include + #type + + + + + name + meta.type.annotation.ts + begin + (:) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.ts + + + end + (?<![:|&])((?=[,);\}\]]|\/\/)|(?==[^>])|(?=^\s*$)|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{))) + patterns + + + include + #type + + + + + + parameter-type-annotation + + patterns + + + name + meta.type.annotation.ts + begin + (:) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.ts + + + end + (?=[,)])|(?==[^>]) + patterns + + + include + #type + + + + + + return-type + + patterns + + + name + meta.return.type.ts + begin + (?<=\))\s*(:)(?=\s*\S) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.ts + + + end + (?<![:|&])(?=$|^|[{};,]|//) + patterns + + + include + #return-type-core + + + + + name + meta.return.type.ts + begin + (?<=\))\s*(:) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.ts + + + end + (?<![:|&])((?=[{};,]|//|^\s*$)|((?<=\S)(?=\s*$))) + patterns + + + include + #return-type-core + + + + + + return-type-core + + patterns + + + include + #comment + + + begin + (?<=[:|&])(?=\s*\{) + end + (?<=\}) + patterns + + + include + #type-object + + + + + include + #type-predicate-operator + + + include + #type + + + + arrow-return-type + + name + meta.return.type.arrow.ts + begin + (?<=\))\s*(:) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.ts + + + end + (?==>|\{|(^\s*(export|function|class|interface|let|var|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|const|import|enum|namespace|module|type|abstract|declare)\s+)) + patterns + + + include + #arrow-return-type-body + + + + possibly-arrow-return-type + + begin + (?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>) + beginCaptures + + 1 + + name + meta.arrow.ts meta.return.type.arrow.ts keyword.operator.type.annotation.ts + + + end + (?==>|\{|(^\s*(export|function|class|interface|let|var|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|const|import|enum|namespace|module|type|abstract|declare)\s+)) + contentName + meta.arrow.ts meta.return.type.arrow.ts + patterns + + + include + #arrow-return-type-body + + + + arrow-return-type-body + + patterns + + + begin + (?<=[:])(?=\s*\{) + end + (?<=\}) + patterns + + + include + #type-object + + + + + include + #type-predicate-operator + + + include + #type + + + + type-parameters + + name + meta.type.parameters.ts + begin + (<) + beginCaptures + + 1 + + name + punctuation.definition.typeparameters.begin.ts + + + end + (>) + endCaptures + + 1 + + name + punctuation.definition.typeparameters.end.ts + + + patterns + + + include + #comment + + + name + storage.modifier.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(extends|in|out|const)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + include + #type + + + include + #punctuation-comma + + + name + keyword.operator.assignment.ts + match + (=)(?!>) + + + + type-arguments + + name + meta.type.parameters.ts + begin + \< + beginCaptures + + 0 + + name + punctuation.definition.typeparameters.begin.ts + + + end + \> + endCaptures + + 0 + + name + punctuation.definition.typeparameters.end.ts + + + patterns + + + include + #type-arguments-body + + + + type-arguments-body + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(_)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + captures + + 0 + + name + keyword.operator.type.ts + + + + + include + #type + + + include + #punctuation-comma + + + + type + + patterns + + + include + #comment + + + include + #type-string + + + include + #numeric-literal + + + include + #type-primitive + + + include + #type-builtin-literals + + + include + #type-parameters + + + include + #type-tuple + + + include + #type-object + + + include + #type-operators + + + include + #type-conditional + + + include + #type-fn-type-parameters + + + include + #type-paren-or-function-parameters + + + include + #type-function-return-type + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s* + captures + + 1 + + name + storage.modifier.ts + + + + + include + #type-name + + + + type-primitive + + name + support.type.primitive.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|bigint|boolean|symbol|any|void|never|unknown)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + type-builtin-literals + + name + support.type.builtin.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(this|true|false|undefined|null|object)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + type-tuple + + name + meta.type.tuple.ts + begin + \[ + beginCaptures + + 0 + + name + meta.brace.square.ts + + + end + \] + endCaptures + + 0 + + name + meta.brace.square.ts + + + patterns + + + name + keyword.operator.rest.ts + match + \.\.\. + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))([_$[:alpha:]][_$[:alnum:]]*)\s*(\?)?\s*(:) + captures + + 1 + + name + entity.name.label.ts + + 2 + + name + keyword.operator.optional.ts + + 3 + + name + punctuation.separator.label.ts + + + + + include + #type + + + include + #punctuation-comma + + + + type-object + + name + meta.object.type.ts + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.ts + + + patterns + + + include + #comment + + + include + #method-declaration + + + include + #indexer-declaration + + + include + #indexer-mapped-type-declaration + + + include + #field-declaration + + + include + #type-annotation + + + begin + \.\.\. + beginCaptures + + 0 + + name + keyword.operator.spread.ts + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #type + + + + + include + #punctuation-comma + + + include + #punctuation-semicolon + + + include + #type + + + + type-conditional + + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(extends)\s+ + beginCaptures + + 1 + + name + storage.modifier.ts + + + end + (?<=:) + patterns + + + begin + \? + beginCaptures + + 0 + + name + keyword.operator.ternary.ts + + + end + : + endCaptures + + 0 + + name + keyword.operator.ternary.ts + + + patterns + + + include + #type + + + + + include + #type + + + + + + type-paren-or-function-parameters + + name + meta.type.paren.cover.ts + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.ts + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.ts + + + patterns + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=\s*(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))))) + captures + + 1 + + name + storage.modifier.ts + + 2 + + name + keyword.operator.rest.ts + + 3 + + name + entity.name.function.ts variable.language.this.ts + + 4 + + name + entity.name.function.ts + + 5 + + name + keyword.operator.optional.ts + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=:) + captures + + 1 + + name + storage.modifier.ts + + 2 + + name + keyword.operator.rest.ts + + 3 + + name + variable.parameter.ts variable.language.this.ts + + 4 + + name + variable.parameter.ts + + 5 + + name + keyword.operator.optional.ts + + + + + include + #type-annotation + + + name + punctuation.separator.parameter.ts + match + , + + + include + #type + + + + type-fn-type-parameters + + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b(?=\s*\<) + beginCaptures + + 1 + + name + meta.type.constructor.ts storage.modifier.ts + + 2 + + name + meta.type.constructor.ts keyword.control.new.ts + + + end + (?<=>) + patterns + + + include + #comment + + + include + #type-parameters + + + + + name + meta.type.constructor.ts + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b\s*(?=\() + beginCaptures + + 1 + + name + storage.modifier.ts + + 2 + + name + keyword.control.new.ts + + + end + (?<=\)) + patterns + + + include + #function-parameters + + + + + name + meta.type.function.ts + begin + (?x)( + (?= + [(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + ) + ) +) + end + (?<=\)) + patterns + + + include + #function-parameters + + + + + + type-function-return-type + + patterns + + + name + meta.type.function.return.ts + begin + (=>)(?=\s*\S) + beginCaptures + + 1 + + name + storage.type.function.arrow.ts + + + end + (?<!=>)(?<![|&])(?=[,\]\)\{\}=;>:\?]|//|$) + patterns + + + include + #type-function-return-type-core + + + + + name + meta.type.function.return.ts + begin + => + beginCaptures + + 0 + + name + storage.type.function.arrow.ts + + + end + (?<!=>)(?<![|&])((?=[,\]\)\{\}=;:\?>]|//|^\s*$)|((?<=\S)(?=\s*$))) + patterns + + + include + #type-function-return-type-core + + + + + + type-function-return-type-core + + patterns + + + include + #comment + + + begin + (?<==>)(?=\s*\{) + end + (?<=\}) + patterns + + + include + #type-object + + + + + include + #type-predicate-operator + + + include + #type + + + + type-operators + + patterns + + + include + #typeof-operator + + + include + #type-infer + + + begin + ([&|])(?=\s*\{) + beginCaptures + + 0 + + name + keyword.operator.type.ts + + + end + (?<=\}) + patterns + + + include + #type-object + + + + + begin + [&|] + beginCaptures + + 0 + + name + keyword.operator.type.ts + + + end + (?=\S) + + + name + keyword.operator.expression.keyof.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))keyof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.operator.ternary.ts + match + (\?|\:) + + + name + keyword.operator.expression.import.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\() + + + + type-infer + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(infer)\s+([_$[:alpha:]][_$[:alnum:]]*)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?:\s+(extends)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))? + name + meta.type.infer.ts + captures + + 1 + + name + keyword.operator.expression.infer.ts + + 2 + + name + entity.name.type.ts + + 3 + + name + keyword.operator.expression.extends.ts + + + + + + type-predicate-operator + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(asserts)\s+)?(?!asserts)(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s(is)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + captures + + 1 + + name + keyword.operator.type.asserts.ts + + 2 + + name + variable.parameter.ts variable.language.this.ts + + 3 + + name + variable.parameter.ts + + 4 + + name + keyword.operator.expression.is.ts + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(asserts)\s+(?!is)(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + captures + + 1 + + name + keyword.operator.type.asserts.ts + + 2 + + name + variable.parameter.ts variable.language.this.ts + + 3 + + name + variable.parameter.ts + + + + + name + keyword.operator.type.asserts.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))asserts(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.operator.expression.is.ts + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))is(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + type-name + + patterns + + + begin + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(<) + captures + + 1 + + name + entity.name.type.module.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + 4 + + name + meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts + + + end + (>) + endCaptures + + 1 + + name + meta.type.parameters.ts punctuation.definition.typeparameters.end.ts + + + contentName + meta.type.parameters.ts + patterns + + + include + #type-arguments-body + + + + + begin + ([_$[:alpha:]][_$[:alnum:]]*)\s*(<) + beginCaptures + + 1 + + name + entity.name.type.ts + + 2 + + name + meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts + + + end + (>) + endCaptures + + 1 + + name + meta.type.parameters.ts punctuation.definition.typeparameters.end.ts + + + contentName + meta.type.parameters.ts + patterns + + + include + #type-arguments-body + + + + + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]]))) + captures + + 1 + + name + entity.name.type.module.ts + + 2 + + name + punctuation.accessor.ts + + 3 + + name + punctuation.accessor.optional.ts + + + + + name + entity.name.type.ts + match + [_$[:alpha:]][_$[:alnum:]]* + + + + punctuation-comma + + name + punctuation.separator.comma.ts + match + , + + punctuation-semicolon + + name + punctuation.terminator.statement.ts + match + ; + + punctuation-accessor + + match + (?:(\.)|(\?\.(?!\s*[[:digit:]]))) + captures + + 1 + + name + punctuation.accessor.ts + + 2 + + name + punctuation.accessor.optional.ts + + + + string + + patterns + + + include + #qstring-single + + + include + #qstring-double + + + include + #template + + + + qstring-double + + name + string.quoted.double.ts + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ts + + + end + (")|((?:[^\\\n])$) + endCaptures + + 1 + + name + punctuation.definition.string.end.ts + + 2 + + name + invalid.illegal.newline.ts + + + patterns + + + include + #string-character-escape + + + + qstring-single + + name + string.quoted.single.ts + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ts + + + end + (\')|((?:[^\\\n])$) + endCaptures + + 1 + + name + punctuation.definition.string.end.ts + + 2 + + name + invalid.illegal.newline.ts + + + patterns + + + include + #string-character-escape + + + + string-character-escape + + name + constant.character.escape.ts + match + \\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]+\}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$) + + template + + patterns + + + include + #template-call + + + contentName + string.template.ts + begin + ([_$[:alpha:]][_$[:alnum:]]*)?(`) + beginCaptures + + 1 + + name + entity.name.function.tagged-template.ts + + 2 + + name + string.template.ts punctuation.definition.string.template.begin.ts + + + end + ` + endCaptures + + 0 + + name + string.template.ts punctuation.definition.string.template.end.ts + + + patterns + + + include + #template-substitution-element + + + include + #string-character-escape + + + + + + template-call + + patterns + + + begin + (?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`) + end + (?=`) + patterns + + + begin + (?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)) + end + (?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`) + patterns + + + include + #support-function-call-identifiers + + + name + entity.name.function.tagged-template.ts + match + ([_$[:alpha:]][_$[:alnum:]]*) + + + + + include + #type-arguments + + + + + begin + ([_$[:alpha:]][_$[:alnum:]]*)?\s*(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`) + beginCaptures + + 1 + + name + entity.name.function.tagged-template.ts + + + end + (?=`) + patterns + + + include + #type-arguments + + + + + + template-substitution-element + + name + meta.template.expression.ts + begin + \$\{ + beginCaptures + + 0 + + name + punctuation.definition.template-expression.begin.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.template-expression.end.ts + + + patterns + + + include + #expression + + + contentName + meta.embedded.line.ts + + type-string + + patterns + + + include + #qstring-single + + + include + #qstring-double + + + include + #template-type + + + + template-type + + patterns + + + include + #template-call + + + contentName + string.template.ts + begin + ([_$[:alpha:]][_$[:alnum:]]*)?(`) + beginCaptures + + 1 + + name + entity.name.function.tagged-template.ts + + 2 + + name + string.template.ts punctuation.definition.string.template.begin.ts + + + end + ` + endCaptures + + 0 + + name + string.template.ts punctuation.definition.string.template.end.ts + + + patterns + + + include + #template-type-substitution-element + + + include + #string-character-escape + + + + + + template-type-substitution-element + + name + meta.template.expression.ts + begin + \$\{ + beginCaptures + + 0 + + name + punctuation.definition.template-expression.begin.ts + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.template-expression.end.ts + + + patterns + + + include + #type + + + contentName + meta.embedded.line.ts + + regex + + patterns + + + name + string.regexp.ts + begin + (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([dgimsuvy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + beginCaptures + + 1 + + name + punctuation.definition.string.begin.ts + + + end + (/)([dgimsuvy]*) + endCaptures + + 1 + + name + punctuation.definition.string.end.ts + + 2 + + name + keyword.other.ts + + + patterns + + + include + #regexp + + + + + name + string.regexp.ts + begin + ((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuvy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ts + + + end + (/)([dgimsuvy]*) + endCaptures + + 1 + + name + punctuation.definition.string.end.ts + + 2 + + name + keyword.other.ts + + + patterns + + + include + #regexp + + + + + + regexp + + patterns + + + name + keyword.control.anchor.regexp + match + \\[bB]|\^|\$ + + + match + \\[1-9]\d*|\\k<([a-zA-Z_$][\w$]*)> + captures + + 0 + + name + keyword.other.back-reference.regexp + + 1 + + name + variable.other.regexp + + + + + name + keyword.operator.quantifier.regexp + match + [?+*]|\{(\d+,\d+|\d+,|,\d+|\d+)\}\?? + + + name + keyword.operator.or.regexp + match + \| + + + name + meta.group.assertion.regexp + begin + (\()((\?=)|(\?!)|(\?<=)|(\?<!)) + beginCaptures + + 1 + + name + punctuation.definition.group.regexp + + 2 + + name + punctuation.definition.group.assertion.regexp + + 3 + + name + meta.assertion.look-ahead.regexp + + 4 + + name + meta.assertion.negative-look-ahead.regexp + + 5 + + name + meta.assertion.look-behind.regexp + + 6 + + name + meta.assertion.negative-look-behind.regexp + + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.group.regexp + + + patterns + + + include + #regexp + + + + + name + meta.group.regexp + begin + \((?:(\?:)|(?:\?<([a-zA-Z_$][\w$]*)>))? + beginCaptures + + 0 + + name + punctuation.definition.group.regexp + + 1 + + name + punctuation.definition.group.no-capture.regexp + + 2 + + name + variable.other.regexp + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.group.regexp + + + patterns + + + include + #regexp + + + + + name + constant.other.character-class.set.regexp + begin + (\[)(\^)? + beginCaptures + + 1 + + name + punctuation.definition.character-class.regexp + + 2 + + name + keyword.operator.negation.regexp + + + end + (\]) + endCaptures + + 1 + + name + punctuation.definition.character-class.regexp + + + patterns + + + name + constant.other.character-class.range.regexp + match + (?:.|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))\-(?:[^\]\\]|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.)) + captures + + 1 + + name + constant.character.numeric.regexp + + 2 + + name + constant.character.control.regexp + + 3 + + name + constant.character.escape.backslash.regexp + + 4 + + name + constant.character.numeric.regexp + + 5 + + name + constant.character.control.regexp + + 6 + + name + constant.character.escape.backslash.regexp + + + + + include + #regex-character-class + + + + + include + #regex-character-class + + + + regex-character-class + + patterns + + + name + constant.other.character-class.regexp + match + \\[wWsSdDtrnvf]|\. + + + name + constant.character.numeric.regexp + match + \\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}) + + + name + constant.character.control.regexp + match + \\c[A-Z] + + + name + constant.character.escape.backslash.regexp + match + \\. + + + + comment + + patterns + + + name + comment.block.documentation.ts + begin + /\*\*(?!/) + beginCaptures + + 0 + + name + punctuation.definition.comment.ts + + + end + \*/ + endCaptures + + 0 + + name + punctuation.definition.comment.ts + + + patterns + + + include + #docblock + + + + + name + comment.block.ts + begin + (/\*)(?:\s*((@)internal)(?=\s|(\*/)))? + beginCaptures + + 1 + + name + punctuation.definition.comment.ts + + 2 + + name + storage.type.internaldeclaration.ts + + 3 + + name + punctuation.decorator.internaldeclaration.ts + + + end + \*/ + endCaptures + + 0 + + name + punctuation.definition.comment.ts + + + + + begin + (^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.ts + + 2 + + name + comment.line.double-slash.ts + + 3 + + name + punctuation.definition.comment.ts + + 4 + + name + storage.type.internaldeclaration.ts + + 5 + + name + punctuation.decorator.internaldeclaration.ts + + + end + (?=$) + contentName + comment.line.double-slash.ts + + + + single-line-comment-consuming-line-ending + + begin + (^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.ts + + 2 + + name + comment.line.double-slash.ts + + 3 + + name + punctuation.definition.comment.ts + + 4 + + name + storage.type.internaldeclaration.ts + + 5 + + name + punctuation.decorator.internaldeclaration.ts + + + end + (?=^) + contentName + comment.line.double-slash.ts + + directives + + name + comment.line.triple-slash.directive.ts + begin + ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name|resolution-mode)\s*=\s*((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)))+\s*/>\s*$) + beginCaptures + + 1 + + name + punctuation.definition.comment.ts + + + end + (?=$) + patterns + + + name + meta.tag.ts + begin + (<)(reference|amd-dependency|amd-module) + beginCaptures + + 1 + + name + punctuation.definition.tag.directive.ts + + 2 + + name + entity.name.tag.directive.ts + + + end + /> + endCaptures + + 0 + + name + punctuation.definition.tag.directive.ts + + + patterns + + + name + entity.other.attribute-name.directive.ts + match + path|types|no-default-lib|lib|name|resolution-mode + + + name + keyword.operator.assignment.ts + match + = + + + include + #string + + + + + + docblock + + patterns + + + match + (?x) +((@)(?:access|api)) +\s+ +(private|protected|public) +\b + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + constant.language.access-type.jsdoc + + + + + match + (?x) +((@)author) +\s+ +( + [^@\s<>*/] + (?:[^@<>*/]|\*[^/])* +) +(?: + \s* + (<) + ([^>\s]+) + (>) +)? + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + entity.name.type.instance.jsdoc + + 4 + + name + punctuation.definition.bracket.angle.begin.jsdoc + + 5 + + name + constant.other.email.link.underline.jsdoc + + 6 + + name + punctuation.definition.bracket.angle.end.jsdoc + + + + + match + (?x) +((@)borrows) \s+ +((?:[^@\s*/]|\*[^/])+) # <that namepath> +\s+ (as) \s+ # as +((?:[^@\s*/]|\*[^/])+) # <this namepath> + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + entity.name.type.instance.jsdoc + + 4 + + name + keyword.operator.control.jsdoc + + 5 + + name + entity.name.type.instance.jsdoc + + + + + name + meta.example.jsdoc + begin + ((@)example)\s+ + end + (?=@|\*/) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + patterns + + + match + ^\s\*\s+ + + + contentName + constant.other.description.jsdoc + begin + \G(<)caption(>) + beginCaptures + + 0 + + name + entity.name.tag.inline.jsdoc + + 1 + + name + punctuation.definition.bracket.angle.begin.jsdoc + + 2 + + name + punctuation.definition.bracket.angle.end.jsdoc + + + end + (</)caption(>)|(?=\*/) + endCaptures + + 0 + + name + entity.name.tag.inline.jsdoc + + 1 + + name + punctuation.definition.bracket.angle.begin.jsdoc + + 2 + + name + punctuation.definition.bracket.angle.end.jsdoc + + + + + match + [^\s@*](?:[^*]|\*[^/])* + captures + + 0 + + name + source.embedded.ts + + + + + + + match + (?x) ((@)kind) \s+ (class|constant|event|external|file|function|member|mixin|module|namespace|typedef) \b + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + constant.language.symbol-type.jsdoc + + + + + match + (?x) +((@)see) +\s+ +(?: + # URL + ( + (?=https?://) + (?:[^\s*]|\*[^/])+ + ) + | + # JSDoc namepath + ( + (?! + # Avoid matching bare URIs (also acceptable as links) + https?:// + | + # Avoid matching {@inline tags}; we match those below + (?:\[[^\[\]]*\])? # Possible description [preceding]{@tag} + {@(?:link|linkcode|linkplain|tutorial)\b + ) + # Matched namepath + (?:[^@\s*/]|\*[^/])+ + ) +) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.link.underline.jsdoc + + 4 + + name + entity.name.type.instance.jsdoc + + + + + match + (?x) +((@)template) +\s+ +# One or more valid identifiers +( + [A-Za-z_$] # First character: non-numeric word character + [\w$.\[\]]* # Rest of identifier + (?: # Possible list of additional identifiers + \s* , \s* + [A-Za-z_$] + [\w$.\[\]]* + )* +) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.jsdoc + + + + + begin + (?x)((@)template)\s+(?={) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + end + (?=\s|\*/|[^{}\[\]A-Za-z_$]) + patterns + + + include + #jsdoctype + + + name + variable.other.jsdoc + match + ([A-Za-z_$][\w$.\[\]]*) + + + + + match + (?x) +( + (@) + (?:arg|argument|const|constant|member|namespace|param|var) +) +\s+ +( + [A-Za-z_$] + [\w$.\[\]]* +) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.jsdoc + + + + + begin + ((@)typedef)\s+(?={) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + end + (?=\s|\*/|[^{}\[\]A-Za-z_$]) + patterns + + + include + #jsdoctype + + + name + entity.name.type.instance.jsdoc + match + (?:[^@\s*/]|\*[^/])+ + + + + + begin + ((@)(?:arg|argument|const|constant|member|namespace|param|prop|property|var))\s+(?={) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + end + (?=\s|\*/|[^{}\[\]A-Za-z_$]) + patterns + + + include + #jsdoctype + + + name + variable.other.jsdoc + match + ([A-Za-z_$][\w$.\[\]]*) + + + name + variable.other.jsdoc + match + (?x) +(\[)\s* +[\w$]+ +(?: + (?:\[\])? # Foo[ ].bar properties within an array + \. # Foo.Bar namespaced parameter + [\w$]+ +)* +(?: + \s* + (=) # [foo=bar] Default parameter value + \s* + ( + # The inner regexes are to stop the match early at */ and to not stop at escaped quotes + (?> + "(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted + '(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted + \[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal + (?:(?:\*(?!/))|\s(?!\s*\])|\[.*?(?:\]|(?=\*/))|[^*\s\[\]])* # Everything else + )* + ) +)? +\s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/)) + captures + + 1 + + name + punctuation.definition.optional-value.begin.bracket.square.jsdoc + + 2 + + name + keyword.operator.assignment.jsdoc + + 3 + + name + source.embedded.ts + + 4 + + name + punctuation.definition.optional-value.end.bracket.square.jsdoc + + 5 + + name + invalid.illegal.syntax.jsdoc + + + + + + + begin + (?x) +( + (@) + (?:define|enum|exception|export|extends|lends|implements|modifies + |namespace|private|protected|returns?|satisfies|suppress|this|throws|type + |yields?) +) +\s+(?={) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + end + (?=\s|\*/|[^{}\[\]A-Za-z_$]) + patterns + + + include + #jsdoctype + + + + + match + (?x) +( + (@) + (?:alias|augments|callback|constructs|emits|event|fires|exports? + |extends|external|function|func|host|lends|listens|interface|memberof!? + |method|module|mixes|mixin|name|requires|see|this|typedef|uses) +) +\s+ +( + (?: + [^{}@\s*] | \*[^/] + )+ +) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + entity.name.type.instance.jsdoc + + + + + contentName + variable.other.jsdoc + begin + ((@)(?:default(?:value)?|license|version))\s+(([''"])) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.jsdoc + + 4 + + name + punctuation.definition.string.begin.jsdoc + + + end + (\3)|(?=$|\*/) + endCaptures + + 0 + + name + variable.other.jsdoc + + 1 + + name + punctuation.definition.string.end.jsdoc + + + + + match + ((@)(?:default(?:value)?|license|tutorial|variation|version))\s+([^\s*]+) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.jsdoc + + + + + name + storage.type.class.jsdoc + match + (?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|generator|global|hideconstructor|host|ignore|implements|implicitCast|inherit[Dd]oc |inner|instance|interface|internal|kind|lends|license|listens|main|member|memberof!?|method |mixes|mixins?|modifies|module|name|namespace|noalias|nocollapse|nocompile|nosideeffects |override|overview|package|param|polymer(?:Behavior)?|preserve|private|prop|property|protected |public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary |suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce|yields?) \b + captures + + 1 + + name + punctuation.definition.block.tag.jsdoc + + + + + include + #inline-tags + + + match + ((@)(?:[_$[:alpha:]][_$[:alnum:]]*))(?=\s+) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + + + + brackets + + patterns + + + begin + { + end + }|(?=\*/) + patterns + + + include + #brackets + + + + + begin + \[ + end + \]|(?=\*/) + patterns + + + include + #brackets + + + + + + inline-tags + + patterns + + + name + constant.other.description.jsdoc + match + (\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial)) + captures + + 1 + + name + punctuation.definition.bracket.square.begin.jsdoc + + 2 + + name + punctuation.definition.bracket.square.end.jsdoc + + + + + name + entity.name.type.instance.jsdoc + begin + ({)((@)(?:link(?:code|plain)?|tutorial))\s* + beginCaptures + + 1 + + name + punctuation.definition.bracket.curly.begin.jsdoc + + 2 + + name + storage.type.class.jsdoc + + 3 + + name + punctuation.definition.inline.tag.jsdoc + + + end + }|(?=\*/) + endCaptures + + 0 + + name + punctuation.definition.bracket.curly.end.jsdoc + + + patterns + + + match + \G((?=https?://)(?:[^|}\s*]|\*[/])+)(\|)? + captures + + 1 + + name + variable.other.link.underline.jsdoc + + 2 + + name + punctuation.separator.pipe.jsdoc + + + + + match + \G((?:[^{}@\s|*]|\*[^/])+)(\|)? + captures + + 1 + + name + variable.other.description.jsdoc + + 2 + + name + punctuation.separator.pipe.jsdoc + + + + + + + + jsdoctype + + patterns + + + name + invalid.illegal.type.jsdoc + match + \G{(?:[^}*]|\*[^/}])+$ + + + contentName + entity.name.type.instance.jsdoc + begin + \G({) + beginCaptures + + 0 + + name + entity.name.type.instance.jsdoc + + 1 + + name + punctuation.definition.bracket.curly.begin.jsdoc + + + end + ((}))\s*|(?=\*/) + endCaptures + + 1 + + name + entity.name.type.instance.jsdoc + + 2 + + name + punctuation.definition.bracket.curly.end.jsdoc + + + patterns + + + include + #brackets + + + + + + + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/tsx.plist b/src/file-viewer/highlight-grammar/tsx.plist new file mode 100644 index 0000000..a7aec5d --- /dev/null +++ b/src/file-viewer/highlight-grammar/tsx.plist @@ -0,0 +1,10281 @@ + + + + + name + TypeScriptReact + scopeName + source.tsx + fileTypes + + tsx + + uuid + 805375ec-d614-41f5-8993-5843fe63ea82 + patterns + + + include + #directives + + + include + #statements + + + include + #shebang + + + repository + + shebang + + name + comment.line.shebang.tsx + match + \A(#!).*(?=$) + captures + + 1 + + name + punctuation.definition.comment.tsx + + + + statements + + patterns + + + include + #declaration + + + include + #control-statement + + + include + #after-operator-block-as-object-literal + + + include + #decl-block + + + include + #label + + + include + #expression + + + include + #punctuation-semicolon + + + include + #string + + + include + #comment + + + + declaration + + patterns + + + include + #decorator + + + include + #var-expr + + + include + #function-declaration + + + include + #class-declaration + + + include + #interface-declaration + + + include + #enum-declaration + + + include + #namespace-declaration + + + include + #type-alias-declaration + + + include + #import-equals-declaration + + + include + #import-declaration + + + include + #export-declaration + + + name + storage.modifier.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(declare|export)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + control-statement + + patterns + + + include + #switch-statement + + + include + #for-loop + + + name + keyword.control.trycatch.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(catch|finally|throw|try)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|goto)\s+([_$[:alpha:]][_$[:alnum:]]*)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + captures + + 1 + + name + keyword.control.loop.tsx + + 2 + + name + entity.name.label.tsx + + + + + name + keyword.control.loop.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 0 + + name + keyword.control.flow.tsx + + + end + (?=[;}]|$|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #expression + + + + + name + keyword.control.switch.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + include + #if-statement + + + name + keyword.control.conditional.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(else|if)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.control.with.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(with)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.control.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(package)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.other.debugger.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(debugger)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + label + + patterns + + + begin + ([_$[:alpha:]][_$[:alnum:]]*)\s*(:)(?=\s*\{) + beginCaptures + + 1 + + name + entity.name.label.tsx + + 2 + + name + punctuation.separator.label.tsx + + + end + (?<=\}) + patterns + + + include + #decl-block + + + + + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(:) + captures + + 1 + + name + entity.name.label.tsx + + 2 + + name + punctuation.separator.label.tsx + + + + + + expression + + patterns + + + include + #expressionWithoutIdentifiers + + + include + #identifiers + + + include + #expressionPunctuations + + + + expressionWithoutIdentifiers + + patterns + + + include + #jsx + + + include + #string + + + include + #regex + + + include + #comment + + + include + #function-expression + + + include + #class-expression + + + include + #arrow-function + + + include + #paren-expression-possibly-arrow + + + include + #cast + + + include + #ternary-expression + + + include + #new-expr + + + include + #instanceof-expr + + + include + #object-literal + + + include + #expression-operators + + + include + #function-call + + + include + #literal + + + include + #support-objects + + + include + #paren-expression + + + + expressionPunctuations + + patterns + + + include + #punctuation-comma + + + include + #punctuation-accessor + + + + decorator + + name + meta.decorator.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))\@ + beginCaptures + + 0 + + name + punctuation.decorator.tsx + + + end + (?=\s) + patterns + + + include + #expression + + + + var-expr + + patterns + + + name + meta.var.expr.tsx + begin + (?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) + end + (?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=^|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))|((?<!^let|[^\._$[:alnum:]]let|^var|[^\._$[:alnum:]]var)(?=\s*$))) + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s* + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.type.tsx + + + end + (?=\S) + + + include + #destructuring-variable + + + include + #var-single-variable + + + include + #variable-initializer + + + include + #comment + + + begin + (,)\s*(?=$|\/\/) + beginCaptures + + 1 + + name + punctuation.separator.comma.tsx + + + end + (?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$))) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + include + #destructuring-variable + + + include + #var-single-variable + + + include + #punctuation-comma + + + + + include + #punctuation-comma + + + + + name + meta.var.expr.tsx + begin + (?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.type.tsx + + + end + (?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=^|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))|((?<!^const|[^\._$[:alnum:]]const)(?=\s*$))) + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s* + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.type.tsx + + + end + (?=\S) + + + include + #destructuring-const + + + include + #var-single-const + + + include + #variable-initializer + + + include + #comment + + + begin + (,)\s*(?=$|\/\/) + beginCaptures + + 1 + + name + punctuation.separator.comma.tsx + + + end + (?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$))) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + include + #destructuring-const + + + include + #var-single-const + + + include + #punctuation-comma + + + + + include + #punctuation-comma + + + + + name + meta.var.expr.tsx + begin + (?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b((?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.type.tsx + + + end + (?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b((?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))|((?<!^using|[^\._$[:alnum:]]using|^await\s+using|[^\._$[:alnum:]]await\s+using)(?=\s*$))) + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b((?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s* + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.type.tsx + + + end + (?=\S) + + + include + #var-single-const + + + include + #variable-initializer + + + include + #comment + + + begin + (,)\s*((?!\S)|(?=\/\/)) + beginCaptures + + 1 + + name + punctuation.separator.comma.tsx + + + end + (?<!,)(((?==|;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$))|((?<=\S)(?=\s*$))) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + include + #var-single-const + + + include + #punctuation-comma + + + + + include + #punctuation-comma + + + + + + var-single-variable + + patterns + + + name + meta.var-single-variable.expr.tsx + begin + (?x)([_$[:alpha:]][_$[:alnum:]]*)(\!)?(?=\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + beginCaptures + + 1 + + name + meta.definition.variable.tsx entity.name.function.tsx + + 2 + + name + keyword.operator.definiteassignment.tsx + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + name + meta.var-single-variable.expr.tsx + begin + ([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])(\!)? + beginCaptures + + 1 + + name + meta.definition.variable.tsx variable.other.constant.tsx + + 2 + + name + keyword.operator.definiteassignment.tsx + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + name + meta.var-single-variable.expr.tsx + begin + ([_$[:alpha:]][_$[:alnum:]]*)(\!)? + beginCaptures + + 1 + + name + meta.definition.variable.tsx variable.other.readwrite.tsx + + 2 + + name + keyword.operator.definiteassignment.tsx + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + + var-single-const + + patterns + + + name + meta.var-single-variable.expr.tsx + begin + (?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + beginCaptures + + 1 + + name + meta.definition.variable.tsx variable.other.constant.tsx entity.name.function.tsx + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + name + meta.var-single-variable.expr.tsx + begin + ([_$[:alpha:]][_$[:alnum:]]*) + beginCaptures + + 1 + + name + meta.definition.variable.tsx variable.other.constant.tsx + + + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|(;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + patterns + + + include + #var-single-variable-type-annotation + + + + + + var-single-variable-type-annotation + + patterns + + + include + #type-annotation + + + include + #string + + + include + #comment + + + + destructuring-variable + + patterns + + + name + meta.object-binding-pattern-variable.tsx + begin + (?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{) + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #object-binding-pattern + + + include + #type-annotation + + + include + #comment + + + + + name + meta.array-binding-pattern-variable.tsx + begin + (?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[) + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #array-binding-pattern + + + include + #type-annotation + + + include + #comment + + + + + + destructuring-const + + patterns + + + name + meta.object-binding-pattern-variable.tsx + begin + (?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{) + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #object-binding-pattern-const + + + include + #type-annotation + + + include + #comment + + + + + name + meta.array-binding-pattern-variable.tsx + begin + (?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[) + end + (?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #array-binding-pattern-const + + + include + #type-annotation + + + include + #comment + + + + + + object-binding-element + + patterns + + + include + #comment + + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) + end + (?=,|\}) + patterns + + + include + #object-binding-element-propertyName + + + include + #binding-element + + + + + include + #object-binding-pattern + + + include + #destructuring-variable-rest + + + include + #variable-initializer + + + include + #punctuation-comma + + + + object-binding-element-const + + patterns + + + include + #comment + + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) + end + (?=,|\}) + patterns + + + include + #object-binding-element-propertyName + + + include + #binding-element-const + + + + + include + #object-binding-pattern-const + + + include + #destructuring-variable-rest-const + + + include + #variable-initializer + + + include + #punctuation-comma + + + + object-binding-element-propertyName + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) + end + (:) + endCaptures + + 0 + + name + punctuation.destructuring.tsx + + + patterns + + + include + #string + + + include + #array-literal + + + include + #numeric-literal + + + name + variable.object.property.tsx + match + ([_$[:alpha:]][_$[:alnum:]]*) + + + + binding-element + + patterns + + + include + #comment + + + include + #string + + + include + #numeric-literal + + + include + #regex + + + include + #object-binding-pattern + + + include + #array-binding-pattern + + + include + #destructuring-variable-rest + + + include + #variable-initializer + + + + binding-element-const + + patterns + + + include + #comment + + + include + #string + + + include + #numeric-literal + + + include + #regex + + + include + #object-binding-pattern-const + + + include + #array-binding-pattern-const + + + include + #destructuring-variable-rest-const + + + include + #variable-initializer + + + + destructuring-variable-rest + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + meta.definition.variable.tsx variable.other.readwrite.tsx + + + + destructuring-variable-rest-const + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + meta.definition.variable.tsx variable.other.constant.tsx + + + + object-binding-pattern + + begin + (?:(\.\.\.)\s*)?(\{) + beginCaptures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + punctuation.definition.binding-pattern.object.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.object.tsx + + + patterns + + + include + #object-binding-element + + + + object-binding-pattern-const + + begin + (?:(\.\.\.)\s*)?(\{) + beginCaptures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + punctuation.definition.binding-pattern.object.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.object.tsx + + + patterns + + + include + #object-binding-element-const + + + + array-binding-pattern + + begin + (?:(\.\.\.)\s*)?(\[) + beginCaptures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + punctuation.definition.binding-pattern.array.tsx + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.array.tsx + + + patterns + + + include + #binding-element + + + include + #punctuation-comma + + + + array-binding-pattern-const + + begin + (?:(\.\.\.)\s*)?(\[) + beginCaptures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + punctuation.definition.binding-pattern.array.tsx + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.array.tsx + + + patterns + + + include + #binding-element-const + + + include + #punctuation-comma + + + + parameter-name + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+) + captures + + 1 + + name + storage.modifier.tsx + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + captures + + 1 + + name + storage.modifier.tsx + + 2 + + name + keyword.operator.rest.tsx + + 3 + + name + entity.name.function.tsx variable.language.this.tsx + + 4 + + name + entity.name.function.tsx + + 5 + + name + keyword.operator.optional.tsx + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??) + captures + + 1 + + name + storage.modifier.tsx + + 2 + + name + keyword.operator.rest.tsx + + 3 + + name + variable.parameter.tsx variable.language.this.tsx + + 4 + + name + variable.parameter.tsx + + 5 + + name + keyword.operator.optional.tsx + + + + + + destructuring-parameter + + patterns + + + name + meta.parameter.object-binding-pattern.tsx + begin + (?<!=|:)\s*(?:(\.\.\.)\s*)?(\{) + beginCaptures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + punctuation.definition.binding-pattern.object.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.object.tsx + + + patterns + + + include + #parameter-object-binding-element + + + + + name + meta.paramter.array-binding-pattern.tsx + begin + (?<!=|:)\s*(?:(\.\.\.)\s*)?(\[) + beginCaptures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + punctuation.definition.binding-pattern.array.tsx + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.array.tsx + + + patterns + + + include + #parameter-binding-element + + + include + #punctuation-comma + + + + + + parameter-object-binding-element + + patterns + + + include + #comment + + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) + end + (?=,|\}) + patterns + + + include + #object-binding-element-propertyName + + + include + #parameter-binding-element + + + include + #paren-expression + + + + + include + #parameter-object-binding-pattern + + + include + #destructuring-parameter-rest + + + include + #variable-initializer + + + include + #punctuation-comma + + + + parameter-binding-element + + patterns + + + include + #comment + + + include + #string + + + include + #numeric-literal + + + include + #regex + + + include + #parameter-object-binding-pattern + + + include + #parameter-array-binding-pattern + + + include + #destructuring-parameter-rest + + + include + #variable-initializer + + + + destructuring-parameter-rest + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + variable.parameter.tsx + + + + parameter-object-binding-pattern + + begin + (?:(\.\.\.)\s*)?(\{) + beginCaptures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + punctuation.definition.binding-pattern.object.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.object.tsx + + + patterns + + + include + #parameter-object-binding-element + + + + parameter-array-binding-pattern + + begin + (?:(\.\.\.)\s*)?(\[) + beginCaptures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + punctuation.definition.binding-pattern.array.tsx + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.binding-pattern.array.tsx + + + patterns + + + include + #parameter-binding-element + + + include + #punctuation-comma + + + + field-declaration + + name + meta.field.declaration.tsx + begin + (?x)(?<!\()(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s+)?(?=\s*((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|(\#?[_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|\}|$)) + beginCaptures + + 1 + + name + storage.modifier.tsx + + + end + (?x)(?=\}|;|,|$|(^(?!\s*((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|(\#?[_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|$))))|(?<=\}) + patterns + + + include + #variable-initializer + + + include + #type-annotation + + + include + #string + + + include + #array-literal + + + include + #numeric-literal + + + include + #comment + + + match + (?x)(\#?[_$[:alpha:]][_$[:alnum:]]*)(?:(\?)|(\!))?(?=\s*\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + captures + + 1 + + name + meta.definition.property.tsx entity.name.function.tsx + + 2 + + name + keyword.operator.optional.tsx + + 3 + + name + keyword.operator.definiteassignment.tsx + + + + + name + meta.definition.property.tsx variable.object.property.tsx + match + \#?[_$[:alpha:]][_$[:alnum:]]* + + + name + keyword.operator.optional.tsx + match + \? + + + name + keyword.operator.definiteassignment.tsx + match + \! + + + + variable-initializer + + patterns + + + begin + (?<!=|!)(=)(?!=)(?=\s*\S)(?!\s*.*=>\s*$) + beginCaptures + + 1 + + name + keyword.operator.assignment.tsx + + + end + (?=$|^|[,);}\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)) + patterns + + + include + #expression + + + + + begin + (?<!=|!)(=)(?!=) + beginCaptures + + 1 + + name + keyword.operator.assignment.tsx + + + end + (?=[,);}\]]|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+))|(?=^\s*$)|(?<![\|\&\+\-\*\/])(?<=\S)(?<!=)(?=\s*$) + patterns + + + include + #expression + + + + + + function-declaration + + name + meta.function.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s* + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.modifier.async.tsx + + 4 + + name + storage.type.function.tsx + + 5 + + name + keyword.generator.asterisk.tsx + + 6 + + name + meta.definition.function.tsx entity.name.function.tsx + + + end + (?=;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))|(?<=\}) + patterns + + + include + #function-name + + + include + #function-body + + + + function-expression + + name + meta.function.expression.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s* + beginCaptures + + 1 + + name + storage.modifier.async.tsx + + 2 + + name + storage.type.function.tsx + + 3 + + name + keyword.generator.asterisk.tsx + + 4 + + name + meta.definition.function.tsx entity.name.function.tsx + + + end + (?=;)|(?<=\}) + patterns + + + include + #function-name + + + include + #single-line-comment-consuming-line-ending + + + include + #function-body + + + + function-name + + name + meta.definition.function.tsx entity.name.function.tsx + match + [_$[:alpha:]][_$[:alnum:]]* + + function-body + + patterns + + + include + #comment + + + include + #type-parameters + + + include + #function-parameters + + + include + #return-type + + + include + #type-function-return-type + + + include + #decl-block + + + name + keyword.generator.asterisk.tsx + match + \* + + + + method-declaration + + patterns + + + name + meta.method.declaration.tsx + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + storage.modifier.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.modifier.tsx + + 4 + + name + storage.modifier.async.tsx + + 5 + + name + storage.type.tsx + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #method-declaration-name + + + include + #function-body + + + + + name + meta.method.declaration.tsx + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\s*\b(new)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(?:(\*)\s*)?)(?=\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + beginCaptures + + 1 + + name + storage.modifier.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.modifier.tsx + + 4 + + name + storage.modifier.async.tsx + + 5 + + name + keyword.operator.new.tsx + + 6 + + name + keyword.generator.asterisk.tsx + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #method-declaration-name + + + include + #function-body + + + + + name + meta.method.declaration.tsx + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + beginCaptures + + 1 + + name + storage.modifier.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.modifier.tsx + + 4 + + name + storage.modifier.async.tsx + + 5 + + name + storage.type.property.tsx + + 6 + + name + keyword.generator.asterisk.tsx + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #method-declaration-name + + + include + #function-body + + + + + + object-literal-method-declaration + + name + meta.method.declaration.tsx + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + beginCaptures + + 1 + + name + storage.modifier.async.tsx + + 2 + + name + storage.type.property.tsx + + 3 + + name + keyword.generator.asterisk.tsx + + + end + (?=\}|;|,)|(?<=\}) + patterns + + + include + #method-declaration-name + + + include + #function-body + + + begin + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + beginCaptures + + 1 + + name + storage.modifier.async.tsx + + 2 + + name + storage.type.property.tsx + + 3 + + name + keyword.generator.asterisk.tsx + + + end + (?=\(|\<) + patterns + + + include + #method-declaration-name + + + + + + method-declaration-name + + begin + (?x)(?=((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<]) + end + (?=\(|\<) + patterns + + + include + #string + + + include + #array-literal + + + include + #numeric-literal + + + name + meta.definition.method.tsx entity.name.function.tsx + match + [_$[:alpha:]][_$[:alnum:]]* + + + name + keyword.operator.optional.tsx + match + \? + + + + arrow-function + + patterns + + + name + meta.arrow.tsx + match + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync)\s+)?([_$[:alpha:]][_$[:alnum:]]*)\s*(?==>) + captures + + 1 + + name + storage.modifier.async.tsx + + 2 + + name + variable.parameter.tsx + + + + + name + meta.arrow.tsx + begin + (?x) (?: + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync) +)? ((?<![})!\]])\s* + (?= + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + ) +) + beginCaptures + + 1 + + name + storage.modifier.async.tsx + + + end + (?==>|\{|(^\s*(export|function|class|interface|let|var|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|const|import|enum|namespace|module|type|abstract|declare)\s+)) + patterns + + + include + #comment + + + include + #type-parameters + + + include + #function-parameters + + + include + #arrow-return-type + + + include + #possibly-arrow-return-type + + + + + name + meta.arrow.tsx + begin + => + beginCaptures + + 0 + + name + storage.type.function.arrow.tsx + + + end + ((?<=\}|\S)(?<!=>)|((?!\{)(?=\S)))(?!\/[\/\*]) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #decl-block + + + include + #expression + + + + + + indexer-declaration + + name + meta.indexer.declaration.tsx + begin + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)\s*)?\s*(\[)\s*([_$[:alpha:]][_$[:alnum:]]*)\s*(?=:) + beginCaptures + + 1 + + name + storage.modifier.tsx + + 2 + + name + meta.brace.square.tsx + + 3 + + name + variable.parameter.tsx + + + end + (\])\s*(\?\s*)?|$ + endCaptures + + 1 + + name + meta.brace.square.tsx + + 2 + + name + keyword.operator.optional.tsx + + + patterns + + + include + #type-annotation + + + + indexer-mapped-type-declaration + + name + meta.indexer.mappedtype.declaration.tsx + begin + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))([+-])?(readonly)\s*)?\s*(\[)\s*([_$[:alpha:]][_$[:alnum:]]*)\s+(in)\s+ + beginCaptures + + 1 + + name + keyword.operator.type.modifier.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + meta.brace.square.tsx + + 4 + + name + entity.name.type.tsx + + 5 + + name + keyword.operator.expression.in.tsx + + + end + (\])([+-])?\s*(\?\s*)?|$ + endCaptures + + 1 + + name + meta.brace.square.tsx + + 2 + + name + keyword.operator.type.modifier.tsx + + 3 + + name + keyword.operator.optional.tsx + + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+ + captures + + 1 + + name + keyword.control.as.tsx + + + + + include + #type + + + + function-parameters + + name + meta.parameters.tsx + begin + \( + beginCaptures + + 0 + + name + punctuation.definition.parameters.begin.tsx + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.parameters.end.tsx + + + patterns + + + include + #function-parameters-body + + + + function-parameters-body + + patterns + + + include + #comment + + + include + #string + + + include + #decorator + + + include + #destructuring-parameter + + + include + #parameter-name + + + include + #parameter-type-annotation + + + include + #variable-initializer + + + name + punctuation.separator.parameter.tsx + match + , + + + + class-declaration + + name + meta.class.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(?:(abstract)\s+)?\b(class)\b(?=\s+|/[/*]) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.modifier.tsx + + 4 + + name + storage.type.class.tsx + + + end + (?<=\}) + patterns + + + include + #class-declaration-or-expression-patterns + + + + class-expression + + name + meta.class.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(class)\b(?=\s+|[<{]|\/[\/*]) + beginCaptures + + 1 + + name + storage.modifier.tsx + + 2 + + name + storage.type.class.tsx + + + end + (?<=\}) + patterns + + + include + #class-declaration-or-expression-patterns + + + + class-declaration-or-expression-patterns + + patterns + + + include + #comment + + + include + #class-or-interface-heritage + + + match + [_$[:alpha:]][_$[:alnum:]]* + captures + + 0 + + name + entity.name.type.class.tsx + + + + + include + #type-parameters + + + include + #class-or-interface-body + + + + interface-declaration + + name + meta.interface.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(?:(abstract)\s+)?\b(interface)\b(?=\s+|/[/*]) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.modifier.tsx + + 4 + + name + storage.type.interface.tsx + + + end + (?<=\}) + patterns + + + include + #comment + + + include + #class-or-interface-heritage + + + match + [_$[:alpha:]][_$[:alnum:]]* + captures + + 0 + + name + entity.name.type.interface.tsx + + + + + include + #type-parameters + + + include + #class-or-interface-body + + + + class-or-interface-heritage + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(extends|implements)\b)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + storage.modifier.tsx + + + end + (?=\{) + patterns + + + include + #comment + + + include + #class-or-interface-heritage + + + include + #type-parameters + + + include + #expressionWithoutIdentifiers + + + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\??\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*) + captures + + 1 + + name + entity.name.type.module.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + + + + match + ([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + entity.other.inherited-class.tsx + + + + + include + #expressionPunctuations + + + + class-or-interface-body + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.tsx + + + patterns + + + include + #comment + + + include + #decorator + + + begin + (?<=:)\s* + end + (?=\s|[;),}\]:\-\+]|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #expression + + + + + include + #method-declaration + + + include + #indexer-declaration + + + include + #field-declaration + + + include + #string + + + include + #type-annotation + + + include + #variable-initializer + + + include + #access-modifier + + + include + #property-accessor + + + include + #async-modifier + + + include + #after-operator-block-as-object-literal + + + include + #decl-block + + + include + #expression + + + include + #punctuation-comma + + + include + #punctuation-semicolon + + + + access-modifier + + name + storage.modifier.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|declare|override|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + property-accessor + + name + storage.type.property.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(accessor|get|set)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + async-modifier + + name + storage.modifier.async.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(async)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + enum-declaration + + name + meta.enum.declaration.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:\b(const)\s+)?\b(enum)\s+([_$[:alpha:]][_$[:alnum:]]*) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.modifier.tsx + + 4 + + name + storage.type.enum.tsx + + 5 + + name + entity.name.type.enum.tsx + + + end + (?<=\}) + patterns + + + include + #comment + + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.tsx + + + patterns + + + include + #comment + + + begin + ([_$[:alpha:]][_$[:alnum:]]*) + beginCaptures + + 0 + + name + variable.other.enummember.tsx + + + end + (?=,|\}|$) + patterns + + + include + #comment + + + include + #variable-initializer + + + + + begin + (?=((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))) + end + (?=,|\}|$) + patterns + + + include + #string + + + include + #array-literal + + + include + #comment + + + include + #variable-initializer + + + + + include + #punctuation-comma + + + + + + namespace-declaration + + name + meta.namespace.declaration.tsx + begin + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(namespace|module)\s+(?=[_$[:alpha:]"'`])) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.type.namespace.tsx + + + end + (?<=\})|(?=;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #comment + + + include + #string + + + name + entity.name.type.module.tsx + match + ([_$[:alpha:]][_$[:alnum:]]*) + + + include + #punctuation-accessor + + + include + #decl-block + + + + type-alias-declaration + + name + meta.type.declaration.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(type)\b\s+([_$[:alpha:]][_$[:alnum:]]*)\s* + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + storage.type.type.tsx + + 4 + + name + entity.name.type.alias.tsx + + + end + (?=\}|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #comment + + + include + #type-parameters + + + begin + (=)\s*(intrinsic)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.operator.assignment.tsx + + 2 + + name + keyword.control.intrinsic.tsx + + + end + (?=\}|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #type + + + + + begin + (=)\s* + beginCaptures + + 1 + + name + keyword.operator.assignment.tsx + + + end + (?=\}|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #type + + + + + + import-equals-declaration + + patterns + + + name + meta.import-equals.external.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type))?\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(require)\s*(\() + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + keyword.control.import.tsx + + 4 + + name + keyword.control.type.tsx + + 5 + + name + variable.other.readwrite.alias.tsx + + 6 + + name + keyword.operator.assignment.tsx + + 7 + + name + keyword.control.require.tsx + + 8 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + include + #comment + + + include + #string + + + + + name + meta.import-equals.internal.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type))?\s+([_$[:alpha:]][_$[:alnum:]]*)\s*(=)\s*(?!require\b) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + keyword.control.import.tsx + + 4 + + name + keyword.control.type.tsx + + 5 + + name + variable.other.readwrite.alias.tsx + + 6 + + name + keyword.operator.assignment.tsx + + + end + (?=;|$|^) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]]))) + captures + + 1 + + name + entity.name.type.module.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + + + + name + variable.other.readwrite.tsx + match + ([_$[:alpha:]][_$[:alnum:]]*) + + + + + + import-declaration + + name + meta.import.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(import)(?:\s+(type)(?!\s+from))?(?!\s*[:\(])(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + storage.modifier.tsx + + 3 + + name + keyword.control.import.tsx + + 4 + + name + keyword.control.type.tsx + + + end + (?<!^import|[^\._$[:alnum:]]import)(?=;|$|^) + patterns + + + include + #single-line-comment-consuming-line-ending + + + include + #comment + + + include + #string + + + begin + (?<=^import|[^\._$[:alnum:]]import)(?!\s*["']) + end + \bfrom\b + endCaptures + + 0 + + name + keyword.control.from.tsx + + + patterns + + + include + #import-export-declaration + + + + + include + #import-export-declaration + + + + export-declaration + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)\s+(as)\s+(namespace)\s+([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + keyword.control.as.tsx + + 3 + + name + storage.type.namespace.tsx + + 4 + + name + entity.name.type.module.tsx + + + + + name + meta.export.default.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:\s+(type))?(?:(?:\s*(=))|(?:\s+(default)(?=\s+))) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + keyword.control.type.tsx + + 3 + + name + keyword.operator.assignment.tsx + + 4 + + name + keyword.control.default.tsx + + + end + (?=$|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #interface-declaration + + + include + #expression + + + + + name + meta.export.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(export)(?:\s+(type))?\b(?!(\$)|(\s*:))((?=\s*[\{*])|((?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s|,))(?!\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b))) + beginCaptures + + 1 + + name + keyword.control.export.tsx + + 2 + + name + keyword.control.type.tsx + + + end + (?=$|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #import-export-declaration + + + + + + import-export-declaration + + patterns + + + include + #comment + + + include + #string + + + include + #import-export-block + + + name + keyword.control.from.tsx + match + \bfrom\b + + + include + #import-export-assert-clause + + + include + #import-export-clause + + + + import-export-assert-clause + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(with)|(assert))\s*(\{) + beginCaptures + + 1 + + name + keyword.control.with.tsx + + 2 + + name + keyword.control.assert.tsx + + 3 + + name + punctuation.definition.block.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.tsx + + + patterns + + + include + #comment + + + include + #string + + + name + meta.object-literal.key.tsx + match + (?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:) + + + name + punctuation.separator.key-value.tsx + match + : + + + + import-export-block + + name + meta.block.tsx + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.tsx + + + patterns + + + include + #import-export-clause + + + + import-export-clause + + patterns + + + include + #comment + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(?:(\btype)\s+)?(?:(\bdefault)|(\*)|(\b[_$[:alpha:]][_$[:alnum:]]*)|((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))))\s+(as)\s+(?:(default(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|([_$[:alpha:]][_$[:alnum:]]*)|((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))) + captures + + 1 + + name + keyword.control.type.tsx + + 2 + + name + keyword.control.default.tsx + + 3 + + name + constant.language.import-export-all.tsx + + 4 + + name + variable.other.readwrite.tsx + + 5 + + name + string.quoted.alias.tsx + + 12 + + name + keyword.control.as.tsx + + 13 + + name + keyword.control.default.tsx + + 14 + + name + variable.other.readwrite.alias.tsx + + 15 + + name + string.quoted.alias.tsx + + + + + include + #punctuation-comma + + + name + constant.language.import-export-all.tsx + match + \* + + + name + keyword.control.default.tsx + match + \b(default)\b + + + match + (?:(\btype)\s+)?(?:([_$[:alpha:]][_$[:alnum:]]*)|((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))) + captures + + 1 + + name + keyword.control.type.tsx + + 2 + + name + variable.other.readwrite.alias.tsx + + 3 + + name + string.quoted.alias.tsx + + + + + + switch-statement + + name + switch-statement.expr.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bswitch\s*\() + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.tsx + + + patterns + + + include + #comment + + + name + switch-expression.expr.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(switch)\s*(\() + beginCaptures + + 1 + + name + keyword.control.switch.tsx + + 2 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + include + #expression + + + + + name + switch-block.expr.tsx + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.tsx + + + end + (?=\}) + patterns + + + name + case-clause.expr.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default(?=:))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.control.switch.tsx + + + end + (?=:) + patterns + + + include + #expression + + + + + begin + (:)\s*(\{) + beginCaptures + + 1 + + name + case-clause.expr.tsx punctuation.definition.section.case-statement.tsx + + 2 + + name + meta.block.tsx punctuation.definition.block.tsx + + + end + \} + endCaptures + + 0 + + name + meta.block.tsx punctuation.definition.block.tsx + + + contentName + meta.block.tsx + patterns + + + include + #statements + + + + + match + (:) + captures + + 0 + + name + case-clause.expr.tsx punctuation.definition.section.case-statement.tsx + + + + + include + #statements + + + + + + for-loop + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))for(?=((\s+|(\s*\/\*([^\*]|(\*[^\/]))*\*\/\s*))await)?\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)?(\()) + beginCaptures + + 0 + + name + keyword.control.loop.tsx + + + end + (?<=\)) + patterns + + + include + #comment + + + name + keyword.control.loop.tsx + match + await + + + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + include + #var-expr + + + include + #expression + + + include + #punctuation-semicolon + + + + + + if-statement + + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))\s*(?!\{)) + end + (?=;|$|\}) + patterns + + + include + #comment + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(if)\s*(\() + beginCaptures + + 1 + + name + keyword.control.conditional.tsx + + 2 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + include + #expression + + + + + name + string.regexp.tsx + begin + (?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuvy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.tsx + + + end + (/)([dgimsuvy]*) + endCaptures + + 1 + + name + punctuation.definition.string.end.tsx + + 2 + + name + keyword.other.tsx + + + patterns + + + include + #regexp + + + + + include + #statements + + + + + + decl-block + + name + meta.block.tsx + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.tsx + + + patterns + + + include + #statements + + + + after-operator-block-as-object-literal + + name + meta.objectliteral.tsx + begin + (?<!\+\+|--)(?<=[:=(,\[?+!>]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{) + beginCaptures + + 1 + + name + punctuation.definition.block.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.tsx + + + patterns + + + include + #object-member + + + + object-literal + + name + meta.objectliteral.tsx + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.tsx + + + patterns + + + include + #object-member + + + + object-member + + patterns + + + include + #comment + + + include + #object-literal-method-declaration + + + name + meta.object.member.tsx meta.object-literal.key.tsx + begin + (?=\[) + end + (?=:)|((?<=[\]])(?=\s*[\(\<])) + patterns + + + include + #comment + + + include + #array-literal + + + + + name + meta.object.member.tsx meta.object-literal.key.tsx + begin + (?=[\'\"\`]) + end + (?=:)|((?<=[\'\"\`])(?=((\s*[\(\<,}])|(\s+(as|satisifies)\s+)))) + patterns + + + include + #comment + + + include + #string + + + + + name + meta.object.member.tsx meta.object-literal.key.tsx + begin + (?x)(?=(\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$))) + end + (?=:)|(?=\s*([\(\<,}])|(\s+as|satisifies\s+)) + patterns + + + include + #comment + + + include + #numeric-literal + + + + + name + meta.method.declaration.tsx + begin + (?<=[\]\'\"\`])(?=\s*[\(\<]) + end + (?=\}|;|,)|(?<=\}) + patterns + + + include + #function-body + + + + + name + meta.object.member.tsx + match + (?![_$[:alpha:]])([[:digit:]]+)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:) + captures + + 0 + + name + meta.object-literal.key.tsx + + 1 + + name + constant.numeric.decimal.tsx + + + + + name + meta.object.member.tsx + match + (?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:(\s*\/\*([^\*]|(\*[^\/]))*\*\/)*\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + captures + + 0 + + name + meta.object-literal.key.tsx + + 1 + + name + entity.name.function.tsx + + + + + name + meta.object.member.tsx + match + (?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:) + captures + + 0 + + name + meta.object-literal.key.tsx + + + + + name + meta.object.member.tsx + begin + \.\.\. + beginCaptures + + 0 + + name + keyword.operator.spread.tsx + + + end + (?=,|\}) + patterns + + + include + #expression + + + + + name + meta.object.member.tsx + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$|\/\/|\/\*) + captures + + 1 + + name + variable.other.readwrite.tsx + + + + + name + meta.object.member.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+(const)(?=\s*([,}]|$)) + captures + + 1 + + name + keyword.control.as.tsx + + 2 + + name + storage.modifier.tsx + + + + + name + meta.object.member.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(as)|(satisfies))\s+ + beginCaptures + + 1 + + name + keyword.control.as.tsx + + 2 + + name + keyword.control.satisfies.tsx + + + end + (?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|^|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as|satisifies)\s+)) + patterns + + + include + #type + + + + + name + meta.object.member.tsx + begin + (?=[_$[:alpha:]][_$[:alnum:]]*\s*=) + end + (?=,|\}|$|\/\/|\/\*) + patterns + + + include + #expression + + + + + name + meta.object.member.tsx + begin + : + beginCaptures + + 0 + + name + meta.object-literal.key.tsx punctuation.separator.key-value.tsx + + + end + (?=,|\}) + patterns + + + begin + (?<=:)\s*(async)?(?=\s*(<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))) + beginCaptures + + 1 + + name + storage.modifier.async.tsx + + + end + (?<=\)) + patterns + + + include + #type-parameters + + + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + include + #expression-inside-possibly-arrow-parens + + + + + + + begin + (?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))) + beginCaptures + + 1 + + name + storage.modifier.async.tsx + + 2 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + include + #expression-inside-possibly-arrow-parens + + + + + begin + (?<=:)\s*(async)?\s*(?=\<\s*$) + beginCaptures + + 1 + + name + storage.modifier.async.tsx + + + end + (?<=\>) + patterns + + + include + #type-parameters + + + + + begin + (?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))) + beginCaptures + + 1 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + include + #expression-inside-possibly-arrow-parens + + + + + include + #possibly-arrow-return-type + + + include + #expression + + + + + include + #punctuation-comma + + + include + #decl-block + + + + ternary-expression + + begin + (?!\?\.\s*[^[:digit:]])(\?)(?!\?) + beginCaptures + + 1 + + name + keyword.operator.ternary.tsx + + + end + \s*(:) + endCaptures + + 1 + + name + keyword.operator.ternary.tsx + + + patterns + + + include + #expression + + + + function-call + + patterns + + + begin + (?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()) + end + (?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()) + patterns + + + name + meta.function-call.tsx + begin + (?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*)) + end + (?=\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()) + patterns + + + include + #function-call-target + + + + + include + #comment + + + include + #function-call-optionals + + + include + #type-arguments + + + include + #paren-expression + + + + + begin + (?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$)) + end + (?<=\>)(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$)) + patterns + + + name + meta.function-call.tsx + begin + (?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*)) + end + (?=(<\s*[\{\[\(]\s*$)) + patterns + + + include + #function-call-target + + + + + include + #comment + + + include + #function-call-optionals + + + include + #type-arguments + + + + + + function-call-target + + patterns + + + include + #support-function-call-identifiers + + + name + entity.name.function.tsx + match + (\#?[_$[:alpha:]][_$[:alnum:]]*) + + + + function-call-optionals + + patterns + + + name + meta.function-call.tsx punctuation.accessor.optional.tsx + match + \?\. + + + name + meta.function-call.tsx keyword.operator.definiteassignment.tsx + match + \! + + + + support-function-call-identifiers + + patterns + + + include + #literal + + + include + #support-objects + + + include + #object-identifiers + + + include + #punctuation-accessor + + + name + keyword.operator.expression.import.tsx + match + (?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*[\(]\s*[\"\'\`])) + + + + new-expr + + name + new.expr.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.operator.new.tsx + + + end + (?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(])))) + patterns + + + include + #expression + + + + instanceof-expr + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(instanceof)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 1 + + name + keyword.operator.expression.instanceof.tsx + + + end + (?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|(===|!==|==|!=)|(([\&\~\^\|]\s*)?[_$[:alpha:]][_$[:alnum:]]*\s+instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(])))) + patterns + + + include + #type + + + + paren-expression-possibly-arrow + + patterns + + + begin + (?<=[(=,])\s*(async)?(?=\s*((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))) + beginCaptures + + 1 + + name + storage.modifier.async.tsx + + + end + (?<=\)) + patterns + + + include + #paren-expression-possibly-arrow-with-typeparameters + + + + + begin + (?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<)|((<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)))\s*$) + beginCaptures + + 1 + + name + storage.modifier.async.tsx + + + end + (?<=\)) + patterns + + + include + #paren-expression-possibly-arrow-with-typeparameters + + + + + include + #possibly-arrow-return-type + + + + paren-expression-possibly-arrow-with-typeparameters + + patterns + + + include + #type-parameters + + + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + include + #expression-inside-possibly-arrow-parens + + + + + + expression-inside-possibly-arrow-parens + + patterns + + + include + #expressionWithoutIdentifiers + + + include + #comment + + + include + #string + + + include + #decorator + + + include + #destructuring-parameter + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+) + captures + + 1 + + name + storage.modifier.tsx + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s* +# function assignment | +(=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) | +# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => +(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | +(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +))) + captures + + 1 + + name + storage.modifier.tsx + + 2 + + name + keyword.operator.rest.tsx + + 3 + + name + entity.name.function.tsx variable.language.this.tsx + + 4 + + name + entity.name.function.tsx + + 5 + + name + keyword.operator.optional.tsx + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$) + captures + + 1 + + name + storage.modifier.tsx + + 2 + + name + keyword.operator.rest.tsx + + 3 + + name + variable.parameter.tsx variable.language.this.tsx + + 4 + + name + variable.parameter.tsx + + 5 + + name + keyword.operator.optional.tsx + + + + + include + #type-annotation + + + include + #variable-initializer + + + name + punctuation.separator.parameter.tsx + match + , + + + include + #identifiers + + + include + #expressionPunctuations + + + + paren-expression + + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + include + #expression + + + + cast + + patterns + + + include + #jsx + + + + expression-operators + + patterns + + + name + keyword.control.flow.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(await)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(yield)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?=\s*\/\*([^\*]|(\*[^\/]))*\*\/\s*\*) + beginCaptures + + 1 + + name + keyword.control.flow.tsx + + + end + \* + endCaptures + + 0 + + name + keyword.generator.asterisk.tsx + + + patterns + + + include + #comment + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(yield)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?:\s*(\*))? + captures + + 1 + + name + keyword.control.flow.tsx + + 2 + + name + keyword.generator.asterisk.tsx + + + + + name + keyword.operator.expression.delete.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))delete(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.operator.expression.in.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))in(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?!\() + + + name + keyword.operator.expression.of.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))of(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?!\() + + + name + keyword.operator.expression.instanceof.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.operator.new.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + include + #typeof-operator + + + name + keyword.operator.expression.void.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))void(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+(const)(?=\s*($|[;,:})\]])) + captures + + 1 + + name + keyword.control.as.tsx + + 2 + + name + storage.modifier.tsx + + + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(as)|(satisfies))\s+ + beginCaptures + + 1 + + name + keyword.control.as.tsx + + 2 + + name + keyword.control.satisfies.tsx + + + end + (?=^|[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as|satisfies)\s+)|(\s+\<)) + patterns + + + include + #type + + + + + name + keyword.operator.spread.tsx + match + \.\.\. + + + name + keyword.operator.assignment.compound.tsx + match + \*=|(?<!\()/=|%=|\+=|\-= + + + name + keyword.operator.assignment.compound.bitwise.tsx + match + \&=|\^=|<<=|>>=|>>>=|\|= + + + name + keyword.operator.bitwise.shift.tsx + match + <<|>>>|>> + + + name + keyword.operator.comparison.tsx + match + ===|!==|==|!= + + + name + keyword.operator.relational.tsx + match + <=|>=|<>|<|> + + + match + (?<=[_$[:alnum:]])(\!)\s*(?:(/=)|(?:(/)(?![/*]))) + captures + + 1 + + name + keyword.operator.logical.tsx + + 2 + + name + keyword.operator.assignment.compound.tsx + + 3 + + name + keyword.operator.arithmetic.tsx + + + + + name + keyword.operator.logical.tsx + match + \!|&&|\|\||\?\? + + + name + keyword.operator.bitwise.tsx + match + \&|~|\^|\| + + + name + keyword.operator.assignment.tsx + match + \= + + + name + keyword.operator.decrement.tsx + match + -- + + + name + keyword.operator.increment.tsx + match + \+\+ + + + name + keyword.operator.arithmetic.tsx + match + %|\*|/|-|\+ + + + begin + (?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(?:(/=)|(?:(/)(?![/*])))) + end + (?:(/=)|(?:(/)(?!\*([^\*]|(\*[^\/]))*\*\/))) + endCaptures + + 1 + + name + keyword.operator.assignment.compound.tsx + + 2 + + name + keyword.operator.arithmetic.tsx + + + patterns + + + include + #comment + + + + + match + (?<=[_$[:alnum:])\]])\s*(?:(/=)|(?:(/)(?![/*]))) + captures + + 1 + + name + keyword.operator.assignment.compound.tsx + + 2 + + name + keyword.operator.arithmetic.tsx + + + + + + typeof-operator + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + beginCaptures + + 0 + + name + keyword.operator.expression.typeof.tsx + + + end + (?=[,);}\]=>:&|{\?]|(extends\s+)|$|;|^\s*$|(?:^\s*(?:abstract|async|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|var|while)\b)) + patterns + + + include + #type-arguments + + + include + #expression + + + + literal + + patterns + + + include + #numeric-literal + + + include + #boolean-literal + + + include + #null-literal + + + include + #undefined-literal + + + include + #numericConstant-literal + + + include + #array-literal + + + include + #this-literal + + + include + #super-literal + + + + array-literal + + name + meta.array.literal.tsx + begin + \s*(\[) + beginCaptures + + 1 + + name + meta.brace.square.tsx + + + end + \] + endCaptures + + 0 + + name + meta.brace.square.tsx + + + patterns + + + include + #expression + + + include + #punctuation-comma + + + + numeric-literal + + patterns + + + name + constant.numeric.hex.tsx + match + \b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$) + captures + + 1 + + name + storage.type.numeric.bigint.tsx + + + + + name + constant.numeric.binary.tsx + match + \b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$) + captures + + 1 + + name + storage.type.numeric.bigint.tsx + + + + + name + constant.numeric.octal.tsx + match + \b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$) + captures + + 1 + + name + storage.type.numeric.bigint.tsx + + + + + match + (?x) +(?<!\$)(?: + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3 + (?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3 + (?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3 + (?:\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1E+3 + (?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*(n)?\b)| # 1.1 + (?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1. + (?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1 + (?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1 +)(?!\$) + captures + + 0 + + name + constant.numeric.decimal.tsx + + 1 + + name + meta.delimiter.decimal.period.tsx + + 2 + + name + storage.type.numeric.bigint.tsx + + 3 + + name + meta.delimiter.decimal.period.tsx + + 4 + + name + storage.type.numeric.bigint.tsx + + 5 + + name + meta.delimiter.decimal.period.tsx + + 6 + + name + storage.type.numeric.bigint.tsx + + 7 + + name + storage.type.numeric.bigint.tsx + + 8 + + name + meta.delimiter.decimal.period.tsx + + 9 + + name + storage.type.numeric.bigint.tsx + + 10 + + name + meta.delimiter.decimal.period.tsx + + 11 + + name + storage.type.numeric.bigint.tsx + + 12 + + name + meta.delimiter.decimal.period.tsx + + 13 + + name + storage.type.numeric.bigint.tsx + + 14 + + name + storage.type.numeric.bigint.tsx + + + + + + boolean-literal + + patterns + + + name + constant.language.boolean.true.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))true(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + constant.language.boolean.false.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))false(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + null-literal + + name + constant.language.null.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + this-literal + + name + variable.language.this.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))this\b(?!\$) + + super-literal + + name + variable.language.super.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))super\b(?!\$) + + undefined-literal + + name + constant.language.undefined.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + numericConstant-literal + + patterns + + + name + constant.language.nan.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))NaN(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + constant.language.infinity.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Infinity(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + support-objects + + patterns + + + name + variable.language.arguments.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(arguments)\b(?!\$) + + + name + support.class.builtin.tsx + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Array|ArrayBuffer|Atomics|BigInt|BigInt64Array|BigUint64Array|Boolean|DataView|Date|Float32Array + |Float64Array|Function|Generator|GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Proxy + |Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|TypedArray + |Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray|WeakMap|WeakSet)\b(?!\$) + + + name + support.class.error.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))((Eval|Internal|Range|Reference|Syntax|Type|URI)?Error)\b(?!\$) + + + name + support.class.promise.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Promise)\b(?!\$) + + + name + support.function.tsx + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(clear(Interval|Timeout)|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval| + isFinite|isNaN|parseFloat|parseInt|require|set(Interval|Timeout)|super|unescape|uneval)(?=\s*\() + + + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Math)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(?: + (abs|acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|clz32|cos|cosh|exp| + expm1|floor|fround|hypot|imul|log|log10|log1p|log2|max|min|pow|random| + round|sign|sin|sinh|sqrt|tan|tanh|trunc) + | + (E|LN10|LN2|LOG10E|LOG2E|PI|SQRT1_2|SQRT2)))?\b(?!\$) + captures + + 1 + + name + support.constant.math.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + 4 + + name + support.function.math.tsx + + 5 + + name + support.constant.property.math.tsx + + + + + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(console)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*( + assert|clear|count|debug|dir|error|group|groupCollapsed|groupEnd|info|log + |profile|profileEnd|table|time|timeEnd|timeStamp|trace|warn))?\b(?!\$) + captures + + 1 + + name + support.class.console.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + 4 + + name + support.function.console.tsx + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(JSON)(?:\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(parse|stringify))?\b(?!\$) + captures + + 1 + + name + support.constant.json.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + 4 + + name + support.function.json.tsx + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(import)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(meta)\b(?!\$) + captures + + 1 + + name + keyword.control.import.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + 4 + + name + support.variable.property.importmeta.tsx + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(target)\b(?!\$) + captures + + 1 + + name + keyword.operator.new.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + 4 + + name + support.variable.property.target.tsx + + + + + match + (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?: + (?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()) + | + (?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$))) + captures + + 1 + + name + punctuation.accessor.tsx + + 2 + + name + punctuation.accessor.optional.tsx + + 3 + + name + support.variable.property.tsx + + 4 + + name + support.constant.tsx + + + + + match + (?x) (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.)) \b (?: + (document|event|navigator|performance|screen|window) + | + (AnalyserNode|ArrayBufferView|Attr|AudioBuffer|AudioBufferSourceNode|AudioContext|AudioDestinationNode|AudioListener + |AudioNode|AudioParam|BatteryManager|BeforeUnloadEvent|BiquadFilterNode|Blob|BufferSource|ByteString|CSS|CSSConditionRule + |CSSCounterStyleRule|CSSGroupingRule|CSSMatrix|CSSMediaRule|CSSPageRule|CSSPrimitiveValue|CSSRule|CSSRuleList|CSSStyleDeclaration + |CSSStyleRule|CSSStyleSheet|CSSSupportsRule|CSSValue|CSSValueList|CanvasGradient|CanvasImageSource|CanvasPattern + |CanvasRenderingContext2D|ChannelMergerNode|ChannelSplitterNode|CharacterData|ChromeWorker|CloseEvent|Comment|CompositionEvent + |Console|ConvolverNode|Coordinates|Credential|CredentialsContainer|Crypto|CryptoKey|CustomEvent|DOMError|DOMException + |DOMHighResTimeStamp|DOMImplementation|DOMString|DOMStringList|DOMStringMap|DOMTimeStamp|DOMTokenList|DataTransfer + |DataTransferItem|DataTransferItemList|DedicatedWorkerGlobalScope|DelayNode|DeviceProximityEvent|DirectoryEntry + |DirectoryEntrySync|DirectoryReader|DirectoryReaderSync|Document|DocumentFragment|DocumentTouch|DocumentType|DragEvent + |DynamicsCompressorNode|Element|Entry|EntrySync|ErrorEvent|Event|EventListener|EventSource|EventTarget|FederatedCredential + |FetchEvent|File|FileEntry|FileEntrySync|FileException|FileList|FileReader|FileReaderSync|FileSystem|FileSystemSync + |FontFace|FormData|GainNode|Gamepad|GamepadButton|GamepadEvent|Geolocation|GlobalEventHandlers|HTMLAnchorElement + |HTMLAreaElement|HTMLAudioElement|HTMLBRElement|HTMLBaseElement|HTMLBodyElement|HTMLButtonElement|HTMLCanvasElement + |HTMLCollection|HTMLContentElement|HTMLDListElement|HTMLDataElement|HTMLDataListElement|HTMLDialogElement|HTMLDivElement + |HTMLDocument|HTMLElement|HTMLEmbedElement|HTMLFieldSetElement|HTMLFontElement|HTMLFormControlsCollection|HTMLFormElement + |HTMLHRElement|HTMLHeadElement|HTMLHeadingElement|HTMLHtmlElement|HTMLIFrameElement|HTMLImageElement|HTMLInputElement + |HTMLKeygenElement|HTMLLIElement|HTMLLabelElement|HTMLLegendElement|HTMLLinkElement|HTMLMapElement|HTMLMediaElement + |HTMLMetaElement|HTMLMeterElement|HTMLModElement|HTMLOListElement|HTMLObjectElement|HTMLOptGroupElement|HTMLOptionElement + |HTMLOptionsCollection|HTMLOutputElement|HTMLParagraphElement|HTMLParamElement|HTMLPreElement|HTMLProgressElement + |HTMLQuoteElement|HTMLScriptElement|HTMLSelectElement|HTMLShadowElement|HTMLSourceElement|HTMLSpanElement|HTMLStyleElement + |HTMLTableCaptionElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableDataCellElement|HTMLTableElement|HTMLTableHeaderCellElement + |HTMLTableRowElement|HTMLTableSectionElement|HTMLTextAreaElement|HTMLTimeElement|HTMLTitleElement|HTMLTrackElement + |HTMLUListElement|HTMLUnknownElement|HTMLVideoElement|HashChangeEvent|History|IDBCursor|IDBCursorWithValue|IDBDatabase + |IDBEnvironment|IDBFactory|IDBIndex|IDBKeyRange|IDBMutableFile|IDBObjectStore|IDBOpenDBRequest|IDBRequest|IDBTransaction + |IDBVersionChangeEvent|IIRFilterNode|IdentityManager|ImageBitmap|ImageBitmapFactories|ImageData|Index|InputDeviceCapabilities + |InputEvent|InstallEvent|InstallTrigger|KeyboardEvent|LinkStyle|LocalFileSystem|LocalFileSystemSync|Location|MIDIAccess + |MIDIConnectionEvent|MIDIInput|MIDIInputMap|MIDIOutputMap|MediaElementAudioSourceNode|MediaError|MediaKeyMessageEvent + |MediaKeySession|MediaKeyStatusMap|MediaKeySystemAccess|MediaKeySystemConfiguration|MediaKeys|MediaRecorder|MediaStream + |MediaStreamAudioDestinationNode|MediaStreamAudioSourceNode|MessageChannel|MessageEvent|MessagePort|MouseEvent + |MutationObserver|MutationRecord|NamedNodeMap|Navigator|NavigatorConcurrentHardware|NavigatorGeolocation|NavigatorID + |NavigatorLanguage|NavigatorOnLine|Node|NodeFilter|NodeIterator|NodeList|NonDocumentTypeChildNode|Notification + |OfflineAudioCompletionEvent|OfflineAudioContext|OscillatorNode|PageTransitionEvent|PannerNode|ParentNode|PasswordCredential + |Path2D|PaymentAddress|PaymentRequest|PaymentResponse|Performance|PerformanceEntry|PerformanceFrameTiming|PerformanceMark + |PerformanceMeasure|PerformanceNavigation|PerformanceNavigationTiming|PerformanceObserver|PerformanceObserverEntryList + |PerformanceResourceTiming|PerformanceTiming|PeriodicSyncEvent|PeriodicWave|Plugin|Point|PointerEvent|PopStateEvent + |PortCollection|Position|PositionError|PositionOptions|PresentationConnectionClosedEvent|PresentationConnectionList + |PresentationReceiver|ProcessingInstruction|ProgressEvent|PromiseRejectionEvent|PushEvent|PushRegistrationManager + |RTCCertificate|RTCConfiguration|RTCPeerConnection|RTCSessionDescriptionCallback|RTCStatsReport|RadioNodeList|RandomSource + |Range|ReadableByteStream|RenderingContext|SVGAElement|SVGAngle|SVGAnimateColorElement|SVGAnimateElement|SVGAnimateMotionElement + |SVGAnimateTransformElement|SVGAnimatedAngle|SVGAnimatedBoolean|SVGAnimatedEnumeration|SVGAnimatedInteger|SVGAnimatedLength + |SVGAnimatedLengthList|SVGAnimatedNumber|SVGAnimatedNumberList|SVGAnimatedPoints|SVGAnimatedPreserveAspectRatio + |SVGAnimatedRect|SVGAnimatedString|SVGAnimatedTransformList|SVGAnimationElement|SVGCircleElement|SVGClipPathElement + |SVGCursorElement|SVGDefsElement|SVGDescElement|SVGElement|SVGEllipseElement|SVGEvent|SVGFilterElement|SVGFontElement + |SVGFontFaceElement|SVGFontFaceFormatElement|SVGFontFaceNameElement|SVGFontFaceSrcElement|SVGFontFaceUriElement + |SVGForeignObjectElement|SVGGElement|SVGGlyphElement|SVGGradientElement|SVGHKernElement|SVGImageElement|SVGLength + |SVGLengthList|SVGLineElement|SVGLinearGradientElement|SVGMPathElement|SVGMaskElement|SVGMatrix|SVGMissingGlyphElement + |SVGNumber|SVGNumberList|SVGPathElement|SVGPatternElement|SVGPoint|SVGPolygonElement|SVGPolylineElement|SVGPreserveAspectRatio + |SVGRadialGradientElement|SVGRect|SVGRectElement|SVGSVGElement|SVGScriptElement|SVGSetElement|SVGStopElement|SVGStringList + |SVGStylable|SVGStyleElement|SVGSwitchElement|SVGSymbolElement|SVGTRefElement|SVGTSpanElement|SVGTests|SVGTextElement + |SVGTextPositioningElement|SVGTitleElement|SVGTransform|SVGTransformList|SVGTransformable|SVGUseElement|SVGVKernElement + |SVGViewElement|ServiceWorker|ServiceWorkerContainer|ServiceWorkerGlobalScope|ServiceWorkerRegistration|ServiceWorkerState + |ShadowRoot|SharedWorker|SharedWorkerGlobalScope|SourceBufferList|StereoPannerNode|Storage|StorageEvent|StyleSheet + |StyleSheetList|SubtleCrypto|SyncEvent|Text|TextMetrics|TimeEvent|TimeRanges|Touch|TouchEvent|TouchList|Transferable + |TreeWalker|UIEvent|USVString|VRDisplayCapabilities|ValidityState|WaveShaperNode|WebGL|WebGLActiveInfo|WebGLBuffer + |WebGLContextEvent|WebGLFramebuffer|WebGLProgram|WebGLRenderbuffer|WebGLRenderingContext|WebGLShader|WebGLShaderPrecisionFormat + |WebGLTexture|WebGLTimerQueryEXT|WebGLTransformFeedback|WebGLUniformLocation|WebGLVertexArrayObject|WebGLVertexArrayObjectOES + |WebSocket|WebSockets|WebVTT|WheelEvent|Window|WindowBase64|WindowEventHandlers|WindowTimers|Worker|WorkerGlobalScope + |WorkerLocation|WorkerNavigator|XMLHttpRequest|XMLHttpRequestEventTarget|XMLSerializer|XPathExpression|XPathResult + |XSLTProcessor))\b(?!\$) + captures + + 1 + + name + support.variable.dom.tsx + + 2 + + name + support.class.dom.tsx + + + + + match + (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?: + (ATTRIBUTE_NODE|CDATA_SECTION_NODE|COMMENT_NODE|DOCUMENT_FRAGMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE + |DOMSTRING_SIZE_ERR|ELEMENT_NODE|ENTITY_NODE|ENTITY_REFERENCE_NODE|HIERARCHY_REQUEST_ERR|INDEX_SIZE_ERR + |INUSE_ATTRIBUTE_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR + |NOT_SUPPORTED_ERR|NOTATION_NODE|PROCESSING_INSTRUCTION_NODE|TEXT_NODE|WRONG_DOCUMENT_ERR) + | + (_content|[xyz]|abbr|above|accept|acceptCharset|accessKey|action|align|[av]Link(?:color)?|all|alt|anchors|appCodeName + |appCore|applets|appMinorVersion|appName|appVersion|archive|areas|arguments|attributes|availHeight|availLeft|availTop + |availWidth|axis|background|backgroundColor|backgroundImage|below|bgColor|body|border|borderBottomWidth|borderColor + |borderLeftWidth|borderRightWidth|borderStyle|borderTopWidth|borderWidth|bottom|bufferDepth|callee|caller|caption + |cellPadding|cells|cellSpacing|ch|characterSet|charset|checked|childNodes|chOff|cite|classes|className|clear + |clientInformation|clip|clipBoardData|closed|code|codeBase|codeType|color|colorDepth|cols|colSpan|compact|complete + |components|content|controllers|cookie|cookieEnabled|cords|cpuClass|crypto|current|data|dateTime|declare|defaultCharset + |defaultChecked|defaultSelected|defaultStatus|defaultValue|defaultView|defer|description|dialogArguments|dialogHeight + |dialogLeft|dialogTop|dialogWidth|dir|directories|disabled|display|docmain|doctype|documentElement|elements|embeds + |enabledPlugin|encoding|enctype|entities|event|expando|external|face|fgColor|filename|firstChild|fontFamily|fontSize + |fontWeight|form|formName|forms|frame|frameBorder|frameElement|frames|hasFocus|hash|headers|height|history|host + |hostname|href|hreflang|hspace|htmlFor|httpEquiv|id|ids|ignoreCase|images|implementation|index|innerHeight|innerWidth + |input|isMap|label|lang|language|lastChild|lastIndex|lastMatch|lastModified|lastParen|layer[sXY]|left|leftContext + |lineHeight|link|linkColor|links|listStyleType|localName|location|locationbar|longDesc|lowsrc|lowSrc|marginBottom + |marginHeight|marginLeft|marginRight|marginTop|marginWidth|maxLength|media|menubar|method|mimeTypes|multiline|multiple + |name|nameProp|namespaces|namespaceURI|next|nextSibling|nodeName|nodeType|nodeValue|noHref|noResize|noShade|notationName + |notations|noWrap|object|offscreenBuffering|onLine|onreadystatechange|opener|opsProfile|options|oscpu|outerHeight + |outerWidth|ownerDocument|paddingBottom|paddingLeft|paddingRight|paddingTop|page[XY]|page[XY]Offset|parent|parentLayer + |parentNode|parentWindow|pathname|personalbar|pixelDepth|pkcs11|platform|plugins|port|prefix|previous|previousDibling + |product|productSub|profile|profileend|prompt|prompter|protocol|publicId|readOnly|readyState|referrer|rel|responseText + |responseXML|rev|right|rightContext|rowIndex|rows|rowSpan|rules|scheme|scope|screen[XY]|screenLeft|screenTop|scripts + |scrollbars|scrolling|sectionRowIndex|security|securityPolicy|selected|selectedIndex|selection|self|shape|siblingAbove + |siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary + |systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead + |title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile + |vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\() + captures + + 1 + + name + punctuation.accessor.tsx + + 2 + + name + punctuation.accessor.optional.tsx + + 3 + + name + support.constant.dom.tsx + + 4 + + name + support.variable.property.dom.tsx + + + + + name + support.class.node.tsx + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Buffer|EventEmitter|Server|Pipe|Socket|REPLServer|ReadStream|WriteStream|Stream + |Inflate|Deflate|InflateRaw|DeflateRaw|GZip|GUnzip|Unzip|Zip)\b(?!\$) + + + match + (?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(process)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))(?: + (arch|argv|config|connected|env|execArgv|execPath|exitCode|mainModule|pid|platform|release|stderr|stdin|stdout|title|version|versions) + | + (abort|chdir|cwd|disconnect|exit|[sg]ete?[gu]id|send|[sg]etgroups|initgroups|kill|memoryUsage|nextTick|umask|uptime|hrtime) +))?\b(?!\$) + captures + + 1 + + name + support.variable.object.process.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + 4 + + name + support.variable.property.process.tsx + + 5 + + name + support.function.process.tsx + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(exports)|(module)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))(exports|id|filename|loaded|parent|children))?)\b(?!\$) + captures + + 1 + + name + support.type.object.module.tsx + + 2 + + name + support.type.object.module.tsx + + 3 + + name + punctuation.accessor.tsx + + 4 + + name + punctuation.accessor.optional.tsx + + 5 + + name + support.type.object.module.tsx + + + + + name + support.variable.object.node.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(global|GLOBAL|root|__dirname|__filename)\b(?!\$) + + + match + (?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* +(?: + (on(?:Rowsinserted|Rowsdelete|Rowenter|Rowexit|Resize|Resizestart|Resizeend|Reset| + Readystatechange|Mouseout|Mouseover|Mousedown|Mouseup|Mousemove| + Before(?:cut|deactivate|unload|update|paste|print|editfocus|activate)| + Blur|Scrolltop|Submit|Select|Selectstart|Selectionchange|Hover|Help| + Change|Contextmenu|Controlselect|Cut|Cellchange|Clock|Close|Deactivate| + Datasetchanged|Datasetcomplete|Dataavailable|Drop|Drag|Dragstart|Dragover| + Dragdrop|Dragenter|Dragend|Dragleave|Dblclick|Unload|Paste|Propertychange|Error| + Errorupdate|Keydown|Keyup|Keypress|Focus|Load|Activate|Afterupdate|Afterprint|Abort) + ) | + (shift|showModelessDialog|showModalDialog|showHelp|scroll|scrollX|scrollByPages| + scrollByLines|scrollY|scrollTo|stop|strike|sizeToContent|sidebar|signText|sort| + sup|sub|substr|substring|splice|split|send|set(?:Milliseconds|Seconds|Minutes|Hours| + Month|Year|FullYear|Date|UTC(?:Milliseconds|Seconds|Minutes|Hours|Month|FullYear|Date)| + Time|Hotkeys|Cursor|ZOptions|Active|Resizable|RequestHeader)|search|slice| + savePreferences|small|home|handleEvent|navigate|char|charCodeAt|charAt|concat| + contextual|confirm|compile|clear|captureEvents|call|createStyleSheet|createPopup| + createEventObject|to(?:GMTString|UTCString|String|Source|UpperCase|LowerCase|LocaleString)| + test|taint|taintEnabled|indexOf|italics|disableExternalCapture|dump|detachEvent|unshift| + untaint|unwatch|updateCommands|join|javaEnabled|pop|push|plugins.refresh|paddings|parse| + print|prompt|preference|enableExternalCapture|exec|execScript|valueOf|UTC|find|file| + fileModifiedDate|fileSize|fileCreatedDate|fileUpdatedDate|fixed|fontsize|fontcolor| + forward|fromCharCode|watch|link|load|lastIndexOf|anchor|attachEvent|atob|apply|alert| + abort|routeEvents|resize|resizeBy|resizeTo|recalc|returnValue|replace|reverse|reload| + releaseCapture|releaseEvents|go|get(?:Milliseconds|Seconds|Minutes|Hours|Month|Day|Year|FullYear| + Time|Date|TimezoneOffset|UTC(?:Milliseconds|Seconds|Minutes|Hours|Day|Month|FullYear|Date)| + Attention|Selection|ResponseHeader|AllResponseHeaders)|moveBy|moveBelow|moveTo| + moveToAbsolute|moveAbove|mergeAttributes|match|margins|btoa|big|bold|borderWidths|blink|back + ) | + (acceptNode|add|addEventListener|addTextTrack|adoptNode|after|animate|append| + appendChild|appendData|before|blur|canPlayType|captureStream| + caretPositionFromPoint|caretRangeFromPoint|checkValidity|clear|click| + cloneContents|cloneNode|cloneRange|close|closest|collapse| + compareBoundaryPoints|compareDocumentPosition|comparePoint|contains| + convertPointFromNode|convertQuadFromNode|convertRectFromNode|createAttribute| + createAttributeNS|createCaption|createCDATASection|createComment| + createContextualFragment|createDocument|createDocumentFragment| + createDocumentType|createElement|createElementNS|createEntityReference| + createEvent|createExpression|createHTMLDocument|createNodeIterator| + createNSResolver|createProcessingInstruction|createRange|createShadowRoot| + createTBody|createTextNode|createTFoot|createTHead|createTreeWalker|delete| + deleteCaption|deleteCell|deleteContents|deleteData|deleteRow|deleteTFoot| + deleteTHead|detach|disconnect|dispatchEvent|elementFromPoint|elementsFromPoint| + enableStyleSheetsForSet|entries|evaluate|execCommand|exitFullscreen| + exitPointerLock|expand|extractContents|fastSeek|firstChild|focus|forEach|get| + getAll|getAnimations|getAttribute|getAttributeNames|getAttributeNode| + getAttributeNodeNS|getAttributeNS|getBoundingClientRect|getBoxQuads| + getClientRects|getContext|getDestinationInsertionPoints|getElementById| + getElementsByClassName|getElementsByName|getElementsByTagName| + getElementsByTagNameNS|getItem|getNamedItem|getSelection|getStartDate| + getVideoPlaybackQuality|has|hasAttribute|hasAttributeNS|hasAttributes| + hasChildNodes|hasFeature|hasFocus|importNode|initEvent|insertAdjacentElement| + insertAdjacentHTML|insertAdjacentText|insertBefore|insertCell|insertData| + insertNode|insertRow|intersectsNode|isDefaultNamespace|isEqualNode| + isPointInRange|isSameNode|item|key|keys|lastChild|load|lookupNamespaceURI| + lookupPrefix|matches|move|moveAttribute|moveAttributeNode|moveChild| + moveNamedItem|namedItem|nextNode|nextSibling|normalize|observe|open| + parentNode|pause|play|postMessage|prepend|preventDefault|previousNode| + previousSibling|probablySupportsContext|queryCommandEnabled| + queryCommandIndeterm|queryCommandState|queryCommandSupported|queryCommandValue| + querySelector|querySelectorAll|registerContentHandler|registerElement| + registerProtocolHandler|releaseCapture|releaseEvents|remove|removeAttribute| + removeAttributeNode|removeAttributeNS|removeChild|removeEventListener| + removeItem|replace|replaceChild|replaceData|replaceWith|reportValidity| + requestFullscreen|requestPointerLock|reset|scroll|scrollBy|scrollIntoView| + scrollTo|seekToNextFrame|select|selectNode|selectNodeContents|set|setAttribute| + setAttributeNode|setAttributeNodeNS|setAttributeNS|setCapture| + setCustomValidity|setEnd|setEndAfter|setEndBefore|setItem|setNamedItem| + setRangeText|setSelectionRange|setSinkId|setStart|setStartAfter|setStartBefore| + slice|splitText|stepDown|stepUp|stopImmediatePropagation|stopPropagation| + submit|substringData|supports|surroundContents|takeRecords|terminate|toBlob| + toDataURL|toggle|toString|values|write|writeln + ) | + (all|catch|finally|race|reject|resolve|then + ) +)(?=\s*\() + captures + + 1 + + name + punctuation.accessor.tsx + + 2 + + name + punctuation.accessor.optional.tsx + + 3 + + name + support.function.event-handler.tsx + + 4 + + name + support.function.tsx + + 5 + + name + support.function.dom.tsx + + 6 + + name + support.function.promise.tsx + + + + + + identifiers + + patterns + + + include + #object-identifiers + + + match + (?x)(?:(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\s*=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) +) | +( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends +) | +# arrow function possible to detect only with => on same line +( + (<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*(((const\s+)?[_$[:alpha:]])|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator +) + )) +)) + captures + + 1 + + name + punctuation.accessor.tsx + + 2 + + name + punctuation.accessor.optional.tsx + + 3 + + name + entity.name.function.tsx + + + + + match + (?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]]) + captures + + 1 + + name + punctuation.accessor.tsx + + 2 + + name + punctuation.accessor.optional.tsx + + 3 + + name + variable.other.constant.property.tsx + + + + + match + (?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + punctuation.accessor.tsx + + 2 + + name + punctuation.accessor.optional.tsx + + 3 + + name + variable.other.property.tsx + + + + + name + variable.other.constant.tsx + match + ([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]]) + + + name + variable.other.readwrite.tsx + match + [_$[:alpha:]][_$[:alnum:]]* + + + + object-identifiers + + patterns + + + name + support.class.tsx + match + ([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\??\.\s*prototype\b(?!\$)) + + + match + (?x)(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(?: + (\#?[[:upper:]][_$[:digit:][:upper:]]*) | + (\#?[_$[:alpha:]][_$[:alnum:]]*) +)(?=\s*\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + punctuation.accessor.tsx + + 2 + + name + punctuation.accessor.optional.tsx + + 3 + + name + variable.other.constant.object.property.tsx + + 4 + + name + variable.other.object.property.tsx + + + + + match + (?x)(?: + ([[:upper:]][_$[:digit:][:upper:]]*) | + ([_$[:alpha:]][_$[:alnum:]]*) +)(?=\s*\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + variable.other.constant.object.tsx + + 2 + + name + variable.other.object.tsx + + + + + + type-annotation + + patterns + + + name + meta.type.annotation.tsx + begin + (:)(?=\s*\S) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.tsx + + + end + (?<![:|&])(?!\s*[|&]\s+)((?=^|[,);\}\]]|//)|(?==[^>])|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{))) + patterns + + + include + #type + + + + + name + meta.type.annotation.tsx + begin + (:) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.tsx + + + end + (?<![:|&])((?=[,);\}\]]|\/\/)|(?==[^>])|(?=^\s*$)|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{))) + patterns + + + include + #type + + + + + + parameter-type-annotation + + patterns + + + name + meta.type.annotation.tsx + begin + (:) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.tsx + + + end + (?=[,)])|(?==[^>]) + patterns + + + include + #type + + + + + + return-type + + patterns + + + name + meta.return.type.tsx + begin + (?<=\))\s*(:)(?=\s*\S) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.tsx + + + end + (?<![:|&])(?=$|^|[{};,]|//) + patterns + + + include + #return-type-core + + + + + name + meta.return.type.tsx + begin + (?<=\))\s*(:) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.tsx + + + end + (?<![:|&])((?=[{};,]|//|^\s*$)|((?<=\S)(?=\s*$))) + patterns + + + include + #return-type-core + + + + + + return-type-core + + patterns + + + include + #comment + + + begin + (?<=[:|&])(?=\s*\{) + end + (?<=\}) + patterns + + + include + #type-object + + + + + include + #type-predicate-operator + + + include + #type + + + + arrow-return-type + + name + meta.return.type.arrow.tsx + begin + (?<=\))\s*(:) + beginCaptures + + 1 + + name + keyword.operator.type.annotation.tsx + + + end + (?==>|\{|(^\s*(export|function|class|interface|let|var|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|const|import|enum|namespace|module|type|abstract|declare)\s+)) + patterns + + + include + #arrow-return-type-body + + + + possibly-arrow-return-type + + begin + (?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>) + beginCaptures + + 1 + + name + meta.arrow.tsx meta.return.type.arrow.tsx keyword.operator.type.annotation.tsx + + + end + (?==>|\{|(^\s*(export|function|class|interface|let|var|(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)|(?:\bawait\s+(?:\busing(?=\s+(?!in\b|of\b(?!\s*(?:of\b|=)))[_$[:alpha:]])\b)\b)|const|import|enum|namespace|module|type|abstract|declare)\s+)) + contentName + meta.arrow.tsx meta.return.type.arrow.tsx + patterns + + + include + #arrow-return-type-body + + + + arrow-return-type-body + + patterns + + + begin + (?<=[:])(?=\s*\{) + end + (?<=\}) + patterns + + + include + #type-object + + + + + include + #type-predicate-operator + + + include + #type + + + + type-parameters + + name + meta.type.parameters.tsx + begin + (<) + beginCaptures + + 1 + + name + punctuation.definition.typeparameters.begin.tsx + + + end + (>) + endCaptures + + 1 + + name + punctuation.definition.typeparameters.end.tsx + + + patterns + + + include + #comment + + + name + storage.modifier.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(extends|in|out|const)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + include + #type + + + include + #punctuation-comma + + + name + keyword.operator.assignment.tsx + match + (=)(?!>) + + + + type-arguments + + name + meta.type.parameters.tsx + begin + \< + beginCaptures + + 0 + + name + punctuation.definition.typeparameters.begin.tsx + + + end + \> + endCaptures + + 0 + + name + punctuation.definition.typeparameters.end.tsx + + + patterns + + + include + #type-arguments-body + + + + type-arguments-body + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(_)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + captures + + 0 + + name + keyword.operator.type.tsx + + + + + include + #type + + + include + #punctuation-comma + + + + type + + patterns + + + include + #comment + + + include + #type-string + + + include + #numeric-literal + + + include + #type-primitive + + + include + #type-builtin-literals + + + include + #type-parameters + + + include + #type-tuple + + + include + #type-object + + + include + #type-operators + + + include + #type-conditional + + + include + #type-fn-type-parameters + + + include + #type-paren-or-function-parameters + + + include + #type-function-return-type + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(readonly)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s* + captures + + 1 + + name + storage.modifier.tsx + + + + + include + #type-name + + + + type-primitive + + name + support.type.primitive.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|bigint|boolean|symbol|any|void|never|unknown)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + type-builtin-literals + + name + support.type.builtin.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(this|true|false|undefined|null|object)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + type-tuple + + name + meta.type.tuple.tsx + begin + \[ + beginCaptures + + 0 + + name + meta.brace.square.tsx + + + end + \] + endCaptures + + 0 + + name + meta.brace.square.tsx + + + patterns + + + name + keyword.operator.rest.tsx + match + \.\.\. + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))([_$[:alpha:]][_$[:alnum:]]*)\s*(\?)?\s*(:) + captures + + 1 + + name + entity.name.label.tsx + + 2 + + name + keyword.operator.optional.tsx + + 3 + + name + punctuation.separator.label.tsx + + + + + include + #type + + + include + #punctuation-comma + + + + type-object + + name + meta.object.type.tsx + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.block.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.block.tsx + + + patterns + + + include + #comment + + + include + #method-declaration + + + include + #indexer-declaration + + + include + #indexer-mapped-type-declaration + + + include + #field-declaration + + + include + #type-annotation + + + begin + \.\.\. + beginCaptures + + 0 + + name + keyword.operator.spread.tsx + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #type + + + + + include + #punctuation-comma + + + include + #punctuation-semicolon + + + include + #type + + + + type-conditional + + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(extends)\s+ + beginCaptures + + 1 + + name + storage.modifier.tsx + + + end + (?<=:) + patterns + + + begin + \? + beginCaptures + + 0 + + name + keyword.operator.ternary.tsx + + + end + : + endCaptures + + 0 + + name + keyword.operator.ternary.tsx + + + patterns + + + include + #type + + + + + include + #type + + + + + + type-paren-or-function-parameters + + name + meta.type.paren.cover.tsx + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.tsx + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.tsx + + + patterns + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=\s*(:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) +)) | +(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) | +(:\s*((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))))) + captures + + 1 + + name + storage.modifier.tsx + + 2 + + name + keyword.operator.rest.tsx + + 3 + + name + entity.name.function.tsx variable.language.this.tsx + + 4 + + name + entity.name.function.tsx + + 5 + + name + keyword.operator.optional.tsx + + + + + match + (?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=:) + captures + + 1 + + name + storage.modifier.tsx + + 2 + + name + keyword.operator.rest.tsx + + 3 + + name + variable.parameter.tsx variable.language.this.tsx + + 4 + + name + variable.parameter.tsx + + 5 + + name + keyword.operator.optional.tsx + + + + + include + #type-annotation + + + name + punctuation.separator.parameter.tsx + match + , + + + include + #type + + + + type-fn-type-parameters + + patterns + + + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b(?=\s*\<) + beginCaptures + + 1 + + name + meta.type.constructor.tsx storage.modifier.tsx + + 2 + + name + meta.type.constructor.tsx keyword.control.new.tsx + + + end + (?<=>) + patterns + + + include + #comment + + + include + #type-parameters + + + + + name + meta.type.constructor.tsx + begin + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b\s*(?=\() + beginCaptures + + 1 + + name + storage.modifier.tsx + + 2 + + name + keyword.control.new.tsx + + + end + (?<=\)) + patterns + + + include + #function-parameters + + + + + name + meta.type.function.tsx + begin + (?x)( + (?= + [(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + ) + ) +) + end + (?<=\)) + patterns + + + include + #function-parameters + + + + + + type-function-return-type + + patterns + + + name + meta.type.function.return.tsx + begin + (=>)(?=\s*\S) + beginCaptures + + 1 + + name + storage.type.function.arrow.tsx + + + end + (?<!=>)(?<![|&])(?=[,\]\)\{\}=;>:\?]|//|$) + patterns + + + include + #type-function-return-type-core + + + + + name + meta.type.function.return.tsx + begin + => + beginCaptures + + 0 + + name + storage.type.function.arrow.tsx + + + end + (?<!=>)(?<![|&])((?=[,\]\)\{\}=;:\?>]|//|^\s*$)|((?<=\S)(?=\s*$))) + patterns + + + include + #type-function-return-type-core + + + + + + type-function-return-type-core + + patterns + + + include + #comment + + + begin + (?<==>)(?=\s*\{) + end + (?<=\}) + patterns + + + include + #type-object + + + + + include + #type-predicate-operator + + + include + #type + + + + type-operators + + patterns + + + include + #typeof-operator + + + include + #type-infer + + + begin + ([&|])(?=\s*\{) + beginCaptures + + 0 + + name + keyword.operator.type.tsx + + + end + (?<=\}) + patterns + + + include + #type-object + + + + + begin + [&|] + beginCaptures + + 0 + + name + keyword.operator.type.tsx + + + end + (?=\S) + + + name + keyword.operator.expression.keyof.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))keyof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.operator.ternary.tsx + match + (\?|\:) + + + name + keyword.operator.expression.import.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\() + + + + type-infer + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(infer)\s+([_$[:alpha:]][_$[:alnum:]]*)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))(?:\s+(extends)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))? + name + meta.type.infer.tsx + captures + + 1 + + name + keyword.operator.expression.infer.tsx + + 2 + + name + entity.name.type.tsx + + 3 + + name + keyword.operator.expression.extends.tsx + + + + + + type-predicate-operator + + patterns + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(asserts)\s+)?(?!asserts)(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s(is)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + captures + + 1 + + name + keyword.operator.type.asserts.tsx + + 2 + + name + variable.parameter.tsx variable.language.this.tsx + + 3 + + name + variable.parameter.tsx + + 4 + + name + keyword.operator.expression.is.tsx + + + + + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(asserts)\s+(?!is)(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + captures + + 1 + + name + keyword.operator.type.asserts.tsx + + 2 + + name + variable.parameter.tsx variable.language.this.tsx + + 3 + + name + variable.parameter.tsx + + + + + name + keyword.operator.type.asserts.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))asserts(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + name + keyword.operator.expression.is.tsx + match + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))is(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)) + + + + type-name + + patterns + + + begin + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(<) + captures + + 1 + + name + entity.name.type.module.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + 4 + + name + meta.type.parameters.tsx punctuation.definition.typeparameters.begin.tsx + + + end + (>) + endCaptures + + 1 + + name + meta.type.parameters.tsx punctuation.definition.typeparameters.end.tsx + + + contentName + meta.type.parameters.tsx + patterns + + + include + #type-arguments-body + + + + + begin + ([_$[:alpha:]][_$[:alnum:]]*)\s*(<) + beginCaptures + + 1 + + name + entity.name.type.tsx + + 2 + + name + meta.type.parameters.tsx punctuation.definition.typeparameters.begin.tsx + + + end + (>) + endCaptures + + 1 + + name + meta.type.parameters.tsx punctuation.definition.typeparameters.end.tsx + + + contentName + meta.type.parameters.tsx + patterns + + + include + #type-arguments-body + + + + + match + ([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]]))) + captures + + 1 + + name + entity.name.type.module.tsx + + 2 + + name + punctuation.accessor.tsx + + 3 + + name + punctuation.accessor.optional.tsx + + + + + name + entity.name.type.tsx + match + [_$[:alpha:]][_$[:alnum:]]* + + + + punctuation-comma + + name + punctuation.separator.comma.tsx + match + , + + punctuation-semicolon + + name + punctuation.terminator.statement.tsx + match + ; + + punctuation-accessor + + match + (?:(\.)|(\?\.(?!\s*[[:digit:]]))) + captures + + 1 + + name + punctuation.accessor.tsx + + 2 + + name + punctuation.accessor.optional.tsx + + + + string + + patterns + + + include + #qstring-single + + + include + #qstring-double + + + include + #template + + + + qstring-double + + name + string.quoted.double.tsx + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.tsx + + + end + (")|((?:[^\\\n])$) + endCaptures + + 1 + + name + punctuation.definition.string.end.tsx + + 2 + + name + invalid.illegal.newline.tsx + + + patterns + + + include + #string-character-escape + + + + qstring-single + + name + string.quoted.single.tsx + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.tsx + + + end + (\')|((?:[^\\\n])$) + endCaptures + + 1 + + name + punctuation.definition.string.end.tsx + + 2 + + name + invalid.illegal.newline.tsx + + + patterns + + + include + #string-character-escape + + + + string-character-escape + + name + constant.character.escape.tsx + match + \\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]+\}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$) + + template + + patterns + + + include + #template-call + + + contentName + string.template.tsx + begin + ([_$[:alpha:]][_$[:alnum:]]*)?(`) + beginCaptures + + 1 + + name + entity.name.function.tagged-template.tsx + + 2 + + name + string.template.tsx punctuation.definition.string.template.begin.tsx + + + end + ` + endCaptures + + 0 + + name + string.template.tsx punctuation.definition.string.template.end.tsx + + + patterns + + + include + #template-substitution-element + + + include + #string-character-escape + + + + + + template-call + + patterns + + + begin + (?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`) + end + (?=`) + patterns + + + begin + (?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)) + end + (?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`) + patterns + + + include + #support-function-call-identifiers + + + name + entity.name.function.tagged-template.tsx + match + ([_$[:alpha:]][_$[:alnum:]]*) + + + + + include + #type-arguments + + + + + begin + ([_$[:alpha:]][_$[:alnum:]]*)?\s*(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`) + beginCaptures + + 1 + + name + entity.name.function.tagged-template.tsx + + + end + (?=`) + patterns + + + include + #type-arguments + + + + + + template-substitution-element + + name + meta.template.expression.tsx + begin + \$\{ + beginCaptures + + 0 + + name + punctuation.definition.template-expression.begin.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.template-expression.end.tsx + + + patterns + + + include + #expression + + + contentName + meta.embedded.line.tsx + + type-string + + patterns + + + include + #qstring-single + + + include + #qstring-double + + + include + #template-type + + + + template-type + + patterns + + + include + #template-call + + + contentName + string.template.tsx + begin + ([_$[:alpha:]][_$[:alnum:]]*)?(`) + beginCaptures + + 1 + + name + entity.name.function.tagged-template.tsx + + 2 + + name + string.template.tsx punctuation.definition.string.template.begin.tsx + + + end + ` + endCaptures + + 0 + + name + string.template.tsx punctuation.definition.string.template.end.tsx + + + patterns + + + include + #template-type-substitution-element + + + include + #string-character-escape + + + + + + template-type-substitution-element + + name + meta.template.expression.tsx + begin + \$\{ + beginCaptures + + 0 + + name + punctuation.definition.template-expression.begin.tsx + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.template-expression.end.tsx + + + patterns + + + include + #type + + + contentName + meta.embedded.line.tsx + + regex + + patterns + + + name + string.regexp.tsx + begin + (?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([dgimsuvy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + beginCaptures + + 1 + + name + punctuation.definition.string.begin.tsx + + + end + (/)([dgimsuvy]*) + endCaptures + + 1 + + name + punctuation.definition.string.end.tsx + + 2 + + name + keyword.other.tsx + + + patterns + + + include + #regexp + + + + + name + string.regexp.tsx + begin + ((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuvy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$])) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.tsx + + + end + (/)([dgimsuvy]*) + endCaptures + + 1 + + name + punctuation.definition.string.end.tsx + + 2 + + name + keyword.other.tsx + + + patterns + + + include + #regexp + + + + + + regexp + + patterns + + + name + keyword.control.anchor.regexp + match + \\[bB]|\^|\$ + + + match + \\[1-9]\d*|\\k<([a-zA-Z_$][\w$]*)> + captures + + 0 + + name + keyword.other.back-reference.regexp + + 1 + + name + variable.other.regexp + + + + + name + keyword.operator.quantifier.regexp + match + [?+*]|\{(\d+,\d+|\d+,|,\d+|\d+)\}\?? + + + name + keyword.operator.or.regexp + match + \| + + + name + meta.group.assertion.regexp + begin + (\()((\?=)|(\?!)|(\?<=)|(\?<!)) + beginCaptures + + 1 + + name + punctuation.definition.group.regexp + + 2 + + name + punctuation.definition.group.assertion.regexp + + 3 + + name + meta.assertion.look-ahead.regexp + + 4 + + name + meta.assertion.negative-look-ahead.regexp + + 5 + + name + meta.assertion.look-behind.regexp + + 6 + + name + meta.assertion.negative-look-behind.regexp + + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.group.regexp + + + patterns + + + include + #regexp + + + + + name + meta.group.regexp + begin + \((?:(\?:)|(?:\?<([a-zA-Z_$][\w$]*)>))? + beginCaptures + + 0 + + name + punctuation.definition.group.regexp + + 1 + + name + punctuation.definition.group.no-capture.regexp + + 2 + + name + variable.other.regexp + + + end + \) + endCaptures + + 0 + + name + punctuation.definition.group.regexp + + + patterns + + + include + #regexp + + + + + name + constant.other.character-class.set.regexp + begin + (\[)(\^)? + beginCaptures + + 1 + + name + punctuation.definition.character-class.regexp + + 2 + + name + keyword.operator.negation.regexp + + + end + (\]) + endCaptures + + 1 + + name + punctuation.definition.character-class.regexp + + + patterns + + + name + constant.other.character-class.range.regexp + match + (?:.|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))\-(?:[^\]\\]|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.)) + captures + + 1 + + name + constant.character.numeric.regexp + + 2 + + name + constant.character.control.regexp + + 3 + + name + constant.character.escape.backslash.regexp + + 4 + + name + constant.character.numeric.regexp + + 5 + + name + constant.character.control.regexp + + 6 + + name + constant.character.escape.backslash.regexp + + + + + include + #regex-character-class + + + + + include + #regex-character-class + + + + regex-character-class + + patterns + + + name + constant.other.character-class.regexp + match + \\[wWsSdDtrnvf]|\. + + + name + constant.character.numeric.regexp + match + \\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}) + + + name + constant.character.control.regexp + match + \\c[A-Z] + + + name + constant.character.escape.backslash.regexp + match + \\. + + + + comment + + patterns + + + name + comment.block.documentation.tsx + begin + /\*\*(?!/) + beginCaptures + + 0 + + name + punctuation.definition.comment.tsx + + + end + \*/ + endCaptures + + 0 + + name + punctuation.definition.comment.tsx + + + patterns + + + include + #docblock + + + + + name + comment.block.tsx + begin + (/\*)(?:\s*((@)internal)(?=\s|(\*/)))? + beginCaptures + + 1 + + name + punctuation.definition.comment.tsx + + 2 + + name + storage.type.internaldeclaration.tsx + + 3 + + name + punctuation.decorator.internaldeclaration.tsx + + + end + \*/ + endCaptures + + 0 + + name + punctuation.definition.comment.tsx + + + + + begin + (^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.tsx + + 2 + + name + comment.line.double-slash.tsx + + 3 + + name + punctuation.definition.comment.tsx + + 4 + + name + storage.type.internaldeclaration.tsx + + 5 + + name + punctuation.decorator.internaldeclaration.tsx + + + end + (?=$) + contentName + comment.line.double-slash.tsx + + + + single-line-comment-consuming-line-ending + + begin + (^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.tsx + + 2 + + name + comment.line.double-slash.tsx + + 3 + + name + punctuation.definition.comment.tsx + + 4 + + name + storage.type.internaldeclaration.tsx + + 5 + + name + punctuation.decorator.internaldeclaration.tsx + + + end + (?=^) + contentName + comment.line.double-slash.tsx + + directives + + name + comment.line.triple-slash.directive.tsx + begin + ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name|resolution-mode)\s*=\s*((\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)))+\s*/>\s*$) + beginCaptures + + 1 + + name + punctuation.definition.comment.tsx + + + end + (?=$) + patterns + + + name + meta.tag.tsx + begin + (<)(reference|amd-dependency|amd-module) + beginCaptures + + 1 + + name + punctuation.definition.tag.directive.tsx + + 2 + + name + entity.name.tag.directive.tsx + + + end + /> + endCaptures + + 0 + + name + punctuation.definition.tag.directive.tsx + + + patterns + + + name + entity.other.attribute-name.directive.tsx + match + path|types|no-default-lib|lib|name|resolution-mode + + + name + keyword.operator.assignment.tsx + match + = + + + include + #string + + + + + + docblock + + patterns + + + match + (?x) +((@)(?:access|api)) +\s+ +(private|protected|public) +\b + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + constant.language.access-type.jsdoc + + + + + match + (?x) +((@)author) +\s+ +( + [^@\s<>*/] + (?:[^@<>*/]|\*[^/])* +) +(?: + \s* + (<) + ([^>\s]+) + (>) +)? + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + entity.name.type.instance.jsdoc + + 4 + + name + punctuation.definition.bracket.angle.begin.jsdoc + + 5 + + name + constant.other.email.link.underline.jsdoc + + 6 + + name + punctuation.definition.bracket.angle.end.jsdoc + + + + + match + (?x) +((@)borrows) \s+ +((?:[^@\s*/]|\*[^/])+) # <that namepath> +\s+ (as) \s+ # as +((?:[^@\s*/]|\*[^/])+) # <this namepath> + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + entity.name.type.instance.jsdoc + + 4 + + name + keyword.operator.control.jsdoc + + 5 + + name + entity.name.type.instance.jsdoc + + + + + name + meta.example.jsdoc + begin + ((@)example)\s+ + end + (?=@|\*/) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + patterns + + + match + ^\s\*\s+ + + + contentName + constant.other.description.jsdoc + begin + \G(<)caption(>) + beginCaptures + + 0 + + name + entity.name.tag.inline.jsdoc + + 1 + + name + punctuation.definition.bracket.angle.begin.jsdoc + + 2 + + name + punctuation.definition.bracket.angle.end.jsdoc + + + end + (</)caption(>)|(?=\*/) + endCaptures + + 0 + + name + entity.name.tag.inline.jsdoc + + 1 + + name + punctuation.definition.bracket.angle.begin.jsdoc + + 2 + + name + punctuation.definition.bracket.angle.end.jsdoc + + + + + match + [^\s@*](?:[^*]|\*[^/])* + captures + + 0 + + name + source.embedded.tsx + + + + + + + match + (?x) ((@)kind) \s+ (class|constant|event|external|file|function|member|mixin|module|namespace|typedef) \b + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + constant.language.symbol-type.jsdoc + + + + + match + (?x) +((@)see) +\s+ +(?: + # URL + ( + (?=https?://) + (?:[^\s*]|\*[^/])+ + ) + | + # JSDoc namepath + ( + (?! + # Avoid matching bare URIs (also acceptable as links) + https?:// + | + # Avoid matching {@inline tags}; we match those below + (?:\[[^\[\]]*\])? # Possible description [preceding]{@tag} + {@(?:link|linkcode|linkplain|tutorial)\b + ) + # Matched namepath + (?:[^@\s*/]|\*[^/])+ + ) +) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.link.underline.jsdoc + + 4 + + name + entity.name.type.instance.jsdoc + + + + + match + (?x) +((@)template) +\s+ +# One or more valid identifiers +( + [A-Za-z_$] # First character: non-numeric word character + [\w$.\[\]]* # Rest of identifier + (?: # Possible list of additional identifiers + \s* , \s* + [A-Za-z_$] + [\w$.\[\]]* + )* +) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.jsdoc + + + + + begin + (?x)((@)template)\s+(?={) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + end + (?=\s|\*/|[^{}\[\]A-Za-z_$]) + patterns + + + include + #jsdoctype + + + name + variable.other.jsdoc + match + ([A-Za-z_$][\w$.\[\]]*) + + + + + match + (?x) +( + (@) + (?:arg|argument|const|constant|member|namespace|param|var) +) +\s+ +( + [A-Za-z_$] + [\w$.\[\]]* +) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.jsdoc + + + + + begin + ((@)typedef)\s+(?={) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + end + (?=\s|\*/|[^{}\[\]A-Za-z_$]) + patterns + + + include + #jsdoctype + + + name + entity.name.type.instance.jsdoc + match + (?:[^@\s*/]|\*[^/])+ + + + + + begin + ((@)(?:arg|argument|const|constant|member|namespace|param|prop|property|var))\s+(?={) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + end + (?=\s|\*/|[^{}\[\]A-Za-z_$]) + patterns + + + include + #jsdoctype + + + name + variable.other.jsdoc + match + ([A-Za-z_$][\w$.\[\]]*) + + + name + variable.other.jsdoc + match + (?x) +(\[)\s* +[\w$]+ +(?: + (?:\[\])? # Foo[ ].bar properties within an array + \. # Foo.Bar namespaced parameter + [\w$]+ +)* +(?: + \s* + (=) # [foo=bar] Default parameter value + \s* + ( + # The inner regexes are to stop the match early at */ and to not stop at escaped quotes + (?> + "(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted + '(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted + \[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal + (?:(?:\*(?!/))|\s(?!\s*\])|\[.*?(?:\]|(?=\*/))|[^*\s\[\]])* # Everything else + )* + ) +)? +\s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/)) + captures + + 1 + + name + punctuation.definition.optional-value.begin.bracket.square.jsdoc + + 2 + + name + keyword.operator.assignment.jsdoc + + 3 + + name + source.embedded.tsx + + 4 + + name + punctuation.definition.optional-value.end.bracket.square.jsdoc + + 5 + + name + invalid.illegal.syntax.jsdoc + + + + + + + begin + (?x) +( + (@) + (?:define|enum|exception|export|extends|lends|implements|modifies + |namespace|private|protected|returns?|satisfies|suppress|this|throws|type + |yields?) +) +\s+(?={) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + end + (?=\s|\*/|[^{}\[\]A-Za-z_$]) + patterns + + + include + #jsdoctype + + + + + match + (?x) +( + (@) + (?:alias|augments|callback|constructs|emits|event|fires|exports? + |extends|external|function|func|host|lends|listens|interface|memberof!? + |method|module|mixes|mixin|name|requires|see|this|typedef|uses) +) +\s+ +( + (?: + [^{}@\s*] | \*[^/] + )+ +) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + entity.name.type.instance.jsdoc + + + + + contentName + variable.other.jsdoc + begin + ((@)(?:default(?:value)?|license|version))\s+(([''"])) + beginCaptures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.jsdoc + + 4 + + name + punctuation.definition.string.begin.jsdoc + + + end + (\3)|(?=$|\*/) + endCaptures + + 0 + + name + variable.other.jsdoc + + 1 + + name + punctuation.definition.string.end.jsdoc + + + + + match + ((@)(?:default(?:value)?|license|tutorial|variation|version))\s+([^\s*]+) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + 3 + + name + variable.other.jsdoc + + + + + name + storage.type.class.jsdoc + match + (?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|generator|global|hideconstructor|host|ignore|implements|implicitCast|inherit[Dd]oc |inner|instance|interface|internal|kind|lends|license|listens|main|member|memberof!?|method |mixes|mixins?|modifies|module|name|namespace|noalias|nocollapse|nocompile|nosideeffects |override|overview|package|param|polymer(?:Behavior)?|preserve|private|prop|property|protected |public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary |suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce|yields?) \b + captures + + 1 + + name + punctuation.definition.block.tag.jsdoc + + + + + include + #inline-tags + + + match + ((@)(?:[_$[:alpha:]][_$[:alnum:]]*))(?=\s+) + captures + + 1 + + name + storage.type.class.jsdoc + + 2 + + name + punctuation.definition.block.tag.jsdoc + + + + + + brackets + + patterns + + + begin + { + end + }|(?=\*/) + patterns + + + include + #brackets + + + + + begin + \[ + end + \]|(?=\*/) + patterns + + + include + #brackets + + + + + + inline-tags + + patterns + + + name + constant.other.description.jsdoc + match + (\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial)) + captures + + 1 + + name + punctuation.definition.bracket.square.begin.jsdoc + + 2 + + name + punctuation.definition.bracket.square.end.jsdoc + + + + + name + entity.name.type.instance.jsdoc + begin + ({)((@)(?:link(?:code|plain)?|tutorial))\s* + beginCaptures + + 1 + + name + punctuation.definition.bracket.curly.begin.jsdoc + + 2 + + name + storage.type.class.jsdoc + + 3 + + name + punctuation.definition.inline.tag.jsdoc + + + end + }|(?=\*/) + endCaptures + + 0 + + name + punctuation.definition.bracket.curly.end.jsdoc + + + patterns + + + match + \G((?=https?://)(?:[^|}\s*]|\*[/])+)(\|)? + captures + + 1 + + name + variable.other.link.underline.jsdoc + + 2 + + name + punctuation.separator.pipe.jsdoc + + + + + match + \G((?:[^{}@\s|*]|\*[^/])+)(\|)? + captures + + 1 + + name + variable.other.description.jsdoc + + 2 + + name + punctuation.separator.pipe.jsdoc + + + + + + + + jsdoctype + + patterns + + + name + invalid.illegal.type.jsdoc + match + \G{(?:[^}*]|\*[^/}])+$ + + + contentName + entity.name.type.instance.jsdoc + begin + \G({) + beginCaptures + + 0 + + name + entity.name.type.instance.jsdoc + + 1 + + name + punctuation.definition.bracket.curly.begin.jsdoc + + + end + ((}))\s*|(?=\*/) + endCaptures + + 1 + + name + entity.name.type.instance.jsdoc + + 2 + + name + punctuation.definition.bracket.curly.end.jsdoc + + + patterns + + + include + #brackets + + + + + + jsx + + patterns + + + include + #jsx-tag-without-attributes-in-expression + + + include + #jsx-tag-in-expression + + + + jsx-tag-without-attributes-in-expression + + begin + (?<!\+\+|--)(?<=[({\[,?=>:*]|&&|\|\||\?|\*\/|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s*(?=(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>)) + end + (?!(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>)) + patterns + + + include + #jsx-tag-without-attributes + + + + jsx-tag-without-attributes + + name + meta.tag.without-attributes.tsx + begin + (<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>) + end + (</)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.tsx + + 2 + + name + entity.name.tag.namespace.tsx + + 3 + + name + punctuation.separator.namespace.tsx + + 4 + + name + entity.name.tag.tsx + + 5 + + name + support.class.component.tsx + + 6 + + name + punctuation.definition.tag.end.tsx + + + endCaptures + + 1 + + name + punctuation.definition.tag.begin.tsx + + 2 + + name + entity.name.tag.namespace.tsx + + 3 + + name + punctuation.separator.namespace.tsx + + 4 + + name + entity.name.tag.tsx + + 5 + + name + support.class.component.tsx + + 6 + + name + punctuation.definition.tag.end.tsx + + + contentName + meta.jsx.children.tsx + patterns + + + include + #jsx-children + + + + jsx-tag-in-expression + + begin + (?x) + (?<!\+\+|--)(?<=[({\[,?=>:*]|&&|\|\||\?|\*\/|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s* + (?!<\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s+[^=>])|,)) # look ahead is not type parameter of arrow + (?=(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>)) + end + (?!(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>)) + patterns + + + include + #jsx-tag + + + + jsx-tag + + name + meta.tag.tsx + begin + (?=(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>)) + end + (/>)|(?:(</)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))?\s*(>)) + endCaptures + + 1 + + name + punctuation.definition.tag.end.tsx + + 2 + + name + punctuation.definition.tag.begin.tsx + + 3 + + name + entity.name.tag.namespace.tsx + + 4 + + name + punctuation.separator.namespace.tsx + + 5 + + name + entity.name.tag.tsx + + 6 + + name + support.class.component.tsx + + 7 + + name + punctuation.definition.tag.end.tsx + + + patterns + + + begin + (<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$[:alpha:]][-_$[:alnum:].]*))(?<!\.|-))(?=((<\s*)|(\s+))(?!\?)|\/?>) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.tsx + + 2 + + name + entity.name.tag.namespace.tsx + + 3 + + name + punctuation.separator.namespace.tsx + + 4 + + name + entity.name.tag.tsx + + 5 + + name + support.class.component.tsx + + + end + (?=[/]?>) + patterns + + + include + #comment + + + include + #type-arguments + + + include + #jsx-tag-attributes + + + + + begin + (>) + beginCaptures + + 1 + + name + punctuation.definition.tag.end.tsx + + + end + (?=</) + contentName + meta.jsx.children.tsx + patterns + + + include + #jsx-children + + + + + + jsx-children + + patterns + + + include + #jsx-tag-without-attributes + + + include + #jsx-tag + + + include + #jsx-evaluated-code + + + include + #jsx-entities + + + + jsx-evaluated-code + + contentName + meta.embedded.expression.tsx + begin + \{ + end + \} + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.tsx + + + endCaptures + + 0 + + name + punctuation.section.embedded.end.tsx + + + patterns + + + include + #expression + + + + jsx-entities + + patterns + + + name + constant.character.entity.tsx + match + (&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;) + captures + + 1 + + name + punctuation.definition.entity.tsx + + 3 + + name + punctuation.definition.entity.tsx + + + + + + jsx-tag-attributes + + name + meta.tag.attributes.tsx + begin + \s+ + end + (?=[/]?>) + patterns + + + include + #comment + + + include + #jsx-tag-attribute-name + + + include + #jsx-tag-attribute-assignment + + + include + #jsx-string-double-quoted + + + include + #jsx-string-single-quoted + + + include + #jsx-evaluated-code + + + include + #jsx-tag-attributes-illegal + + + + jsx-tag-attribute-name + + match + (?x) + \s* + (?:([_$[:alpha:]][-_$[:alnum:].]*)(:))? + ([_$[:alpha:]][-_$[:alnum:]]*) + (?=\s|=|/?>|/\*|//) + captures + + 1 + + name + entity.other.attribute-name.namespace.tsx + + 2 + + name + punctuation.separator.namespace.tsx + + 3 + + name + entity.other.attribute-name.tsx + + + + jsx-tag-attribute-assignment + + name + keyword.operator.assignment.tsx + match + =(?=\s*(?:'|"|{|/\*|//|\n)) + + jsx-string-double-quoted + + name + string.quoted.double.tsx + begin + " + end + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.tsx + + + endCaptures + + 0 + + name + punctuation.definition.string.end.tsx + + + patterns + + + include + #jsx-entities + + + + jsx-string-single-quoted + + name + string.quoted.single.tsx + begin + ' + end + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.tsx + + + endCaptures + + 0 + + name + punctuation.definition.string.end.tsx + + + patterns + + + include + #jsx-entities + + + + jsx-tag-attributes-illegal + + name + invalid.illegal.attribute.tsx + match + \S+ + + + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/xml.plist b/src/file-viewer/highlight-grammar/xml.plist new file mode 100644 index 0000000..66d1012 --- /dev/null +++ b/src/file-viewer/highlight-grammar/xml.plist @@ -0,0 +1,573 @@ + + + + + fileTypes + + xml + xsd + tld + jsp + pt + cpt + dtml + rss + opml + + keyEquivalent + ^~X + name + XML + patterns + + + begin + (<\?)\s*([-_a-zA-Z0-9]+) + captures + + 1 + + name + punctuation.definition.tag.xml + + 2 + + name + entity.name.tag.xml + + + end + (\?>) + name + meta.tag.metadata.processing.xml + patterns + + + match + ([a-zA-Z-]+) + name + entity.other.attribute-name.xml + + + include + #doublequotedString + + + include + #singlequotedString + + + + + begin + (<!)(DOCTYPE)\s+([:a-zA-Z_][:a-zA-Z0-9_.-]*) + captures + + 1 + + name + punctuation.definition.tag.xml + + 2 + + name + entity.name.tag.xml + + 3 + + name + entity.other.attribute-name.documentroot.xml + + + end + \s*(>) + name + meta.tag.metadata.doctype.xml + patterns + + + include + #internalSubset + + + + + begin + <[!%]-- + captures + + 0 + + name + punctuation.definition.comment.xml + + + end + --%?> + name + comment.block.xml + + + begin + (<)((?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+))(?=(\s[^>]*)?></\2>) + beginCaptures + + 1 + + name + punctuation.definition.tag.xml + + 3 + + name + entity.name.tag.namespace.xml + + 4 + + name + entity.name.tag.xml + + 5 + + name + punctuation.separator.namespace.xml + + 6 + + name + entity.name.tag.localname.xml + + + end + (>(<))/(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+)(>) + endCaptures + + 1 + + name + punctuation.definition.tag.xml + + 2 + + name + meta.scope.between-tag-pair.xml + + 3 + + name + entity.name.tag.namespace.xml + + 4 + + name + entity.name.tag.xml + + 5 + + name + punctuation.separator.namespace.xml + + 6 + + name + entity.name.tag.localname.xml + + 7 + + name + punctuation.definition.tag.xml + + + name + meta.tag.no-content.xml + patterns + + + include + #tagStuff + + + + + begin + (</?)(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+) + captures + + 1 + + name + punctuation.definition.tag.xml + + 2 + + name + entity.name.tag.namespace.xml + + 3 + + name + entity.name.tag.xml + + 4 + + name + punctuation.separator.namespace.xml + + 5 + + name + entity.name.tag.localname.xml + + + end + (/?>) + name + meta.tag.xml + patterns + + + include + #tagStuff + + + + + include + #entity + + + include + #bare-ampersand + + + begin + <%@ + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.xml + + + end + %> + endCaptures + + 0 + + name + punctuation.section.embedded.end.xml + + + name + source.java-props.embedded.xml + patterns + + + match + page|include|taglib + name + keyword.other.page-props.xml + + + + + begin + <%[!=]?(?!--) + beginCaptures + + 0 + + name + punctuation.section.embedded.begin.xml + + + end + (?!--)%> + endCaptures + + 0 + + name + punctuation.section.embedded.end.xml + + + name + source.java.embedded.xml + patterns + + + include + source.java + + + + + begin + <!\[CDATA\[ + beginCaptures + + 0 + + name + punctuation.definition.string.begin.xml + + + end + ]]> + endCaptures + + 0 + + name + punctuation.definition.string.end.xml + + + name + string.unquoted.cdata.xml + + + repository + + EntityDecl + + begin + (<!)(ENTITY)\s+(%\s+)?([:a-zA-Z_][:a-zA-Z0-9_.-]*)(\s+(?:SYSTEM|PUBLIC)\s+)? + captures + + 1 + + name + punctuation.definition.tag.xml + + 2 + + name + keyword.other.entity.xml + + 3 + + name + punctuation.definition.entity.xml + + 4 + + name + variable.language.entity.xml + + 5 + + name + keyword.other.entitytype.xml + + + end + (>) + patterns + + + include + #doublequotedString + + + include + #singlequotedString + + + + bare-ampersand + + match + & + name + invalid.illegal.bad-ampersand.xml + + doublequotedString + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.xml + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.xml + + + name + string.quoted.double.xml + patterns + + + include + #entity + + + include + #bare-ampersand + + + + entity + + captures + + 1 + + name + punctuation.definition.constant.xml + + 3 + + name + punctuation.definition.constant.xml + + + match + (&)([:a-zA-Z_][:a-zA-Z0-9_.-]*|#[0-9]+|#x[0-9a-fA-F]+)(;) + name + constant.character.entity.xml + + internalSubset + + begin + (\[) + captures + + 1 + + name + punctuation.definition.constant.xml + + + end + (\]) + name + meta.internalsubset.xml + patterns + + + include + #EntityDecl + + + include + #parameterEntity + + + + parameterEntity + + captures + + 1 + + name + punctuation.definition.constant.xml + + 3 + + name + punctuation.definition.constant.xml + + + match + (%)([:a-zA-Z_][:a-zA-Z0-9_.-]*)(;) + name + constant.character.parameter-entity.xml + + singlequotedString + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.xml + + + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.xml + + + name + string.quoted.single.xml + patterns + + + include + #entity + + + include + #bare-ampersand + + + + tagStuff + + patterns + + + captures + + 1 + + name + entity.other.attribute-name.namespace.xml + + 2 + + name + entity.other.attribute-name.xml + + 3 + + name + punctuation.separator.namespace.xml + + 4 + + name + entity.other.attribute-name.localname.xml + + + match + (?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9]+)= + + + include + #doublequotedString + + + include + #singlequotedString + + + + + scopeName + text.xml + uuid + D3C4E6DA-6B1C-11D9-8CC2-000D93589AF6 + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/yaml.plist b/src/file-viewer/highlight-grammar/yaml.plist new file mode 100644 index 0000000..609c2d4 --- /dev/null +++ b/src/file-viewer/highlight-grammar/yaml.plist @@ -0,0 +1,1164 @@ + + + + + fileTypes + + yaml + yml + rviz + reek + clang-format + yaml-tmlanguage + syntax + sublime-syntax + + firstLineMatch + ^%YAML( ?1.\d+)? + keyEquivalent + ^~Y + name + YAML + patterns + + + include + #comment + + + include + #property + + + include + #directive + + + match + ^--- + name + entity.other.document.begin.yaml + + + match + ^\.{3} + name + entity.other.document.end.yaml + + + include + #node + + + repository + + block-collection + + patterns + + + include + #block-sequence + + + include + #block-mapping + + + + block-mapping + + patterns + + + include + #block-pair + + + + block-node + + patterns + + + include + #prototype + + + include + #block-scalar + + + include + #block-collection + + + include + #flow-scalar-plain-out + + + include + #flow-node + + + + block-pair + + patterns + + + begin + \? + beginCaptures + + 1 + + name + punctuation.definition.key-value.begin.yaml + + + end + (?=\?)|^ *(:)|(:) + endCaptures + + 1 + + name + punctuation.separator.key-value.mapping.yaml + + 2 + + name + invalid.illegal.expected-newline.yaml + + + name + meta.block-mapping.yaml + patterns + + + include + #block-node + + + + + begin + (?x) + (?= + (?x: + [^\s[-?:,\[\]{}#&*!|>'"%@`]] + | [?:-] \S + ) + ( + [^\s:] + | : \S + | \s+ (?![#\s]) + )* + \s* + : + (\s|$) + ) + + end + (?x) + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + ) + + patterns + + + include + #flow-scalar-plain-out-implicit-type + + + begin + (?x) + [^\s[-?:,\[\]{}#&*!|>'"%@`]] + | [?:-] \S + + beginCaptures + + 0 + + name + entity.name.tag.yaml + + + contentName + entity.name.tag.yaml + end + (?x) + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + ) + + name + string.unquoted.plain.out.yaml + + + + + match + :(?=\s|$) + name + punctuation.separator.key-value.mapping.yaml + + + + block-scalar + + begin + (?:(\|)|(>))([1-9])?([-+])?(.*\n?) + beginCaptures + + 1 + + name + keyword.control.flow.block-scalar.literal.yaml + + 2 + + name + keyword.control.flow.block-scalar.folded.yaml + + 3 + + name + constant.numeric.indentation-indicator.yaml + + 4 + + name + storage.modifier.chomping-indicator.yaml + + 5 + + patterns + + + include + #comment + + + match + .+ + name + invalid.illegal.expected-comment-or-newline.yaml + + + + + end + ^(?=\S)|(?!\G) + patterns + + + begin + ^([ ]+)(?! ) + end + ^(?!\1|\s*$) + name + string.unquoted.block.yaml + + + + block-sequence + + match + (-)(?!\S) + name + punctuation.definition.block.sequence.item.yaml + + comment + + begin + (?:(^[ \t]*)|[ \t]+)(?=#\p{Print}*$) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.yaml + + + end + (?!\G) + patterns + + + begin + # + beginCaptures + + 0 + + name + punctuation.definition.comment.yaml + + + end + \n + name + comment.line.number-sign.yaml + + + + directive + + begin + ^% + beginCaptures + + 0 + + name + punctuation.definition.directive.begin.yaml + + + end + (?=$|[ \t]+($|#)) + name + meta.directive.yaml + patterns + + + captures + + 1 + + name + keyword.other.directive.yaml.yaml + + 2 + + name + constant.numeric.yaml-version.yaml + + + match + \G(YAML)[ \t]+(\d+\.\d+) + + + captures + + 1 + + name + keyword.other.directive.tag.yaml + + 2 + + name + storage.type.tag-handle.yaml + + 3 + + name + support.type.tag-prefix.yaml + + + match + (?x) + \G + (TAG) + (?:[ \t]+ + ((?:!(?:[0-9A-Za-z\-]*!)?)) + (?:[ \t]+ ( + ! (?x: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]] )* + | (?![,!\[\]{}]) (?x: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]] )+ + ) + )? + )? + + + + captures + + 1 + + name + support.other.directive.reserved.yaml + + 2 + + name + string.unquoted.directive-name.yaml + + 3 + + name + string.unquoted.directive-parameter.yaml + + + match + (?x) \G (\w+) (?:[ \t]+ (\w+) (?:[ \t]+ (\w+))? )? + + + match + \S+ + name + invalid.illegal.unrecognized.yaml + + + + flow-alias + + captures + + 1 + + name + keyword.control.flow.alias.yaml + + 2 + + name + punctuation.definition.alias.yaml + + 3 + + name + variable.other.alias.yaml + + 4 + + name + invalid.illegal.character.anchor.yaml + + + match + ((\*))([^\s\[\]/{/},]+)([^\s\]},]\S*)? + + flow-collection + + patterns + + + include + #flow-sequence + + + include + #flow-mapping + + + + flow-mapping + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.mapping.begin.yaml + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.mapping.end.yaml + + + name + meta.flow-mapping.yaml + patterns + + + include + #prototype + + + match + , + name + punctuation.separator.mapping.yaml + + + include + #flow-pair + + + + flow-node + + patterns + + + include + #prototype + + + include + #flow-alias + + + include + #flow-collection + + + include + #flow-scalar + + + + flow-pair + + patterns + + + begin + \? + beginCaptures + + 0 + + name + punctuation.definition.key-value.begin.yaml + + + end + (?=[},\]]) + name + meta.flow-pair.explicit.yaml + patterns + + + include + #prototype + + + include + #flow-pair + + + include + #flow-node + + + begin + :(?=\s|$|[\[\]{},]) + beginCaptures + + 0 + + name + punctuation.separator.key-value.mapping.yaml + + + end + (?=[},\]]) + patterns + + + include + #flow-value + + + + + + + begin + (?x) + (?= + (?: + [^\s[-?:,\[\]{}#&*!|>'"%@`]] + | [?:-] [^\s[\[\]{},]] + ) + ( + [^\s:[\[\]{},]] + | : [^\s[\[\]{},]] + | \s+ (?![#\s]) + )* + \s* + : + (\s|$) + ) + + end + (?x) + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + | \s* : [\[\]{},] + | \s* [\[\]{},] + ) + + name + meta.flow-pair.key.yaml + patterns + + + include + #flow-scalar-plain-in-implicit-type + + + begin + (?x) + [^\s[-?:,\[\]{}#&*!|>'"%@`]] + | [?:-] [^\s[\[\]{},]] + + beginCaptures + + 0 + + name + entity.name.tag.yaml + + + contentName + entity.name.tag.yaml + end + (?x) + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + | \s* : [\[\]{},] + | \s* [\[\]{},] + ) + + name + string.unquoted.plain.in.yaml + + + + + include + #flow-node + + + begin + :(?=\s|$|[\[\]{},]) + captures + + 0 + + name + punctuation.separator.key-value.mapping.yaml + + + end + (?=[},\]]) + name + meta.flow-pair.yaml + patterns + + + include + #flow-value + + + + + + flow-scalar + + patterns + + + include + #flow-scalar-double-quoted + + + include + #flow-scalar-single-quoted + + + include + #flow-scalar-plain-in + + + + flow-scalar-double-quoted + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.yaml + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.yaml + + + name + string.quoted.double.yaml + patterns + + + match + \\([0abtnvfre "/\\N_Lp]|x\d\d|u\d{4}|U\d{8}) + name + constant.character.escape.yaml + + + match + \\\n + name + constant.character.escape.double-quoted.newline.yaml + + + + flow-scalar-plain-in + + patterns + + + include + #flow-scalar-plain-in-implicit-type + + + begin + (?x) + [^\s[-?:,\[\]{}#&*!|>'"%@`]] + | [?:-] [^\s[\[\]{},]] + + end + (?x) + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + | \s* : [\[\]{},] + | \s* [\[\]{},] + ) + + name + string.unquoted.plain.in.yaml + + + + flow-scalar-plain-in-implicit-type + + patterns + + + captures + + 1 + + name + constant.language.null.yaml + + 2 + + name + constant.language.boolean.yaml + + 3 + + name + constant.numeric.integer.yaml + + 4 + + name + constant.numeric.float.yaml + + 5 + + name + constant.other.timestamp.yaml + + 6 + + name + constant.language.value.yaml + + 7 + + name + constant.language.merge.yaml + + + match + (?x) + (?x: + (null|Null|NULL|~) + | (y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF) + | ( + (?: + [-+]? 0b [0-1_]+ # (base 2) + | [-+]? 0 [0-7_]+ # (base 8) + | [-+]? (?: 0|[1-9][0-9_]*) # (base 10) + | [-+]? 0x [0-9a-fA-F_]+ # (base 16) + | [-+]? [1-9] [0-9_]* (?: :[0-5]?[0-9])+ # (base 60) + ) + ) + | ( + (?x: + [-+]? (?: [0-9] [0-9_]*)? \. [0-9.]* (?: [eE] [-+] [0-9]+)? # (base 10) + | [-+]? [0-9] [0-9_]* (?: :[0-5]?[0-9])+ \. [0-9_]* # (base 60) + | [-+]? \. (?: inf|Inf|INF) # (infinity) + | \. (?: nan|NaN|NAN) # (not a number) + ) + ) + | ( + (?x: + \d{4} - \d{2} - \d{2} # (y-m-d) + | \d{4} # (year) + - \d{1,2} # (month) + - \d{1,2} # (day) + (?: [Tt] | [ \t]+) \d{1,2} # (hour) + : \d{2} # (minute) + : \d{2} # (second) + (?: \.\d*)? # (fraction) + (?: + (?:[ \t]*) Z + | [-+] \d{1,2} (?: :\d{1,2})? + )? # (time zone) + ) + ) + | (=) + | (<<) + ) + (?: + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + | \s* : [\[\]{},] + | \s* [\[\]{},] + ) + ) + + + + + flow-scalar-plain-out + + patterns + + + include + #flow-scalar-plain-out-implicit-type + + + begin + (?x) + [^\s[-?:,\[\]{}#&*!|>'"%@`]] + | [?:-] \S + + end + (?x) + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + ) + + name + string.unquoted.plain.out.yaml + + + + flow-scalar-plain-out-implicit-type + + patterns + + + captures + + 1 + + name + constant.language.null.yaml + + 2 + + name + constant.language.boolean.yaml + + 3 + + name + constant.numeric.integer.yaml + + 4 + + name + constant.numeric.float.yaml + + 5 + + name + constant.other.timestamp.yaml + + 6 + + name + constant.language.value.yaml + + 7 + + name + constant.language.merge.yaml + + + match + (?x) + (?x: + (null|Null|NULL|~) + | (y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF) + | ( + (?: + [-+]? 0b [0-1_]+ # (base 2) + | [-+]? 0 [0-7_]+ # (base 8) + | [-+]? (?: 0|[1-9][0-9_]*) # (base 10) + | [-+]? 0x [0-9a-fA-F_]+ # (base 16) + | [-+]? [1-9] [0-9_]* (?: :[0-5]?[0-9])+ # (base 60) + ) + ) + | ( + (?x: + [-+]? (?: [0-9] [0-9_]*)? \. [0-9.]* (?: [eE] [-+] [0-9]+)? # (base 10) + | [-+]? [0-9] [0-9_]* (?: :[0-5]?[0-9])+ \. [0-9_]* # (base 60) + | [-+]? \. (?: inf|Inf|INF) # (infinity) + | \. (?: nan|NaN|NAN) # (not a number) + ) + ) + | ( + (?x: + \d{4} - \d{2} - \d{2} # (y-m-d) + | \d{4} # (year) + - \d{1,2} # (month) + - \d{1,2} # (day) + (?: [Tt] | [ \t]+) \d{1,2} # (hour) + : \d{2} # (minute) + : \d{2} # (second) + (?: \.\d*)? # (fraction) + (?: + (?:[ \t]*) Z + | [-+] \d{1,2} (?: :\d{1,2})? + )? # (time zone) + ) + ) + | (=) + | (<<) + ) + (?x: + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + ) + ) + + + + + flow-scalar-single-quoted + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.yaml + + + end + '(?!') + endCaptures + + 0 + + name + punctuation.definition.string.end.yaml + + + name + string.quoted.single.yaml + patterns + + + match + '' + name + constant.character.escape.single-quoted.yaml + + + + flow-sequence + + begin + \[ + beginCaptures + + 0 + + name + punctuation.definition.sequence.begin.yaml + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.sequence.end.yaml + + + name + meta.flow-sequence.yaml + patterns + + + include + #prototype + + + match + , + name + punctuation.separator.sequence.yaml + + + include + #flow-pair + + + include + #flow-node + + + + flow-value + + patterns + + + begin + \G(?![},\]]) + end + (?=[},\]]) + name + meta.flow-pair.value.yaml + patterns + + + include + #flow-node + + + + + + node + + patterns + + + include + #block-node + + + + property + + begin + (?=!|&) + end + (?!\G) + name + meta.property.yaml + patterns + + + captures + + 1 + + name + keyword.control.property.anchor.yaml + + 2 + + name + punctuation.definition.anchor.yaml + + 3 + + name + entity.name.type.anchor.yaml + + 4 + + name + invalid.illegal.character.anchor.yaml + + + match + \G((&))([^\s\[\]/{/},]+)(\S+)? + + + match + (?x) + \G + (?: + ! < (?: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]] )+ > + | (?:!(?:[0-9A-Za-z\-]*!)?) (?: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&=+$_.~*'()] )+ + | ! + ) + (?=\ |\t|$) + + name + storage.type.tag-handle.yaml + + + match + \S+ + name + invalid.illegal.tag-handle.yaml + + + + prototype + + patterns + + + include + #comment + + + include + #property + + + + + scopeName + source.yaml + uuid + 686AD6AE-33F3-4493-9512-9E9FC1D5417F + + \ No newline at end of file diff --git a/src/file-viewer/highlight-grammar/zig.plist b/src/file-viewer/highlight-grammar/zig.plist new file mode 100644 index 0000000..cf30522 --- /dev/null +++ b/src/file-viewer/highlight-grammar/zig.plist @@ -0,0 +1,846 @@ + + + + + fileTypes + + zig + + keyEquivalent + ^~Z + name + Zig + patterns + + + include + #dummy_main + + + repository + + block + + begin + ([a-zA-Z_][\w.]*|@\".+\")?\s*(\{) + beginCaptures + + 1 + + name + storage.type.zig + + 2 + + name + punctuation.section.braces.begin.zig + + + end + (\}) + endCaptures + + 1 + + name + punctuation.section.braces.end.zig + + + patterns + + + include + #dummy_main + + + + character_escapes + + patterns + + + match + \\n + name + constant.character.escape.newline.zig + + + match + \\r + name + constant.character.escape.carrigereturn.zig + + + match + \\t + name + constant.character.escape.tabulator.zig + + + match + \\\\ + name + constant.character.escape.backslash.zig + + + match + \\' + name + constant.character.escape.single-quote.zig + + + match + \\\" + name + constant.character.escape.double-quote.zig + + + match + \\x[a-fA-F\d]{2} + name + constant.character.escape.hexidecimal.zig + + + match + \\u\{[a-fA-F\d]{1,6}\} + name + constant.character.escape.hexidecimal.zig + + + + comments + + patterns + + + begin + /// + end + $\n? + name + comment.line.documentation.zig + + + begin + //[^/]\s*TODO + end + $\n? + name + comment.line.todo.zig + + + begin + //[^/]* + end + $\n? + name + comment.line.zig + + + + constants + + patterns + + + match + \b(null|undefined|true|false)\b + name + constant.language.zig + + + match + \b(?<!\.)(-?[\d_]+)(?!\.)\b + name + constant.numeric.integer.zig + + + match + \b(?<!\.)(0x[a-fA-F\d_]+)(?!\.)\b + name + constant.numeric.integer.hexadecimal.zig + + + match + \b(?<!\.)(0o[0-7_]+)(?!\.)\b + name + constant.numeric.integer.octal.zig + + + match + \b(?<!\.)(0b[01_]+)(?!\.)\b + name + constant.numeric.integer.binary.zig + + + match + (?<!\.)(-?\b[\d_]+(?:\.[\d_]+)?(?:[eE][+-]?[\d_]+)?)(?!\.)\b + name + constant.numeric.float.zig + + + match + (?<!\.)(-?\b0x[a-fA-F\d_]+(?:\.[a-fA-F\d_]+)?[pP]?(?:[+-]?[\d_]+)?)(?!\.)\b + name + constant.numeric.float.hexadecimal.zig + + + + container_decl + + patterns + + + match + \b(?!\d)([a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:extern|packed)?\b\s*(?:union)\s*[(\{]) + name + entity.name.union.zig + + + match + \b(?!\d)([a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:extern|packed)?\b\s*(?:struct)\s*[(\{]) + name + entity.name.struct.zig + + + match + \b(?!\d)([a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:extern|packed)?\b\s*(?:enum)\s*[(\{]) + name + entity.name.enum.zig + + + match + \b(?!\d)([a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:error)\s*[(\{]) + name + entity.name.error.zig + + + captures + + 1 + + name + storage.type.error.zig + + 2 + + name + punctuation.accessor.zig + + 3 + + name + entity.name.error.zig + + + match + \b(error)(\.)([a-zA-Z_]\w*|@\".+\") + + + + dummy_main + + patterns + + + include + #label + + + include + #function_type + + + include + #punctuation + + + include + #storage_modifier + + + include + #container_decl + + + include + #constants + + + include + #comments + + + include + #strings + + + include + #storage + + + include + #keywords + + + include + #operators + + + include + #support + + + include + #field_decl + + + include + #block + + + include + #function_def + + + include + #function_call + + + include + #enum_literal + + + + enum_literal + + match + (?<!\w|\)|\?|\}|\]|\*)(\.(?:[a-zA-Z_]\w*\b|@\"[^\"]*\"))(?!\(|\s*=[^=>]) + name + constant.language.enum + + field_decl + + begin + ([a-zA-Z_]\w*|@\".+\")\s*(:)\s* + beginCaptures + + 1 + + name + variable.other.member.zig + + 2 + + name + punctuation.separator.zig + + + end + ([a-zA-Z_][\w.]*|@\".+\")?\s*(?:(,)|(=)|$) + endCaptures + + 1 + + name + storage.type.zig + + 2 + + name + punctuation.separator.zig + + 3 + + name + keyword.operator.assignment.zig + + + patterns + + + include + #dummy_main + + + + function_call + + match + (?<!fn)\b([a-zA-Z_]\w*|@\".+\")(?=\s*\() + name + variable.function.zig + + function_def + + begin + (?<=fn)\s+([a-zA-Z_]\w*|@\".+\")(\() + beginCaptures + + 1 + + name + entity.name.function + + 2 + + name + punctuation.section.parens.begin.zig + + + end + (?<=\)[^\)])\s*([a-zA-Z_][\w.]*|@\".+\")?(!)?\s*(?:([a-zA-Z_][\w.]*|@\".+\")\b(?!\s*\())? + endCaptures + + 1 + + name + storage.type.zig + + 2 + + name + keyword.operator.zig + + 3 + + name + storage.type.zig + + + patterns + + + include + #label + + + include + #param_list + + + match + ([a-zA-Z_][\w.]*|@\".+\") + name + storage.type.zig + + + include + #dummy_main + + + + function_type + + begin + \b(fn)\s*(\() + beginCaptures + + 1 + + name + storage.type.function.zig + + 2 + + name + punctuation.section.parens.begin.zig + + + contentName + meta.function.parameters.zig + end + (?<=\)|\})\s*([a-zA-Z_][\w.]*|@\".+\")?\s*(!)?\s*([a-zA-Z_][\w.]*|@\".+\") + endCaptures + + 1 + + name + storage.type.zig + + 2 + + name + keyword.operator.zig + + 3 + + name + storage.type.zig + + + patterns + + + include + #label + + + include + #param_list + + + match + ([a-zA-Z_][\w.]*|@\".+\") + name + storage.type.zig + + + include + #dummy_main + + + + keywords + + patterns + + + match + \b(while|for|break|return|continue|asm|defer|errdefer|unreachable)\b + name + keyword.control.zig + + + match + \b(async|await|suspend|nosuspend|resume)\b + name + keyword.control.async.zig + + + match + \b(if|else|switch|try|catch|orelse)\b + name + keyword.control.conditional.zig + + + match + (?<!\w)(@import|@cImport|@cInclude)\b + name + keyword.control.import.zig + + + match + \b(usingnamespace)\b + name + keyword.other.usingnamespace.zig + + + + label + + captures + + 1 + + name + keyword.control.zig + + 2 + + name + entity.name.label.zig + + 3 + + name + entity.name.label.zig + + + match + \b(break|continue)\s*:\s*([a-zA-Z_]\w*|@\".+\")\b|\b(?!\d)([a-zA-Z_]\w*|@\".+\")\b(?=\s*:\s*(?:\{|while\b)) + + operators + + patterns + + + match + \b!\b + name + keyword.operator.zig + + + match + (==|(?:!|>|<)=?) + name + keyword.operator.logical.zig + + + match + \b(and|or)\b + name + keyword.operator.word.zig + + + match + ((?:(?:\+|-|\*)\%?|/|%|<<|>>|&|\|(?=[^\|])|\^)?=) + name + keyword.operator.assignment.zig + + + match + ((?:\+|-|\*)\%?|/(?!/)|%) + name + keyword.operator.arithmetic.zig + + + match + (<<|>>|&(?=[a-zA-Z_]|@\")|\|(?=[^\|])|\^|~) + name + keyword.operator.bitwise.zig + + + match + (\+\+|\*\*|->|\.\?|\.\*|&(?=[a-zA-Z_]|@\")|\?|\|\||\.{2,3}) + name + keyword.operator.other.zig + + + + param_list + + begin + ([a-zA-Z_]\w*|@\".+\")\s*(:)\s* + beginCaptures + + 1 + + name + variable.parameter.zig + + 2 + + name + punctuation.separator.zig + + + end + ([a-zA-Z_][\w.]*|@\".+\")?\s*(?:(,)|(\))) + endCaptures + + 1 + + name + storage.type.zig + + 2 + + name + punctuation.separator.zig + + 3 + + name + punctuation.section.parens.end.zig + + + patterns + + + include + #dummy_main + + + match + ([a-zA-Z_][\w.]*|@\".+\") + name + storage.type.zig + + + + punctuation + + patterns + + + match + , + name + punctuation.separator.zig + + + match + ; + name + punctuation.terminator.zig + + + match + (\() + name + punctuation.section.parens.begin.zig + + + match + (\)) + name + punctuation.section.parens.end.zig + + + + storage + + patterns + + + match + \b(bool|void|noreturn|type|anyerror|anytype)\b + name + storage.type.zig + + + match + \b(?<!\.)([iu]\d+|[iu]size|comptime_int)\b + name + storage.type.integer.zig + + + match + \b(f16|f32|f64|f128|comptime_float)\b + name + storage.type.float.zig + + + match + \b(c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void)\b + name + storage.type.c_compat.zig + + + captures + + 1 + + name + storage.type.zig + + 2 + + name + keyword.operator.zig + + 3 + + name + storage.type.zig + + + match + \b(anyframe)\b\s*(->)?\s*(?:([a-zA-Z_][\w.]*|@\".+\")\b(?!\s*\())? + + + match + \bfn\b + name + storage.type.function.zig + + + match + \btest\b + name + storage.type.test.zig + + + match + \bstruct\b + name + storage.type.struct.zig + + + match + \benum\b + name + storage.type.enum.zig + + + match + \bunion\b + name + storage.type.union.zig + + + match + \berror\b + name + storage.type.error.zig + + + + storage_modifier + + match + \b(const|var|extern|packed|export|pub|noalias|inline|noinline|comptime|volatile|align|linksection|threadlocal|allowzero)\b + name + storage.modifier.zig + + strings + + patterns + + + begin + \' + end + \' + name + string.quoted.single.zig + patterns + + + include + #character_escapes + + + match + \\[^\'][^\']*? + name + invalid.illegal.character.zig + + + + + begin + c?\" + end + \" + name + string.quoted.double.zig + patterns + + + include + #character_escapes + + + match + \\[^\'][^\']*? + name + invalid.illegal.character.zig + + + + + begin + c?\\\\ + end + $\n? + name + string.quoted.other.zig + + + + support + + match + (?<!\w)@[^\"\d][a-zA-Z_]\w*\b + name + support.function.zig + + + scopeName + source.zig + uuid + 06C2FF99-3080-441A-9019-460C51E93116 + + \ No newline at end of file diff --git a/src/file-viewer/highlight.ts b/src/file-viewer/highlight.ts new file mode 100644 index 0000000..ae0707b --- /dev/null +++ b/src/file-viewer/highlight.ts @@ -0,0 +1,204 @@ +import { onceAsync } from "../lib.ts"; +import * as fs from "node:fs/promises"; +import * as path from "node:path"; +import * as oniguruma from "vscode-oniguruma"; +import * as textmate from "vscode-textmate"; +import { escapeHTML } from "../framework/bun-polyfill.ts"; + +const languages = [ + "ts", + "tsx", + "zig", + "json", + "css", + "astro", + "mdx", + "lua", + "shell", + "dosbatch", + "powershell", + "yaml", + "toml", + "xml", + "python", + "php", + "diff", +] as const; +const altScopes: Record = { + astro: "text.html.astro", + xml: "text.xml", + php: "text.html.php", +}; +export type Language = (typeof languages)[number]; + +const scopes = [ + // CSS + ["punctuation.definition.keyword", "keyword", "css"], + ["entity.name.tag.css", "class", "css"], + ["meta.selector.css", "method", "css"], + ["entity.other.attribute-name.class.css", "builtin", "css"], + ["punctuation.definition.entity", "builtin", "css"], + ["variable.css", "parameter", "css"], + + // JSON + ["support.type.property-name.json", "variable", "json"], + ["constant.numeric", "method", "json"], + ["constant", "class", "json"], + + // Lua + ["entity.name", "class", "lua"], + + // Diff + ["punctuation.definition.deleted", "variable", "diff"], + ["markup.deleted", "variable", "diff"], + ["punctuation.definition.inserted", "method", "diff"], + ["markup.inserted", "method", "diff"], + ["meta.diff.range", "string", "diff"], + ["punctuation.definition.range", "string", "diff"], + ["meta.toc-list-line.number", "keyword", "diff"], + ["meta.diff", "comment", "diff"], + + // General + ["meta.object-literal.key", "property"], + ["comment", "comment"], + ["string", "string"], + ["storage", "keyword"], + ["keyword", "keyword"], + ["variable.parameter", "parameter"], + ["entity.name.function", "method"], + ["support.type.primitive", "builtin"], + ["entity.name.type", "class"], + ["support.type", "class"], + ["support.class", "class"], + ["constant.language", "builtin"], + ["constant", "constant"], + ["support.constant", "constant"], + ["meta.parameters", "parameter"], + ["support.function", "method"], + ["variable", "variable"], + ["punctuation", null], + ["meta.function-call", "method"], +] as const; + +interface HighlightLinesOptions { + lines: string[]; + grammar: textmate.IGrammar; + state: textmate.StateStack; + language: Language; +} + +export function getStyle(scopesToCheck: string[], langugage: Language) { + if (import.meta.main) console.log(scopesToCheck); + for (const scope of scopes) { + if (scope[2] && scope[2] !== langugage) continue; + const find = scopesToCheck.find((s) => s.startsWith(scope[0])); + if (find) { + return scope[1]; + } + } + return null; +} +function highlightLines({ + lines, + grammar, + state, + language, +}: HighlightLinesOptions) { + let html = ""; + let lastHtmlStyle: string | null = null; + + const { length } = lines; + for (let i = 0; i < length; i += 1) { + const { tokens, ruleStack, stoppedEarly } = grammar.tokenizeLine( + lines[i], + state, + ); + if (stoppedEarly) throw new Error("TODO: Tokenization stopped early?"); + state = ruleStack; + + for (const token of tokens) { + const str = lines[i].slice(token.startIndex, token.endIndex); + if (str.trim().length === 0) { + // Emit but do not consider scope changes + html += escapeHTML(str); + continue; + } + + const style = getStyle(token.scopes, language); + if (style !== lastHtmlStyle) { + if (lastHtmlStyle) html += ""; + if (style) html += ``; + } + html += escapeHTML(str); + lastHtmlStyle = style; + } + html += "\n"; + } + + if (lastHtmlStyle) html += ""; + + return { state, html }; +} + +export const getRegistry = onceAsync(async () => { + const wasmBin = await fs.readFile( + path.join( + import.meta.dirname, + "../node_modules/vscode-oniguruma/release/onig.wasm", + ), + ); + await oniguruma.loadWASM(wasmBin); + + return new textmate.Registry({ + onigLib: Promise.resolve({ + createOnigScanner: (patterns) => new oniguruma.OnigScanner(patterns), + createOnigString: (s) => new oniguruma.OnigString(s), + }), + loadGrammar: async (scopeName: string) => { + for (const lang of languages) { + if (scopeName.endsWith(`.${lang}`)) { + const file = await fs.readFile( + path.join(import.meta.dirname, `highlight-grammar/${lang}.plist`), + "utf-8", + ); + return textmate.parseRawGrammar(file); + } + } + return null; + }, + }); +}); + +export async function highlightCode(code: string, language: Language) { + const registry = await getRegistry(); + const grammar = await registry.loadGrammar( + altScopes[language] ?? "source." + language, + ); + if (!grammar) { + throw new Error(`No grammar found for language: ${language}`); + } + let state = textmate.INITIAL; + const { html } = highlightLines({ + lines: code.split("\n"), + grammar, + state, + language, + }); + return html; +} + +import { existsSync } from "node:fs"; +if (import.meta.main) { + // validate exts + for (const ext of languages) { + if ( + !existsSync( + path.join(import.meta.dirname, `highlight-grammar/${ext}.plist`), + ) + ) { + console.error(`Missing grammar for ${ext}`); + } + const html = await highlightCode("wwwwwwwwwwwaaaaaaaaaaaaaaaa", ext); + } + console.log(await highlightCode(`{"maps":"damn"`, "json")); +} diff --git a/src/file-viewer/models/BlobAsset.ts b/src/file-viewer/models/BlobAsset.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/file-viewer/models/FilePermission.ts b/src/file-viewer/models/FilePermission.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/file-viewer/models/MediaFile.ts b/src/file-viewer/models/MediaFile.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/file-viewer/pages/file.cotyledon_enterance.tsx b/src/file-viewer/pages/file.cotyledon_enterance.tsx new file mode 100644 index 0000000..6f9c148 --- /dev/null +++ b/src/file-viewer/pages/file.cotyledon_enterance.tsx @@ -0,0 +1,27 @@ +import { MediaFile } from "../db"; +import { useInlineScript } from "../framework/page-resources"; +import { Readme } from "../media/cotyledon"; +import { MediaPanel } from "../pages-dynamic/file_viewer"; +import "../media/files.css"; + +export const theme = { + bg: "#312652", + fg: "#f0f0ff", + primary: "#fabe32", +}; + +export default function CotyledonPage() { + useInlineScript("canvas_cotyledon"); + useInlineScript("file_viewer"); + return ( +
+ + +
+ ); +} diff --git a/src/file-viewer/pages/file.cotyledon_speedbump.tsx b/src/file-viewer/pages/file.cotyledon_speedbump.tsx new file mode 100644 index 0000000..27f18c0 --- /dev/null +++ b/src/file-viewer/pages/file.cotyledon_speedbump.tsx @@ -0,0 +1,27 @@ +import { MediaFile } from "../db"; +import { useInlineScript } from "../framework/page-resources"; +import { Speedbump } from "../media/cotyledon"; +import { MediaPanel } from "../pages-dynamic/file_viewer"; +import "../media/files.css"; + +export const theme = { + bg: "#312652", + fg: "#f0f0ff", + primary: "#fabe32", +}; + +export default function CotyledonPage() { + useInlineScript("canvas_cotyledon"); + useInlineScript("file_viewer"); + return ( +
+ + +
+ ); +} diff --git a/src/file-viewer/redirects.ts b/src/file-viewer/redirects.ts new file mode 100644 index 0000000..4120984 --- /dev/null +++ b/src/file-viewer/redirects.ts @@ -0,0 +1,9 @@ +export const mediaRedirects: Record = { + "/q+a/172533.png": "/q+a/172533.jpg", + "/q+a/2021-12-05_smooth.mp4": "/2019/smooth.mp4", + "/q+a/temp_2022-08-17-19-43-32.m4a": + "/2023/g-missing/fragments/2022-08-17-19-43-32.m4a", + "/q+a/2023-02-09_20-5814i.png": + "/2023/g-is-missing/fragments/2023-02-09_20-5814i.png", + "/2024/waterfalls/": "/2025/waterfalls/", +}; diff --git a/src/file-viewer/scripts/canvas_2017.ts b/src/file-viewer/scripts/canvas_2017.ts new file mode 100644 index 0000000..da45795 --- /dev/null +++ b/src/file-viewer/scripts/canvas_2017.ts @@ -0,0 +1,233 @@ +// Vibe coded with AI +(globalThis as any).canvas_2017 = function (canvas: HTMLCanvasElement) { + const isStandalone = canvas.getAttribute("data-standalone") === "true"; + // Configuration interface for the checkerboard effect + interface CheckerboardConfig { + fps: number; // frames per second + color1: string; // first checkerboard color + color2: string; // second checkerboard color + opacity: number; // opacity of each checkerboard (0-1) + speedX1: number; // horizontal speed of first checkerboard (pixels per second) + speedY1: number; // vertical speed of first checkerboard (pixels per second) + speedX2: number; // horizontal speed of second checkerboard (pixels per second) + speedY2: number; // vertical speed of second checkerboard (pixels per second) + baseTileSize: number; // base size of checkerboard tiles + sizeVariation: number; // maximum variation in tile size (pixels) + sineFrequency1: number; // frequency of first sine wave for size variation + sineFrequency2: number; // frequency of second sine wave for size variation + sineOffset: number; // offset between the two sine waves (radians) + rotation: number; // rotation in degrees for the entire pattern + rotation2: number; // rotation in degrees for the entire pattern + } + + // Default configuration + const config: CheckerboardConfig = { + fps: 30, + color1: "#1A1C17", + color2: "#1A1C17", + opacity: 0.3, + speedX1: -0.02, // moving left slowly + speedY1: -0.01, // moving up slowly + speedX2: -0.015, // moving left (slightly slower) + speedY2: 0.012, // moving down slowly + baseTileSize: 200, + sizeVariation: 1.5, + sineFrequency1: 0.0005, + sineFrequency2: 0.0008, + sineOffset: Math.PI / 2, // 90 degrees offset + rotation: 2, // 5 degree rotation + rotation2: -2, // 5 degree rotation + }; + + // Get the canvas context + const ctx = canvas.getContext("2d"); + if (!ctx) { + console.error("Could not get canvas context"); + return () => {}; + } + + // Make canvas transparent + if (isStandalone) { + canvas.style.backgroundColor = "#737D60"; + } else { + canvas.style.backgroundColor = "transparent"; + } + + // Variables to track position and animation + let width = canvas.width; + let height = canvas.height; + let animationFrameId: number; + let lastFrameTime = 0; + const frameInterval = 1000 / config.fps; + + // Position offsets for the two checkerboards (centered) + let offset1X = 0; + let offset1Y = 0; + let offset2X = 0; + let offset2Y = 0; + + // Time variable for sine wave calculation + let time = 0; + + // Convert rotation to radians + const rotationRad = (config.rotation * Math.PI) / 180; + const rotationRad2 = (config.rotation2 * Math.PI) / 180; + + // Update canvas dimensions when resized + const updateDimensions = () => { + width = canvas.width = canvas.clientWidth; + height = canvas.height = canvas.clientHeight; + }; + + // Calculate the diagonal length of the canvas (to ensure rotation covers corners) + const calculateDiagonal = () => { + return Math.sqrt(width * width + height * height); + }; + + // Draw a single checkerboard pattern scaled from center with rotation + const drawCheckerboard = ( + offsetX: number, + offsetY: number, + tileSize: number, + color1: string, + color2: string, + opacity: number, + rotationRad: number, + ) => { + ctx.globalAlpha = opacity; + + // Get the center of the viewport + const centerX = width / 2; + const centerY = height / 2; + + // Save the current transformation state + ctx.save(); + + // Move to the center of the canvas, rotate, then move back + ctx.translate(centerX, centerY); + ctx.rotate(rotationRad); + + // Calculate the number of tiles needed to cover the rotated canvas + // We need to use the diagonal length to ensure we cover the corners when rotated + const diagonal = calculateDiagonal(); + const tilesX = Math.ceil(diagonal / tileSize) + 6; // Added extra tiles for rotation + const tilesY = Math.ceil(diagonal / tileSize) + 6; + + // Calculate how many tiles fit from center to edge (in each direction) + const halfTilesX = Math.ceil(tilesX / 2); + const halfTilesY = Math.ceil(tilesY / 2); + + // Adjust the offset to be relative to the center + // The modulo ensures the pattern repeats smoothly even with scaling + const adjustedOffsetX = offsetX % (tileSize * 2); + const adjustedOffsetY = offsetY % (tileSize * 2); + + // Draw the checker pattern, centered on the viewport + for (let y = -halfTilesY; y <= halfTilesY; y++) { + for (let x = -halfTilesX; x <= halfTilesX; x++) { + // Determine if this tile should be colored (creating checker pattern) + // We add a large number to ensure (x+y) is always positive for the modulo + if ((x + y + 1000) % 2 === 0) { + ctx.fillStyle = color1; + } else { + ctx.fillStyle = color2; + } + + // Calculate the position of this tile relative to the center + // The adjusted offset creates the movement effect + const posX = (x * tileSize) + adjustedOffsetX; + const posY = (y * tileSize) + adjustedOffsetY; + + // Draw the tile + ctx.fillRect( + posX - tileSize / 2, + posY - tileSize / 2, + tileSize, + tileSize, + ); + } + } + + // Restore the transformation state + ctx.restore(); + }; + + // Animation loop + const animate = (currentTime: number) => { + animationFrameId = requestAnimationFrame(animate); + + // Control frame rate + if (currentTime - lastFrameTime < frameInterval) { + return; + } + + // Calculate the time elapsed since the last frame + const dt = currentTime - lastFrameTime; + lastFrameTime = currentTime; + + // Increment time for sine wave calculation + time += dt; + + // Update the position offsets based on speed and elapsed time + offset1X += config.speedX1 * dt; + offset1Y += config.speedY1 * dt; + offset2X += config.speedX2 * dt; + offset2Y += config.speedY2 * dt; + + // Calculate the tile sizes using sine waves + const tileSize1 = config.baseTileSize + + Math.sin(time * config.sineFrequency1) * config.sizeVariation; + const tileSize2 = config.baseTileSize + + Math.sin(time * config.sineFrequency2 + config.sineOffset) * + config.sizeVariation; + + // Clear canvas + ctx.clearRect(0, 0, width, height); + + // Draw the two checkerboards + drawCheckerboard( + offset1X, + offset1Y, + tileSize1, + config.color1, + "transparent", + config.opacity, + rotationRad, + ); + + drawCheckerboard( + offset2X, + offset2Y, + tileSize2, + config.color2, + "transparent", + config.opacity, + rotationRad2, + ); + + // Reset global alpha + ctx.globalAlpha = 1.0; + }; + + // Initialize the animation + const init = () => { + // Set up resize handler + window.addEventListener("resize", updateDimensions); + + // Initial setup + updateDimensions(); + + // Start animation + lastFrameTime = performance.now(); + animationFrameId = requestAnimationFrame(animate); + }; + + // Start the animation + init(); + + // Return cleanup function + return () => { + window.removeEventListener("resize", updateDimensions); + cancelAnimationFrame(animationFrameId); + }; +}; diff --git a/src/file-viewer/scripts/canvas_2018.ts b/src/file-viewer/scripts/canvas_2018.ts new file mode 100644 index 0000000..6364d60 --- /dev/null +++ b/src/file-viewer/scripts/canvas_2018.ts @@ -0,0 +1,431 @@ +// This canvas is based on the maze generation algo in Tanks. This was +// originally written in C++ as a single function in 2018, and was ported to TS +// by Chloe in 2025 for the cotyledon canvas. +// +// The main difference is that this version is a visualization, rather than the +// practical function. Instead of taking a millisecond, only 5 steps are +// performed per second, visualizing the whole ordeal. It also isn't a playable +// game, obviously. +// +// Ported with love because I care about my old self +// She deserves the world, but instead gave it to me. +(globalThis as any).canvas_2018 = function (canvas: HTMLCanvasElement) { + const isStandalone = canvas.getAttribute("data-standalone") === "true"; + if (isStandalone) { + canvas.style.backgroundColor = "#27201E"; + } + interface Cell { + down: boolean; + right: boolean; + visited: boolean; + + cell_flash: number; + down_flash: number; + right_flash: number; + } + interface Pos { + x: number; + y: number; + /** Where the wall is relative to x, y. */ + dir: "left" | "right" | "up" | "down"; + } + interface Maze { + grid: Grid; + cursor: { x: number; y: number }; + lastTick: number; + /* Pixels */ + transform: number; + newCellsToVisit: Pos[]; + randomWallBag: Cell[]; + randomWallTarget: number; + renderOffset: { x: number; y: number }; + done: boolean; + } + const hex = (color: number[]) => + "#" + color.map((c) => c.toString(16).padStart(2, "0")).join(""); + let cellSize: number; + let borderThickness: number; + const cellFlashModifier = isStandalone ? 0.4 : 0.2; + const color = isStandalone ? "#170d0b" : "#231C1A"; + const bg = [0x27, 0x20, 0x1E]; + const wallFlashColor = [0xFF, 0xA8, 0x7A]; + const cellFlashColor = "#FFA87A"; + const updateTime = 1000 / 7; + const randomWallBreakInterval = [6, 12]; // every 10 to 18 walls. + function randomBetween(min: number, max: number) { + return Math.round( + Math.random() * (max - min), + ) + min; + } + function randomOf(array: T[]): T { + return array[randomBetween(0, array.length - 1)]; + } + function randomWallTarget() { + return randomBetween( + randomWallBreakInterval[0], + randomWallBreakInterval[1], + ); + } + + // Originally, this used a 2-dimensional array. However, I wanted to make sure + // that the grid could be infinitely sized. This grid constructs new cells on + // demand, as needed. + class Grid { + cells = new Map(); + cell({ x, y }: { x: number; y: number }) { + const k = ((x | 0) << 16) + (y | 0); + const { cells } = this; + let existing = this.cells.get(k); + if (!existing) { + existing = { + cell_flash: 0, + down: true, + down_flash: 0, + right: true, + right_flash: 0, + visited: false, + }; + cells.set(k, existing); + } + return existing; + } + forAll( + renderOffset: { x: number; y: number }, + width: number, + height: number, + cb: (cell: Cell, pos: { x: number; y: number }) => void, + ) { + const { x: offsetX, y: offsetY } = renderOffset; + const startX = Math.floor(-offsetX / cellSize); + const startY = Math.floor(-offsetY / cellSize); + const endX = Math.ceil((width - offsetX) / cellSize); + const endY = Math.ceil((height - offsetY) / cellSize); + for (let x = startX; x <= endX; x++) { + for (let y = startY; y <= endY; y++) { + const cellX = offsetX + x * cellSize; + const cellY = offsetY + y * cellSize; + cb(this.cell({ x, y }), { x: cellX, y: cellY }); + } + } + } + } + + const ctx = canvas.getContext("2d")!; + if (!ctx) { + console.error("Could not get canvas context"); + return () => {}; + } + + let width: number, height: number; + const updateDimensions = () => { + width = canvas.width = canvas.offsetWidth; + height = canvas.height = canvas.offsetHeight; + cellSize = 100; + borderThickness = 8; + }; + updateDimensions(); + + setTimeout(() => { + updateDimensions(); + }, 10); + + let maze = initMaze(); + let nextMaze: Maze | null = null; + let completeFade = 0; + function initMaze(): Maze { + return { + grid: new Grid(), + transform: 0, + cursor: { + x: randomBetween(0, Math.ceil(width / cellSize)), + y: randomBetween(0, Math.ceil(height / cellSize)), + }, + lastTick: performance.now(), + randomWallBag: [], + randomWallTarget: randomWallTarget(), + newCellsToVisit: [], + renderOffset: { x: 0, y: 0 }, + done: false, + }; + } + + function isOnScreen(maze: Maze, x: number, y: number) { + const { x: offsetX, y: offsetY } = maze.renderOffset; + const cellX = offsetX + x * cellSize; + const cellY = offsetY + y * cellSize; + return ( + cellX + cellSize > 0 && + cellX < width && + cellY + cellSize > 0 && + cellY < height + ); + } + + function tick(maze: Maze, other?: Maze) { + if (maze.done) return; + + // The original maze algorithm broke down 4%-8% of random right facing + // walls, and 4%-8% of down facing walls. It did this at the end. + // To make this visual more interesting, two random walls will be broken + // down every 12-25 cell visits. This way, the main trail is always running. + if (maze.randomWallBag.length > maze.randomWallTarget) { + const down: Cell = randomOf(maze.randomWallBag); + const right: Cell = randomOf(maze.randomWallBag); + maze.randomWallBag.forEach((cell) => + cell.cell_flash = Math.min(cell.cell_flash + 0.2, 1) + ); + down.cell_flash = 1; + down.down = false; + down.down_flash = 1; + right.cell_flash = 1; + right.right = false; + right.right_flash = 1; + maze.randomWallBag = []; + maze.randomWallTarget = randomWallTarget(); + return; + } + + // The main algorithm was simple: Have a cursor position, and move it in a + // random direction that it had not seen before. Once it had run out of + // options, branch off of a previous location. Only visit each cell once. + // + // In this visualization, cells that are too far offscreen are softly + // treated as "visited", which is how the simulation always stays in frame. + const current = maze.grid.cell(maze.cursor); + current.visited = true; + current.cell_flash = 1; + maze.randomWallBag.push(current); + const adjacent = ([ + { x: maze.cursor.x + 1, y: maze.cursor.y, dir: "left" }, + { x: maze.cursor.x - 1, y: maze.cursor.y, dir: "right" }, + { x: maze.cursor.x, y: maze.cursor.y + 1, dir: "up" }, + { x: maze.cursor.x, y: maze.cursor.y - 1, dir: "down" }, + ] as Pos[]).filter((pos) => + isOnScreen(maze, pos.x, pos.y) && + maze.grid.cell(pos).visited === false + ); + if (adjacent.length === 0) { + // move cursor to a random cell that has not been visited. + const cells = maze.newCellsToVisit.filter((pos) => + isOnScreen(maze, pos.x, pos.y) && + maze.grid.cell(pos).visited === false + ); + if (cells.length === 0) { + maze.done = true; + return; + } + const continuePos = randomOf(cells); + breakWall(maze, continuePos, other); + maze.cursor = { x: continuePos.x, y: continuePos.y }; + return; + } + + // break a random wall + const toBreak = randomOf(adjacent); + breakWall(maze, toBreak, other); + maze.cursor = { x: toBreak.x, y: toBreak.y }; + + // add the other directions to the new cells to visit. + maze.newCellsToVisit.push( + ...adjacent.filter((pos) => pos.dir !== toBreak.dir), + ); + } + + function breakWall(maze: Maze, pos: Pos, other?: Maze) { + if (pos.dir === "right") { + const cell = maze.grid.cell(pos); + cell.right = false; + cell.right_flash = 1; + if (other) cell.right = false; + } else if (pos.dir === "down") { + const cell = maze.grid.cell(pos); + cell.down = false; + cell.down_flash = 1; + if (other) cell.down = false; + } else if (pos.dir === "left") { + const cell = maze.grid.cell({ x: pos.x - 1, y: pos.y }); + cell.right = false; + cell.right_flash = 1; + if (other) cell.right = false; + } else if (pos.dir === "up") { + const cell = maze.grid.cell({ x: pos.x, y: pos.y - 1 }); + cell.down = false; + cell.down_flash = 1; + if (other) cell.down = false; + } + } + + function renderOffset(maze: Maze) { + return { x: maze.transform, y: maze.transform }; + } + + let animationFrameId: number; + let last = performance.now(); + let dt: number = 0; + + function renderMazeBorders(maze: Maze, opacity: number) { + ctx.globalAlpha = opacity; + maze.grid.forAll( + maze.renderOffset, + width, + height, + (cell, { x: cellX, y: cellY }) => { + // Walls + if (cell.right) { + ctx.fillStyle = color; + ctx.fillRect( + cellX + cellSize - borderThickness / 2, + cellY - borderThickness / 2, + borderThickness, + cellSize + borderThickness, + ); + } + if (cell.down) { + ctx.fillStyle = color; + ctx.fillRect( + cellX - borderThickness / 2, + cellY + cellSize - borderThickness / 2, + cellSize + borderThickness, + borderThickness, + ); + } + }, + ); + ctx.globalAlpha = 1; + } + + function renderCellFlash(maze: Maze) { + maze.grid.forAll( + maze.renderOffset, + width, + height, + (cell, { x: cellX, y: cellY }) => { + // Cell flash to show visiting path. + if (cell.cell_flash > 0) { + cell.cell_flash = Math.max(0, cell.cell_flash - dt / 1000); + ctx.fillStyle = cellFlashColor; + ctx.globalAlpha = cell.cell_flash * cellFlashModifier; + ctx.fillRect(cellX, cellY, cellSize, cellSize); + ctx.globalAlpha = 1; + } + }, + ); + } + + function renderBorderFlash(maze: Maze) { + maze.grid.forAll( + maze.renderOffset, + width, + height, + (cell, { x: cellX, y: cellY }) => { + if (cell.right_flash == 0 && cell.down_flash == 0) { + return; + } + + // Walls + const cellFlash = cell.cell_flash * cellFlashModifier; + if (cell.right_flash > 0) { + cell.right_flash = Math.max(0, cell.right_flash - dt / 500); + ctx.fillStyle = interpolateColor( + bg, + wallFlashColor, + Math.max(cell.right_flash, cellFlash), + ); + if (cellFlash > cell.right_flash) { + ctx.globalAlpha = cell.right_flash / cellFlash; + } + ctx.fillRect( + cellX + cellSize - borderThickness / 2, + cellY + borderThickness / 2, + borderThickness, + cellSize - borderThickness, + ); + ctx.globalAlpha = 1; + } + if (cell.down_flash > 0) { + if (cellFlash > cell.down_flash) { + ctx.globalAlpha = cell.down_flash / cellFlash; + } + cell.down_flash = Math.max(0, cell.down_flash - dt / 500); + ctx.fillStyle = interpolateColor( + bg, + wallFlashColor, + Math.max(cell.down_flash, cellFlash), + ); + ctx.fillRect( + cellX + borderThickness / 2, + cellY + cellSize - borderThickness / 2, + cellSize - borderThickness, + borderThickness, + ); + ctx.globalAlpha = 1; + } + }, + ); + } + + function render() { + const now = performance.now(); + dt = now - last; + maze.transform += dt * 0.005; + maze.renderOffset = renderOffset(maze); + if (!maze.done) { + if (now - maze.lastTick >= updateTime) { + tick(maze); + maze.lastTick = now; + + if (maze.done) { + nextMaze = initMaze(); + nextMaze.transform = (maze.transform % cellSize) - dt * 0.005; + nextMaze.lastTick = now; + completeFade = 0; + } + } + } + if (nextMaze) { + nextMaze.transform += dt * 0.005; + nextMaze.renderOffset = renderOffset(nextMaze); + if (!nextMaze.done && now - nextMaze.lastTick >= updateTime) { + tick(nextMaze, maze); + nextMaze.lastTick = now; + } + } + last = now; + + ctx.clearRect(0, 0, width, height); + + renderCellFlash(maze); + if (nextMaze) renderCellFlash(nextMaze); + + renderMazeBorders(maze, 1); + if (nextMaze) { + renderMazeBorders(nextMaze, completeFade); + completeFade += dt / 3000; + if (completeFade >= 1) { + maze = nextMaze; + nextMaze = null; + } + } + + renderBorderFlash(maze); + if (nextMaze) { + renderCellFlash(nextMaze); + renderBorderFlash(nextMaze); + } + + animationFrameId = requestAnimationFrame(render); + } + + function interpolateColor(start: number[], end: number[], t: number) { + return hex(start.map((s, i) => Math.round(s + (end[i] - s) * t))); + } + + window.addEventListener("resize", updateDimensions); + animationFrameId = requestAnimationFrame(render); + + // cleanup function + return () => { + window.removeEventListener("resize", updateDimensions); + cancelAnimationFrame(animationFrameId); + }; +}; diff --git a/src/file-viewer/scripts/canvas_2019.ts b/src/file-viewer/scripts/canvas_2019.ts new file mode 100644 index 0000000..6030c38 --- /dev/null +++ b/src/file-viewer/scripts/canvas_2019.ts @@ -0,0 +1,213 @@ +// Ported from CanvasAPI, allegedly written on 2019-08-26. +(globalThis as any).canvas_2019 = function (canvas: HTMLCanvasElement) { + const isStandalone = canvas.getAttribute("data-standalone") === "true"; + if (isStandalone) { + canvas.parentElement!.style.backgroundColor = "#121013"; + } + // Canvas.tsx + abstract class CanvasAPI { + canvas: HTMLCanvasElement; + ctx: CanvasRenderingContext2D; + width = 0; + height = 0; + private _disposed = false; + private _running = false; + private _last = 0; + + constructor(canvas: HTMLCanvasElement) { + this.canvas = canvas; + this.width = canvas.width = canvas.clientWidth; + this.height = canvas.height = canvas.clientHeight; + const ctx = this.canvas.getContext("2d"); + if (!ctx) { + throw new Error("Canvas2D Not Supported!"); + } + this.ctx = ctx; + } + + stopRenderLoop() { + this._running = false; + } + + startRenderLoop() { + if (this._disposed) return; + this._running = true; + this._last = performance.now(); + requestAnimationFrame(this._renderLoop); + } + + private _renderLoop = (delta: number) => { + if (!this._running) return; + this.render(delta - this._last); + this._last = delta; + requestAnimationFrame(this._renderLoop); + }; + + abstract render(delta: number): void; + } + + // VaultBackground.ts + function addGSHelper( + grad: CanvasGradient, + color: string, + dotOpacity: number, + gradStop: number, + gradOpacity: number, + ) { + grad.addColorStop(gradStop, `rgba(${color},${dotOpacity * gradOpacity})`); + } + + function randAround(target: number, dist: number) { + return (Math.random() - 0.5) * dist * 2 + target; + } + + class Dot { + x = Math.random() * 1.1 - 0.05; + y = Math.random() / 4 + 0.9; + size = Math.random() * 200 + 50; + opacity = 0; + opacityRandom = Math.random() / 3 + 0.3; + fadeInOpacity = 1; + color = `${randAround(217, 30)}, ${randAround(170, 30)}, ${ + randAround(255, 20) + }`; + + life = 0; + + ySpeed_1 = 0; + ySpeed_2 = -0.0000063; + ySpeed_3 = 0.000000016; + ySpeed_4 = 0.000000000009; + + seed = Math.random(); + + delete = false; + + update(init: boolean) { + this.life += 0.8; + if (this.life < 115) { + this.opacity = this.life / 230; + } else if (this.life > 450) { + this.delete = true; + } else if (this.life > 300) { + this.opacity = (150 + 300 - this.life) / 300; + } + + this.ySpeed_3 += this.ySpeed_4; + this.ySpeed_2 += this.ySpeed_3; + this.ySpeed_1 += this.ySpeed_2; + this.y += this.ySpeed_1 * 0.5; + + this.size -= 0.08; + + if (this.delete) { + Object.assign(this, new Dot()); + } + } + + render(scene: VaultBackground) { + const ctx = scene.ctx; + + if (this.fadeInOpacity < 1) { + this.fadeInOpacity += 0.0075; + } + + const finalX = this.x + + Math.sin(this.seed * Math.PI * 2 + Date.now() / 15000) * 0.2; + + const drawX = scene.shakeX + + finalX * Math.max(700, scene.width) - + (Math.max(700, scene.width) - scene.width) / 2; + const drawY = scene.shakeY + (this.y * 1.5 - 0.5) * scene.height; + + const opacity = this.opacity * this.opacityRandom * this.fadeInOpacity; + + const grad = ctx.createRadialGradient( + drawX, + drawY, + 0, + drawX, + drawY, + this.size, + ); + addGSHelper(grad, this.color, opacity, 0, 1); + addGSHelper(grad, this.color, opacity, 0.8, 0.7); + addGSHelper(grad, this.color, opacity, 0.87, 0.5); + addGSHelper(grad, this.color, opacity, 0.93, 0.3); + addGSHelper(grad, this.color, opacity, 1, 0); + + ctx.fillStyle = grad; + ctx.fillRect( + drawX - this.size, + drawY - this.size, + this.size * 2, + this.size * 2, + ); + } + } + + class VaultBackground extends CanvasAPI { + private items = new Set(); + + private shakeVar = 0; + private dom?: HTMLElement; + shakeX = 0; + shakeY = 0; + + constructor(canvas: HTMLCanvasElement) { + super(canvas); + for (let i = 0; i < 450; i++) { + if (i % 7 === 0) { + this.items.add(new Dot()); + } + this.items.forEach((x) => x.update(true)); + } + this.items.forEach((x) => x.fadeInOpacity = 0); + } + + render(): void { + this.ctx.clearRect(0, 0, this.width, this.height); + + this.items.forEach((x) => (x.update(false), x.render(this))); + + if (this.shakeVar >= 0.0001) { + this.shakeVar *= 0.97 - 0.22 * this.shakeVar; + + if (this.shakeVar >= 0.0001) { + this.shakeX = (Math.random() * 2 - 1) * this.shakeVar * 65; + this.shakeY = (Math.random() * 2 - 1) * this.shakeVar * 65; + if (this.dom) { + this.dom.style.transform = + `translate(${this.shakeX}px,${this.shakeY}px)`; + } + } else { + this.shakeX = 0; + this.shakeY = 0; + if (this.dom) this.dom.style.removeProperty("transform"); + this.dom = undefined; + } + } + } + + shake(dom?: HTMLElement | null) { + this.dom = dom || document.body; + this.shakeVar = 1; + } + } + + // Binding code + let bg = new VaultBackground(canvas); + bg.startRenderLoop(); + canvas.style.opacity = "0.2"; + function onResize() { + bg.width = canvas.width = canvas.clientWidth; + bg.height = canvas.height = canvas.clientHeight; + } + window.addEventListener("resize", onResize); + onResize(); + (globalThis as any).vault = bg; + return () => { + bg.stopRenderLoop(); + window.removeEventListener("resize", onResize); + }; +}; diff --git a/src/file-viewer/scripts/canvas_2020.ts b/src/file-viewer/scripts/canvas_2020.ts new file mode 100644 index 0000000..16170c4 --- /dev/null +++ b/src/file-viewer/scripts/canvas_2020.ts @@ -0,0 +1,197 @@ +// Vibe coded with AI +(globalThis as any).canvas_2020 = function (canvas: HTMLCanvasElement) { + const isStandalone = canvas.getAttribute("data-standalone") === "true"; + // Rain effect with slanted lines + // Configuration interface for the rain effect + interface RainConfig { + fps: number; // frames per second + color: string; // color of rain particles + angle: number; // angle in degrees + particleDensity: number; // particles per 10000 pixels of canvas area + speed: number; // speed of particles (pixels per frame) + lineWidth: number; // thickness of rain lines + lineLength: number; // length of rain lines + } + + // Rain particle interface + interface RainParticle { + x: number; // x position + y: number; // y position + } + + // Default configuration + const config: RainConfig = { + fps: 16, + color: isStandalone ? "#00FEFB99" : "#081F24", + angle: -18, + particleDensity: 1, + speed: 400, + lineWidth: 8, + lineLength: 100, + }; + + // Get the canvas context + const ctx = canvas.getContext("2d"); + if (!ctx) { + console.error("Could not get canvas context"); + return () => {}; + } + + // Make canvas transparent + if (isStandalone) { + canvas.style.backgroundColor = "#0F252B"; + } else { + canvas.style.backgroundColor = "transparent"; + } + + // Calculate canvas dimensions and update when resized + let width = canvas.width; + let height = canvas.height; + let particles: RainParticle[] = []; + let animationFrameId: number; + let lastFrameTime = 0; + const frameInterval = 1000 / config.fps; + + // Calculate angle in radians + const angleRad = (config.angle * Math.PI) / 180; + + // Update canvas dimensions and particle count when resized + const updateDimensions = () => { + width = canvas.width = canvas.offsetWidth; + height = canvas.height = canvas.offsetHeight; + + // Calculate the canvas area in pixels + const canvasArea = width * height; + + // Calculate target number of particles based on canvas area + const targetParticleCount = Math.floor( + (canvasArea / 10000) * config.particleDensity, + ); + + // Calculate buffer for horizontal offset due to slanted angle + const buffer = Math.abs(height * Math.tan(angleRad)) + config.lineLength; + + // Adjust the particles array + if (particles.length < targetParticleCount) { + // Add more particles if needed + for (let i = particles.length; i < targetParticleCount; i++) { + particles.push(createParticle(true, buffer)); + } + } else if (particles.length > targetParticleCount) { + // Remove excess particles + particles = particles.slice(0, targetParticleCount); + } + }; + + // Create a new particle + // Added initialDistribution parameter to distribute particles across the entire canvas at startup + const createParticle = ( + initialDistribution = false, + buffer: number, + ): RainParticle => { + // For initial distribution, place particles throughout the canvas + // Otherwise start them above the canvas + let x = Math.random() * (width + buffer * 2) - buffer; + let y; + + if (initialDistribution) { + // Distribute across the entire canvas height for initial setup + y = Math.random() * (height + config.lineLength * 2) - config.lineLength; + } else { + // Start new particles from above the canvas with some randomization + y = -config.lineLength - (Math.random() * config.lineLength * 20); + } + + return { + x, + y, + }; + }; + + // Update particle positions + const updateParticles = () => { + // Calculate buffer for horizontal offset due to slanted angle + const buffer = Math.abs(height * Math.tan(angleRad)) + config.lineLength; + + for (let i = 0; i < particles.length; i++) { + const p = particles[i]; + + // Update position based on speed and angle + p.x += Math.sin(angleRad) * config.speed; + p.y += Math.cos(angleRad) * config.speed; + + // Reset particles that go offscreen - only determined by position + // Add extra buffer to ensure particles fully exit the visible area before resetting + if ( + p.y > height + config.lineLength || + p.x < -buffer || + p.x > width + buffer + ) { + particles[i] = createParticle(false, buffer); + } + } + }; + + // Draw particles + const drawParticles = () => { + // Clear canvas + ctx.clearRect(0, 0, width, height); + + // Set drawing properties + ctx.strokeStyle = config.color; + ctx.lineWidth = config.lineWidth; + ctx.lineCap = "square"; + + // Draw each rain line + ctx.beginPath(); + for (const p of particles) { + // Only draw particles that are either on screen or within a reasonable buffer + // This is for performance reasons - we don't need to draw particles far offscreen + if (p.y >= -config.lineLength * 2 && p.y <= height + config.lineLength) { + const endX = p.x + Math.sin(angleRad) * config.lineLength; + const endY = p.y + Math.cos(angleRad) * config.lineLength; + + ctx.moveTo(p.x, p.y); + ctx.lineTo(endX, endY); + } + } + ctx.stroke(); + }; + + // Animation loop + const animate = (currentTime: number) => { + animationFrameId = requestAnimationFrame(animate); + + // Control frame rate + if (currentTime - lastFrameTime < frameInterval) { + return; + } + + lastFrameTime = currentTime; + + updateParticles(); + drawParticles(); + }; + + // Initialize the animation + const init = () => { + // Set up resize handler + window.addEventListener("resize", updateDimensions); + + // Initial setup + updateDimensions(); + + // Start animation + lastFrameTime = performance.now(); + animationFrameId = requestAnimationFrame(animate); + }; + + // Start the animation + init(); + + // Return cleanup function + return () => { + window.removeEventListener("resize", updateDimensions); + cancelAnimationFrame(animationFrameId); + }; +}; diff --git a/src/file-viewer/scripts/canvas_2021.ts b/src/file-viewer/scripts/canvas_2021.ts new file mode 100644 index 0000000..3c319cf --- /dev/null +++ b/src/file-viewer/scripts/canvas_2021.ts @@ -0,0 +1,783 @@ +// Vibe coded. +(globalThis as any).canvas_2021 = function (canvas: HTMLCanvasElement) { + const isStandalone = canvas.getAttribute("data-standalone") === "true"; + // Constants for simulation + const PARTICLE_RADIUS = 4.5; + const PARTICLE_DENSITY = 0.004; // Particles per pixel + const MIN_SPEED = 0.05; + const MAX_SPEED = 6.0; + const FRICTION = 0.96; + const REPULSION_STRENGTH = 0.1; + const REPULSION_RADIUS = 50; + const FORCE_RADIUS = 400; // Increased radius + const FORCE_STRENGTH = 0.25; + const FORCE_FALLOFF_EXPONENT = 3; // Higher value = sharper falloff + const FORCE_SPACING = 10; // Pixels between force points + const MIN_FORCE_STRENGTH = 0.05; // Minimum force strength for very slow movements + const MAX_FORCE_STRENGTH = 0.4; // Maximum force strength for fast movements + const MIN_SPEED_THRESHOLD = 1; // Movement speed (px/frame) that produces minimum force + const MAX_SPEED_THRESHOLD = 20; // Movement speed that produces maximum force + const OVERSCAN_PIXELS = 250; + const CELL_SIZE = REPULSION_RADIUS; // For spatial hashing + + let globalOpacity = 0; + + if (isStandalone) { + canvas.style.backgroundColor = "#301D02"; + } else { + canvas.style.backgroundColor = "transparent"; + } + + // Interfaces + interface Particle { + x: number; + y: number; + vx: number; + vy: number; + charge: number; // 0 to 1, affecting color + } + + interface Force { + x: number; + y: number; + dx: number; + dy: number; + strength: number; + radius: number; + createdAt: number; + } + + interface SpatialHash { + [key: string]: Particle[]; + } + + // State + let first = true; + let particles: Particle[] = []; + let forces: Force[] = []; + let width = canvas.width; + let height = canvas.height; + let targetParticleCount = 0; + let spatialHash: SpatialHash = {}; + let ctx: CanvasRenderingContext2D | null = null; + let animationId: number | null = null; + let isRunning = false; + + // Mouse tracking + let lastMousePosition: { x: number; y: number } | null = null; + // Track position of the last created force + let lastForcePosition: { x: number; y: number } | null = null; + + // Keep track of previous canvas dimensions for resize logic + let previousWidth = 0; + let previousHeight = 0; + + // Initialize and cleanup + function init(): void { + ctx = canvas.getContext("2d"); + if (!ctx) return; + + // Set canvas to full size + resizeCanvas(); + + // Event listeners + window.addEventListener("resize", resizeCanvas); + document.addEventListener("mousemove", handleMouseMove); + + // Start animation immediately + start(); + } + + function cleanup(): void { + // Stop the animation + stop(); + + // Remove event listeners + window.removeEventListener("resize", resizeCanvas); + document.removeEventListener("mousemove", handleMouseMove); + + // Clear arrays + particles = []; + forces = []; + spatialHash = {}; + lastMousePosition = null; + lastForcePosition = null; + } + + // Resize canvas and adjust particle count + function resizeCanvas(): void { + // Store previous dimensions + previousWidth = width; + previousHeight = height; + + // Update to new dimensions + width = window.innerWidth; + height = window.innerHeight; + canvas.width = width; + canvas.height = height; + + const oldTargetCount = targetParticleCount; + targetParticleCount = Math.floor(width * height * PARTICLE_DENSITY); + + // Adjust particle count + if (targetParticleCount > oldTargetCount) { + // Add more particles if needed, but only in newly available space + addParticles(targetParticleCount - oldTargetCount, !first); + first = false; + } + // Note: Removal of excess particles happens naturally during update + } + + // Handle mouse movement + function handleMouseMove(e: MouseEvent): void { + const rect = canvas.getBoundingClientRect(); + const currentX = e.clientX - rect.left; + const currentY = e.clientY - rect.top; + + // Initialize positions if this is the first movement + if (!lastMousePosition || !lastForcePosition) { + lastMousePosition = { x: currentX, y: currentY }; + lastForcePosition = { x: currentX, y: currentY }; + return; + } + + // Store current mouse position + const mouseX = currentX; + const mouseY = currentY; + + // Calculate vector from last mouse position to current + const dx = mouseX - lastMousePosition.x; + const dy = mouseY - lastMousePosition.y; + const distMoved = Math.sqrt(dx * dx + dy * dy); + + // Skip if essentially no movement (avoids numerical issues) + if (distMoved < 0.1) { + return; + } + + // Get the vector from the last force to the current mouse position + const forceDx = mouseX - lastForcePosition.x; + const forceDy = mouseY - lastForcePosition.y; + const forceDistance = Math.sqrt(forceDx * forceDx + forceDy * forceDy); + + // Only create forces if we've moved far enough from the last force + if (forceDistance >= FORCE_SPACING) { + // Calculate the direction vector from last force to current mouse + let dirX = forceDx / forceDistance; + let dirY = forceDy / forceDistance; + + // Calculate how many force points to create + const numPoints = Math.floor(forceDistance / FORCE_SPACING); + + // Calculate movement speed based on the recent movement + const movementSpeed = distMoved; // Simple approximation of speed + + // Scale force strength based on movement speed + let speedFactor; + if (movementSpeed <= MIN_SPEED_THRESHOLD) { + speedFactor = MIN_FORCE_STRENGTH; + } else if (movementSpeed >= MAX_SPEED_THRESHOLD) { + speedFactor = MAX_FORCE_STRENGTH; + } else { + // Linear interpolation between min and max + const t = (movementSpeed - MIN_SPEED_THRESHOLD) / + (MAX_SPEED_THRESHOLD - MIN_SPEED_THRESHOLD); + speedFactor = MIN_FORCE_STRENGTH + + t * (MAX_FORCE_STRENGTH - MIN_FORCE_STRENGTH); + } + + // Store current force position to update incrementally + let currentForceX = lastForcePosition.x; + let currentForceY = lastForcePosition.y; + + // Create evenly spaced force points along the path from last force to current mouse + for (let i = 0; i < numPoints; i++) { + // Calculate position for this force point + const t = (i + 1) / numPoints; + const fx = lastForcePosition.x + forceDx * t; + const fy = lastForcePosition.y + forceDy * t; + + // Create force at this position with the direction vector + createForce(fx, fy, dirX, dirY, speedFactor); + + // Update the last force position to this new force + currentForceX = fx; + currentForceY = fy; + } + + // Update the last force position + lastForcePosition = { x: currentForceX, y: currentForceY }; + } + + // Always update the last mouse position + lastMousePosition = { x: mouseX, y: mouseY }; + } + + // Create a new force + function createForce( + x: number, + y: number, + dx: number, + dy: number, + strength = FORCE_STRENGTH, + ): void { + forces.push({ + x, + y, + dx, + dy, + strength, + radius: 1, + createdAt: Date.now(), + }); + } + + // Improved particle addition with fill strategy options + function addParticles(count: number, inNewAreaOnly: boolean = false): void { + // Determine available space + const minX = -OVERSCAN_PIXELS; + const maxX = width + OVERSCAN_PIXELS; + const minY = -OVERSCAN_PIXELS; + const maxY = height + OVERSCAN_PIXELS; + + // Use a grid system that guarantees uniform spacing of particles + const gridSpacing = REPULSION_RADIUS * 0.8; // Slightly less than repulsion radius + const gridWidth = Math.ceil((maxX - minX) / gridSpacing); + const gridHeight = Math.ceil((maxY - minY) / gridSpacing); + + // Track which grid cells are already occupied + const occupiedCells: Set = new Set(); + + // Mark cells occupied by existing particles + for (const particle of particles) { + const cellX = Math.floor((particle.x - minX) / gridSpacing); + const cellY = Math.floor((particle.y - minY) / gridSpacing); + + // Ensure cell coordinates are within valid range + if (cellX >= 0 && cellX < gridWidth && cellY >= 0 && cellY < gridHeight) { + occupiedCells.add(`${cellX},${cellY}`); + } + } + + // Create arrays of all cells and filter by placement strategy + const allGridCells: { x: number; y: number }[] = []; + + for (let cellY = 0; cellY < gridHeight; cellY++) { + for (let cellX = 0; cellX < gridWidth; cellX++) { + const cellKey = `${cellX},${cellY}`; + if (!occupiedCells.has(cellKey)) { + const posX = minX + (cellX + 0.5) * gridSpacing; + const posY = minY + (cellY + 0.5) * gridSpacing; + + // For new area only placement, filter to expanded areas + if (inNewAreaOnly && previousWidth > 0 && previousHeight > 0) { + const expandedRight = width > previousWidth; + const expandedBottom = height > previousHeight; + + const inNewRightArea = expandedRight && posX >= previousWidth && + posX <= width; + const inNewBottomArea = expandedBottom && posY >= previousHeight && + posY <= height; + + if (inNewRightArea || inNewBottomArea) { + allGridCells.push({ x: cellX, y: cellY }); + } + } else if (!inNewAreaOnly) { + // Standard placement - add all valid cells + allGridCells.push({ x: cellX, y: cellY }); + } + } + } + } + + if (allGridCells.length == 0) { + throw new Error("No cells available to place particles"); + } + + // We now have all grid cells that match our placement criteria + + // If we need more particles than we have available cells, we need to adjust + // gridSpacing to fit more cells into the same space + if (count > allGridCells.length) { + // Retry with a smaller grid spacing + // Proportionally reduce the grid spacing to fit the required number of particles + const scaleFactor = Math.sqrt(allGridCells.length / count); + const newGridSpacing = gridSpacing * scaleFactor; + + // Clear particles and try again with new spacing + // This is a recursive call, but with adjusted parameters that will fit + return addParticlesWithCustomSpacing( + count, + inNewAreaOnly, + newGridSpacing, + ); + } + + // Shuffle the available cells for random selection + shuffleArray(allGridCells); + + // Take the number of cells we need + const cellsToUse = Math.min(count, allGridCells.length); + const selectedCells = allGridCells.slice(0, cellsToUse); + + // Create particles in selected cells + for (const cell of selectedCells) { + // Add jitter within the cell for natural look + const jitterX = (Math.random() - 0.5) * gridSpacing * 0.8; + const jitterY = (Math.random() - 0.5) * gridSpacing * 0.8; + + // Calculate final position + const x = minX + (cell.x + 0.5) * gridSpacing + jitterX; + const y = minY + (cell.y + 0.5) * gridSpacing + jitterY; + + // Create a particle at this position + particles.push(createParticle(x, y)); + } + } + + // Helper function to add particles with custom grid spacing + function addParticlesWithCustomSpacing( + count: number, + inNewAreaOnly: boolean, + gridSpacing: number, + ): void { + if (gridSpacing == 0) throw new Error("Grid spacing is 0"); + // Determine available space + const minX = -OVERSCAN_PIXELS; + const maxX = width + OVERSCAN_PIXELS; + const minY = -OVERSCAN_PIXELS; + const maxY = height + OVERSCAN_PIXELS; + + // Create grid using the custom spacing + const gridWidth = Math.ceil((maxX - minX) / gridSpacing); + const gridHeight = Math.ceil((maxY - minY) / gridSpacing); + + // Track which grid cells are already occupied + const occupiedCells: Set = new Set(); + + // Mark cells occupied by existing particles + for (const particle of particles) { + const cellX = Math.floor((particle.x - minX) / gridSpacing); + const cellY = Math.floor((particle.y - minY) / gridSpacing); + + // Ensure cell coordinates are within valid range + if (cellX >= 0 && cellX < gridWidth && cellY >= 0 && cellY < gridHeight) { + occupiedCells.add(`${cellX},${cellY}`); + } + } + + // Create arrays of all cells and filter by placement strategy + const allGridCells: { x: number; y: number }[] = []; + + for (let cellY = 0; cellY < gridHeight; cellY++) { + for (let cellX = 0; cellX < gridWidth; cellX++) { + const cellKey = `${cellX},${cellY}`; + if (!occupiedCells.has(cellKey)) { + const posX = minX + (cellX + 0.5) * gridSpacing; + const posY = minY + (cellY + 0.5) * gridSpacing; + + // For new area only placement, filter to expanded areas + if (inNewAreaOnly && previousWidth > 0 && previousHeight > 0) { + const expandedRight = width > previousWidth; + const expandedBottom = height > previousHeight; + + const inNewRightArea = expandedRight && posX >= previousWidth && + posX <= width; + const inNewBottomArea = expandedBottom && posY >= previousHeight && + posY <= height; + + if (inNewRightArea || inNewBottomArea) { + allGridCells.push({ x: cellX, y: cellY }); + } + } else if (!inNewAreaOnly) { + // Standard placement - add all valid cells + allGridCells.push({ x: cellX, y: cellY }); + } + } + } + } + + // Shuffle the available cells for random distribution + shuffleArray(allGridCells); + + // Take the number of cells we need (or all if we have fewer) + const cellsToUse = Math.min(count, allGridCells.length); + + // Create particles in selected cells + for (let i = 0; i < cellsToUse; i++) { + const cell = allGridCells[i]; + + // Add jitter within the cell + const jitterX = (Math.random() - 0.5) * gridSpacing * 0.8; + const jitterY = (Math.random() - 0.5) * gridSpacing * 0.8; + + // Calculate final position + const x = minX + (cell.x + 0.5) * gridSpacing + jitterX; + const y = minY + (cell.y + 0.5) * gridSpacing + jitterY; + + // Create a particle at this position + particles.push(createParticle(x, y)); + } + } + + // Utility to shuffle an array (Fisher-Yates algorithm) + function shuffleArray(array: T[]): void { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; + } + } + + // Simplified createParticle function that just places at a specific position + function createParticle(x: number, y: number): Particle { + return { + x: x + (Math.random() * 4 - 2), + y: y + (Math.random() * 4 - 2), + vx: 0, + vy: 0, + charge: 0, + }; + } + + // Function to create a particle on one of the edges + function createParticleOnEdge(): Particle { + // Overscan bounds with fixed pixel size + const minX = -OVERSCAN_PIXELS; + const maxX = width + OVERSCAN_PIXELS; + const minY = -OVERSCAN_PIXELS; + const maxY = height + OVERSCAN_PIXELS; + + let x: number, y: number; + + // Place on one of the edges + const edge = Math.floor(Math.random() * 4); + switch (edge) { + case 0: // Top + x = minX + Math.random() * (maxX - minX); + y = minY; + break; + case 1: // Right + x = maxX; + y = minY + Math.random() * (maxY - minY); + break; + case 2: // Bottom + x = minX + Math.random() * (maxX - minX); + y = maxY; + break; + case 3: // Left + x = minX; + y = minY + Math.random() * (maxY - minY); + break; + default: + x = minX + Math.random() * (maxX - minX); + y = minY + Math.random() * (maxY - minY); + } + + return createParticle(x, y); + } + + // Spatial hashing functions + function getHashKey(x: number, y: number): string { + const cellX = Math.floor(x / CELL_SIZE); + const cellY = Math.floor(y / CELL_SIZE); + return `${cellX},${cellY}`; + } + + function addToSpatialHash(particle: Particle): void { + const key = getHashKey(particle.x, particle.y); + if (!spatialHash[key]) { + spatialHash[key] = []; + } + spatialHash[key].push(particle); + } + + function updateSpatialHash(): void { + // Clear previous hash + spatialHash = {}; + + // Add all particles to hash + for (const particle of particles) { + addToSpatialHash(particle); + } + } + + function getNearbyParticles( + x: number, + y: number, + radius: number, + ): Particle[] { + const result: Particle[] = []; + const cellRadius = Math.ceil(radius / CELL_SIZE); + + const centerCellX = Math.floor(x / CELL_SIZE); + const centerCellY = Math.floor(y / CELL_SIZE); + + for ( + let cellX = centerCellX - cellRadius; + cellX <= centerCellX + cellRadius; + cellX++ + ) { + for ( + let cellY = centerCellY - cellRadius; + cellY <= centerCellY + cellRadius; + cellY++ + ) { + const key = `${cellX},${cellY}`; + const cell = spatialHash[key]; + + if (cell) { + result.push(...cell); + } + } + } + + return result; + } + + // Main update function + function update(): void { + const now = Date.now(); + // Fixed pixel overscan + const minX = -OVERSCAN_PIXELS; + const maxX = width + OVERSCAN_PIXELS; + const minY = -OVERSCAN_PIXELS; + const maxY = height + OVERSCAN_PIXELS; + + // Update spatial hash + updateSpatialHash(); + + // Update forces and remove expired ones + if (forces.length > 40) { + forces = forces.slice(-40); + } + forces = forces.filter((force) => { + force.strength *= 0.95; + force.radius *= 0.95; + return force.strength > 0.001; + }); + + // Update particles + const newParticles: Particle[] = []; + + for (const particle of particles) { + // Apply forces + for (const force of forces) { + const dx = particle.x - force.x; + const dy = particle.y - force.y; + const distSq = dx * dx + dy * dy; + + const radius = force.radius * FORCE_RADIUS; + + if (distSq < radius * radius) { + const dist = Math.sqrt(distSq); + + // Exponential falloff - much more concentrated at center + // (1 - x/R)^n where n controls how sharp the falloff is + const normalizedDist = dist / radius; + const factor = Math.pow(1 - normalizedDist, FORCE_FALLOFF_EXPONENT); + + // Calculate force line projection for directional effect + // This makes particles along the force's path experience stronger effect + const dotProduct = (dx * -force.dx) + (dy * -force.dy); + const projectionFactor = Math.max(0, dotProduct / dist); + + // Apply the combined factors - stronger directional bias + const finalFactor = factor * force.strength * + (0.1 + 0.9 * projectionFactor); + + particle.vx += force.dx * finalFactor; + particle.vy += force.dy * finalFactor; + // charge for the first 100ms + if ((now - force.createdAt) < 100) { + particle.charge = Math.min( + 1, + particle.charge + (finalFactor * finalFactor) * 0.2, + ); + } + } + } + + // Apply repulsion from nearby particles + const nearby = getNearbyParticles( + particle.x, + particle.y, + REPULSION_RADIUS, + ); + + for (const other of nearby) { + if (other === particle) continue; + + const dx = particle.x - other.x; + const dy = particle.y - other.y; + const distSq = dx * dx + dy * dy; + + if (distSq < REPULSION_RADIUS * REPULSION_RADIUS && distSq > 0) { + const dist = Math.sqrt(distSq); + const factor = REPULSION_STRENGTH * (1 - dist / REPULSION_RADIUS); + + const fx = dx / dist * factor; + const fy = dy / dist * factor; + + particle.vx += fx; + particle.vy += fy; + } + } + + // Apply friction + particle.vx *= FRICTION; + particle.vy *= FRICTION; + + // Ensure minimum speed + const speed = Math.sqrt( + particle.vx * particle.vx + particle.vy * particle.vy, + ); + if (speed < MIN_SPEED && speed > 0) { + const scale = MIN_SPEED / speed; + particle.vx *= scale; + particle.vy *= scale; + } + + // Cap at maximum speed + if (speed > MAX_SPEED) { + const scale = MAX_SPEED / speed; + particle.vx *= scale; + particle.vy *= scale; + } + + // Update position + particle.x += particle.vx; + particle.y += particle.vy; + + // Decrease charge + particle.charge *= 0.99; + + // Check if particle is within extended bounds + if ( + particle.x >= minX && particle.x <= maxX && + particle.y >= minY && particle.y <= maxY + ) { + // If outside screen but within overscan, keep it if we need more particles + if ( + (particle.x < 0 || particle.x > width || + particle.y < 0 || particle.y > height) && + newParticles.length >= targetParticleCount + ) { + continue; + } + + newParticles.push(particle); + } else { + // Out of bounds, respawn if needed + if (newParticles.length < targetParticleCount) { + newParticles.push(createParticleOnEdge()); + } + } + } + + // Add more particles if needed + while (newParticles.length < targetParticleCount) { + newParticles.push(createParticleOnEdge()); + } + + particles = newParticles; + } + + // Render function + const mul = isStandalone ? 0.9 : 0.5; + const add = isStandalone ? 0.1 : 0.03; + function render(): void { + if (!ctx) return; + + // Clear canvas + ctx.clearRect(0, 0, width, height); + + // Draw particles + for (const particle of particles) { + // Only draw if within canvas bounds (plus a small margin) + if ( + particle.x >= -PARTICLE_RADIUS && + particle.x <= width + PARTICLE_RADIUS && + particle.y >= -PARTICLE_RADIUS && particle.y <= height + PARTICLE_RADIUS + ) { + ctx.beginPath(); + ctx.arc(particle.x, particle.y, PARTICLE_RADIUS, 0, Math.PI * 2); + + // Color based on charge + ctx.fillStyle = "#FFCB1F"; + ctx.globalAlpha = (particle.charge * mul + add) * globalOpacity; + ctx.fill(); + } + } + + // // Debug: Draw forces and falloff visualization + // if (ctx) { + // for (const force of forces) { + // const R = force.radius * FORCE_RADIUS; + + // // Draw force point + // ctx.beginPath(); + // ctx.arc(force.x, force.y, 5, 0, Math.PI * 2); + // ctx.fillStyle = 'rgba(255, 0, 0, 0.5)'; + // ctx.fill(); + + // // Draw force direction + // ctx.beginPath(); + // ctx.moveTo(force.x, force.y); + // ctx.lineTo(force.x + force.dx * 20, force.y + force.dy * 20); + // ctx.strokeStyle = 'red'; + // ctx.stroke(); + + // // Visualize the falloff curve with rings + // for (let i = 0; i <= 10; i++) { + // const radius = (R * i) / 10; + // const normalizedDist = radius / R; + // const intensity = Math.pow(1 - normalizedDist, FORCE_FALLOFF_EXPONENT); + + // ctx.beginPath(); + // ctx.arc(force.x, force.y, radius, 0, Math.PI * 2); + // ctx.strokeStyle = `rgba(255, 0, 0, ${intensity * 0.2})`; + // ctx.stroke(); + // } + // } + // } + } + + // Animation loop + let r = Math.random(); + function animate(): void { + globalOpacity = Math.min(1, globalOpacity + 0.03); + update(); + render(); + + if (isRunning) { + animationId = requestAnimationFrame(animate); + } + } + + // Start/stop functions + function start(): void { + if (isRunning) return; + + // Calculate target particle count based on canvas size + targetParticleCount = Math.floor(width * height * PARTICLE_DENSITY); + + // Clear any existing particles and create new ones with proper spacing + particles = []; + addParticles(targetParticleCount); + + isRunning = true; + animate(); + } + + function stop(): void { + isRunning = false; + + if (animationId !== null) { + cancelAnimationFrame(animationId); + animationId = null; + } + } + + init(); + return cleanup; +}; diff --git a/src/file-viewer/scripts/canvas_2022.ts b/src/file-viewer/scripts/canvas_2022.ts new file mode 100644 index 0000000..4f03027 --- /dev/null +++ b/src/file-viewer/scripts/canvas_2022.ts @@ -0,0 +1,160 @@ +(globalThis as any).canvas_2022 = function (canvas: HTMLCanvasElement) { + const isStandalone = canvas.getAttribute("data-standalone") === "true"; + // Configuration for the grid of rotating squares + const config = { + gridRotation: 20, // Overall grid rotation in degrees + squareSize: 20, // Size of each square + spacing: 100, // Distance between square centers + moveSpeedX: 0.01, // Horizontal movement speed (pixels per second) + moveSpeedY: 0.01, // Vertical movement speed (pixels per second) + squareColor: "#00220A", // Color of the squares + squareOpacity: 1, // Opacity of the squares + + // Function to determine square rotation based on its coordinates and time + // Can be adjusted for different patterns + rotationFunction: (x: number, y: number, time: number): number => { + // Combination of spatial wave and time-based rotation + return Math.sin(x * 0.05) * Math.cos(y * 0.05) * 180; + }, + }; + + // Convert grid rotation to radians + const gridRotationRad = (config.gridRotation * Math.PI) / 180; + + // Get the canvas context + const ctx = canvas.getContext("2d"); + if (!ctx) { + console.error("Could not get canvas context"); + return () => {}; + } + + // Make canvas transparent + if (isStandalone) { + canvas.style.backgroundColor = "#154226"; + } else { + canvas.style.backgroundColor = "transparent"; + } + + // Animation variables + let width = canvas.width; + let height = canvas.height; + let offsetX = 0; + let offsetY = 0; + let time = 0; + let animationFrameId: number; + let lastTime = 0; + + // Update canvas dimensions when resized + const updateDimensions = () => { + width = canvas.width = canvas.clientWidth; + height = canvas.height = canvas.clientHeight; + }; + + // Calculate the diagonal length of the canvas (to ensure rotation covers corners) + const calculateDiagonal = () => { + return Math.sqrt(width * width + height * height); + }; + + // Draw a single square with rotation + const drawSquare = (x: number, y: number, size: number, rotation: number) => { + ctx.save(); + + // Move to the center of the square position, rotate, then draw + ctx.translate(x, y); + ctx.rotate((rotation * Math.PI) / 180); // Convert rotation degrees to radians + + // Draw square centered at position + ctx.fillRect(-size / 2, -size / 2, size, size); + + ctx.restore(); + }; + + // Draw the entire grid of squares + const drawGrid = () => { + ctx.clearRect(0, 0, width, height); + + // Set drawing properties + ctx.fillStyle = config.squareColor; + ctx.globalAlpha = config.squareOpacity; + + // Save the current transformation state + ctx.save(); + + // Move to the center of the canvas, rotate the grid, then move back + const centerX = width / 2; + const centerY = height / 2; + ctx.translate(centerX, centerY); + ctx.rotate(gridRotationRad); + + // Calculate how much of the grid to draw based on canvas size + const diagonal = calculateDiagonal(); + const gridSize = Math.ceil(diagonal / config.spacing) + 2; + + // Adjust for offset to create movement + const adjustedOffsetX = offsetX % config.spacing; + const adjustedOffsetY = offsetY % config.spacing; + + // Draw grid with enough squares to cover the rotated canvas + const halfGrid = Math.ceil(gridSize / 2); + + for (let y = -halfGrid; y <= halfGrid; y++) { + for (let x = -halfGrid; x <= halfGrid; x++) { + // Calculate actual position with offset + const posX = x * config.spacing + adjustedOffsetX; + const posY = y * config.spacing + adjustedOffsetY; + + // Calculate square rotation based on its position and time + const squareRotation = config.rotationFunction(posX, posY, time); + + // Draw the square + drawSquare(posX, posY, config.squareSize, squareRotation); + } + } + + // Restore the transformation state + ctx.restore(); + + // Reset global alpha + ctx.globalAlpha = 1.0; + }; + + // Animation loop + const animate = (currentTime: number) => { + animationFrameId = requestAnimationFrame(animate); + + // Calculate time elapsed since last frame + const elapsed = currentTime - lastTime; + lastTime = currentTime; + + // Update time variable for rotation function + time += elapsed; + + // Update position offsets for movement + offsetX += config.moveSpeedX * elapsed; + offsetY += config.moveSpeedY * elapsed; + + // Draw the grid + drawGrid(); + }; + + // Initialize the animation + const init = () => { + // Set up resize handler + window.addEventListener("resize", updateDimensions); + + // Initial setup + updateDimensions(); + + // Start animation + animationFrameId = requestAnimationFrame(animate); + }; + + // Start the animation + init(); + + // Return cleanup function + return () => { + window.removeEventListener("resize", updateDimensions); + cancelAnimationFrame(animationFrameId); + }; +}; diff --git a/src/file-viewer/scripts/canvas_2023.ts b/src/file-viewer/scripts/canvas_2023.ts new file mode 100644 index 0000000..ce8bf1c --- /dev/null +++ b/src/file-viewer/scripts/canvas_2023.ts @@ -0,0 +1,197 @@ +(globalThis as any).canvas_2023 = function (canvas: HTMLCanvasElement) { + const isStandalone = canvas.getAttribute("data-standalone") === "true"; + const config = { + heartBaseSize: 50, + heartMaxSize: 100, + spacing: 150, + rowSpeed: 0.1, + heartColor: "#FF90D9", + heartOpacity: isStandalone ? 0.5 : 0.04, + mouseInfluenceRadius: 1000, + heartScaleFunction: (distance: number, radius: number): number => { + if (distance > radius) return 1; + + const normalizedDistance = distance / radius; + const scaleFactor = 1 + + (1 - normalizedDistance) * + (config.heartMaxSize / config.heartBaseSize - 1); + + return 1 + (scaleFactor - 1) * Math.pow(1 - normalizedDistance, 2); + }, + }; + + const heart = new Path2D( + "M23.9451 45.3973L20.8672 42.6493C16.9551 39.0174 13.7054 35.8927 11.1181 33.275C8.53056 30.6574 6.46731 28.286 4.92839 26.1608C3.38946 24.0356 2.31772 22.1028 1.71314 20.3624C1.10856 18.6219 0.806274 16.8705 0.806274 15.1081C0.806274 11.4718 2.03118 8.42016 4.481 5.95312C6.93118 3.48608 9.93831 2.25256 13.5024 2.25256C15.5649 2.25256 17.482 2.70142 19.2536 3.59912C21.0255 4.49682 22.5893 5.80674 23.9451 7.52887C25.484 5.73346 27.1059 4.40522 28.8108 3.54416C30.5161 2.6831 32.3751 2.25256 34.3877 2.25256C38.0141 2.25256 41.0551 3.48663 43.5108 5.95477C45.9661 8.42291 47.1938 11.4758 47.1938 15.1136C47.1938 16.8712 46.8823 18.6115 46.2594 20.3343C45.6365 22.0568 44.5648 23.9807 43.0442 26.1059C41.5236 28.231 39.4721 30.6136 36.8896 33.2536C34.3068 35.8936 31.0362 39.0255 27.0779 42.6493L23.9451 45.3973ZM23.9176 38.802C27.6088 35.431 30.6339 32.5547 32.9928 30.173C35.3518 27.7913 37.2091 25.7211 38.5648 23.9624C39.9205 22.2036 40.864 20.6137 41.3953 19.1928C41.9266 17.7715 42.1923 16.4101 42.1923 15.1086C42.1923 12.8768 41.4529 11.0098 39.974 9.50748C38.4952 8.0052 36.6461 7.25406 34.4268 7.25406C32.631 7.25406 30.9572 7.6811 29.4055 8.87193C27.8537 10.0628 25.5389 13.0434 25.5389 13.0434L23.9451 15.3299L22.3512 13.0434C22.3512 13.0434 20.0643 10.2311 18.4638 9.04031C16.8634 7.84948 15.2194 7.25406 13.4991 7.25406C11.2929 7.25406 9.46857 7.98816 8.02602 9.45637C6.58383 10.9246 5.86273 12.8162 5.86273 15.1311C5.86273 16.4784 6.13644 17.8679 6.68386 19.2994C7.23127 20.731 8.18394 22.3333 9.54185 24.1064C10.8998 25.879 12.7329 27.9562 15.0413 30.3379C17.3497 32.7196 20.3084 35.5409 23.9176 38.802Z", + ); + + const ctx = canvas.getContext("2d"); + if (!ctx) { + console.error("Could not get canvas context"); + return () => {}; + } + + if (isStandalone) { + canvas.style.backgroundColor = "#2F1C21"; + } else { + canvas.style.backgroundColor = "transparent"; + } + + let width = canvas.width; + let height = canvas.height; + let animationFrameId: number; + let lastFrameTime = 0; + + let mouseX = width / 2; + let mouseY = height / 2; + + let offset = config.spacing / 2; + + const updateDimensions = () => { + width = canvas.width = canvas.clientWidth; + height = canvas.height = canvas.clientHeight; + + mouseX = width / 2; + mouseY = height / 2; + }; + + const drawHeart = (x: number, y: number, size: number) => { + const scale = size / 30; + + ctx.save(); + ctx.translate(x, y); + ctx.scale(scale, scale); + + ctx.fillStyle = config.heartColor; + ctx.fill(heart); + + ctx.restore(); + }; + + const c = 400; + const h = 40; + const k = solveForK(c, h); + + const drawHeartGrid = () => { + ctx.clearRect(0, 0, width, height); + + ctx.globalAlpha = config.heartOpacity; + + const numRows = Math.ceil(height / config.spacing) + 1; + + for (let row = 0; row < numRows; row++) { + const direction = row % 2 === 0 ? 1 : -1; + const rowOffset = (offset * direction) % config.spacing; + + const posYInit = row * config.spacing + config.spacing / 2; + + for ( + let posXInit = -config.spacing + rowOffset; + posXInit < width + config.spacing; + posXInit += config.spacing + ) { + const dx = (posXInit + config.heartBaseSize / 2) - mouseX; + const dy = (posYInit + config.heartBaseSize / 2) - mouseY; + const distance = Math.sqrt(dx * dx + dy * dy); + + const pushIntensity = asymmetricBump(distance, h, c, k, 0.00002); + + const pushAngle = Math.atan2(dy, dx); + + const pushDistanceX = pushIntensity * Math.cos(pushAngle); + const pushDistanceY = pushIntensity * Math.sin(pushAngle); + const posX = posXInit + pushDistanceX * 1; + const posY = posYInit + pushDistanceY * 2; + + const scaleFactor = config.heartScaleFunction( + distance, + config.mouseInfluenceRadius, + ); + const heartSize = config.heartBaseSize * scaleFactor; + + if ( + posX > -config.heartMaxSize && + posX < width + config.heartMaxSize && + posY > -config.heartMaxSize && + posY < height + config.heartMaxSize + ) { + drawHeart(posX - heartSize / 2, posY - heartSize / 2, heartSize); + } + } + } + + ctx.globalAlpha = 1.0; + }; + + function solveForK(c: number, k: number) { + // input -> f(x)=h*e^{(-k*(x-c)^{2})} + // desired result is (0, 0.45). (0, 0) is unsolvable but 0.45px will round down to 0. + // + // solution: -\frac{\ln\left(\frac{0.45}{h}\right)}{c^{2}} + return -Math.log(0.45 / h) / (c * c); + } + + function asymmetricBump( + x: number, + h: number, + c: number, + leftK: number, + rightK: number, + ) { + const k = (x <= c) ? leftK : rightK; + return h * Math.exp(-k * Math.pow(x - c, 2)); + } + + const updateOffset = (elapsed: number) => { + offset += config.rowSpeed * elapsed; + + if (offset > 1000000) { + offset -= 1000000; + } + }; + + const animate = (currentTime: number) => { + animationFrameId = requestAnimationFrame(animate); + + const elapsed = currentTime - lastFrameTime; + lastFrameTime = currentTime; + + updateOffset(elapsed * 0.05); + + drawHeartGrid(); + }; + + const handleMouseMove = (event: MouseEvent) => { + const rect = canvas.getBoundingClientRect(); + mouseX = event.clientX - rect.left; + mouseY = event.clientY - rect.top; + }; + + const handleTouchMove = (event: TouchEvent) => { + if (event.touches.length > 0) { + event.preventDefault(); + const rect = canvas.getBoundingClientRect(); + mouseX = event.touches[0].clientX - rect.left; + mouseY = event.touches[0].clientY - rect.top; + } + }; + + const init = () => { + window.addEventListener("resize", updateDimensions); + document.addEventListener("mousemove", handleMouseMove); + document.addEventListener("touchmove", handleTouchMove, { passive: false }); + + updateDimensions(); + + lastFrameTime = performance.now(); + animationFrameId = requestAnimationFrame(animate); + }; + + init(); + + return () => { + window.removeEventListener("resize", updateDimensions); + document.removeEventListener("mousemove", handleMouseMove); + document.removeEventListener("touchmove", handleTouchMove); + cancelAnimationFrame(animationFrameId); + }; +}; diff --git a/src/file-viewer/scripts/canvas_2024.ts b/src/file-viewer/scripts/canvas_2024.ts new file mode 100644 index 0000000..6bab57f --- /dev/null +++ b/src/file-viewer/scripts/canvas_2024.ts @@ -0,0 +1,251 @@ +// Vibe coded with AI +(globalThis as any).canvas_2024 = function (canvas: HTMLCanvasElement) { + const isStandalone = canvas.getAttribute("data-standalone") === "true"; + if (isStandalone) { + canvas.parentElement!.style.backgroundColor = "black"; + } + + const gl = canvas.getContext("webgl", { + alpha: true, + premultipliedAlpha: false, + }); + if (!gl) { + console.error("WebGL not supported"); + return () => {}; + } + + canvas.style.imageRendering = "pixelated"; + canvas.style.opacity = isStandalone ? "0.3" : "0.15"; + + // Resize canvas to match display size + const resize = () => { + const displayWidth = Math.floor( + (canvas.clientWidth || window.innerWidth) / 3, + ); + const displayHeight = Math.floor( + (canvas.clientHeight || window.innerHeight) / 3, + ); + + if (canvas.width !== displayWidth || canvas.height !== displayHeight) { + canvas.width = displayWidth; + canvas.height = displayHeight; + gl.viewport(0, 0, canvas.width, canvas.height); + } + }; + resize(); + + // Vertex shader (just passes coordinates) + const vertexShaderSource = ` + attribute vec2 a_position; + void main() { + gl_Position = vec4(a_position, 0.0, 1.0); + } + `; + + // Fragment shader creates random noise with higher opacity to ensure visibility + const fragmentShaderSource = ` + precision mediump float; + uniform float u_time; + + float noise1(float seed1,float seed2){ + return( + fract(seed1+12.34567* + fract(100.*(abs(seed1*0.91)+seed2+94.68)* + fract((abs(seed2*0.41)+45.46)* + fract((abs(seed2)+757.21)* + fract(seed1*0.0171)))))) + * 1.0038 - 0.00185; + } + + float n(float seed1, float seed2, float seed3){ + float buff1 = abs(seed1+100.81) + 1000.3; + float buff2 = abs(seed2+100.45) + 1000.2; + float buff3 = abs(noise1(seed1, seed2)+seed3) + 1000.1; + buff1 = (buff3*fract(buff2*fract(buff1*fract(buff2*0.146)))); + buff2 = (buff2*fract(buff2*fract(buff1+buff2*fract(buff3*0.52)))); + buff1 = noise1(buff1, buff2); + return(buff1); + } + + void main() { + float noise = n(gl_FragCoord.x, gl_FragCoord.y, u_time); + + gl_FragColor = vec4(1.0, 0.7, 0.7, 0.8*noise); + } + `; + + // Create and compile shaders + const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource); + const fragmentShader = createShader( + gl, + gl.FRAGMENT_SHADER, + fragmentShaderSource, + ); + + // Check if shader creation failed + if (!vertexShader || !fragmentShader) { + console.error("Failed to create shaders"); + return () => {}; + } + + // Create program and link shaders + const program = createProgram(gl, vertexShader, fragmentShader); + + // Check if program creation failed + if (!program) { + console.error("Failed to create program"); + return () => {}; + } + + // Get attribute and uniform locations + const positionAttributeLocation = gl.getAttribLocation(program, "a_position"); + const timeUniformLocation = gl.getUniformLocation(program, "u_time"); + + // Create a position buffer for a rectangle covering the entire canvas + const positionBuffer = gl.createBuffer(); + if (!positionBuffer) { + console.error("Failed to create position buffer"); + return () => {}; + } + + gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer); + // Rectangle that covers the entire clip space + const positions = [ + -1.0, + -1.0, // bottom left + 1.0, + -1.0, // bottom right + -1.0, + 1.0, // top left + 1.0, + 1.0, // top right + ]; + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW); + + // Set up blending + gl.enable(gl.BLEND); + gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); + + // Fixed 24 FPS timing + const FPS = 24; + const FRAME_TIME = 1000 / FPS; // ms per frame + + // Handle animation + let animationTimerId: number; + let startTime = Date.now(); + let lastFrameTime = 0; + + const render = () => { + // Get current time + const currentTime = Date.now(); + const deltaTime = currentTime - lastFrameTime; + + // Skip frame if it's too early (maintain 24 FPS) + if (deltaTime < FRAME_TIME) { + animationTimerId = window.setTimeout(render, 0); // Check again ASAP but yield to browser + return; + } + + // Update last frame time, accounting for any drift + lastFrameTime = currentTime - (deltaTime % FRAME_TIME); + + // Resize canvas if needed + resize(); + + // Calculate elapsed time in seconds for animation + const elapsedTime = (currentTime - startTime) / 1000; + + // Clear the canvas with transparent black + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + + // Use our shader program + gl.useProgram(program); + + // Set up the position attribute + gl.enableVertexAttribArray(positionAttributeLocation); + gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer); + gl.vertexAttribPointer( + positionAttributeLocation, + 2, // 2 components per vertex + gl.FLOAT, // data type + false, // normalize + 0, // stride (0 = compute from size and type) + 0, // offset + ); + + // Update time uniform for animation + gl.uniform1f(timeUniformLocation, elapsedTime); + + // Draw the rectangle (2 triangles) + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); + + // Schedule next frame (aiming for 24 FPS) + const timeToNextFrame = Math.max( + 0, + FRAME_TIME - (Date.now() - currentTime), + ); + animationTimerId = window.setTimeout(render, timeToNextFrame); + }; + + // Helper function to create shaders + function createShader( + gl: WebGLRenderingContext, + type: number, + source: string, + ): WebGLShader | null { + const shader = gl.createShader(type); + if (!shader) { + console.error("Failed to create shader object"); + return null; + } + + gl.shaderSource(shader, source); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + console.error("Shader compilation error:", gl.getShaderInfoLog(shader)); + gl.deleteShader(shader); + return null; + } + + return shader; + } + + // Helper function to create program and link shaders + function createProgram( + gl: WebGLRenderingContext, + vertexShader: WebGLShader, + fragmentShader: WebGLShader, + ): WebGLProgram | null { + const program = gl.createProgram(); + if (!program) { + console.error("Failed to create program object"); + return null; + } + + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + gl.linkProgram(program); + + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + console.error("Program linking error:", gl.getProgramInfoLog(program)); + return null; + } + + return program; + } + + // Start the rendering with initial timestamp + lastFrameTime = Date.now(); + render(); + + // Return cleanup function + return () => { + clearTimeout(animationTimerId); + if (program) gl.deleteProgram(program); + if (vertexShader) gl.deleteShader(vertexShader); + if (fragmentShader) gl.deleteShader(fragmentShader); + if (positionBuffer) gl.deleteBuffer(positionBuffer); + }; +}; diff --git a/src/file-viewer/scripts/canvas_cotyledon.ts b/src/file-viewer/scripts/canvas_cotyledon.ts new file mode 100644 index 0000000..b5e2ef0 --- /dev/null +++ b/src/file-viewer/scripts/canvas_cotyledon.ts @@ -0,0 +1,362 @@ +// @ts-ignore +globalThis.canvas_cotyledon = function ( + canvas: HTMLCanvasElement, + panel: HTMLElement, +) { + let running = true; + const ctx = canvas.getContext("2d"); + + function resizeCanvas() { + canvas.width = canvas.clientWidth; + canvas.height = canvas.clientHeight; + } + + resizeCanvas(); + window.addEventListener("resize", resizeCanvas); + + const clover = new Path2D( + "M18.9845 34.4839C20.4004 34.5218 21.8336 34.6883 23.2644 34.9578C20.1378 31.095 18.4268 27.1546 18.0555 23.2959C17.321 15.6622 21.9022 9.36595 28.8908 5.78535C34.6355 2.84212 40.258 2.98454 44.2809 5.96879C45.6605 6.99221 46.7683 8.2886 47.5877 9.78593C48.3054 8.50307 49.134 7.26623 50.0858 6.17951C51.8368 4.18037 54.1947 2.47127 57.2294 2.15019C60.2768 1.82766 63.467 2.9608 66.7548 5.52299C70.9834 8.81811 73.084 12.8864 73.5996 17.2135C74.1044 21.4504 73.0711 25.7433 71.4155 29.6117C70.6566 31.3849 69.7488 33.1106 68.7557 34.7506C70.3664 33.9983 72.0168 33.3376 73.6816 32.8312C77.2262 31.7528 81.0258 31.3024 84.8151 32.2149C88.6451 33.1371 92.2246 35.3946 95.3823 39.3157C98.4534 43.1293 99.9219 46.6818 99.997 49.9677C100.073 53.3033 98.7051 55.9829 96.8652 57.9789C95.0586 59.9387 92.7653 61.2872 90.7505 62.1315C90.692 62.1561 90.6334 62.1802 90.5746 62.2042L90.4465 62.256C91.4852 63.7304 92.4724 65.5955 93.0127 67.6979C93.5916 69.9509 93.6669 72.5285 92.674 75.1356C91.679 77.7482 89.7006 80.1559 86.5767 82.2161C86.5556 82.23 86.5342 82.2438 86.5126 82.2571C84.1333 83.7267 81.5504 84.7197 78.6932 84.9352C75.832 85.151 72.8634 84.5742 69.7337 83.1522C64.7667 80.8953 59.274 76.4525 52.8745 69.3645C52.8789 70.1568 52.8844 70.9254 52.9004 71.6677C52.9643 74.6226 53.1868 77.4534 54.0666 80.6265C55.2259 84.503 57.2821 88.4684 60.9561 92.3161C61.644 93.0366 61.8512 94.0908 61.4872 95.018L60.9919 96.2799C60.6464 97.16 59.8435 97.778 58.9041 97.8865C57.9647 97.9952 57.042 97.5769 56.5047 96.7985C52.5406 91.0574 50.3441 86.3289 49.1491 82.0434C48.0155 78.2319 47.6244 74.4579 47.5085 71.0024C45.418 73.6873 42.8696 76.4687 40.0618 78.9101C34.3517 83.8756 26.6803 88.1931 19.142 85.9955C15.5301 84.9425 12.8635 83.2751 11.0848 81.1179C9.2952 78.9474 8.5557 76.4627 8.4981 74.0631C8.43961 71.6256 9.07998 69.225 10.075 67.1703C7.76333 66.828 5.38011 65.9682 3.47071 64.2327C-0.339092 60.7699 -1.2199 54.8876 1.86982 46.4552C3.47011 42.0878 5.90372 38.9798 8.98328 37.0179C12.0444 35.0677 15.5215 34.3912 18.9845 34.4839Z", + ); + + // Background + const base = [0x14, 0x1a, 0x19]; + + let blobTextureCanvas: OffscreenCanvas; + let blobTextureCtx: OffscreenCanvasRenderingContext2D; + const blobSize = 1000; // Size of the noise texture + { + const blobTexture = new ImageData(blobSize, blobSize); + const data = blobTexture.data; + + let x = 0; + let y = 0; + for (let i = 0; i < data.length; i += 4) { + if (x >= blobSize) { + x = 0; + y++; + } + + const noiseX = Math.sin(x * .2 + y * .1) * 0.03; + const noiseY = Math.cos(y * .6 + x * .2) * 0.05; + + const centerX = blobSize / 2; + const centerY = blobSize / 2; + const dx = (x + noiseX) - centerX; + const dy = (y + noiseY) - centerY; + const distanceFromCenterRaw = (dx * dx + dy * dy) ** 0.5; + + const maxDistance = blobSize / 2; + const distanceFromCenter = Math.min( + 1, + distanceFromCenterRaw / maxDistance, + ); + + const noiseValue = (1 - 0.5 * Math.sin(x * 0.02 - y * 0.04)) * + (1 - 0.5 * Math.cos(x * 0.03 + y * 0.04)) * 0.3; + + const gradient = (1 - distanceFromCenter) * + (0.95 - distanceFromCenter * 0.4); + const finalValue = Math.max( + 0, + Math.min(1, gradient * (Math.random() * 0.3 + 0.85 + noiseValue)), + ); + + data[i] = 121; + data[i + 1] = 219; + data[i + 2] = 160; + data[i + 3] = Math.floor(finalValue * 255.99); // Alpha + x++; + } + blobTextureCanvas = new OffscreenCanvas(blobSize, blobSize); + blobTextureCtx = blobTextureCanvas.getContext("2d")!; + blobTextureCtx.putImageData(blobTexture, 0, 0); + } + + class CotyledonParticle { + x: number; + y: number; + size: number; + velocityX: number; + velocityY: number; + rotation: number; + rotationSpeed: number; + color: string; + + constructor(positioning: "random" | "edge") { + this.size = Math.random() * 0.1 + 0.6; + + if (positioning === "edge") { + const edge = Math.floor(Math.random() * 5); + if (edge === 0 || edge === 1) { + // Right edge + this.x = 1.05; + this.y = Math.random(); + this.velocityX = -Math.random() * 0.1 - 0.2; + this.velocityY = 0; + } else if (edge === 2 || edge === 3) { + // Top edge + this.x = Math.random(); + this.y = -0.05; + this.velocityX = -Math.random() * 0.1 - 0.1; + this.velocityY = -Math.random() * 0.2 - 0.05; + } else { + // Bottom edge + this.x = Math.random() * 0.5 + 0.5; + this.y = 1.05; + this.velocityX = Math.random() * 0.1 + 0.1; + this.velocityY = -Math.random() * 0.3 - 0.1; + } + } else { + let tries = 0; + do { + this.x = Math.random(); + this.y = Math.random(); + this.velocityX = -Math.random() * 0.05 - 0.1; + this.velocityY = -Math.random() * 0.2 + 0.1; + } while (this.tooCloseToAnyOtherParticle() && (tries++ < 10)); + } + + this.rotation = Math.random() * Math.PI * 2; + this.rotationSpeed = (Math.random() * 0.003 - 0.0015) * + (Math.random() > 0.5 ? 1 : -1); + + const opacity = Math.random() * 0.4 + 0.2; + this.color = `rgba(${ + base.map((x) => x + Math.floor(x * opacity)).join(",") + }, 1)`; + } + + tooCloseToAnyOtherParticle() { + for (let i = 0; i < cotyledonParticles.length; i++) { + const otherParticle = cotyledonParticles[i]; + const distance = Math.sqrt( + (this.x - otherParticle.x) ** 2 + (this.y - otherParticle.y) ** 2, + ); + if (distance < 0.1) { + return true; + } + } + } + + update() { + if (this.velocityY < 0.01) { + this.velocityY += 0.00025; + } + this.velocityX -= 0.0001; + this.x += this.velocityX / 1300; + this.y += this.velocityY / 1000; + this.rotation += this.rotationSpeed; + return this.x < -0.05 || (this.y > 1 && this.velocityY < 0); + } + + draw() { + if (!ctx) return; + + ctx.save(); + ctx.translate(this.x * canvas.width, this.y * canvas.height); + ctx.rotate(this.rotation); + ctx.scale(this.size, this.size); + ctx.translate(-50, -50); + ctx.fillStyle = this.color; + ctx.fill(clover); + ctx.restore(); + } + } + + class BlobParticle { + x: number; + y: number; + opacity: number; + state: 0 | 1 | 2; + stateTime: number; + stayDuration: number; + innerColor: string; + rot: number = Math.random() * Math.PI * 2; + + constructor() { + this.x = Math.random() * 0.6 + 0.2; + this.y = Math.random() * 0.6 + 0.2; + + this.opacity = 0; // Start fully transparent + + this.state = 0; + this.stateTime = 0; + this.stayDuration = Math.random() * 10000 + 5000; // Random stay duration between 5-15 seconds + + const colorMultiplier = Math.random() * 0.5 + 1.5; // 0.5-1.0 multiplier + const colorValues = base.map((x) => Math.floor(x * colorMultiplier)); + this.innerColor = `rgba(${colorValues.join(",")}, 1)`; + } + + update(deltaTime: number) { + this.stateTime += deltaTime; + + if (this.state === 0) { + this.opacity = Math.min(1, this.stateTime / 15000); + if (this.stateTime >= 15000) { + this.state = 1; + this.stateTime = 0; + } + } else if (this.state === 1) { + if (this.stateTime >= this.stayDuration) { + this.state = 2; + this.stateTime = 0; + } + } else if (this.state === 2) { + this.opacity = Math.max(0, 1 - (this.stateTime / 15000)); + if (this.stateTime >= 15000) { + return true; + } + } + return false; + } + + draw() { + if (!ctx) return; + + const screenX = this.x * canvas.width; + const screenY = this.y * canvas.height; + const screenSize = (Math.min(canvas.width, canvas.height) * 2) / blobSize; + + ctx.save(); + ctx.translate(screenX - screenSize * 0.5, screenY - screenSize * 0.5); + ctx.scale(screenSize, screenSize); + ctx.rotate(this.rot); + ctx.globalAlpha = this.opacity * 0.2; + ctx.globalCompositeOperation = "overlay"; + ctx.drawImage(blobTextureCanvas, 0, 0); + ctx.restore(); + } + } + + const cotyledonParticles: CotyledonParticle[] = []; + const blobParticles: BlobParticle[] = []; + let blobParticleTop: BlobParticle = new BlobParticle(); + for (let i = 0; i < 80; i++) { + cotyledonParticles.push(new CotyledonParticle("random")); + } + for (let i = 0; i < 9; i++) { + const blobParticle = new BlobParticle(); + if (i < 4) { + blobParticle.state = 1; + blobParticle.opacity = 1; + blobParticle.stayDuration = Math.random() * 10000; + } else { + blobParticle.state = i < 7 ? 2 : 0; + blobParticle.stateTime = Math.random() * 15000; + } + if (i > 0) { + do { + blobParticle.x = Math.random(); + blobParticle.y = Math.random(); + } while ( + blobParticles.some((p) => + Math.sqrt((p.x - blobParticle.x) ** 2 + (p.y - blobParticle.y) ** 2) < + 0.1 + ) + ); + } + blobParticles.push(blobParticle); + } + + let lastTime = performance.now(); + + function animate(currentTime: number) { + if (!running) return; + if (!ctx) return; + + const deltaTime = currentTime - lastTime; + lastTime = currentTime; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + + for (let i = blobParticles.length - 1; i >= 0; i--) { + const shouldRemove = blobParticles[i].update(deltaTime); + if (shouldRemove) { + blobParticles[i] = new BlobParticle(); + } else { + blobParticles[i].draw(); + } + } + + for (let i = cotyledonParticles.length - 1; i >= 0; i--) { + const shouldRemove = cotyledonParticles[i].update(); + if (shouldRemove) { + cotyledonParticles[i] = new CotyledonParticle("edge"); + } else { + cotyledonParticles[i].draw(); + } + } + + if (blobParticleTop.update(deltaTime)) { + blobParticleTop = new BlobParticle(); + } + blobParticleTop.draw(); + + requestAnimationFrame(animate); + } + + let clickedButton = false; + const enterButton = panel.querySelector("button#enter")!; + enterButton.addEventListener("click", () => { + if (clickedButton) return; + clickedButton = true; + const first = panel.querySelector("#first")! as HTMLElement; + const second = panel.querySelector("#captcha")! as HTMLElement; + first.style.transition = second.style.transition = "opacity 1s ease-in-out"; + first.style.opacity = "0"; + second.style.opacity = "0"; + setTimeout(() => { + first.style.display = "none"; + second.style.display = "block"; + setTimeout(() => { + second.style.opacity = "1"; + + document.getElementById("enter2")?.addEventListener("click", () => { + second.style.opacity = "0"; + let p = fetch("/file/cotyledon", { + method: "POST", + body: "I AGREE", + }); + setTimeout(() => { + p.then(() => { + location.reload(); + }); + }, 1000); + }); + }, 10); + }, 1000); + }); + const imageButtons = panel.querySelectorAll(".image-grid button")!; + imageButtons.forEach((button) => { + let canClick = true; + button.addEventListener("click", () => { + if (!canClick) return; + canClick = false; + const image = button.querySelector("img")!; + image.style.transition = "opacity 0.05s linear"; + image.style.opacity = "0"; + setTimeout(() => { + image.style.transition = "opacity 2s linear"; + let newNum; + do { + newNum = Math.floor(Math.random() * 18); // 0-17 inclusive + } while ( + document.querySelector(`img[src="/captcha/image/${newNum}.jpeg"]`) + ); + image.setAttribute("src", `/captcha/image/${newNum}.jpeg`); + setTimeout(() => { + image.style.opacity = "0.75"; + canClick = true; + }, 50); + }, 300); + }); + }); + + // Start animation + animate(performance.now()); + return () => { + window.removeEventListener("resize", resizeCanvas); + running = false; + }; +}; diff --git a/src/file-viewer/static/captcha/0.jpeg b/src/file-viewer/static/captcha/0.jpeg new file mode 100644 index 0000000..3ceedb3 Binary files /dev/null and b/src/file-viewer/static/captcha/0.jpeg differ diff --git a/src/file-viewer/static/captcha/1.jpeg b/src/file-viewer/static/captcha/1.jpeg new file mode 100644 index 0000000..583bf34 Binary files /dev/null and b/src/file-viewer/static/captcha/1.jpeg differ diff --git a/src/file-viewer/static/captcha/10.jpeg b/src/file-viewer/static/captcha/10.jpeg new file mode 100644 index 0000000..1c7b478 Binary files /dev/null and b/src/file-viewer/static/captcha/10.jpeg differ diff --git a/src/file-viewer/static/captcha/11.jpeg b/src/file-viewer/static/captcha/11.jpeg new file mode 100644 index 0000000..2b03a2d Binary files /dev/null and b/src/file-viewer/static/captcha/11.jpeg differ diff --git a/src/file-viewer/static/captcha/12.jpeg b/src/file-viewer/static/captcha/12.jpeg new file mode 100644 index 0000000..70d0582 Binary files /dev/null and b/src/file-viewer/static/captcha/12.jpeg differ diff --git a/src/file-viewer/static/captcha/13.jpeg b/src/file-viewer/static/captcha/13.jpeg new file mode 100644 index 0000000..d92b575 Binary files /dev/null and b/src/file-viewer/static/captcha/13.jpeg differ diff --git a/src/file-viewer/static/captcha/14.jpeg b/src/file-viewer/static/captcha/14.jpeg new file mode 100644 index 0000000..8c17777 Binary files /dev/null and b/src/file-viewer/static/captcha/14.jpeg differ diff --git a/src/file-viewer/static/captcha/15.jpeg b/src/file-viewer/static/captcha/15.jpeg new file mode 100644 index 0000000..11e253a Binary files /dev/null and b/src/file-viewer/static/captcha/15.jpeg differ diff --git a/src/file-viewer/static/captcha/16.jpeg b/src/file-viewer/static/captcha/16.jpeg new file mode 100644 index 0000000..cb1d076 Binary files /dev/null and b/src/file-viewer/static/captcha/16.jpeg differ diff --git a/src/file-viewer/static/captcha/17.jpeg b/src/file-viewer/static/captcha/17.jpeg new file mode 100644 index 0000000..1d29f27 Binary files /dev/null and b/src/file-viewer/static/captcha/17.jpeg differ diff --git a/src/file-viewer/static/captcha/2.jpeg b/src/file-viewer/static/captcha/2.jpeg new file mode 100644 index 0000000..d85eb9b Binary files /dev/null and b/src/file-viewer/static/captcha/2.jpeg differ diff --git a/src/file-viewer/static/captcha/3.jpeg b/src/file-viewer/static/captcha/3.jpeg new file mode 100644 index 0000000..4f1e842 Binary files /dev/null and b/src/file-viewer/static/captcha/3.jpeg differ diff --git a/src/file-viewer/static/captcha/4.jpeg b/src/file-viewer/static/captcha/4.jpeg new file mode 100644 index 0000000..f153da0 Binary files /dev/null and b/src/file-viewer/static/captcha/4.jpeg differ diff --git a/src/file-viewer/static/captcha/5.jpeg b/src/file-viewer/static/captcha/5.jpeg new file mode 100644 index 0000000..5939aac Binary files /dev/null and b/src/file-viewer/static/captcha/5.jpeg differ diff --git a/src/file-viewer/static/captcha/6.jpeg b/src/file-viewer/static/captcha/6.jpeg new file mode 100644 index 0000000..8373022 Binary files /dev/null and b/src/file-viewer/static/captcha/6.jpeg differ diff --git a/src/file-viewer/static/captcha/7.jpeg b/src/file-viewer/static/captcha/7.jpeg new file mode 100644 index 0000000..b3b1094 Binary files /dev/null and b/src/file-viewer/static/captcha/7.jpeg differ diff --git a/src/file-viewer/static/captcha/8.jpeg b/src/file-viewer/static/captcha/8.jpeg new file mode 100644 index 0000000..5471f07 Binary files /dev/null and b/src/file-viewer/static/captcha/8.jpeg differ diff --git a/src/file-viewer/static/captcha/9.jpeg b/src/file-viewer/static/captcha/9.jpeg new file mode 100644 index 0000000..02d2287 Binary files /dev/null and b/src/file-viewer/static/captcha/9.jpeg differ diff --git a/src/file-viewer/views/canvas.astro b/src/file-viewer/views/canvas.astro new file mode 100644 index 0000000..ca31307 --- /dev/null +++ b/src/file-viewer/views/canvas.astro @@ -0,0 +1,12 @@ +--- +import { useInlineScript } from "../framework/page-resources.ts"; + +const { script } = Astro.props; +useInlineScript('canvas_' + script as any); +useInlineScript('canvas_demo'); +--- + diff --git a/src/file-viewer/views/canvas.client.ts b/src/file-viewer/views/canvas.client.ts new file mode 100644 index 0000000..3b90c5b --- /dev/null +++ b/src/file-viewer/views/canvas.client.ts @@ -0,0 +1,10 @@ +const canvas = document.querySelector("canvas"); +const id = canvas?.getAttribute("data-canvas"); +if (!id) { + throw new Error("No canvas id found"); +} +const func = (window as any)["canvas_" + id]; +if (!func) { + throw new Error("No canvas function found"); +} +func(canvas, document.body); diff --git a/src/file-viewer/views/clofi.client.ts b/src/file-viewer/views/clofi.client.ts new file mode 100644 index 0000000..4cf9af4 --- /dev/null +++ b/src/file-viewer/views/clofi.client.ts @@ -0,0 +1,685 @@ +const filesContainer = document.querySelector(".files")!; + +// push the scrollbar to the end of the view. +let distanceFromEnd = 0; +let fakeScrollToEnd: number | null = null; +filesContainer.scrollLeft = filesContainer.scrollWidth - + filesContainer.clientWidth; +window.addEventListener("resize", () => { + if (fakeScrollToEnd) return; + const { scrollWidth, clientWidth } = filesContainer; + if (scrollWidth <= clientWidth) { + distanceFromEnd = 0; + } else { + filesContainer.scrollLeft = scrollWidth - clientWidth - distanceFromEnd; + } +}, { passive: false }); +let lastScrollLeft = filesContainer.scrollLeft; +filesContainer.addEventListener("scroll", (ev) => { + const { scrollWidth, scrollLeft, clientWidth } = filesContainer; + if (scrollWidth <= clientWidth) { + distanceFromEnd = 0; + } else { + distanceFromEnd = scrollWidth - scrollLeft - clientWidth; + if (fakeScrollToEnd && scrollLeft < lastScrollLeft) { + cancelAnimationFrame(fakeScrollToEnd); + fakeScrollToEnd = null; + } + } + lastScrollLeft = scrollLeft; +}); +const lerp = (a: number, b: number, t: number) => a + t * (b - a); +function snapToEnd(initScrollStart: number) { + if (fakeScrollToEnd) { + cancelAnimationFrame(fakeScrollToEnd); + } + let lastTime = performance.now(); + let scrollStart = initScrollStart ?? filesContainer.scrollLeft; + if (scrollStart >= filesContainer.scrollWidth) { + return; + } + fakeScrollToEnd = requestAnimationFrame(function tick() { + const now = performance.now(); + const dt = now - lastTime; + lastTime = now; + + const f = 1 - (0.98 ** dt); + const { scrollWidth, clientWidth } = filesContainer; + const target = Math.floor(scrollWidth - clientWidth); + scrollStart = lerp(scrollStart, target, f); + filesContainer.scrollLeft = scrollStart; + if (Math.abs(scrollStart - target) < 0.2) { + fakeScrollToEnd = null; + } else { + fakeScrollToEnd = requestAnimationFrame(tick); + } + }); +} + +interface CacheEntry { + html: string; + expires: number; +} +// It is intentional that the existing page is NOT put into the cache. This is +// just to avoid the differences between the partials and the full page +// (subtle differences in activeFilename & isLast) +let currentFile: string = location.pathname.replace(/^\/file/, ""); +let navigationId = 0; +const cache = new Map(); +const prefetching = new Map>(); +const fetchLater: string[] = []; +let hasCotyledonSpeedbump = false; + +function prefetchEntry( + filePath: string, + lazy = false, +): void | Promise { + console.assert(filePath[0] === "/", "filePath must start with a /"); + const existingEntry = cache.get(filePath); + if (existingEntry) { + if (existingEntry.expires > Date.now()) { + return; + } + cache.delete(filePath); + } + + const existingPromise = prefetching.get(filePath); + if (existingPromise) return existingPromise; + + // lazy prefetches should be limited + if (lazy && prefetching.size > 2) { + if (!fetchLater.includes(filePath)) { + fetchLater.push(filePath); + } + return; + } + + if (filePath === "/cotyledon") { + ensureCanvasReady("cotyledon"); + } + + const promise = fetch(`/file${filePath}$partial`) + .then((resp) => { + if (resp.status !== 200) { + throw new Error(`Failed to fetch ${filePath}`); + } + return resp.text(); + }) + .then((html) => { + const entry: CacheEntry = { html, expires: Date.now() + 1000 * 60 * 20 }; + cache.set(filePath, entry); + prefetching.delete(filePath); + + if (fetchLater.length > 0 && prefetching.size < 2) { + const filePath = fetchLater.shift()!; + prefetchEntry(filePath, false); + } + + return entry; + }); + prefetching.set(filePath, promise); + + return promise; +} + +function fetchEntry(filePath: string): Promise { + const pf = prefetchEntry(filePath); + if (pf) return pf; + return Promise.resolve(cache.get(filePath)!); +} + +type CanvasFn = (canvas: HTMLCanvasElement, panel: HTMLElement) => void; +const fetchCanvas = new Map>(); +function ensureCanvasReady(id: string): Promise { + let func = (globalThis as any)["canvas_" + id]; + if (func) return Promise.resolve(func); + let promise = fetchCanvas.get(id); + if (promise) return promise; + let resolve: (c: CanvasFn) => void; + promise = new Promise((r) => resolve = r); + fetchCanvas.set(id, promise); + const script = document.createElement("script"); + script.src = `/js/canvas/${id}.js`; + script.async = true; + script.onload = () => { + func = (globalThis as any)["canvas_" + id]; + fetchCanvas.delete(id); + if (func) { + resolve(func); + } else { + console.error(`Error loading canvas script: ${id}`); + } + }; + script.onerror = () => { + console.error(`Error loading canvas script: ${id}`); + }; + document.head.appendChild(script); + return promise; +} + +interface Tooltip { + tooltip: HTMLElement; + top: number; + index: number; +} + +const panels: Panel[] = []; + +class Panel { + index: number; + panel: HTMLElement; + content: HTMLElement; + width: number; + tooltips: Tooltip[] | null; + linkFlags: number[] | null = null; + basenames: string[] | null = null; + unmountCanvas: (() => void) | null = null; + + constructor(panel: HTMLElement, index: number) { + console.assert(panel.classList.contains("panel")); + this.panel = panel; + this.index = index; + this.content = panel.querySelector(".content.primary")!; + + if (index === 0) { + this.panel.classList.add("first"); + } + + const canvas = panel.querySelector( + "canvas[data-canvas]", + ) as HTMLCanvasElement; + if (canvas) { + canvas.width = canvas.clientWidth; + canvas.height = canvas.clientHeight; + requestAnimationFrame(() => { + canvas.width = canvas.clientWidth; + canvas.height = canvas.clientHeight; + }); + const id = canvas.getAttribute("data-canvas")!; + let cancelled = false; + this.unmountCanvas = () => (cancelled = true); + ensureCanvasReady(id).then((func) => { + if (cancelled) return; + this.unmountCanvas = func(canvas, panel) as any; + }); + if (id === "cotyledon") { + filesContainer.classList.add("ctld-sb"); + const group = document.querySelector( + "[data-group='cotyledon']", + )! as HTMLElement; + if (group) { + group.setAttribute("inert", "true"); + group.style.opacity = "0.5"; + group.style.pointerEvents = "none"; + hasCotyledonSpeedbump = true; + } + } + } + + const ul = panel.querySelector("ul"); + if (!ul) { + this.width = 0; + this.linkFlags = null; + this.basenames = null; + this.tooltips = null; + return; + } + this.width = ul.offsetWidth; + const links = panel.querySelectorAll("ul > li > a.li"); + + this.content.setAttribute("data-clover", `${index}`); + + this.tooltips = []; + this.linkFlags = new Array(links.length).fill(0); + const basenames = this.basenames = new Array(links.length); + for (let i = 0; i < links.length; i++) { + const link = links[i] as HTMLAnchorElement; + link.setAttribute("data-clover", `${index};${i}`); + link.addEventListener("mouseenter", onLinkMouseEnter); + basenames[i] = link.classList.contains("readme") + ? "readme.txt" + : link.getAttribute("href")!.split("/").pop()!; + } + } + + update(newActiveFile: string) { + console.assert(newActiveFile); + const p = this.panel; + p.querySelector(".li.active")?.classList.remove("active"); + const basenames = this.basenames; + if (!basenames) return; + const ul = p.querySelector("ul")!; + this.width = ul.offsetWidth; + console.assert(!newActiveFile.includes("/")); + if (hasCotyledonSpeedbump) { + newActiveFile = "__"; + } + + const linkIndex = basenames.indexOf(newActiveFile); + if (linkIndex === -1) return; + const link = p.querySelector(`[data-clover="${this.index};${linkIndex}"]`)!; + link.classList.add("active"); + + const newActiveTooltip = this.tooltips!.findIndex((t) => + t.index === linkIndex + ); + for (let i = 0; i < this.tooltips!.length; i++) { + const { tooltip } = this.tooltips![i]; + tooltip.classList[i === newActiveTooltip ? "add" : "remove"]("active"); + } + } + + hideReadme() { + this.panel.classList.remove("last"); + const lastHsplit = this.panel.querySelector(".hsplit")!; + if (lastHsplit) { + lastHsplit.className = "hsplit-hidden"; + const previousReadme = this.panel.querySelector( + ".content.readme", + )! as HTMLElement; + console.assert(previousReadme, "No readme found"); + previousReadme.style.display = "none"; + } + } + + showReadme() { + this.panel.classList.add("last"); + const hsplit = this.panel.querySelector(".hsplit-hidden")!; + if (hsplit) { + hsplit.className = "hsplit"; + const previousReadme = this.panel.querySelector( + ".content.readme", + )! as HTMLElement; + console.assert(previousReadme, "No readme found"); + previousReadme.style.display = "block"; + } + } + + destroy() { + if (this.unmountCanvas) { + this.unmountCanvas(); + } + this.panel.querySelectorAll("audio,video").forEach((el) => + (el as HTMLVideoElement | HTMLAudioElement).pause() + ); + this.panel.remove(); + } +} + +function onContentScrollForTooltip(ev: Event) { + const content = ev.target as HTMLElement; + const panelIndex = parseInt(content.getAttribute("data-clover")!); + const panel = panels[panelIndex]; + const scrollTop = content.scrollTop; + for (const tooltip of panel.tooltips!) { + tooltip.tooltip.style.transform = tooltipTransform(tooltip.top, scrollTop); + } +} + +function tooltipTransform(offsetTop: number, scrollTop: number) { + return `translateY(${offsetTop - scrollTop}px)`; +} + +let activeTooltip: HTMLElement | null = null; +let activeTooltipCancel: (() => void) | null = null; + +function onLinkMouseEnter(e: MouseEvent) { + const link = e.target as HTMLAnchorElement; + console.assert(link.classList.contains("li")); + const attr = link.getAttribute("data-clover")!; + console.assert(attr && attr.match(/^\d+;\d+$/)); + const [panelIndex, linkIndex] = attr.split(";").map(Number); + const panel = panels[panelIndex]; + console.assert(panel, `panel${panelIndex}`); + const linkWidths = panel.linkFlags; + let filePath: string | null = null; + if (linkWidths![linkIndex] == 0) { + // filter only links that truncate their text + // insane discovery: while this is recommended online, it doesn't + // account for the `...` itself, meaning when just the file size + // is truncated, a tooltip won't be available. + // > if (link.scrollWidth <= link.offsetWidth) continue; + const lastChild = link.lastElementChild! as HTMLElement; + linkWidths![linkIndex] = lastChild?.offsetLeft !== undefined + ? (lastChild.offsetLeft + lastChild.offsetWidth) ^ 0 + : 1; + + const href = (link as HTMLAnchorElement).getAttribute("href") ?? null; + filePath = href?.startsWith("/file") ? href.slice(5) || "/" : null; + } + if (filePath) { + prefetchEntry(filePath, true); + } + if (linkWidths![linkIndex] > panel.width) { + if (activeTooltipCancel) { + activeTooltipCancel(); + activeTooltipCancel = null; + } + maybeBuildTooltipUi(link, linkIndex, panel); + } +} + +function cancelOnMouseLeave() { + activeTooltipCancel!(); + activeTooltipCancel = null; +} + +function maybeBuildTooltipUi( + link: HTMLAnchorElement, + linkIndex: number, + panel: Panel, +) { + if (activeTooltip) { + activeTooltip.remove(); + buildTooltipUi(link, linkIndex, panel, false); + } else { + link.addEventListener("mouseleave", cancelOnMouseLeave); + const timer = setTimeout(() => { + activeTooltipCancel = null; + link.removeEventListener("mouseleave", cancelOnMouseLeave); + buildTooltipUi(link, linkIndex, panel, true); + }, 150); + activeTooltipCancel = () => { + clearTimeout(timer); + link.removeEventListener("mouseleave", cancelOnMouseLeave); + }; + } +} + +function buildTooltipUi( + link: HTMLAnchorElement, + linkIndex: number, + panel: Panel, + animateIn: boolean, +) { + const tooltip = activeTooltip = document.createElement("div"); + tooltip.classList.add("tooltip"); + if (link.classList.contains("active")) { + tooltip.classList.add("active"); + } + if (animateIn) { + tooltip.style.animation = "fadeIn .1s ease-out forwards"; + } + tooltip.innerHTML = link.innerHTML; + const top = link.parentElement!.offsetTop; + tooltip.style.transform = tooltipTransform(top, panel.content.scrollTop); + panel.panel.appendChild(tooltip); + panel.tooltips!.push({ tooltip, top, index: linkIndex }); + if (panel.tooltips!.length === 1) { + panel.content.addEventListener("scroll", onContentScrollForTooltip); + } + + link.addEventListener("mouseleave", (e) => { + tooltip.style.animation = "fadeIn .3s .2s ease reverse forwards"; + const timer = setTimeout(() => { + activeTooltipCancel = null; + tooltip.remove(); + activeTooltip = null; + + const tt = panel.tooltips = panel.tooltips!.filter((t) => + t.tooltip !== tooltip + ); + if (tt.length === 0) { + panel.content.removeEventListener("scroll", onContentScrollForTooltip); + } + }, 500); + activeTooltipCancel = () => { + clearTimeout(timer); + }; + }, { once: true }); +} + +function addPanel(panel: HTMLElement, activeFile?: string) { + const p = new Panel(panel, panels.length); + panels.push(p); + if (activeFile) { + p.update(activeFile); + } +} + +async function maybeInterceptClick(event: MouseEvent, element: HTMLElement) { + const href = (element as HTMLAnchorElement).href; + const url = new URL(href, window.location.origin); + if (maybeNavigate(url, true)) { + event.preventDefault(); + } +} + +type URLLike = Pick; +function maybeNavigate(url: URLLike, pushState: boolean) { + if (!url.pathname.startsWith("/file")) return false; + if (url.origin !== location.origin) return false; + if (url.search !== "") return false; + navigate(url.pathname, pushState); + return true; +} + +async function navigate(pathname: string, pushState: boolean) { + const filePath = pathname.slice(5) || "/"; + + const currentNavigationId = ++navigationId; + + if (filePath === currentFile) return; + + const currentSplit = splitSlashes(currentFile); + const filePathSplit = splitSlashes(filePath); + + // Find the first index where the currentSplit and filePathSplit differ, then + // add all the paths after that to panelsToFetch + let deleteCount = Math.max(currentSplit.length - filePathSplit.length, 0); + let appendPanels = []; + for (let i = -1; i < filePathSplit.length; i++) { + if (currentSplit[i] !== filePathSplit[i]) { + deleteCount = currentSplit.length - i; + appendPanels = []; + for (let j = i; j < filePathSplit.length; j++) { + appendPanels.push("/" + filePathSplit.slice(0, j + 1).join("/")); + } + break; + } + } + + // Before fetching, prepare to mark the panels as loading + const loadingPanels = new Set(); + { + let lastPanel = filesContainer.lastElementChild; + let toDelete = deleteCount; + while (lastPanel && toDelete > 0) { + lastPanel.querySelectorAll(".content").forEach((content) => { + loadingPanels.add(content as HTMLElement); + }); + lastPanel = lastPanel.previousElementSibling; + toDelete--; + } + if (deleteCount == 0) { + const last = filesContainer.lastElementChild!; + console.assert(last, "Last panel is not a panel"); + + const readme = last.querySelector(".content.readme")!; + if (readme) { + loadingPanels.add(readme as HTMLElement); + } + } + const folderWithReadme = panels[panels.length - deleteCount - 1]; + const readmes = folderWithReadme.panel.querySelectorAll(".readme"); + if (readmes.length === 1) { + deleteCount += 1; + appendPanels.unshift( + "/" + currentSplit.slice(0, panels.length - deleteCount).join("/"), + ); + } + } + + console.assert( + deleteCount > 0 || appendPanels.length > 0, + "No difference found", + ); + let timer = loadingPanels.size > 0 + ? setTimeout(() => { + if (navigationId !== currentNavigationId) { + return; // cancelled + } + document.querySelectorAll(".loading") + .forEach((thing) => thing.classList.remove("loading")); + for (const panel of loadingPanels) { + panel.classList.add("loading"); + } + timer = null; + }, 100) + : null; + + // Fetch the data + let appendEntries; + try { + appendEntries = await Promise.all(appendPanels.map(fetchEntry)); + } catch (e) { + console.error("error", e); + if (navigationId === currentNavigationId) { + console.error(e); + location.href = "/file" + (filePath.length > 1 ? filePath : ""); + } + return; // cancelled + } + if (navigationId !== currentNavigationId) { + return; // cancelled + } + if (timer) clearTimeout(timer); + else {for (const panel of loadingPanels) { + panel.classList.remove("loading"); + }} + currentFile = filePath; + + if (pushState) { + history.pushState(null, "", `/file${filePath.length > 1 ? filePath : ""}`); + } + + const startScrollleft = filesContainer.scrollLeft; + + if (currentSplit[0] !== filePathSplit[0]) { + if (currentSplit[0] === "cotyledon") { + filesContainer.classList.remove("ctld-et", "ctld-sb"); + } + if (parseInt(currentSplit[0]) < 2025) { + filesContainer.classList.remove("ctld", "ctld-" + currentSplit[0]); + } + if (parseInt(filePathSplit[0]) < 2025) { + filesContainer.classList.add("ctld", "ctld-" + filePathSplit[0]); + } + } + + // Make the last panel into a regular panel + panels[panels.length - 1].hideReadme(); + + // Delete the panels that are no longer needed + for (let i = 0; i < deleteCount; i++) { + const panel = panels.pop(); + console.assert(panel, "No panel found"); + if (panel) { + panel.destroy(); + } + } + + // Update the last panel + const currentFileSplit = splitSlashes(currentFile); + const activeFile = currentFileSplit[panels.length - 1]; + panels[panels.length - 1]?.update(activeFile ?? "readme.txt"); + + // Insert the new panels + if (appendEntries.length > 0) { + let lastNewPanel: HTMLElement | null = null; + for (const entry of appendEntries) { + const panel = document.createElement("div"); + panel.classList.add("panel"); + if (panels.length >= 2) { + panel.classList.add("fade-slide-in"); + } + panel.innerHTML = entry.html; + filesContainer.appendChild(panel); + lastNewPanel = panel; + const current = currentFileSplit[panels.length]; + addPanel(panel, current ?? "readme.txt"); + if (current) { + panels[panels.length - 1].hideReadme(); + } + } + console.assert(lastNewPanel, "No last new panel found"); + lastNewPanel!.classList.add("last"); + + // Automatically play videos + const video = lastNewPanel!.querySelector("video") || + lastNewPanel!.querySelector("audio"); + if (video) { + const timer = setTimeout(() => { + video.play(); + }, 50); + video.play().then(() => { + clearTimeout(timer); + }, () => {}); + } + } else { + // Make the last panel the .last panel + const lastPanel = filesContainer.lastElementChild!; + console.assert(lastPanel, "No last panel found"); + lastPanel.classList.add("last"); + panels[panels.length - 1].showReadme(); + } + + updateWidths(); + filesContainer.scrollLeft = startScrollleft; + requestAnimationFrame(() => { + updateWidths(); + filesContainer.scrollLeft = startScrollleft; + snapToEnd(startScrollleft); + }); +} + +function updateWidths() { + for (const panel of panels.slice(-2)) { + const ul = panel.panel.querySelector("ul")!; + if (ul) { + panel.width = ul.offsetWidth; + } + } +} + +function splitSlashes(path: string) { + if (path.length <= 1) return []; + return path.slice(1).split("/"); +} + +requestAnimationFrame(() => { + document.querySelectorAll(".panel").forEach((panel) => + addPanel(panel as HTMLElement) + ); + (document.querySelector(".files")! as HTMLElement).addEventListener( + "click", + (event, element = event.target as HTMLAnchorElement) => { + if ( + !(event.button || + event.which != 1 || + event.metaKey || + event.ctrlKey || + event.shiftKey || + event.altKey || + event.defaultPrevented) + ) { + while (element && element !== document.body) { + if ( + element.nodeName.toUpperCase() === "A" + ) { + maybeInterceptClick(event, element); + return; + } + element = + (element.assignedSlot ?? element.parentNode) as HTMLAnchorElement; + } + } + }, + ); +}); + +window.addEventListener("popstate", (event) => { + if (!maybeNavigate(window.location, false)) { + location.reload(); + } +}); diff --git a/src/file-viewer/views/clofi.css b/src/file-viewer/views/clofi.css new file mode 100644 index 0000000..ba0d4b1 --- /dev/null +++ b/src/file-viewer/views/clofi.css @@ -0,0 +1,798 @@ +html, body { + height: 100vh; + width: 100vw; + overflow: hidden; + --dark-bg: #27143f; + --bar: #804fc9; +} +@font-face { + font-family: c1; + src: url(/cydn_header.woff2); + font-variation-settings: "wght" 50; +} +body { + display: grid; + background-color: var(--dark-bg); +} +.files { + background-color: var(--bg); + --scroll-bg: var(--dark-bg); + display: flex; + flex-direction: row; + overflow-x: scroll; + overflow-y: hidden; + min-height: 100vh; + border-bottom: 0; + box-sizing: border-box; + --tooltip: lch(from var(--bg) calc(l - 2) c h); + --muted: lch(from var(--dark-bg) 60 20 h / 0.8); + z-index: 1; +} +.ctld { + --c: 4.5; + --bg: lch(13 var(--c) var(--hue)); + --dark-bg: lch(10 var(--c) var(--hue)); + --bar: lch(90 96 var(--hue)); + --primary: lch(90 96 var(--hue)); +} +.ctld-2017 { + --hue: 120; +} +.ctld-2018 { + --hue: 40; +} +.ctld-2019 { + --hue: 290; + --c: 10; +} +.ctld-2020 { + --hue: 220; + --c: 10; +} +.ctld-2021 { + --hue: 70; + --c: 20; +} +.ctld-2022 { + --hue: 150; + --c: 20; +} +.ctld-2023 { + --hue: 5; + --c: 10; +} +.ctld-et { + --hue: 150; + --c: 0; +} +.ctld-2024, .ctld-sb { + --bg: #191919; + --dark-bg: #101010; + --fg: #a7a7a7; + --bar: white; + --primary: white; + .active { + font-weight: bold; + } +} +.ctld-2024 { + --dark-bg: #00000080; + --scroll-bg: #0000004d; + .content:not(.file-view-image):not(.file-view-video):not(.file-view-audio) { + background-color: #00000050; + } +} +.ctld-2024 .convo { + --primary: #ff6c5c; +} +.files::-webkit-scrollbar { + height: 24px; + background-color: transparent; +} +.files::-webkit-scrollbar-thumb { + background-color: var(--bar); + border: 6px solid var(--dark-bg); + border-radius: 12px; +} +.files::-webkit-scrollbar-track { + background-color: var(--dark-bg); +} +.files .panel { + position: relative; + flex: 0 0 auto; + min-width: 235px; + max-width: 235px; + height: 100%; + min-height: calc(100vh - 59px); /* safari hack */ + display: flex; + flex-direction: column; +} +.files .panel div.header { + display: none; +} +.files .panel .header { + white-space: nowrap; + font-size: 1rem; + font-weight: bold; + background-color: var(--dark-bg); + padding: 0.5rem 0.5rem 0.5rem 0.25rem; + color: var(--primary); + --color: var(--primary); + overflow: hidden; + text-overflow: ellipsis; + flex-shrink: 0; +} +.actions { + display: flex; + gap: 0.5rem; + height: 19px; + margin-right: 4px; + & > * { + position: relative; + width: 22px; + display: flex; + &::before { + position: absolute; + top: -3px; + width: 24px; + height: 24px; + } + } +} +.files .panel .content { + position: relative; + flex: 1; + overflow-y: scroll; + overflow-x: hidden; +} +a.header { + display: flex; +} +.files .panel.last { + min-width: min(calc(100vw - 255px), calc(90% - 20rem)); + max-width: none; + div.header { + display: flex; + } + a.header { + display: none; + } +} +.files .panel.first:not(.last) { + max-width: 216px; + min-width: 216px; +} +.files .panel.first .content:not(.readme) { + max-width: 200px; + min-width: 200px; +} +.panel:first-child { + border-left: 16px solid var(--dark-bg); +} +.panel:last-child { + flex: 1; +} +.files .panel .hsplit { + display: flex; + flex-direction: row-reverse; + height: calc(100vh - 59px); + .content { + min-width: 235px; + flex: 0 0 auto; + } + .content.readme { + min-width: 300px; + flex: 1; + } +} +.content { + height: calc(100vh - 59px); +} +.files .panel ul { + white-space: nowrap; + list-style-type: none; + display: flex; + flex-direction: column; + &, li { + margin: 0; + padding: 0; + } + li a { + &:active { + --muted: red !important; + } + position: relative; + display: block; + text-overflow: ellipsis; + font-size: 0.5rem; + overflow: hidden; + color: var(--muted); + & > * { + color: var(--fg); + font-size: 1rem; + } + &:hover:not(.active) { + background-color: rgb(from var(--dark-bg) r g b / 0.5); + } + &:active { + background-color: var(--dark-bg) !important; + color: red; + date { + color: red; + } + } + } +} +.li, .tooltip { + padding: 0.5rem 0.2rem 0.5rem 0.2rem; + color: var(--fg); + &.active { + background-color: var(--dark-bg); + color: var(--primary); + --color: var(--primary); + --muted: var(--primary); + } + date { + color: var(--muted); + letter-spacing: -0.08em; + padding-right: 0.3rem; + transform: scaleX(0.95); + display: inline-block; + &.inline { + padding-right: 0; + } + } +} +pre { + padding: 1rem; + font-size: 1rem; +} +.files .panel ul a.readme { + display: flex; + font-weight: bold; + align-items: center; + color: #91fff2; + &.active { + --muted: #91fff2; + } + .line { + display: block; + width: 58px; + margin-right: 8px; + margin-left: 2px; + height: 2px; + background-color: var(--muted); + } +} +.panel .content::-webkit-scrollbar { + width: 10px; +} +.panel .content::-webkit-scrollbar-thumb { + background-color: var(--bar); + border: 2px solid var(--dark-bg); + border-radius: 8px; +} +.panel .content::-webkit-scrollbar-track { + background-color: var(--scroll-bg); +} +.tooltip { + position: absolute; + left: 0; + top: 35px; + background-color: var(--tooltip); + pointer-events: none; + padding-right: 1rem; + border-bottom-right-radius: 8px; + border-top-right-radius: 8px; + white-space: nowrap; + z-index: 100; +} +h3 { + padding-left: 0.25rem; + font-size: 1rem; + margin: 0; + margin-top: 8px; + margin-bottom: 2px; + text-decoration: underline; + text-underline-offset: 1px; + text-decoration-thickness: 2px; +} +@keyframes fadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } +} +.file-view { + display: flex; + flex-direction: column; +} +.bold-slash { + font-weight: bold; + text-shadow: 1px 0 0 var(--color); +} +.size { + display: inline-block; + font-size: 0.9rem; + color: var(--muted); + padding-left: 0.4rem; +} +.first .size { + display: inline-block; + font-size: 0.7rem; + padding-left: 0.2rem; + transform: translateY(1px); +} +.mobile-back { + display: none; +} +.actions .download::before { + content: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjQiIGZpbGw9IiNmZmZmZmYiPjxwYXRoIGQ9Ik00ODAtMzIwIDI4MC01MjBsNTYtNTggMTA0IDEwNHYtMzI2aDgwdjMyNmwxMDQtMTA0IDU2IDU4LTIwMCAyMDBaTTI0MC0xNjBxLTMzIDAtNTYuNS0yMy41VDE2MC0yNDB2LTEyMGg4MHYxMjBoNDgwdi0xMjBoODB2MTIwcTAgMzMtMjMuNSA1Ni41VDcyMC0xNjBIMjQwWiIvPjwvc3ZnPg==); + transform: scale(1.2); +} +.actions .full-screen::before { + content: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMTIwLTEyMHYtMzIwaDgwdjE4NGw1MDQtNTA0SDUyMHYtODBoMzIwdjMyMGgtODB2LTE4NEwyNTYtMjAwaDE4NHY4MEgxMjBaIi8+PC9zdmc+); +} +.ico { + display: inline-block; + height: 19px; + position: relative; + width: 19px; + margin-right: 2px; + &::before { + content: " "; + position: absolute; + transform: translate(-2px, 3px); + width: 20px; + height: 20px; + background-color: var(--muted); + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMjU5LjcyLTY0cS00MC40NSAwLTY5LjA4LTI4Ljc5UTE2Mi0xMjEuNTggMTYyLTE2MnYtNjM2cTAtNDAuNDIgMjguNzktNjkuMjFRMjE5LjU3LTg5NiAyNjAtODk2aDMwNGwyMzQgMjMzdjUwMXEwIDQwLjQyLTI4LjggNjkuMjFRNzQwLjQtNjQgNjk5Ljk2LTY0SDI1OS43MlpNNTA0LTYwMmgxOTZMNTA0LTc5OHYxOTZaIi8+PC9zdmc+); + } +} +.header .ico::before { + transform: translate(-2px, 0); +} +/* file icons alter the mask image. 24x24 */ +.ico-dir::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMTYzLjA0LTEyMC4wOXEtNTEuMyAwLTg3LjEyLTM1LjgzLTM1LjgzLTM1LjgyLTM1LjgzLTg3LjEydi00NzMuOTJxMC01MS4zIDM1LjgzLTg3LjEyIDM1LjgyLTM1LjgzIDg3LjEyLTM1LjgzaDIxMS41M0w0ODAtNzM0LjQ4aDMxNi45NnE1MS4zIDAgODcuMTIgMzUuODMgMzUuODMgMzUuODMgMzUuODMgODcuMTN2MzY4LjQ4cTAgNTEuMy0zNS44MyA4Ny4xMi0zNS44MiAzNS44My04Ny4xMiAzNS44M0gxNjMuMDRabTAtMTIyLjk1aDYzMy45MnYtMzY4LjQ4SDQyOS4yMkwzMjMuNzgtNzE2Ljk2SDE2My4wNHY0NzMuOTJabTAgMHYtNDczLjkyIDQ3My45MloiLz48L3N2Zz4=); +} +.active .ico-dir::before, .ico-dir-open::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMTU3LjgzLTEyNC42NXEtNDYuOTMgMC04MC4wNi0zMy4xMi0zMy4xMi0zMy4xMy0zMy4xMi04MC4wNnYtNDg0LjM0cTAtNDcuMTcgMzMuMTItODAuMTggMzMuMTMtMzMgODAuMDYtMzNoMjE2LjQxTDQ4MC03MjkuNTloMzIyLjE3cTQ3LjE3IDAgODAuMTggMzMuMTMgMzMgMzMuMTIgMzMgODAuMDVINDMzLjEzTDMyNy4zNy03MjIuMTdIMTU3LjgzdjQ3NC40NWw4NS40Ny0yODguNjloNzExLjcybC05MS4yOCAzMDYuMTVxLTE2LjY3IDU3LjMtNTAuOTIgODEuNDYtMzQuMjUgMjQuMTUtOTkuMDggMjQuMTVIMTU3LjgzWm0xMTUuODQtMTEzLjE4aDQ3My45NGw1NC42NS0xODUuNDFIMzI4LjA5bC01NC40MiAxODUuNDFabTAgMCA1NC40Mi0xODUuNDEtNTQuNDIgMTg1LjQxWk0xNTcuODMtNjE2LjQxdi0xMDUuNzYgMTA1Ljc2WiIvPjwvc3ZnPg==); +} +.ico-webpage::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDgwLTY0cS04NiAwLTE2Mi0zMi41dC0xMzIuNS04OVExMjktMjQyIDk2LjUtMzE4VDY0LTQ4MHEwLTg2IDMyLjUtMTYydDg5LTEzMi41UTI0Mi04MzEgMzE4LTg2My41VDQ4MC04OTZxODYgMCAxNjIgMzIuNXQxMzIuNSA4OVE4MzEtNzE4IDg2My41LTY0MlQ4OTYtNDgwcTAgODYtMzIuNSAxNjJ0LTg5IDEzMi41UTcxOC0xMjkgNjQyLTk2LjVUNDgwLTY0Wm0wLTEwMnExNS0xNiAzMS02M3QyNS05OUg0MjRxOSA1MiAyNSA5OXQzMSA2M1ptLTEwMS0xMnEtMTMtMjctMjIuNS02NVQzNDAtMzI4SDIwMXEyNyA1NCA3NSA5My41VDM3OS0xNzhabTIwMiAwcTU1LTE3IDEwMy01Ni41dDc1LTkzLjVINjIwcS03IDQ3LTE2LjUgODVUNTgxLTE3OFpNMTcwLTQxMGgxNTlxLTEtMTctMS41LTM1LjVUMzI3LTQ4MnEwLTE4IC41LTM1LjVUMzI5LTU1MEgxNzBxLTUgMTctNi41IDM0LjVUMTYyLTQ4MHEwIDE4IDEuNSAzNS41VDE3MC00MTBabTI0MyAwaDEzNHEyLTE4IDIuNS0zNS41dC41LTM0LjVxMC0xNy0uNS0zNXQtMi41LTM1SDQxM3EtMiAxNy0yLjUgMzV0LS41IDM1cTAgMTcgLjUgMzV0Mi41IDM1Wm0yMTggMGgxNTlxNS0xNyA2LjUtMzQuNVQ3OTgtNDgwcTAtMTgtMS41LTM2dC02LjUtMzRINjMxcTEgMTcgMS41IDM1LjV0LjUgMzYuNXEwIDE4LS41IDM1LjVUNjMxLTQxMFptLTExLTIyMmgxMzlxLTI3LTU0LTc1LTkzLjVUNTgxLTc4MnExMyAyNyAyMi41IDY1dDE2LjUgODVabS0xOTYgMGgxMTJxLTktNTItMjUtOTguNVQ0ODAtNzk5cS0xNSAyMi0zMSA2OC41VDQyNC02MzJabS0yMjMgMGgxMzlxNy00NyAxNi41LTg1dDIyLjUtNjVxLTU1IDE3LTEwMyA1Ni41VDIwMS02MzJaIi8+PC9zdmc+); +} +.ico-image::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMjEyLTc2cS01Ny4xMiAwLTk2LjU2LTM5LjQ0UTc2LTE1NC44OCA3Ni0yMTJ2LTUzNnEwLTU3LjEzIDM5LjQ0LTk2LjU2UTE1NC44OC04ODQgMjEyLTg4NGg1MzZxNTcuMTMgMCA5Ni41NiAzOS40NFE4ODQtODA1LjEzIDg4NC03NDh2NTM2cTAgNTcuMTItMzkuNDQgOTYuNTZRODA1LjEzLTc2IDc0OC03NkgyMTJabTQtMTg2aDUyOEw1NzEtNTAyIDQ1MC0zNDFsLTkxLTEyMS0xNDMgMjAwWm0xMjQuMjQtMjcwcTM3LjE4IDAgNjIuNDctMjUuNTNRNDI4LTU4My4wNSA0MjgtNjIwLjI0cTAtMzcuMTgtMjUuNTMtNjIuNDdRMzc2Ljk1LTcwOCAzMzkuNzYtNzA4cS0zNy4xOCAwLTYyLjQ3IDI1LjUzUTI1Mi02NTYuOTUgMjUyLTYxOS43NnEwIDM3LjE4IDI1LjUzIDYyLjQ3UTMwMy4wNS01MzIgMzQwLjI0LTUzMloiLz48L3N2Zz4=); +} +.ico-video::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMTk4LTE2MnEtMzkuNzMgMC02OC44Ni0yOS4xNFExMDAtMjIwLjI3IDEwMC0yNjB2LTQ0MHEwLTQwLjQyIDI5LjE0LTY5LjIxUTE1OC4yNy03OTggMTk4LTc5OGg0NDBxNDAuNDIgMCA2OS4yMSAyOC43OVE3MzYtNzQwLjQyIDczNi03MDB2MTU0bDE3Mi0xNzJ2NDc2TDczNi00MTR2MTU0cTAgMzkuNzMtMjguNzkgNjguODZRNjc4LjQyLTE2MiA2MzgtMTYySDE5OFoiLz48L3N2Zz4=); +} +.ico-blend::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIHZpZXdCb3g9IjAgMCAyMCAyMCI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi4zNiAxNC4xYy0uMTItLjM5LS4yLS45LS4yLTEuMTZsLS4wMi0uMDFjMC0uMjYuMDUtLjcuMDUtLjdsLTMuOSAzLjIxYy0uNy41Ni0xLjYxLjU1LTIuMDQgMC0uNDMtLjU0LS4yMS0xLjQuNDYtMS45MmwuMDMtLjAyIDcuMTktNS42LTQuMDIuMDFjLS42OCAwLTEuMTMtLjQ2LTEtMS4wMS4xMy0uNTUuNzYtLjk4IDEuNDEtLjk4aDcuOTRzLS42OC0xLjAzLTEuMzItMS41Yy0uNDctLjM1LTEuMi0uNzgtMS4yLS43OHMtLjQ2LS4xNy0xLjI4LS42OGMtLjgyLS41MS0uMi0xLjcuNTktMS45LjUgMCAxLjM4LjQzIDIuMjEuODMgMi44NCAxLjQgNS43IDQuMiA2LjMgNC44Mi41OS42MiAxLjEzIDEuMjUgMS41NCAxLjlhNS45IDUuOSAwIDAgMS0uNyA3LjE3IDcuNyA3LjcgMCAwIDEtMi4zIDEuOTUgNy40MyA3LjQzIDAgMCAxLTYuMS4wMWMtLjktLjQtMi4yMi0xLjU4LTIuMjItMS41OHMtMS4xNS0xLjIyLTEuNDItMi4wNVptNi44MiAxLjg4YzIuMyAwIDQuMTYtMS44IDQuMTYtNCAwLTIuMjEtMS44Ni00LTQuMTYtNFM5IDkuNzcgOSAxMS45OGMwIDIuMiAxLjg3IDQgNC4xNyA0WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PGVsbGlwc2UgY3g9IjEzLjI3IiBjeT0iMTIuMDYiIHJ4PSIxLjgxIiByeT0iMS45NSIvPjwvc3ZnPg==); +} +.ico-fusion::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyMCAyMCI+PGNpcmNsZSBjeD0iOS4yMiIgY3k9IjE3LjU4IiByPSIxLjUiIGZpbGw9IiNEOUQ5RDkiLz48cGF0aCBmaWxsPSIjRDlEOUQ5IiBkPSJNMTYuNDMgMi45NUEyLjk1IDIuOTUgMCAwIDEgMTEuNyA1LjNhMi45NCAyLjk0IDAgMCAwLTQuMDEgMS4xMSAyLjk1IDIuOTUgMCAxIDEtLjg1LTMuNDMgMi43NiAyLjc2IDAgMCAwIDMuOS0xLjEyIDIuOTUgMi45NSAwIDAgMSA1LjY5IDEuMDlabS0uNjkgNy40NWEyLjE4IDIuMTggMCAwIDEtMy41IDEuNzMgMi4xNyAyLjE3IDAgMCAwLTIuOTYuODIgMi4xOCAyLjE4IDAgMSAxLS42Mi0yLjU0IDIuMDQgMi4wNCAwIDAgMCAyLjg3LS44MiAyLjE4IDIuMTggMCAwIDEgNC4yMS44WiIvPjwvc3ZnPg==); +} +.ico-audio::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNTM2LTc4di0xMDFxMTA2LTIzIDE3My0xMDguNVQ3NzYtNDgxcTAtMTA3LTY4LTE5MC41VDUzNi03ODF2LTEwMXExNDcgMjMgMjQyLjUgMTM3VDg3NC00ODJxMCAxNTAtOTUgMjY1LjVUNTM2LTc4Wk04Ni0zNjV2LTIzMmgxNThsMjIwLTIyMnY2NzZMMjQ0LTM2NUg4NlptNDUwIDQ3di0zMjRxNDkgMjEgNzguNSA2NC41VDY0NC00ODFxMCA1NC0yOS41IDk3LjVUNTM2LTMxOFoiLz48L3N2Zz4=); +} +.ico-archive::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDQ0LjQzLTU3Ljk2di00MDMuNDNMMTA0LjA5LTY1NC4yMnYzMzMuNTdxMCAzMC45NSAxNS4yNiA1Ny42OXQ0Mi4yMiA0MmwyODIuODYgMTYzWm03Mi0xIDI4MS41Ny0xNjJxMjYuOTYtMTUuMjYgNDIuMjItNDIgMTUuMjYtMjYuNzQgMTUuMjYtNTcuNjl2LTMzNS43TDUxNi40My00NjMuODN2NDA0Ljg3Wm0xNzQuMTQtNTg3Ljg3IDEzNC42NS03NS4zOS0yODguMTgtMTY1LjNxLTI2LjUyLTE1LjI2LTU3LjA0LTE1LjI2dC01Ny40OCAxNS4yNmwtNzQuNjEgNDMuMyAzNDIuNjYgMTk3LjM5Wk00NzgtNTI1LjI2bDE0MC04MC0zNDQuMjItMTk3Ljk2LTE0MC41NiA4MS41N0w0NzgtNTI1LjI2WiIvPjwvc3ZnPg==); +} +.ico-text::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNOTgtMjA4di0xMjhoNTI0djEyOEg5OFptMC0yMDh2LTEyOGg3NjR2MTI4SDk4Wm0wLTIwOXYtMTI4aDc2NHYxMjhIOThaIi8+PC9zdmc+); +} +.ico-link::before { + transform: translate(-2px, 3px); + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDMyLTI4OEgyODhxLTc5LjY4IDAtMTM1Ljg0LTU2LjIzUTk2LTQwMC40NSA5Ni00ODAuMjMgOTYtNTYwIDE1Mi4xNi02MTZxNTYuMTYtNTYgMTM1Ljg0LTU2aDE0NHY3MkgyODhxLTUwIDAtODUgMzV0LTM1IDg1cTAgNTAgMzUgODV0ODUgMzVoMTQ0djcyWm0tOTYtMTU2di03MmgyODh2NzJIMzM2Wm0xOTIgMTU2di03MmgxNDRxNTAgMCA4NS0zNXQzNS04NXEwLTUwLTM1LTg1dC04NS0zNUg1Mjh2LTcyaDE0NHE3OS42OCAwIDEzNS44NCA1Ni4yMyA1Ni4xNiA1Ni4yMiA1Ni4xNiAxMzZRODY0LTQwMCA4MDcuODQtMzQ0IDc1MS42OC0yODggNjcyLTI4OEg1MjhaIi8+PC9zdmc+); +} +.ico-readme::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDI0LTI2N2gxMTJ2LTI2MUg0MjR2MjYxWm01NS42MS0zMTlxMjUuODkgMCA0My4xNC0xNi44NlE1NDAtNjE5LjczIDU0MC02NDUuNjFxMC0yNS44OS0xNi44Ni00My4xNFE1MDYuMjctNzA2IDQ4MC4zOS03MDZxLTI1Ljg5IDAtNDMuMTQgMTYuODZRNDIwLTY3Mi4yNyA0MjAtNjQ2LjM5cTAgMjUuODkgMTYuODYgNDMuMTRRNDUzLjczLTU4NiA0NzkuNjEtNTg2Wm0uNjcgNTM2cS04OC45MiAwLTE2Ny43NS0zMy4xLTc4LjgyLTMzLjExLTEzNy41Ny05MS44NlQ4My4xLTMxMi40OVE1MC0zOTEuMjggNTAtNDgwLjQ2cTAtODkuNDQgMzMuMTYtMTY3LjQ5IDMzLjE3LTc4LjA1IDkyLjE4LTEzNi45NCA1OS4wMS01OC44OSAxMzcuNTMtOTJRMzkxLjM5LTkxMCA0ODAuNDYtOTEwcTg5LjQzIDAgMTY3LjUyIDMzLjA5IDc4LjA5IDMzLjEgMTM2Ljk2IDkxLjk3IDU4Ljg3IDU4Ljg3IDkxLjk3IDEzNy4yMVE5MTAtNTY5LjM4IDkxMC00ODAuMTl0LTMzLjExIDE2Ny41MnEtMzMuMTEgNzguMzItOTIgMTM3LjMzUTcyNi0xMTYuMzMgNjQ3LjcyLTgzLjE2IDU2OS40NS01MCA0ODAuMjgtNTBaIi8+PC9zdmc+); +} +.ico-chat::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNTAtNDZ2LTc0MXEwLTUzLjgzIDM3LjA5LTkwLjkxUTEyNC4xOC05MTUgMTc4LTkxNWg2MDRxNTMuODMgMCA5MC45MSAzNy4wOVE5MTAtODQwLjgzIDkxMC03ODd2NDU5cTAgNTMuODMtMzcuMDkgOTAuOTFRODM1LjgzLTIwMCA3ODItMjAwSDIwNEw1MC00NlptMTg0LTMzOGgzNDd2LTcySDIzNHY3MlptMC0xMzhoNDkydi03MkgyMzR2NzJabTAtMTM4aDQ5MnYtNzJIMjM0djcyWiIvPjwvc3ZnPg); +} +.ico-snow::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNDU2LTI4MyAzMzYtMTYxcS04IDgtMTYuNSA4dC0xNy41LTdxLTgtOS04LTE4dDgtMTdsMTU0LTE1M3YtMTA4SDM1MEwxOTQtMzAycS04IDktMTcgOC41dC0xNy04LjVxLTgtOS04LTE3LjV0OS0xNy41bDEyNC0xMTlIMTI4cS03IDAtMTQuNS02LjVUMTA2LTQ3OXEwLTcgNi41LTE1dDE2LjUtOGgxNTZMMTYxLTYyM3EtOC04LTgtMTYuNXQ3LTE2LjVxOS05IDE4LTl0MTcgOWwxNTUgMTU0aDEwNnYtMTEwTDMwMi03NjRxLTgtOC04LTE3dDgtMTdxOS04IDE3LjUtOHQxNy41IDlsMTE5IDEyMHYtMTU0cTAtNyA2LjUtMTV0MTYuNS04cTcgMCAxNSA4dDggMTV2MTU0bDEyMS0xMjJxOC04IDE2LjUtOHQxNi41IDhxOSA4IDkgMTd0LTkgMTdMNTAyLTYxMnYxMTBoMTA4bDE1NC0xNTVxOC04IDE3LTh0MTcgOHE4IDkgOCAxNy41dC05IDE3LjVMNjc1LTUwMmgxNTZxNyAwIDE1IDh0OCAxNXEwIDEwLTggMTYuNXQtMTUgNi41SDY3NWwxMjMgMTIwcTkgOCA5IDE2LjV0LTggMTcuNXEtOCA4LTE3IDguNXQtMTgtNy41TDYxMC00NTZINTAydjEwOGwxNTQgMTU0cTkgOCA5IDE3LjV0LTggMTYuNXEtOSA4LTE3LjUgOHQtMTYuNS04TDUwMi0yODN2MTU1cTAgNy04IDE0LjV0LTE1IDcuNXEtMTAgMC0xNi41LTYuNVQ0NTYtMTI5di0xNTRaIi8+PC9zdmc+); +} +.ico-code::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNMzE5LTIwMCAzOC00ODBsMjgyLTI4MiA5MSA5MC0xOTAgMTkxIDE5MCAxODktOTIgOTJabTMyMiAxLTkxLTkxIDE5MC0xOTAtMTkwLTE5MCA5MS05MCAyODEgMjgwLTI4MSAyODFaIi8+PC9zdmc+); +} +.ico-json::before { + mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyMHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJNNjE0LjA0LTE1Ni42NXYtMTAzLjk0aDM1LjE4cTIwLjc4IDAgMzUuNDgtMTQuODMgMTQuNzEtMTQuODIgMTQuNzEtMzUuNnYtNDkuNDZxMC00Ni41MiAzMC4yNi04MC4xNiAzMC4yNi0zMy42NCA3Ni41NS00MC42NHYtMi4yNHEtNDYuNTItMy45Ni03Ni42Ny0zNi43Mi0zMC4xNC0zMi43Ni0zMC4xNC03OS4yOHYtNDkuN3EwLTIwLjc4LTE0LjcxLTM1LjQ4LTE0LjctMTQuNzEtMzUuNDgtMTQuNzFoLTM1LjE4di0xMDMuOTRINjc1cTUzLjQzIDAgOTAuODkgMzcuOTZ0MzcuNDYgOTEuNjN2NDkuNDZxMCAyMC43NyAxNC4zMyAzNS42IDE0LjMyIDE0LjgzIDMyLjgyIDE0LjgzaDQ4Ljg1djE4Ny43NEg4NTAuNXEtMTguNSAwLTMyLjgyIDE0LjcxLTE0LjMzIDE0LjcxLTE0LjMzIDM1LjQ5djQ5LjY5cTAgNTMuNjctMzcuNDYgOTEuNjMtMzcuNDYgMzcuOTYtOTAuODkgMzcuOTZoLTYwLjk2Wm0tMzI5LjA0IDBxLTUzLjQzIDAtOTAuODktMzcuOTZ0LTM3LjQ2LTkxLjYzdi00OS42OXEwLTIwLjc4LTE0LjcxLTM1LjQ5dC0zNi40OC0xNC43MUg2MC42NXYtMTg3Ljc0aDQ0LjgxcTIxLjc3IDAgMzYuNDgtMTQuODMgMTQuNzEtMTQuODMgMTQuNzEtMzUuNnYtNDkuNDZxMC01My42NyAzNy40Ni05MS42MyAzNy40Ni0zNy45NiA5MC44OS0zNy45Nmg2MC45NnYxMDMuOTRoLTM0Ljk0cS0yMC43OCAwLTM1LjYgMTQuNzEtMTQuODMgMTQuNy0xNC44MyAzNS40OHY0OS43cTAgNDcuNTItMzAuMTQgODAuNzgtMzAuMTUgMzMuMjYtNzYuNDMgMzQuMjJ2Mi4zOXE0Ni4yOCA1Ljg1IDc2LjQzIDM5Ljk5IDMwLjE0IDM0LjE0IDMwLjE0IDgxLjY2djQ5LjQ2cTAgMjAuNzggMTQuODMgMzUuNiAxNC44MiAxNC44MyAzNS42IDE0LjgzaDM0Ljk0djEwMy45NEgyODVaIi8+PC9zdmc+); +} +.loading { + animation: loading 2s linear infinite; + background-color: hsl(from var(--bg) h s calc(l + 20) / 50%) !important; +} +@keyframes loading { + from { + opacity: 0.4; + } + 50% { + opacity: 0.7; + } + to { + opacity: 0.4; + } +} +.mobile { + display: none !important; +} +.file-view-image, .file-view-video, .file-view-audio { + background-color: lch(from var(--dark-bg) calc(l - 3) calc(c - 15) h); +} +.file-view-video, .file-view-audio { + display: flex; + justify-content: center; + align-items: center; + & > * { + max-width: 100%; + max-height: 100%; + object-fit: contain; + } +} +.file-view-download { + p:first-child { + margin-top: 2rem; + } + p { + margin: 0.5rem 2rem; + max-width: 60ch; + } + code { + background-color: lch(from var(--dark-bg) calc(l - 5) calc(c - 5) h); + padding: 0.3rem 0.5rem; + border-radius: 0.3rem; + } +} +.speedbump { + z-index: 1; + position: relative; + canvas { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: -1; + } + header { + font-family: c1; + height: max(min(40vh, 400px), 100px); + color: #00ff80; + letter-spacing: 0.8ch; + margin-right: -0.8ch; + font-size: 6vw; + display: flex; + align-items: center; + justify-content: center; + font-variation-settings: "wght" 50; + text-shadow: 0 0 20px #00ff8022, 0 0 10px #00ff8033; + margin-bottom: 2rem; + h1 { + flex: 1; + margin: 0; + padding: 0; + display: flex; + align-items: center; + justify-content: center; + } + } + p { + max-width: 50ch; + margin: 0 auto 1rem auto; + color: #ecffea88; + line-height: 1.5; + letter-spacing: 0.01em; + word-spacing: 0.3em; + text-align: center; + font-size: 1.2rem; + } + button { + background-color: #00ff80bb; + color: #111318; + border: none; + padding: 0.5rem 1rem; + border-radius: 0.3rem; + font-size: 1.2rem; + font-weight: 400; + cursor: pointer; + letter-spacing: 0.5rem; + padding-right: 0.5rem; + } + .enter-container { + display: flex; + justify-content: center; + align-items: center; + margin-top: 1rem; + } + .image-grid { + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-template-rows: repeat(3, 1fr); + gap: 0.5rem; + margin: 0 auto; + background-color: #050d06; + padding: 0.5rem; + border-radius: 0.75rem; + button { + background-color: #0c1f0e; + width: 100%; + max-width: 100px; + aspect-ratio: 1/1; + padding: 0; + margin: 0; + cursor: pointer; + border-radius: 0.5rem; + img { + width: 100%; + height: 100%; + display: block; + opacity: 0.75; + border-radius: 0.5rem; + } + &:hover { + img { + opacity: 0.85; + } + } + } + } +} +.lyrics { + align-self: flex-start; +} +.fullscreen-canvas { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + z-index: -1; + pointer-events: none; + user-select: none; + touch-action: none; +} +.cotyledon-link { + position: absolute; + bottom: 0; + right: 0; + color: #27143f; + padding: 0.5rem 1rem; + border-radius: 0.3rem; +} +.convo { + padding: 1rem; + .line { + margin-bottom: 0.5rem; + } + /* different colors for different ppl */ + .s-other_a { + padding-left: 4rem; + color: var(--primary); + } + .s-other_b { + padding-left: 8rem; + color: hsl(from var(--primary) calc(h + 200) s l); + } + .s-other_b2 { + padding-left: 4rem; + color: hsl(from var(--primary) calc(h + 200) s l); + } + .s-other_c { + padding-left: 12rem; + color: hsl(from var(--primary) calc(h + 100) s l); + } + .s-other_d { + padding-left: 4rem; + color: hsl(from var(--primary) calc(h + 50) s l); + } + .s-other_e { + padding-left: 4rem; + color: hsl(from var(--primary) calc(h + 80) s l); + } + .s-other_f { + padding-left: 4rem; + color: #00ff80; + } + hr { + margin-top: 2rem; + margin-bottom: 2rem; + border: none; + border-top: 2px solid var(--muted); + } +} +:not(.active) .ext { + font-size: 80%; + color: var(--muted); +} +.file-view-code { + color: lch(from var(--primary) 90 10 h / 0.88); + + .comment { + color: var(--muted); + } + .keyword { + font-weight: bold; + color: lch(from var(--primary) 100 20 h / 1); + } + .string { + color: lch(from var(--primary) calc(l + 30) calc(c + 30) h); + } + .constant { + color: lch(from var(--primary) calc(l + 30) calc(c - 30) h); + } + .method { + color: lch(from var(--primary) l c calc(h - 25)); + } + .class { + color: lch(from var(--primary) l c calc(h + 25)); + } + .builtin { + color: var(--primary); + font-weight: bold; + } + .parameter { + font-style: italic; + } + .variable { + color: lch(from var(--primary) 90 30 h / 0.88); + } +} +.for_everyone { + max-width: 69ch; + padding: 1rem 3rem; + font-family: rmo, monospace; + line-height: 1; + &:last-child { + padding-bottom: 3rem; + } + &:first-child { + padding-top: 3rem; + } + p { + /* line */ + margin: 0; + min-height: 1rem; + margin-bottom: 0.5rem; + } + p.normal { + line-height: 1.5; + } + blockquote { + margin-left: 0; + padding-left: 1rem; + border-left: 2px solid #f66244; + color: #ffbfb2; + line-height: 1.5; + p { + margin-bottom: 0.5rem; + } + } +} +.fade-slide-in { + animation: fadeSlideIn 0.4s cubic-bezier(0.3, 0.8, 0.3, 1); +} +@keyframes fadeSlideIn { + from { + opacity: 0.5; + transform: translateY(12px); + } + to { + opacity: 1; + transform: translateY(0); + } +} +/* MOBILE */ +@media (max-width: 1000px) { + html, body { + overflow: unset; + width: unset; + height: unset; + } + .mobile { + display: inline !important; + } + .desktop { + display: none !important; + } + h3 { + padding-left: 1rem; + font-size: 1.2rem; + } + body { + overflow-y: auto; + } + .files { + overflow-x: unset; + overflow-y: unset; + border-bottom: 16px solid var(--dark-bg); + min-height: 100vh; + .panel { + overflow-x: hidden; + border: none !important; + } + .panel, .panel .hsplit { + height: unset; + min-height: unset; + } + .panel .header { + padding: 0.75rem; + gap: 1rem; + align-items: center; + } + .mobile-back { + margin-left: -0.75rem; + display: block; + width: 48px; + height: 48px; + &::before { + display: block; + content: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjRkZGRkZGIj48cGF0aCBkPSJtMzEzLTQ0MCAyMjQgMjI0LTU3IDU2LTMyMC0zMjAgMzIwLTMyMCA1NyA1Ni0yMjQgMjI0aDQ4N3Y4MEgzMTNaIi8+PC9zdmc+); + transform: scale(2); + transform-origin: top left; + } + } + .full-screen, .download { + width: 48px; + height: 48px; + &::before { + transform: scale(2); + } + } + .panel ul li a { + display: flex; + flex-direction: column-reverse; + padding: 0.5rem 1rem; + text-overflow: unset; + white-space: wrap; + date { + font-size: 0.9rem; + padding-right: 0; + } + .size { + padding-left: 0; + } + .size:not(:first-child) { + padding-left: 0.5rem; + } + } + .first .size { + font-size: 0.9rem; + &::before { + content: "("; + } + &::after { + content: ")"; + } + } + } + .panel:not(.last) { + display: none; + } + .panel { + position: relative; + min-width: unset !important; + max-width: unset !important; + border-left-width: 10px !important; + } + .content { + height: unset !important; + min-width: unset !important; + max-width: unset !important; + overflow: unset !important; + } + .hsplit { + display: block !important; + } + .li.readme { + display: none !important; + } + .tooltip { + display: none !important; + } +} diff --git a/src/file-viewer/views/clofi.tsx b/src/file-viewer/views/clofi.tsx new file mode 100644 index 0000000..4f4b7f6 --- /dev/null +++ b/src/file-viewer/views/clofi.tsx @@ -0,0 +1,1007 @@ +import "./clofi.css"; +import assert from "node:assert"; +import path, { dirname } from "node:path"; +import { MediaFile } from "../db.ts"; +import { useInlineScript } from "../framework/page-resources.ts"; +import { escapeUri, formatDuration, formatSize } from "../media/share.ts"; +import { + highlightConvo, + highlightHashComments, + highlightLinksInTextView, +} from "../media/text-formatting.ts"; +import { TestID } from "../test/id.ts"; +import { ForEveryone } from "../media/cotyledon.tsx"; + +export const theme = { + bg: "#312652", + fg: "#f0f0ff", + primary: "#fabe32", +}; + +export const extensionToViewer: { + [key: string]: (props: { + file: MediaFile; + siblingFiles?: MediaFile[]; + }) => any; +} = { + ".html": IframeView, + ".txt": TextView, + ".md": TextView, + ".mp4": VideoView, + ".mkv": VideoView, + ".webm": VideoView, + ".avi": VideoView, + ".mov": VideoView, + ".mp3": AudioView, + ".flac": AudioView, + ".wav": AudioView, + ".ogg": AudioView, + ".m4a": AudioView, + ".jpg": ImageView, + ".jpeg": ImageView, + ".png": ImageView, + ".gif": ImageView, + ".webp": ImageView, + ".avif": ImageView, + ".heic": ImageView, + ".svg": ImageView, + ".chat": ChatView, + ".json": CodeView, + ".jsonc": CodeView, + ".toml": CodeView, + ".ts": CodeView, + ".js": CodeView, + ".tsx": CodeView, + ".jsx": CodeView, + ".css": CodeView, + ".py": CodeView, + ".lua": CodeView, + ".sh": CodeView, + ".bat": CodeView, + ".ps1": CodeView, + ".cmd": CodeView, + ".yaml": CodeView, + ".yml": CodeView, + ".xml": CodeView, + ".zig": CodeView, + ".astro": CodeView, + ".mdx": CodeView, + ".php": CodeView, + ".diff": CodeView, + ".patch": CodeView, +}; + +export default function MediaList({ + file, + hasCotyledonCookie, +}: { + file: MediaFile; + hasCotyledonCookie: boolean; +}) { + useInlineScript("file_viewer"); + + const dirs: MediaFile[] = []; + let dir: MediaFile | null = file; + assert(dir); + do { + dirs.unshift(dir); + dir = dir?.getParent(); + } while (dir); + const parts = file.path.split("/"); + + const isCotyledon = parseInt(parts[1]) < 2025; + + return ( +
+ {dirs.map((entry, i) => { + const isLast = i === dirs.length - 1; + return ( + + ); + })} +
+ ); +} + +const specialCaseViewers: Record = { + "/2024/for everyone": ForEveryone, +}; + +export function MediaPanel({ + file, + isLast, + activeFilename, + hasCotyledonCookie, +}: { + file: MediaFile; + isLast: boolean; + activeFilename: string | null; + hasCotyledonCookie: boolean; +}) { + const showsActions = file.path !== "/2024/for everyone"; + const label = file.path === "/" + ? ( + "clo's files" + ) + : ( + <> + {file.kind === MediaFile.Kind.directory + ? ( + + {file.basename} + / + + ) + : ( + <> + {file.basename} +
+ {showsActions && ( +
+ + + + +
+ )} + + )} + + ); + let View = specialCaseViewers[file.path] ?? + (extensionToViewer[file.extension.toLowerCase()] as any) ?? + DownloadView; + if (View === VideoView && file.size > 500_000_000) { + View = DownloadViewTooBig; + } + const mobileBtn = file.path !== "/" && ( + + ); + const canvases: Record = { + "/2017": "2017", + "/2018": "2018", + "/2019": "2019", + "/2020": "2020", + "/2021": "2021", + "/2022": "2022", + "/2023": "2023", + "/2024": "2024", + }; + if (canvases[file.path]) { + useInlineScript(`canvas_${canvases[file.path]}` as any); + } + return ( +
+ {canvases[file.path] && ( + + + )} + {file.kind === MediaFile.Kind.directory && ( + +
+ {label} +
+ )} +
+ {mobileBtn} + {
} + {label} +
+ + {file.kind === MediaFile.Kind.directory + ? ( + + ) + : ( +
+ +
+ )} +
+ ); +} + +const readmeFile = "readme.txt"; +const priorityFiles = ["readme.txt", "index.html"]; + +function sorterFromDirSort(dirsort: string) { + const array: string[] = JSON.parse(dirsort); + if (array.length === 1 && array[0] === "a-z") { + return sortAlphabetically; + } + return (a: MediaFile, b: MediaFile) => { + const aIndex = array.indexOf(a.basename); + const bIndex = array.indexOf(b.basename); + if (bIndex == -1 && aIndex >= 0) return -1; + if (aIndex == -1 && bIndex >= 0) return 1; + if (aIndex >= 0 && bIndex >= 0) { + return aIndex - bIndex; + } + return sortDefault(a, b); + }; +} + +function sortNumerically(a: MediaFile, b: MediaFile) { + const n1 = parseInt(a.basenameWithoutExt); + const n2 = parseInt(a.basenameWithoutExt); + return n1 - n2; +} + +function sortDefault(a: MediaFile, b: MediaFile) { + // First check if either file is in the priority list + const aIndex = priorityFiles.indexOf(a.basename.toLowerCase()); + const bIndex = priorityFiles.indexOf(b.basename.toLowerCase()); + + if (aIndex !== -1 && bIndex !== -1) { + // Both are priority files, sort by priority order + return aIndex - bIndex; + } else if (aIndex !== -1) { + // Only a is a priority file + return -1; + } else if (bIndex !== -1) { + // Only b is a priority file + return 1; + } + + // Then sort directories before files + if (a.kind !== b.kind) { + return a.kind === MediaFile.Kind.directory ? -1 : 1; + } + + // Finally sort by date (newest first), then by name (a-z) if dates are the same + const dateComparison = b.date.getTime() - a.date.getTime(); + if (dateComparison !== 0) { + return dateComparison; + } + // If dates are the same, sort alphabetically by name + return a.basename.localeCompare(b.basename); +} + +function sortAlphabetically(a: MediaFile, b: MediaFile) { + // First check if either file is in the priority list + const aIndex = priorityFiles.indexOf(a.basename.toLowerCase()); + const bIndex = priorityFiles.indexOf(b.basename.toLowerCase()); + + if (aIndex !== -1 && bIndex !== -1) { + // Both are priority files, sort by priority order + return aIndex - bIndex; + } else if (aIndex !== -1) { + // Only a is a priority file + return -1; + } else if (bIndex !== -1) { + // Only b is a priority file + return 1; + } + + // If dates are the same, sort alphabetically by name + return a.basename.localeCompare(b.basename); +} + +function isNumericallyOrdered(files: MediaFile[]) { + return !files.some((x) => Number.isNaN(parseInt(x.basenameWithoutExt))); +} + +function sortChronologicalStartToEnd(a: MediaFile, b: MediaFile) { + const aIndex = priorityFiles.indexOf(a.basename.toLowerCase()); + const bIndex = priorityFiles.indexOf(b.basename.toLowerCase()); + + if (aIndex !== -1 && bIndex !== -1) { + return aIndex - bIndex; + } else if (aIndex !== -1) { + return -1; + } else if (bIndex !== -1) { + return 1; + } + + const dateComparison = a.date.getTime() - b.date.getTime(); + if (dateComparison !== 0) { + return dateComparison; + } + return a.basename.localeCompare(b.basename); +} + +const sortOverrides: Record number> = { + "/2024": sortChronologicalStartToEnd, + "/2023": sortChronologicalStartToEnd, + "/2022": sortChronologicalStartToEnd, + "/2021": sortChronologicalStartToEnd, + "/2020": sortChronologicalStartToEnd, + "/2019": sortChronologicalStartToEnd, + "/2018": sortChronologicalStartToEnd, + "/2017": sortChronologicalStartToEnd, +}; + +function DirView({ + dir, + activeFilename, + isLast, + hasCotyledonCookie, +}: { + dir: MediaFile; + activeFilename: string | null; + isLast: boolean; + hasCotyledonCookie: boolean; +}) { + if (dir.path === "/") { + return ( + + ); + } + const isCotyledon = parseInt(dir.path.split("/")?.[1]) < 2025; + const unsortedFiles = dir + .getPublicChildren() + .filter((f) => !f.basenameWithoutExt.startsWith("_unlisted")); + const sorter = dir.dirsort + ? sorterFromDirSort(dir.dirsort) + : isNumericallyOrdered(unsortedFiles) + ? sortNumerically + : isCotyledon + ? sortChronologicalStartToEnd + : (sortOverrides[dir.path] ?? sortDefault); + const sortedFiles = unsortedFiles.sort(sorter); + const readme = sortedFiles.find((f) => f.basename === readmeFile); + if (readme && isLast) activeFilename ||= readmeFile; + const main = ( +
+
    + {sortedFiles.map((file) => { + return ( + + ); + })} +
+
+ ); + + if (readme && isLast) { + return ( +
+ + {main} +
+ ); + } + + return main; +} + +const unknownDate = new Date("1970-01-03"); +const unknownDateWithKnownYear = new Date("1970-02-20"); + +function ListItem({ + file, + active, + noDate, +}: { + file: MediaFile; + active: boolean; + noDate?: boolean; +}) { + const dateTime = file.date; + let shortDate = dateTime < unknownDateWithKnownYear + ? ( + dateTime < unknownDate + ? ( + "??.??.??" + ) + : <>xx.xx.{21 + Math.floor(dateTime.getTime() / 86400000)} + ) + : ( + `${(dateTime.getMonth() + 1).toString().padStart(2, "0")}.${ + dateTime + .getDate() + .toString() + .padStart(2, "0") + }.${dateTime.getFullYear().toString().slice(2)}` + ); + + let basenameWithoutExt = file.basenameWithoutExt; + + let meta = file.kind === MediaFile.Kind.directory + ? formatSize(file.size) + : (file.duration ?? 0) > 0 + ? formatDuration(file.duration!) + : null; + if (meta && dirname(file.path) !== "/") { + meta = `(${meta})`; + } + + const isReadme = file.basename === readmeFile; + + return ( +
  • + + + {file.basename === readmeFile + ? <>{!noDate &&
    } + : <>{!noDate && {shortDate}}} + {meta} +
    + + + {path.dirname(file.path) !== "/" && ( + + )} + {basenameWithoutExt} + {file.extension} + {file.kind === MediaFile.Kind.directory + ? / + : ( + "" + )} + + {meta} + +
    +
  • + ); +} + +function fileIcon(file: MediaFile, dirOpen?: boolean) { + if (file.kind === MediaFile.Kind.directory) { + return dirOpen ? "dir-open" : "dir"; + } + if (file.basename === "readme.txt") { + return "readme"; + } + if (file.path === "/2024/for everyone") { + return "snow"; + } + const ext = path.extname(file.basename).toLowerCase(); + if ( + ext === ".mp4" || + ext === ".mkv" || + ext === ".webm" || + ext === ".avi" || + ext === ".mov" + ) { + return "video"; + } + if ( + ext === ".mp3" || + ext === ".flac" || + ext === ".wav" || + ext === ".ogg" || + ext === ".m4a" + ) { + return "audio"; + } + if ( + ext === ".jpg" || + ext === ".jpeg" || + ext === ".png" || + ext === ".gif" || + ext === ".webp" || + ext === ".avif" || + ext === ".heic" || + ext === ".svg" + ) { + return "image"; + } + if (ext === ".comp" || ext === ".fuse" || ext === ".setting") return "fusion"; + if (ext === ".txt" || ext === ".md") return "text"; + if (ext === ".html") return "webpage"; + if (ext === ".blend") return "blend"; + if ( + ext === ".zip" || + ext === ".rar" || + ext === ".7z" || + ext === ".tar" || + ext === ".gz" || + ext === ".bz2" || + ext === ".xz" + ) { + return "archive"; + } + if (ext === ".lnk") return "link"; + if (ext === ".chat") return "chat"; + if ( + ext === ".ts" || + ext === ".js" || + ext === ".tsx" || + ext === ".jsx" || + ext === ".css" || + ext === ".py" || + ext === ".lua" || + ext === ".sh" || + ext === ".bat" || + ext === ".ps1" || + ext === ".cmd" || + ext === ".php" + ) { + return "code"; + } + if (ext === ".json" || ext === ".toml" || ext === ".yaml" || ext === ".yml") { + return "json"; + } + return "file"; +} + +function RootDirView({ + dir, + activeFilename, + isLast, + hasCotyledonCookie, +}: { + dir: MediaFile; + activeFilename: string | null; + isLast: boolean; + hasCotyledonCookie: boolean; +}) { + const children = dir.getPublicChildren(); + let readme: MediaFile | null = null; + + const groups = { + // years 2025 and onwards + years: [] as MediaFile[], + // named categories + categories: [] as MediaFile[], + // years 2017 to 2024 + cotyledon: [] as MediaFile[], + }; + const colorMap = { + years: "#a2ff91", + categories: "#9c91ff", + cotyledon: "#ff91ca", + }; + for (const child of children) { + const basename = child.basename; + if (basename === readmeFile) { + readme = child; + continue; + } + + const year = basename.match(/^(\d{4})/); + if (year) { + const n = parseInt(year[1]); + if (n >= 2025) { + groups.years.push(child); + } else { + groups.cotyledon.push(child); + } + } else { + groups.categories.push(child); + } + } + + if (readme && isLast) activeFilename ||= readmeFile; + + const main = ( +
    + {readme && ( +
      + +
    + )} + {Object.entries(groups).map(([key, files]) => { + if (key === "cotyledon" && !hasCotyledonCookie) { + return null; + } + if (key === "years" || key === "cotyledon") { + files.sort((a, b) => { + return b.basename.localeCompare(a.basename); + }); + } else { + files.sort((a, b) => { + return a.basename.localeCompare(b.basename); + }); + } + return ( +
    +

    + {key} +

    +
      + {files.map((file) => ( + + ))} +
    +
    + ); + })} +
    + ); + + if (readme && isLast) { + return ( +
    + + + cotyledon + + + )} + /> + {main} + {!hasCotyledonCookie && ( + <> + + cotyledon + + + )} +
    + ); + } + + return main; +} + +function TextView({ + file, + siblingFiles = [], +}: { + file: MediaFile; + siblingFiles?: MediaFile[]; +}) { + const contents = file.contents; + + if (file.path.startsWith("/2021/phoenix-write/maps")) { + const basename = file.basename; + if (basename.includes("map") && basename.endsWith(".txt")) { + return ( +
    
    +      );
    +    }
    +  }
    +
    +  return (
    +    
     f.kind === MediaFile.Kind.file),
    +        ),
    +      }}
    +    >
    + ); +} + +function ChatView({ file }: { file: MediaFile }) { + const contents = file.contents; + return ( +
    +
    + ); +} + +function CodeView({ file }: { file: MediaFile }) { + const highlightedContents = file.contents; + if (!highlightedContents) { + if (file.size > 1_000_000) { + return ; + } + return ; + } + return ( +
    +  );
    +}
    +
    +function VideoView({ file }: { file: MediaFile }) {
    +  useInlineScript("video_player");
    +  const dimensions = file.parseDimensions() ?? { width: 1920, height: 1080 };
    +  return (
    +    <>
    +      
    +    
    +  );
    +}
    +
    +function AudioView({
    +  file,
    +  onlyAudio = false,
    +}: {
    +  file: MediaFile;
    +  onlyAudio?: boolean;
    +}) {
    +  const parent = file.getParent();
    +  let lyricsFile: MediaFile | null = null;
    +  if (parent && !onlyAudio) {
    +    const siblings = parent.getPublicChildren();
    +    // show lyrics only if
    +    // - this media file is the only audio file
    +    // - there is lyrics.txt in the same directory
    +    const audioFiles = siblings.filter(
    +      (f) =>
    +        f.kind === MediaFile.Kind.file &&
    +        extensionToViewer[path.extname(f.basename)] === AudioView,
    +    );
    +    if (
    +      audioFiles.length === 1 &&
    +      siblings.find((f) => f.basename === "lyrics.txt")
    +    ) {
    +      lyricsFile = siblings.find((f) => f.basename === "lyrics.txt")!;
    +    }
    +  }
    +  return (
    +    <>
    +      
    +      {lyricsFile && (
    +        
    +

    + lyrics +

    + +
    + )} + + ); +} + +function ImageView({ file }: { file: MediaFile }) { + return ( + {file.basename} + ); +} + +function IframeView({ file }: { file: MediaFile }) { + return ( + <> +